Monitoring and Control Systems
How monitoring and control systems differ, how sensors, an ADC, the processor and actuators work together with feedback, a control loop in 9618 pseudocode, and how bit masks test, set and clear the bits that monitor and control a device.
Monitoring and control systems
A monitoring system only measures and reports; a control system also changes the conditions, using feedback.
| Monitoring system | Control system | |
|---|---|---|
| Uses sensors to measure conditions | yes | yes |
| What the processor does | records the readings or warns someone; it changes nothing | also drives actuators that change the conditions |
| Example | a patient monitor, a weather station | a greenhouse, central heating |
An actuator is a device that makes a physical change, such as a motor, heater, valve or pump.
The syllabus names four sensors: temperature, pressure, infra-red and sound.
How a reading is used:
- An ADC converts the sensor's analogue signal to digital.
- The processor, not the sensor, compares the reading with a stored value.
Feedback makes control work. The output changes the conditions. The sensor measures the change. The new reading decides the next output. That keeps the value close to the set point (the value the system aims for).
CONSTANT SetPoint = 24 DECLARE Temp : REAL REPEAT // from the sensor, via an ADC INPUT Temp IF Temp < SetPoint - 0.5 THEN // a signal to the actuator OUTPUT "HEATER ON" ENDIF IF Temp > SetPoint + 0.5 THEN OUTPUT "HEATER OFF" ENDIF // the loop repeats while the system is on UNTIL FALSE
Monitoring or control? Justify it from the system
To say "monitoring" or "control", give reasons from the system in the question.
Exam:There is no mark for just writing "monitoring" or "control". The marks are for the reasons, applied to the system in the question.
Ask two questions:
- Does it have an actuator that changes the conditions? A sign, an alarm or a screen only tells a person something.
- Does its output change the next input? If not, there is no feedback.
| System | Actuator? | Feedback? | So it is |
|---|---|---|---|
| A bridge's warning sign | no: the sign does not change a vehicle's height | no | monitoring |
| Automatic doors | yes: the doors open | yes: the person walks through, and the sensor's next reading changes | a control system |
Watch out:"It monitors the conditions" earns nothing, because it only repeats the name.
Sensors: what each one measures
A sensor measures one physical quantity and sends the reading to the processor; it never decides anything.
A sensor measures one physical quantity. It sends each reading to the processor.
Watch out:A sensor decides nothing and switches nothing on. "The sensor turns on the heater" is wrong.
The syllabus names four sensors: temperature, pressure, infra-red and sound. Light sensors and others are used too.
| Sensor | Measures | For example |
|---|---|---|
| temperature | how hot or cold something is | keeping a fridge at 4 °C to 6 °C |
| pressure | the force pressing on it | a vehicle's weight on a bridge, or a person in a seat |
| infra-red | a beam that something breaks, or the heat of a person nearby | a vehicle's height; a person within 2 m |
| sound | how loud the sound is | a noise inside a locked car |
| light | the light level | a floodlight that comes on at dusk |
Exam:In an answer, say what the sensor detects in that system.
From an analogue signal to a binary number
An ADC turns a sensor's smooth voltage into a binary number that the processor can compare.
Many sensors give an analogue signal: a voltage that changes smoothly. It can take any value in its range.
A processor can only process digital data. So an analogue-to-digital converter (ADC) turns each reading into a binary number.
Example:The figure uses a made-up model. 0 °C to 50 °C gives 0 V to 5 V. An 8-bit ADC gives a whole number from 0 to 255.
| Step | Value |
|---|---|
| Temperature (the greenhouse's set point) | 24 °C |
| Voltage from the sensor | 2.4 V |
| Number from the ADC | 122 |
| In binary | 01111010 |
The processor never sees "24 °C". It compares binary numbers: each new reading with the stored value.
The processor decides; the actuator acts
The processor makes every decision; the actuator only makes the physical change it is told to.
How the work is shared:
- The sensor gives a reading.
- The processor compares each digital reading with a stored value, set in advance. When action is needed, it sends a signal to an actuator.
- The actuator makes a physical change on that signal.
The actuator does no processing. It never reads the sensor and never decides.
Examples of actuators:
- a motor opens doors or a greenhouse window
- an arm pushes an underweight chocolate bar off the belt
Watch out:Check the comparison. With < or >, a reading equal to the stored value does not fire the rule, as the figure shows.
Exam:Name the actuator and say what it does in that system.
Feedback: the output changes the next input
Feedback means the output changes the conditions, and the next reading decides the next output.
Feedback is what makes control work. It is a loop:
- The output changes the conditions.
- The sensor's next reading shows that change.
- That reading decides the next output.
Example:In automatic braking, the brakes slow the car. The distance to the object ahead changes. The new distance decides whether to keep braking, and how hard.
Feedback keeps a system within its set limits. The output affects the next input, so the conditions are adjusted automatically, with no person needed.
Watch out:Feedback here means this loop, not people's opinions of the system. A monitoring system has no feedback: its output does not affect what it measures next.
A control loop in 9618 pseudocode
Two stored values, one to switch on and one to switch off, stop the heaters switching on and off all the time.
A 9618 exam question describes a sports hall's heating:
- The heaters switch on when the temperature is below 10.
- The heaters switch off when it is above 20.
The pseudocode below stores these two values as constants.
Between 10 and 20, neither IF changes Heaters. So the heaters keep their last state. In the figure, the reading 15 gives "heaters on" the first time and "heaters off" the second.
Why two values? With only one stored value, every small rise or fall across it would switch the heaters.
Remember:A real control loop repeats continuously, like REPEAT … UNTIL FALSE in the first note. This one runs six times only, and INPUT stands in for the sensor.
CONSTANT HeatOn = 10 CONSTANT HeatOff = 20 DECLARE Temp : INTEGER DECLARE Heaters : BOOLEAN DECLARE Count : INTEGER Heaters ← FALSE // six test readings only FOR Count ← 1 TO 6 INPUT Temp IF Temp < HeatOn THEN Heaters ← TRUE ENDIF IF Temp > HeatOff THEN Heaters ← FALSE ENDIF IF Heaters THEN OUTPUT Temp, ": heaters on" ELSE OUTPUT Temp, ": heaters off" ENDIF NEXT Count
Masks: testing and setting bits to control a device
A mask is a byte that lets one operation change or test only the bits you choose.
Each bit of a byte can stand for one lamp or sensor. A mask is a byte that makes an operation affect only chosen bits.
| To | Use | The mask has |
|---|---|---|
| test a bit | AND | a 1 only in that place; a result other than 0 means the bit was 1 |
| set bits | OR | 1s in those places |
| clear a bit | AND | a 0 there and 1s elsewhere |
| flip a bit | XOR | a 1 there |
Setting, clearing and flipping leave the other bits alone.
So a program can monitor a device by testing its bit. It can control a device, such as a fan, by setting its bit.
LDD SENSORS ; keep only bit 1: 1 = too hot AND B00000010 CMP #0 ; 0: not too hot, change nothing JPE DONE LDD CONTROL ; set bit 1: the fan on OR B00000010 ; the other bits are unchanged STO CONTROL DONE: END SENSORS: B00000010 CONTROL: B00000001 ; CONTROL ends as B00000011: ; the fan is now on too ; clear bit 0 (the heater off): ; AND B11111110 ; flip bit 3: XOR B00001000
One bit per device: a program that monitors and controls
One byte can hold eight on/off states, one bit per sensor or actuator.
A device can report eight sensors in one byte, one status bit each. A control byte can switch eight actuators, one bit each.
As a number, the byte means little. CONTROL = 00000011 says only this: bit 0 (the heater) and bit 1 (the fan) are on.
The processor's status register works the same way: one bit for each flag.
What the program below does:
- It monitors: it tests bit 1 of SENSORS (too hot).
- It controls the fan through bit 1 of CONTROL. If the test found a 1, OR sets the bit. If not, AND clears it.
No other bit changes.
Watch out:AND B00000000 would clear the whole byte.
LDD SENSORS ; keep bit 1 only: 1 = too hot AND B00000010 CMP #0 ; 0: not too hot, so the fan off JPE FANOFF LDD CONTROL ; set bit 1: the fan on OR B00000010 JMP SAVE FANOFF: LDD CONTROL ; clear bit 1: the fan off AND B11111101 SAVE: STO CONTROL END SENSORS: B00000010 CONTROL: B00000001 ; CONTROL ends as B00000011: ; the fan on, the heater still on
Which sensor would an automated system use for each job?
PICK ONE, THEN PICK ITS GROUP
- empty
- empty
- empty
- empty
- empty
KEY TERMS
CHECK YOURSELF
1.What does a control system have that a monitoring system does not?
2.Which operation turns bit 1 of a byte on without changing the other bits?
3.A bridge has a sign that tells drivers to stop if their vehicle is too tall or too heavy. Which reason would earn a mark for calling this a monitoring system?
4.Which sensor would check whether a vehicle is too heavy to cross a bridge?
5.Why does a temperature sensor's reading pass through an ADC?
6.In a control system, which part compares a reading with the stored value?
7.Why does a control system need feedback?
8.Heaters switch on below 10 °C and off above 20 °C. They are off, and the new reading is 15 °C. What happens?
9.Which instruction clears bit 0 of the ACC and leaves every other bit as it was?