The Scenario FIGURE 1 shows part of a control system used to maintain the water level in a sump between the levels high and low. Two transducers (HIGH and LOW) are used to monitor the level. The water is pumped out by two pumps, P1 and P2. The water level in the sump is to be controlled as follows: ? If the level reaches high one pump will start to pump out. ? If the level does not reach low within about 30 seconds, the second pump will come into action. If the level does reach low before 30 second pumping should stop. ? If the level does not reach low within about 30 seconds of the second pump starting, an alarm is given. The alarm is sounded until the level reaches low. If the level does reach low before 30 seconds the pumping should stop. ? The pumps will stop when low is detected. ? To give even loading of the pumps they are to be used alternately, e.g. if on one pump cycle P1 starts first and P2 is the ‘back up’ then on the next cycle P2 will start first and P1 is the ‘back up’.
The system is to be controlled by an Arduino microcontroller. The pumps can be mimicked by LEDs*. Switches can be used to represent the LOW and HIGH transducers. The program should inspect the input switches at regular intervals and take appropriate action. *If you chose to use the UnoArduSim then you can use its motor simulators to model the two pumps. A further enhancement would be to use a potentiometer as a ‘level’ transducer so that, say, 10% travel is ‘low level’ and 90% ‘high level’.
PROGRAM SPECIFICATION It is obvious that before starting to design and code a computer program, the programmer should have all the relevant information required to solve the problem. This information should include: • what operation the program is expected to perform • details of input data that will be used • an indication of the expected output • any additional information such as mathematical formulae to be used, as well as any hints that would help in the solution. All this information forms the PROGRAM SPECIFICATION