What you learn today
- Sequence fill–hold–drain
- Timeout
- Acknowledge faults
This week gave you all the building blocks for a step sequence: the state in a register, the jump table with a catch, the time per state and a fault that has to be acknowledged. The project puts them together into a plant that stands in many bases: a basin that is filled at the push of a button, held for a while and drained again – for example a buffer tank in which hot gas is meant to cool down before it moves on.
The plant
| Device | Prefab | Name |
|---|---|---|
| Volume pump into the basin | StructureVolumePump | “Fuellpumpe” |
| Volume pump out of the basin | StructureVolumePump | “Leerpumpe” |
| Pipe analyzer on the basin | StructurePipeAnalysizer | “Becken” |
| Button | StructureLogicButton | “Start” |
| Button | StructureLogicButton | “Quittieren” |
| LED display | StructureConsoleLED5 | “Status” (state) |
| LED display | StructureConsoleLED5 | “Ursache” (cause) |
| Flashing light | StructureFlashingLight | “Stoerung” |
The step sequence
| State | No. | running | move on when | time limit |
|---|---|---|---|---|
| Ready | 0 | nothing | button “Start” → Filling | – |
| Filling | 1 | fill pump | pressure ≥ 1000 kPa → Holding | over 60 ticks (30 s) → fault, cause 1 |
| Holding | 2 | nothing | after 20 ticks (10 s) → Draining | – |
| Draining | 3 | drain pump | pressure < 10 kPa → Ready | over 60 ticks (30 s) → fault, cause 2 |
| Fault | 4 | flashing light | “Quittieren” and analyzer present → Ready | – |
If the analyzer is missing, the plant goes from every state into the fault state with cause 3, all pumps off. An unknown state leads to cause 4. The display “Ursache” shows the first cause until it is acknowledged.
Setting the cause in the state block
The only new thing is that a transition into the fault state brings its reason along. For that the block sets a second register reason, which starts at 0 every tick:
s_filling:
sgt tmp ticks MAXFILL
select next tmp FAULT next
select reason tmp C_FILL reason
sge tmp pressure FULL
select next tmp HOLDING next
j output
In the output you only take over reason if the plant really goes into the fault state. If the basin does fill up in the last allowed tick, success wins and the cause stays empty. After that you latch as on day 137: select cause cause cause reason.
Milestones
- Start fills the basin, a full basin moves on to Holding
- Holding lasts 10 s, then the basin is drained, and empty means Ready again
- Filling takes too long: fault with cause 1, pumps off, flashing light on, Start has no effect
- Draining takes too long: fault with cause 2
- Unknown state: fault with cause 4, acknowledging leads back to Ready
- Analyzer gone: fault with cause 3, all pumps off, acknowledging has no effect
First build the sequence without times and without causes and get milestones 1 and 2 green. Then the time limits, then the fault. If you write everything at once, you end up hunting three bugs at the same time.
Project task
Task
Build the pump station following the tables above. Header, register plan and reading the inputs are done – reason is 0 every tick, ticks already counts up. Missing are the jump table with catch, the five state blocks and the output with counter reset, latch and all devices.
Milestones
- Milestone 1: fill until full
- Milestone 2: hold, drain, ready
- Milestone 3: filling takes too long
- Milestone 4: draining takes too long
- Milestone 5: unknown state and acknowledging
- Milestone 6: analyzer gone
Hints
Hint 1
Chain: five beq lines, then the catch with move next FAULT, move reason C_STATE and j output.
Hint 2
Filling and draining: first the time limit (sgt, two select for next and reason), then success. Holding: sge tmp ticks HOLDTIME.
Hint 3
Fault: and tmp ack ok, then next to READY and cause to 0 – both with select.
Hint 4
Output: without analyzer reason = C_SENSOR and next = FAULT; keep reason only if next = FAULT; latch; reset the counter; move state next; then all sbn.
Quiz
2 questions. You pass from 60 % – the server does the grading.
Complete the day
- Passed all milestones of the project
- Passed the quiz with at least 60 %
Without an account progress is saved in this browser only.
Report a mistake in this lesson
Please sign in to report. Sign in