Loading local progress…
PLC Gym
PLC Gym homeLevel 1, 0 XP · your progress
Mission 87 · PRO (needs Pro)

Log what explains a stop: PLC SCADA training exercise

Store a value when it changes enough, never go silent, then read the trend to find what failed.

Give the factory's history what it needs to explain a stop. Write the store for two : the air pressure, kept when it moves 0.2 bar or after 10 s, and the line's state, kept on every change or after 10 s. Then choose what to log and how, and read a recorded stop to find its cause.

This mission is part of ProCreate a free account: every account gets a free Pro trial until 5 December.

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
The 3D model factory this mission runs onPRO (needs Pro) mission
How the test runs

A flat line still gets its heartbeat

Test 1 of 3
Set by the testChecked by the testStep 9 of 9 · 21 s
Level
Advanced
Time
About 45 min
Reward
+500 XP
Rig
3D model factory
Siemens editors
Ladder (LAD), SCL
Rockwell editors
Ladder, Structured Text
Beckhoff editors
Structured Text
Stage
45. SCADA 3: log what explains a stop
Required behaviour

Log what explains a stop: what your code must do

The plant control is written and working. A historian can't keep every scan of every tag, so each tag is stored on change, with a slowest rate so a flat line is known to be alive. Write that store in the PLC, as a remote station does, so only what matters is sent. Air pressure: add 0.02 to AirAge every scan. When AirPressure is 0.2 bar or more above or below AirStored, or AirAge reaches 10.0 s, store it: copy AirPressure to AirStored, add 1 to AirSamples and set AirAge to 0. The line: add 0.02 to LineAge every scan. When LineRun differs from LineStored, or LineAge reaches 10.0 s, store it: copy LineRun to LineStored, add 1 to LineSamples and set LineAge to 0. The Operator screen tab draws what your PLC stores over the real signal. There, choose which tags the history keeps, how often and with what deadband. Then read the stop recorded last night and say what failed.

Air
Store on a 0.2 bar change either way, or after 10 s.
Line
Store on any change of LineRun, or after 10 s.
A store
Copy the value, add 1 to the count, set the age to 0.
Tag table

Log what explains a stop: inputs and outputs

Your program reads 17 inputs and sets 18 outputs. 2 more inputs drive the simulation or show readings, for you to test with. The names are the same in every maker’s editor.

TagData typeYour codeWhat it means on the machine
StartBOOLReadsAn input your code needsStart the factory
StopBOOLReadsAn input your code needsStop the factory where it is
ResetBOOLReadsAn input your code needsReset after an emergency stop or a light-curtain trip
EStopBOOLReadsAn input your code needsEmergency stop pressed
AirPressureREALReadsAn input your code needsAir receiver pressure, bar
SteamPressureREALReadsAn input your code needsBoiler steam pressure, bar
VesselLevelREALReadsAn input your code needsMixing vessel level, %
VesselTempREALReadsAn input your code needsBatch temperature, °C
SugarAddedREALReadsAn input your code needsSugar the weigh feeder has added to this batch, kg
BufferLevelREALReadsAn input your code needsFiller buffer tank level, %
BadBottleBOOLReadsAn input your code needsCamera: a bottle with no label is passing
GateEyeBOOLReadsAn input your code needsA bottle is in front of the reject gate
AccumFullBOOLReadsAn input your code needsThree packs are waiting for the robot
CurtainClearBOOLReadsAn input your code needsLight curtain beams unbroken
PalletFullBOOLReadsAn input your code needsA full pallet is waiting or on its way to the wrapper
PalletOnWrapperBOOLReadsAn input your code needsA pallet is on the wrapper turntable
WrapDoneBOOLReadsAn input your code needsThe pallet on the wrapper is wrapped
PersonInCellBOOLNot neededFor testing or watching; your code can leave it outTry it: someone walks into the robot cell
CompressorFaultBOOLNot neededFor testing or watching; your code can leave it outTry it: the compressor trips
CompressorBOOLWritesAn output your code setsRun the air compressor
BoilerOnBOOLWritesAn output your code setsSwitch the boiler on
WaterValveBOOLWritesAn output your code setsWater into the mixing vessel
FeederBOOLWritesAn output your code setsRun the sugar weigh feeder
AgitatorBOOLWritesAn output your code setsRun the agitator
SteamValveBOOLWritesAn output your code setsSteam to the vessel jacket
TransferPumpBOOLWritesAn output your code setsPump the batch to the buffer tank
LineRunBOOLWritesAn output your code setsRun the bottling line
RejectGateBOOLWritesAn output your code setsFire the reject gate
RobotEnableBOOLWritesAn output your code setsLet the robot palletise
PalletOutBOOLWritesAn output your code setsMove the full pallet to the wrapper
WrapBOOLWritesAn output your code setsRun the stretch wrapper
AGVCallBOOLWritesAn output your code setsCall the AGV to collect the wrapped pallet
GreenLampBOOLWritesAn output your code setsStack light: producing
AmberLampBOOLWritesAn output your code setsStack light: starting or waiting
RedLampBOOLWritesAn output your code setsStack light: emergency stop or light-curtain trip
AirStoredREALWritesAn output your code setsHistory: the air pressure last stored, bar
LineStoredBOOLWritesAn output your code setsHistory: the line state last stored

In Siemens SCL, write a block’s own tags with # in front, as TIA Portal does: #Start. Rockwell and TwinCAT use the name on its own: Start.

Automatic tests

Log what explains a stop: what the tests check

  1. AirStored follows AirPressure to within 0.2 bar.
  2. A steady pressure is still stored every 10 s, so a flat line is known to be live.
  3. LineStored takes every change of LineRun on the it happens, and a 10 s heartbeat.
  4. AirSamples and LineSamples count one for each store: tens a minute, not thousands.
  5. The history keeps the measurement, the command and the state that explain a stop, on change, with a just above the 's noise.
  6. The recorded stop is read correctly: the compressor was called and the pressure kept falling.
  1. Try it Use the buttons below the model and watch the rig respond.
  2. Test solution Every check runs on your code in one press.
  3. 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.

Why it matters

Where you’d see this on site

A plant historian keeps years of readings from thousands of tags. After every unexplained stop, the first thing an engineer opens is the trend of the minutes before it.

A trip that happens at night with nobody watching leaves only what was logged. If the command and the pressure were not both kept, at a rate fast enough to see which moved first, the cause is a guess.

Where you'd find thisOne controller for a whole factory: when each machine may run, and what keeps it safe

A small drinks factory makes an orange drink. Sugar and water are batched and pasteurised, then pumped to a filler. Bottles are filled, capped, labelled and inspected, packed in sixes, stacked on pallets by a robot, wrapped and carried to the dock by a driverless forklift. Every machine has its own controls; the plant controller decides when each may run, hands work from one to the next, and stops everything safely.

  1. BatchMix and pasteurise
  2. FillFill, cap, label
  3. InspectReject bad bottles
  4. PackRobot stacks packsYou are here
  5. ShipWrap, AGV to dock
On a real site: places, parts and safety
  • Soft drinks and juice bottling halls
  • Sauces, dairy and liquid food plants
  • Household and personal-care liquids

An emergency stop is wired through a safety relay that cuts the power on its own. The program must then hold everything off and wait for a deliberate Reset and Start, so nothing moves by surprise.

Robot cells are fenced. Light curtains and interlocked doors stop the robot when someone goes in, and a restart needs a reset from outside the cell, in the spirit of ISO 10218 and ISO 13849.

The sizes, timings and cutaways are teaching choices, not a drawing of any one real installation.

Keep going

Next on the road