Feedback in an automated system

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Feedback in an automated system

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A heater switches on and the room warms up. What happens next in a feedback system?
A The sensor takes a new reading that shows the higher temperature
B The sensor ignores the room until the heater is switched off by hand
2. Which statement describes feedback correctly?
A The actuator's effect changes the next sensor reading
B The sensor changes the stored value after every reading
3. The stored value is 22°C. The sensor reads 22°C. What does the microprocessor do?
A Keeps the heater on until the sensor reads 30°C
B Switches the heater off because the target is reached
4. Why does the sensor-microprocessor-actuator loop repeat continuously?
A So the heater always stays on after the first reading
B So the system can keep checking and adjusting as conditions change
5. Stored value: 20°C. Loop 1 reads 15°C and the heater is on. Loop 2 reads 18°C. What should the heater do?
A Stay on, because 18°C is still below 20°C
B Switch off, because the temperature has risen

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1IF temp < 20 THEN heater ← ON Aheater ON: 17 -> 19 -> 21
2WHILE true: read sensor again BThe loop repeats continuously, so the next reading shows the effect the actuator has had.
3The heater is on and warms the room, so the next temperature reading is higher than the last one. CThe sensor is read only once and never checked again, so there is no feedback. The system cannot notice the target has been reached or switch the actuator off.
4When the reading reaches the target, the microprocessor switches the actuator off. DThe heater is on but the reading never changes. With feedback, the actuator's effect should change the next sensor reading, so the temperature should rise each loop.
5Loop 1: 17 | Loop 2: 17 | Loop 3: 17 (heater ON) EIF temp >= 21 THEN heater ← OFF
6Read sensor once, then heater ON forever FThe microprocessor compares the sensor reading with the stored value and switches the actuator on when the room is too cold.

Definitions

feedback

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
WHILE ____ temp ← ReadSensor() IF temp < 20 THEN heater ← ON
2.
temp ← ReadSensor() IF temp _ 20 THEN heater ← ON
3.
IF temp >= 20 THEN heater ← ___ ENDIF
4.
heater ← ON WAIT 1 temp ← __________()
5.
REPEAT temp ← ReadSensor() UNTIL temp >= ______

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A WHILE TRUE
B temp ← READ_SENSOR()
C IF temp > 20 THEN
D heater ← ON
E ELSE
F heater ← OFF
Question 2
A target ← 22
B temp ← 22
C IF temp < target THEN
D heater ← ON
Question 3
A FOR i ← 1 TO 1
B temp ← READ_SENSOR()
C IF temp >= 22 THEN
D heater ← OFF
Question 4
A WHILE temp > 22
B heater ← ON
C temp ← READ_SENSOR()
D ENDWHILE
E heater ← OFF
Question 5
A temp ← READ_SENSOR()
B IF temp <= target THEN
C heater ← OFF
D ELSE
E heater ← ON

Answer Key

Feedback in an automated system
Section A: Quick Questions
Q1
A — The sensor takes a new reading that shows the higher temperature
Q2
A — The actuator's effect changes the next sensor reading
Q3
B — Switches the heater off because the target is reached
Q4
B — So the system can keep checking and adjusting as conditions change
Q5
A — Stay on, because 18°C is still below 20°C
Section B: Match the Pairs
Q1
IF temp < 20 THEN heater ← ON → The microprocessor compares the sensor reading with the stored value and switches the actuator on when the room is too cold.
Q2
WHILE true: read sensor again → The loop repeats continuously, so the next reading shows the effect the actuator has had.
Q3
The heater is on and warms the room, so the next temperature reading is higher than the last one. → heater ON: 17 -> 19 -> 21
Q4
When the reading reaches the target, the microprocessor switches the actuator off. → IF temp >= 21 THEN heater ← OFF
Q5
Loop 1: 17 | Loop 2: 17 | Loop 3: 17 (heater ON) → The heater is on but the reading never changes. With feedback, the actuator's effect should change the next sensor reading, so the temperature should rise each loop.
Q6
Read sensor once, then heater ON forever → The sensor is read only once and never checked again, so there is no feedback. The system cannot notice the target has been reached or switch the actuator off.
Section C: Definitions
Q1
feedback — When an actuator's effect changes the next sensor reading, so the system keeps adjusting itself until the stored value is reached, e.g. a heater warms the room until the target.
Section D: Fill in the Blanks
Q1
WHILE TRUE temp ← ReadSensor() IF temp < 20 THEN heater ← ON
Q2
temp ← ReadSensor() IF temp < 20 THEN heater ← ON
Q3
IF temp >= 20 THEN heater ← OFF ENDIF
Q4
heater ← ON WAIT 1 temp ← ReadSensor()
Q5
REPEAT temp ← ReadSensor() UNTIL temp >= target
Section E: Spot the Error
Q1
C — The heater should switch on when the temperature is BELOW the stored value. With > the heater would switch on when the room is already warm, so feedback would never bring it up to the target. It should be IF temp < 20 THEN.
Q2
B — The program must take a fresh reading from the sensor. Setting temp to a fixed number means the effect of the heater is never seen, so there is no feedback. It should be temp ← READ_SENSOR().
Q3
A — A feedback loop must repeat continuously so each new sensor reading can be checked. A loop that runs only once cannot keep adjusting. The first line should be WHILE TRUE.
Q4
A — The loop should keep running while the temperature is still below the stored value, so the heater stays on until the target is reached. It should be WHILE temp < 22.
Q5
B — The actuator should switch off once the target is reached or passed, so the test needs >=. With <= the heater would switch off when the room is cold. It should be IF temp >= target THEN.