A simple decision model has three parts: inputs, rules and an output. To explain a decision, you say which inputs were read, which rule applied, and what the system did as a result.
This lesson follows feedback and fixed sequences and is part of automation and emerging systems. It matters because explanation questions give marks for linking the rule to the specific values in the scenario.
How do you build the model?
- List the inputs and the units or states they can take.
- Write each rule as a condition and an output.
- Check the rules cover every case, including the boundary values.
- Show it as a table or as IF statements, whichever the question asks for.
Worked example
An irrigation controller has two inputs: soil moisture (a number from 0 to 100) and whether rain is expected (yes or no). It waters only when the soil is dry, meaning moisture below 40, and no rain is expected.
IF moisture < 40 AND rainExpected = "no"
THEN
pump ← "ON"
ELSE
pump ← "OFF"
ENDIF
| moisture | rain expected | moisture < 40 | pump |
|---|---|---|---|
| 35 | no | true | ON |
| 35 | yes | true | OFF |
| 55 | no | false | OFF |
| 40 | no | false | OFF |
Explaining row 2 in an answer: “The moisture is 35, which is below 40, so the soil is dry. But rain is expected, so the second condition is false. Both conditions must be true for the pump to run, so the pump stays OFF.”
Explaining row 4: a reading of exactly 40 is not below 40, so the soil counts as not dry and the pump stays OFF.
The mistake to watch for
A common slip is to read AND as OR.
Mistaken answer: for moisture 35 with rain expected, the pump is ON, “because the soil is dry”.
The student applied only one condition.
With AND, both conditions must be true. With OR, the pump would run whenever either condition held, which would also water in the rain-expected case and defeat the purpose. Check each condition separately, then combine the results with the operator.
Check yourself
1. Using the same rule, give the pump state for moisture 12, rain expected “no”.
Show answer
12 < 40 is true and rain is “no”, so both conditions hold. The pump is ON.
2. Using the same rule, give the pump state for moisture 39, rain expected “yes”, and explain.
Show answer
39 < 40 is true, but rain expected is “yes”, so the second condition is false. With AND, the whole condition is false. The pump is OFF.
3. A gate controller opens when a card is valid AND the gate sensor reports it is closed. The card is valid and the gate is already open. What does it do, and why?
Show answer
The gate does nothing. The card is valid (true), but “gate is closed” is false because it is already open. With AND, the whole condition is false.
Where this leads next
A model is only as good as the data it reads, which is the subject of assessing data quality in an automated system. To try your explanations on new cases, run rules through the pseudocode trace trainer.
If you want a teacher to read your written explanations and tighten them, see one-to-one Computer Science tuition.