Ladder logic to structured text converterand Rockwell to Siemens, both ways
Paste a Studio 5000, TIA Portal or TwinCAT program and get it back in another maker's code, or as ladder. Then PLC Gym runs both versions side by side to show they do the same thing.
- Every line mapped Hover a rung or line to see where it came from
- Proved, not guessed Both programs run on the same inputs, scan by scan
- Stays in your browser Your code is never uploaded
Rockwell, Siemens and TwinCAT: the same instruction, three names
The converter maps each of these for you. It's also a handy cheat sheet when you move between plants.
| What it does | Rockwell Studio 5000 | Siemens TIA Portal | Beckhoff TwinCAT 3 |
|---|---|---|---|
| Normally open and closed contacts | XIC, XIO | NO and NC contacts | Written as logic: A AND NOT B |
| Coil, latch and unlatch | OTE, OTL, OTU | Coil, S, R | x := …, IF … THEN x := TRUE |
| On-delay timer | TON on a TIMER (.PRE .ACC .DN); TONR on an FBD_TIMER in ST | TON_TIME (PT, ET, Q) | TON (PT, ET, Q) |
| Off-delay timer | TOF; TOFR in ST | TOF_TIME | TOF |
| Up counter | CTU on a COUNTER, reset with RES; CTUD in ST | CTU on an IEC_COUNTER (PV, CV, Q, R) | CTU (PV, CV, Q, RESET) |
| Rising edge | ONS, OSR; OSRI in ST | P contact, P_TRIG, R_TRIG | R_TRIG |
| Move a value | MOVE (MOV before v36) | MOVE | x := y |
| Compare | EQ, NE, LT, GT, LE, GE (EQU, NEQ, LES, GRT, LEQ, GEQ before) | CMP ==, <>, <, >, <=, >= | =, <>, <, >, <=, >= |
| Maths | ADD, SUB, MUL, DIV, CPT | ADD, SUB, MUL, DIV, CALCULATE | +, -, *, / |
| Scale an analogue input | SCP | NORM_X then SCALE_X | Written out as a formula |
| Whole numbers | DINT (INT exists, DINT is native) | Int, DInt | INT, DINT |
| Times | DINT milliseconds: 2000 | Time: T#2s | TIME: T#2S |
| Tags inside a block | Program tags, no prefix | #Name (block interface) | No prefix (VAR sections) |
What it converts, and what it doesn't
It converts the logic. Anything it can't carry across is listed with the line and what to do, never left out quietly.
Converts
- Ladder logic to Structured Text, every time
- Structured Text to ladder, where the logic fits ladder: contacts, coils, set and reset, timers, counters, edges, compares, moves and maths
- Rockwell to Siemens and back, in Structured Text or ladder, and TwinCAT both ways
- Timer and counter members (IN/PT/Q/ET to TimerEnable/PRE/DN/ACC), # locals, data types, edges, MOVE and MOV, compares and maths
- Tag declarations with their comments, and the comments in your code
Doesn't convert
- Hardware configuration, I/O addresses, networks and communications (MSG, PUT/GET, EtherNet/IP, PROFINET)
- HMI tags, alarms and screens
- Vendor library blocks such as PID, motion and drives
- Your own function blocks, AOIs and UDTs (not yet)
- FOR loops into ladder: they're flagged with the line and a suggestion
- STL, IL, FBD, SFC and GRAPH
How the proof works
Your code is read into a neutral form, then written out the way the target maker writes it: member writes and TONR in Logix, one TON_TIME call in SCL, T#2s or 2000.
PLC Gym's simulator runs the original and the converted program for 3,000 scans (60 simulated seconds). Inputs are pressed, held and released, and numbers cross every limit your code compares against.
Every output is compared on every scan. Where makers truly differ (a one-shot on the first scan, a counter reset), the converter writes the code so the behaviour still matches, and says so.
It's a strong check, not a guarantee: test on the real machine as your site requires. Want to see it run? Press Run it to open the converted program on the online PLC simulator's control panel, or test your PLC code on a 3D machine.
Questions engineers ask
Can you convert ladder logic to Structured Text?
Yes, always. Each rung becomes one or two lines of Structured Text: contacts become AND and OR, coils become assignments, OTL and OTU become IF … THEN, and timers, counters and one-shots become calls in the target maker's own style. The rung comments come across as comments.
Can any Structured Text be turned into ladder?
Most control logic can: contacts, coils, set and reset, timers, counters, edges, compares, moves and maths. FOR loops can't, because ladder runs each rung once per scan, so the converter flags the line and suggests writing one rung per element or keeping that part in Structured Text.
Does it convert Rockwell Studio 5000 code to Siemens TIA Portal?
Yes. Paste or open an L5X export (a Structured Text or ladder routine) and choose Siemens SCL or LAD. TONR timers become TON_TIME, CTUD counters become CTU, OSRI one-shots become R_TRIG, DN becomes Q and ACC becomes ET or CV, and every local tag gets its # in SCL. It works the other way too.
How do I know the converted code does the same thing?
PLC Gym runs your original and the converted program side by side in its simulator for thousands of scans, driving both with the same inputs, and compares every output on every scan. You see the result as a logic analyser trace. Press Run it to open the converted program on PLC Gym's control panel, with buttons, switches and lamps made from its tags, and try it yourself. Always test on the real machine as your site requires.
Is my code uploaded anywhere?
No. The converter runs entirely in your browser tab. Your code is never sent to PLC Gym's servers, and it is hidden from the session recordings we use to improve the site.
Can I import the result into TIA Portal, Studio 5000 or TwinCAT?
Yes. Download an .scl source and use Generate blocks from source in TIA Portal, an .L5X to import into Studio 5000, or a .TcPOU to add to a TwinCAT 3 project. TIA Portal has no text format for ladder, so for Siemens LAD you redraw the networks shown, or use the SCL file.
What doesn't it convert?
Logic only: not hardware configuration, communications, HMI tags or vendor library blocks such as PID and motion. Your own function blocks, AOIs and UDTs aren't converted yet. Anything it can't carry across is listed with the line and what to do, never left out quietly.