Sprint: 5 — Timers, Counters, Registers (with SFC concepts from Sprint 4) Time: ~2 hours
Implement a 3-ingredient batch recipe:
Y_Water until Flow_Total ≥ 50)Y_Sugar until Weight_Total ≥ 25)Mixer_Run true, gated by Mix_Done)Y_Drain until Tank_Empty)Implement as a phase machine in ST. The Hold_Timer_EN for the mixer is gated by the phase.
| Tag | Type | Description |
|---|---|---|
Start / Stop / EStop |
BOOL | Standard controls |
Flow_Total |
INT | Cumulative water (L) |
Weight_Total |
INT | Cumulative sugar (kg) |
Mix_Done |
BOOL | Mixer timer elapsed |
Tank_Empty |
BOOL | Drain complete sensor |
Y_Water / Y_Sugar / Y_Drain |
BOOL | Valves |
Mixer_Run |
BOOL | Mixer contactor |
Phase |
INT | 0=Idle, 1=Water, 2=Sugar, 3=Mix, 4=Drain |
See tests/cases.json. Submit as solution.st.
Look at Lab 03 for the phase-machine pattern. This is the same pattern with more steps.