Reviewing Migrated Ladder
A migrated program is a starting point. This page explains what the migration already checked for you, what it cannot check, and what to do before the code runs on a machine.
What the agent reports
Section titled “What the agent reports”At the end of a Studio 5000 migration the agent tells you:
- how many rungs became Ladder, how many are comments only, and how many are placeholders;
- the result of the automatic check: how many networks are identical to the source, how many are different, and how many are not comparable;
- the assumptions to confirm: choices the translator made where the source was ambiguous;
- for projects with motion or PID: the lines and review files described in Motion and PID;
- the types it had to assume, such as the memory addresses given to I/O.
The automatic check
Section titled “The automatic check”Every generated block is compared with the rungs it was built from. Both sides are reduced to the same form: for each output, the condition under which it acts (contacts with their polarity, comparisons with their operands, one-shots, parallel branches, parallel outputs, move and math destinations, timer, counter, and block calls).
| Result | Meaning |
|---|---|
| Identical | The network does the same thing as the source rung, as far as the check can see |
| Different | The network does not match its source rung. Look at it before you use the block. The agent lists these |
| Not comparable | The rung uses an instruction the check does not cover. It is not necessarily wrong, but nothing confirmed it |
Placeholder networks
Section titled “Placeholder networks”A rung the translator cannot handle is not guessed. In TIA Portal it appears as a network that contains only comments, for example:
// TODO rung 5 (network 6) was not generated: <the reason>// source: <the original rung text>The block still compiles, and the logic of the other networks is complete.
For a whole project the generator also writes a list of every placeholder next to the generated files: placeholders.json (for the agent), and migration_status.md (for you). For each placeholder it records the block, the network, the original Studio 5000 rung, the reason, the types of the tags in the rung, and a triage that says who can resolve it:
| Triage | Meaning |
|---|---|
| write | The S7 form exists, the translator has no rule for it yet. The agent can write it |
| decide | It depends on your machine or hardware (motion, drive diagnostics, communication, safety). The agent asks you first |
| blocked | The source is not in the export (a vendor block without logic, a routine in another language) |
| review | The reason is unclear. Read the original rung |
The triage is a suggestion from the reason text, not a proof. Ask the agent how many placeholders there are and of what kind, then which ones it can write. It records its progress in migration_status.md (open, written, asked you, skipped), so you can see where the work stands even after a long session. For some kinds of placeholder (the COP instruction in its different forms, fills, jumps and labels, variable indexes into arrays and into the bits of a word, string instructions, writes to timer and counter members, file instructions such as FSC and FFL, and BTD) the agent also gets a short recipe with patterns that were compiled in TIA Portal, so it writes the usual cases the same way every time and asks you the questions that only you can answer, such as the word or byte order of a sensor. A network the agent writes is not compiled or checked until it is imported: import the file again and read the compiler result. TIA Portal V21 closes entirely when one block has an SCL network that uses an instance data block (a call of an Add-On Instruction instance, or a read or write of its members) ahead of a Ladder network that calls an instance as a box. The import tool now refuses such a block before sending it and tells the agent how to restructure it (the SCL in its own function, or the Ladder boxes first). If TIA Portal itself closes while the agent is importing anyway, reopen the project and tell the agent: it saves the project after every import that compiles without errors, so only the import in progress is lost, and the agent will not retry it in a loop.
Studio 5000 numbers rungs from 0 and TIA Portal numbers networks from 1, so network N is rung N minus 1. The placeholder shows both numbers.
You have three options for each placeholder:
- Ask the agent to write that network, giving it the source text and any context (“this timer is the motor start delay, write it in Ladder”).
- Write it yourself in TIA Portal, using the original rung text as the specification.
- Leave it if the rung is not needed on the new platform.
| Typical reason | What to do |
|---|---|
| Talking to another device (message instruction) | Decide which S7 mechanism fits: PUT/GET, Open User Communication, Modbus, or acyclic access to the device. The comment says what the original does |
A system value (GSV) with no S7 counterpart |
The comment says where the S7 equivalent is read, for example the diagnostic functions or the cycle time of the OB |
| Cam or motion-dynamics instructions | Rebuild with the matching technology object functions |
| A conditional return in the middle of a routine | Restructure the logic, or use the S7 return in an SCL network |
| Call to a routine in another language | Migrate that routine separately, or rewrite it |
Check the assumptions
Section titled “Check the assumptions”The assumptions to confirm are choices where the source did not decide for the translator. Typical examples: how many characters a string copy moves, or the byte order of a value assembled from two words. Each assumption names the routine and the rung. Check every one against how the machine is meant to behave. Resets of counters and retentive timers carry a standing note: a reset takes effect one scan later than in Logix, a retentive timer in S7 can count up to one scan more per enable segment, and a counter that is reset while its count input is still true does not count again until the input drops and rises (Logix counts again in the next scan). These were found by running migrated programs in a simulator next to a model of the Logix behavior, and they only matter when the logic depends on the exact scan of a reset.
Before it runs on a machine
Section titled “Before it runs on a machine”- Replace the placeholder addresses. I/O is mapped to memory addresses so that the logic compiles. Move the tags to the real inputs and outputs in the tag tables.
- Check the organization blocks. The continuous task became OB1 (
Main) and every periodic task a cyclic interrupt OB with the same cycle time, calling the entry routines of its programs. The OB1 of the project is replaced. The priority is mapped from the Logix priority (Logix 1 to S7 priority 24, Logix 15 to 13): check it against the timing the machine needs. Event tasks, safety programs and programs that no task schedules are not generated. The report names them, and you create their organization blocks. - Check retention. Decide which tags must keep their value across a power cycle.
- Compile the whole PLC (Compile → Software). Fix any error before you test.
- Simulate. Run the program in PLCSIM Advanced and exercise start, stop, fault, and reset paths against what the original does.
- Test online in a safe condition, with the outputs disconnected or the machine in a state where a mistake cannot hurt anyone. Compare the inputs and outputs with known-good behaviour of the original.
Documenting what changed
Section titled “Documenting what changed”After migration, add a comment to each block that was migrated, for example:
// Migrated from Studio 5000 by S7 PLC Buddy on <date>.// Source: Plant.L5X, routine <name>.// Reviewed by: <your name>This helps the next engineer understand where the block came from and how far it was reviewed.