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

The cylinder that never arrives: PLC programming exercise

Give every move three seconds, and stop safely if one runs out.

Run the A+ B+ B− A− cycle, and watch every move with a three second . A move that runs out of time stops the cycle with FaultLamp ON, and the cylinders come home in a safe order.

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 electro-pneumatics trainer this mission runs onPRO (needs Pro) mission
How the test runs

Healthy cycles, no fault

Test 1 of 7
Set by the testChecked by the testStep 7 of 7 · 12.3 s
Level
Advanced
Time
About 35 min
Reward
+500 XP
Rig
3D electro-pneumatics trainer
Siemens editors
Ladder (LAD), SCL
Rockwell editors
Ladder, Structured Text
Beckhoff editors
Structured Text
Stage
33. Pneumatics lab: cylinders, valves and reed switches
Required behaviour

The cylinder that never arrives: what your code must do

A sequence that waits for a switch waits for ever if the switch never comes: a jammed cylinder, a failed reed switch, a kinked hose. Keep AirOn ON, and run the same cycle as before: Start with AirOK, A0 and B0; A out (ExtendA), B out (ExtendB), B back (RetractB), A back, each on its reed switch, with RunLamp ON. Now time each move. If any one move takes more than 3 seconds, stop the cycle: RunLamp OFF and FaultLamp ON. Then come home safely: bring B back first (RetractB ON until B0) with A still held out, and only then let A go (ExtendA OFF). FaultLamp stays ON until Reset is pressed with both cylinders home (A0 and B0). While FaultLamp is ON, Start does nothing. A slow cylinder is not a fault: a move that finishes inside 3 seconds must not trip.

Cycle
A out, B out, B back, A back, on the reed switches.
Time limit
More than 3 s for any one move is a fault.
On a fault
B back first, then A. FaultLamp ON, RunLamp OFF.
Reset
Only with A0 and B0. Start does nothing until then.
How it's checked
The checks press the buttons and switch the jam on, then watch the trainer itself: its reed switches and its counts of finished strokes.
Tag table

The cylinder that never arrives: inputs and outputs

Your program reads 7 inputs and sets 6 outputs. 4 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 needsGreen Start pushbutton
ResetBOOLReadsAn input your code needsBlue Reset pushbutton
AirOKBOOLReadsAn input your code needsPressure switch 0B1: ON once the air is above 4.5 bar
A0BOOLReadsAn input your code needsReed switch 1B1: cylinder A fully back
A1BOOLReadsAn input your code needsReed switch 1B2: cylinder A fully out
B0BOOLReadsAn input your code needsReed switch 2B1: cylinder B fully back
B1BOOLReadsAn input your code needsReed switch 2B2: cylinder B fully out
SlowABOOLNot neededFor testing or watching; your code can leave it outTry it: wind in the flow control on A's out stroke, so A goes out slowly
SlowBBOOLNot neededFor testing or watching; your code can leave it outTry it: wind in both flow controls on B, so B is slow both ways
JamABOOLNot neededFor testing or watching; your code can leave it outTry it: cylinder A jams part way along its stroke
JamBBOOLNot neededFor testing or watching; your code can leave it outTry it: cylinder B jams part way along its stroke
AirOnBOOLWritesAn output your code setsDump valve 0V2: ON lets the air in, OFF lets it out
ExtendABOOLWritesAn output your code setsValve 1V1, spring return: ON sends A out, OFF brings it back
ExtendBBOOLWritesAn output your code setsValve 2V1, out solenoid: sends B out, and the valve stays there
RetractBBOOLWritesAn output your code setsValve 2V1, back solenoid: brings B back, and the valve stays there
RunLampBOOLWritesAn output your code setsGreen lamp: a cycle is running
FaultLampBOOLWritesAn output your code setsRed lamp: fault

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

The cylinder that never arrives: what the tests check

  1. A healthy cycle runs with no fault, even with a slow cylinder.
  2. A move that takes more than 3 seconds stops the cycle: RunLamp OFF, FaultLamp ON.
  3. After a fault, B comes back first, and A lets go only when B is home.
  4. The fault holds until Reset is pressed with both cylinders home.
  5. Start does nothing while FaultLamp is ON.
  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

Every real sequence has this watchdog. On an operator screen it reads as 'Step 20 timeout: B not out', which tells the fitter exactly where to look.

Without a time limit, a jammed cylinder leaves the machine sitting silently in the middle of a cycle with the clamp closed. People reach in to see what's wrong.

Where you'd find thisMove things with air, and know where every cylinder is

Most machines that clamp, push, lift or eject do it with air cylinders. A solenoid valve sends air to one side of the piston and lets it out of the other, and a small switch on the barrel tells the controller when the piston has arrived. Colleges teach it on a board like this one, because the same few parts make up almost every pneumatic machine.

  1. Air supplyFiltered, set to 6 bar
  2. ValvesOne 5/2 valve a cylinder
  3. CylindersOut and back on airYou are here
  4. Reed switchesProve each stroke
On a real site: places, parts and safety
  • Assembly machines that clamp a part, then press or drill it
  • Packing lines that push, lift and eject cartons
  • College and apprentice training workshops

Compressed air is stored energy. Shut the isolator and let the air out before touching pipework: a hose that comes off under pressure whips.

Letting the air out isn't always the safe state. A cylinder holding a load upright drops when the air goes, so real machines are assessed one cylinder at a time.

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

Keep going

Next on the road