Hold a job, then resume it: state machine PLC exercise
Add a Held state to the mixing job, and decide which request wins.
Add Hold, Resume and Stop to the mixing job. State is still one whole number (a ) in one CASE statement, with two new states: 30 Held and 90 Stopped. Hold pauses the job with every OFF. Resume carries on, but only once Hold is released. Stop wins over everything, and then only Reset lets the job start again. Change State at most once per .
No card. Nothing to pay. Nothing to cancel.
Official release: 5 December. Top the leaderboard on the day and win 3 months of Pro, plus 2 weeks of Pro to give a friend. 2nd place wins 4 weeks. 3rd place wins 2 weeks. Rules
- Every Coaching lesson, from zero
- Every mission and lesson, as you level up
- A practical test for every title, with a certificate
- Rewind any test, one scan at a time
- Worked solutions when you're stuck
- The code converter, as much as you like
PRO (needs Pro) missionStart, complete and reset
Test 1 of 8StateJob stateRunningPumpOnPump commandOFFValveCmdInlet valve commandOFFMixerOnMixer commandOFF- Level
- Advanced
- Time
- About 18 min
- Reward
- +400 XP
- Rig
- 3D process tank
- Siemens editors
- SCL
- Rockwell editors
- Structured Text
- Beckhoff editors
- Structured Text
- Stage
- 16. Write phases in text
Hold a job, then resume it: what your code must do
This is the second of three missions on the same mixing job. The operating rules below list each state and what every output must be. When two requests arrive in the same scan, the order of your IF and ELSIF lines decides which one wins: Stop first, then Hold, then finishing.
- 0 · Idle
- All outputs OFF. Start → 10, but only if Stop and Hold are released. Other inputs do nothing.
- 10 · Running
- PumpOn, ValveCmd and MixerOn ON. Done OFF. Stop → 90. If not, Hold → 30. If not, MixDone → 50.
- 30 · Held
- All outputs OFF. Stop → 90. If not, Resume AND NOT Hold → 10. Start, MixDone and Reset cannot restart it.
- 50 · Complete / 90 · Stopped
- Pump, valve and mixer OFF. Done is ON only in 50. Reset → 0, but only with Stop released. It must not also start in that same scan.
- Scan and reset rules
- State starts at 0. Change State at most once per scan. On the scan where State changes, the outputs may match the old state or the new one, as a full set. From the next scan, they must match the current state. Reset does nothing in Running or Held.
Hold a job, then resume it: inputs and outputs
Your program reads 6 inputs and sets 4 outputs. The names are the same in every maker’s editor.
Hold a job, then resume it: what the tests check
- Every state sets all four outputs: pump, valve, mixer and Done.
- Held waits for Resume, and only once Hold is released.
- Stop works from Running and from Held, and beats Hold, Resume, MixDone and Reset. Reset only works from Complete or Stopped.
- Try it Use the buttons below the model and watch the rig respond.
- Test solution Every check runs on your code in one press.
- Rewind PRO (needs Pro) If one fails, step back through it one scan at a time to see why.
Stuck on this mission? Ask the members in the Locker Room.
Where you’d see this on site
An operator pauses a mixing batch to check the tank, then carries on. If something is wrong, Stop ends the batch.
A job that restarts when Hold is let go can catch the operator out. Stop must win, even when another button is pressed in the same moment.
At a drinks factory, valves let measured amounts of water and syrup into a mixing tank. An electric mixer blends them into one batch. An outlet valve then sends the drink to a holding tank. Filling machines bottle it from there.
- Ingredient tanksHold the water and syrup
- Mixing tankFill, mix and measure one batchYou are here
- Holding tankKeeps the finished drink ready
- Bottle fillerPuts the drink into bottles
On a real site: places, parts and safety
- Drinks factory — blending water and syrup
- Paint factory — mixing ingredients into a consistent colour
- Water-treatment works — preparing a measured chemical mixture
- Brewery — heating water for washing equipment
A full tank does not close its own inlet. Water keeps arriving until the valve closes, so an open inlet can flood the room.
A heater that is not covered by liquid can overheat. Real tanks have separate safety devices as well as the PLC program.
The sizes, timings and cutaways are teaching choices, not a drawing of any one real installation.
Next on the road
- Average the last four readingsSmooth a noisy level. Keep four readings, and let each new one replace the oldest.Applied · 15 min · +350 XP
- Average the last N readingsSmooth a noisy level. Average only the readings you have, and drop the oldest.Advanced · 25 min · +450 XP
- Green figure, on timeRun a crossing's six stages with their timers.Advanced · 30 min · +450 XP
- Down, grip, up, acrossStep a pick and place through its sequence, every move confirmed.Advanced · 35 min · +450 XP