A decision is only as good as the data behind it. Data quality means asking whether a reading is accurate, present, up to date and sensible for the setting before the system acts on it.
This lesson extends explaining a simple decision model and completes the reasoning inside automation and emerging systems. Scenario questions often add a faulty sensor and ask what goes wrong and how to prevent it.
What can go wrong with a reading?
- Inaccurate: the value is off from the true one, for example a sensor that drifts.
- Missing: no value arrives, or a placeholder code arrives instead.
- Out of date: the value is old, so it describes the room as it was, not as it is.
- Impossible: the value cannot be real, such as a classroom at 99 °C.
- Wrong place: the sensor measures somewhere unrepresentative, such as beside a heater.
Worked example
A greenhouse sensor sends 25, 26, 99, 26, 25 (°C). The fan rule is “ON if the average of the readings is above 35”. A range check accepts only values from 0 to 60.
Without the check: 25 + 26 + 99 + 26 + 25 = 201, and 201 ÷ 5 = 40.2. Since 40.2 > 35, the fan switches ON for no real reason.
With the check:
total ← 0
count ← 0
FOR i ← 1 TO 5
value ← GetReading()
IF value >= 0 AND value <= 60
THEN
total ← total + value
count ← count + 1
ENDIF
NEXT i
average ← total / count
| i | value | in range 0 to 60 | total | count |
|---|---|---|---|---|
| 1 | 25 | true | 25 | 1 |
| 2 | 26 | true | 51 | 2 |
| 3 | 99 | false | 51 | 2 |
| 4 | 26 | true | 77 | 3 |
| 5 | 25 | true | 102 | 4 |
The average is 102 ÷ 4 = 25.5. Since 25.5 is not above 35, the fan stays OFF. The check kept one impossible value from changing the decision.
The system should also record that a value was rejected, so someone can check the sensor.
The mistake to watch for
A common slip is to say “the system will fix the data by itself”.
Mistaken answer: “The processor will notice 99 is wrong because it is a computer.”
The student assumed the processor understands the situation.
A processor only does what its rules say. Unless a check is written, 99 is accepted like any other number. The correction is to name a specific check, such as a range check, and say what the system does with a rejected value.
Check yourself
1. A sensor sends 12, 14, -999, 13, 15, where -999 means “no reading”. Valid range is 0 to 50. Find the average of the accepted values.
Show answer
Accepted: 12, 14, 13, 15. Total = 12 + 14 + 13 + 15 = 54. Count = 4. Average = 54 ÷ 4 = 13.5. Including -999 would give -945 ÷ 5 = -189, which is meaningless.
2. Give one problem with a reading that arrives ten minutes late in a system that needs updates every second.
Show answer
The reading is out of date. The processor would decide using conditions that may no longer be true, so the actuator could do the wrong thing.
3. Why should the limits of a range check not be set too tight?
Show answer
A tight range could reject real events, such as a genuine rise in temperature, so the system would ignore exactly the readings it needs to act on.
Where this leads next
The last lesson in the module is about keeping your notes tied to the right year: labelling 2029-only additions. To rehearse bad-data traces, use the Python reasoning sandbox with short loops like the one above.
Teachers in Computer Science tuition often ask you to break a rule deliberately, so you learn to see the weak point before an exam question points it out.