TIA Portal Compare: Resolving Pseudo-Network Shift Errors

David Krause13 min read
SiemensTIA PortalTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Overview of the TIA Portal Compare Function

The Compare function in Siemens TIA Portal (Totally Integrated Automation Portal) is the built-in differencing engine used for offline/online program comparisons, project-to-project comparisons, and library/version drift checks on S7-1200, S7-1500, ET 200, and WinAC targets. It operates on the compiled network graph of the PLC program and renders side-by-side LAD (Ladder Diagram) and FBD (Function Block Diagram) networks. When both compared programs contain the same number of networks with semantically similar content, the tool pairs them one-to-one and highlights differing elements (contacts, coils, parameters) using color codes: red for deletion candidates, green for insertion candidates, yellow for modification, and a colored underline for parameter-level changes.

For SCL (Structured Control Language) blocks, the comparison is performed on a tokenized representation of the source text and exposes line-level differences rather than network-level alignment. GRAPH programs are compared at step/transition granularity. STL programs follow the same network-level scheme as LAD/FBD but tokenize at the instruction level.

The compare function is reachable through four entry points:

  • Project tree → PLC → Compare offline/online (replaced from V15 onward by the Snapshot + Go online workflow)
  • Right-click on a block → Compare blocks
  • Library management → Find differences
  • Project history comparison (project vs. project archive, .zap/.zal)

Full entry-point documentation is available in the SIMATIC TIA Portal manuals collection and the TIA Portal V16 system manual.

Problem Symptom: Cascading Network Misalignment

A recurring failure mode reported in TIA Portal V15.1 through V16 is the appearance of pseudo-networks carrying the label "No corresponding network found" in the title bar after only a single contact change. Once a pseudo-network is injected into the comparison view, all subsequent pairings shift by one slot: Network 1 in project A is paired with Network 2 in project B, Network 2 with Network 3, and so on. The visible result is a cascade of mismatches even though only one or two networks were actually edited.

Engineers observing this behavior typically see:

  • One pseudo-network containing the message "No corresponding network found", highlighted in gray and labeled with a unique pseudo-network index (e.g., P-12).
  • Pseudo-networks are read-only; they cannot be edited, merged, or deleted from inside the compare view.
  • Subsequent networks flagged as different in spite of identical source content.
  • The total count of networks in the comparison view exceeds the network count in either source project by the number of inserted pseudo-networks.
  • The compare result PDF/CSV export carries the same alignment shift.

This is documented system behavior, not a defect in the comparison engine. The Siemens TIA Portal help describes it in the chapter "Visualization of the comparison result for LAD/FBD", which ships with the TIA Portal installation and is mirrored on the Siemens Industry Online Support portal.

Root Cause: The 50% Similarity Threshold

The compare engine uses a similarity heuristic to decide whether two networks are the same network with edits or two unrelated networks. The threshold rule, as quoted from the TIA Portal help chapter Visualization of the comparison result for LAD/FBD, is:

If there is a difference of more than 50 percent between two networks, these networks are regarded as not belonging together and there is no comparison between these networks. In this case, pseudo networks are also inserted until a suitable network is found.

The 50% metric is computed against the network's content tokens. A token is one of:

  • A contact (NO, NC, contactor, comparator, negated contact).
  • A coil (--()--, set, reset, retentive variants).
  • A function block / function call instance.
  • A parameter assignment (input, output, in-out).
  • A jump label or network title.

A single contact deletion in a small three-contact network removes 33% of the content tokens. Whether that trips the threshold depends on the engine's forward-search ordering and on whether the modified network still has any unambiguous match candidate at the expected slot. The matching algorithm performs a greedy forward search: starting at Network 1, it scans forward for the first network whose similarity exceeds 50%. If the original first network still passes, alignment proceeds normally. If the modified network no longer matches the next candidate (because all subsequent networks were already compared against the original), the engine inserts a pseudo-network and shifts all subsequent pairings.

Common scenarios that trip the 50% threshold:

Scenario Token Change % Triggers Pseudo-Network?
1 contact deleted in 3-contact network ~33% Sometimes (depends on engine ordering)
1 coil added to 4-element network ~25% Sometimes
Comment block replaced with logic change 0–100% Frequently
Function block instance renamed (call preserved) ~50% Likely
Network split into two via new junction 100% (old) / 100% (new) Always
Identical network duplicated 0% No
Variable rename across all contacts 100% Always

How Pseudo-Networks Are Generated

The matching algorithm in TIA Portal's compare function walks the network list of both projects in parallel. At each position it attempts a 1:1 match. When the candidate on the right-hand project differs by more than 50%, the algorithm executes three steps:

  1. Inserts a pseudo-network in the side missing content (gray, read-only, titled "No corresponding network found").
  2. Continues the search from the next real network.
  3. Repeats until a real network is found whose similarity score exceeds the 50% threshold.

Pseudo-networks are visualization artifacts only. They are not stored in the project, do not affect compilation, do not appear in the project tree, and are not written to the online program. They exist solely to keep the side-by-side view balanced when the engine cannot resolve a pairing.

Engineering impact: When pseudo-networks appear, the engineer must read the alignment manually rather than trust the visual pairing. The downstream comparison result ("networks are different") becomes unreliable because the engine has shifted alignment by the number of inserted pseudo-networks. Bulk acceptance/rejection actions taken from this corrupted view can therefore be wrong on a system-wide basis.

Affected Versions and Configuration Limits

The behavior described is documented and consistent across the following TIA Portal versions:

TIA Portal Version Recommended Update Compare Engine Behavior Status
V15.1 Update 4 or later V15 compare framework Confirmed affected
V16 Update 5 or later V16 compare framework Confirmed affected
V17 Update 6 or later Refined diff/merge UI Improved; threshold still applies
V18 Update 1 or later Block-level diff Same threshold logic retained
V19 Update 1 or later Block-level diff with semantic tag matching Threshold retained; pseudo-network UI added to GRAPH

Configuration limits to be aware of when the compare engine is involved:

  • Network size limit: A single network may contain up to 1,024 network elements. Networks that exceed this limit are truncated in the comparison view and tokenization is incomplete, which can itself cause misalignment.
  • Block count limit: The compare function processes up to 4,096 blocks in a single offline/online snapshot. For larger projects, segmented comparison is required.
  • SCL tokenization: For SCL sources, the 50% threshold applies to the tokenized statement list, not raw lines. Long conditional blocks can therefore cross the threshold faster than expected.
  • Multi-instance DBs: Renaming a multi-instance DB can shift all its call sites simultaneously; the 50% threshold is then reached across many networks at once.

Reference: TIA Portal V16: Using the project comparison.

Workaround 1: Blank Network Insertion to Realign

The most reliable workaround adopted by integrator teams is to insert an empty network as a synchronization marker before or after the network that triggered the pseudo-network injection. An empty network trivially exceeds the 50% similarity threshold (both sides are empty, similarity = 100%) and forces the engine to re-establish a clean 1:1 alignment at that point.

Procedure:

  1. Identify the network in project A whose edit triggered the pseudo-network cascade.
  2. Open both projects (or the offline/online snapshot) and navigate to the same block (e.g., FB100 "MainSequence").
  3. In project B (the side that does not contain the edited network), right-click in the network margin below the affected network and select Insert network.
  4. Leave the inserted network empty. Do not place any contacts, coils, or comments.
  5. Add a comment in the network title (e.g., //ALIGN_MARKER_v16) so the marker can be removed after the comparison is resolved.
  6. Save, compile, and re-run the compare.
  7. If the marker itself triggers a pseudo-network on the opposite side, insert a matching empty network in project A at the same network index.
Why this works: The greedy forward search now finds an exact match at the inserted blank network. It pairs the blanks, then re-starts the forward scan from the next real network. Alignment downstream of the marker is restored.

Workaround 2: Manual Pairing Strategy

For projects where inserting blank networks is not acceptable (e.g., cleanroom-programmed blocks or audit-locked code under FDA 21 CFR Part 11 / DO-254 / IEC 62443-4-2 controls), use manual pairing:

  1. Open the comparison view and identify the pseudo-network(s).
  2. Use the navigation pane to scroll vertically past the pseudo-network and read the pairing hints in the network title (e.g., "Network 5 (A) vs. Network 6 (B)").
  3. Map the shift manually: subtract the count of pseudo-networks inserted before the network of interest to derive the correct pairing index.
  4. Annotate the pseudo-network title or use the search bar in the network pane to jump directly to the corresponding network in either project.
  5. Use the "Show differences only" filter to hide identical networks and reduce the visual surface area.

Manual pairing is reliable but does not scale beyond 20–30 pseudo-networks. For larger deltas, external diff tools should be used.

Workaround 3: Pre-Comparison Hygiene

Reducing the size of edits before invoking the compare function lowers the probability of crossing the 50% threshold. Apply these habits at the project workflow level:

  • Patch in small commits. Apply one network's worth of edits, save, snapshot, and continue. Compare snapshots incrementally rather than at the end of a multi-network edit session. TIA Portal's Snapshot feature (project right-click → Snapshots → Create) is designed for exactly this workflow.
  • Avoid comment-only changes near structural changes. Renaming a tag inside a contact changes token identity even though the logic is identical. Defer cosmetic renames until after structural edits.
  • Maintain network shape parity. Avoid inserting junctions or splitting networks mid-edit. If a network must be split, do so as a single discrete change with a backup snapshot.
  • Use consistent tag aliases. Symbolic addressing with stable tag names prevents token-level shifts caused by address remapping. P#DB100.DBX0.0 remapped to "StartButton" should never be changed in the middle of an edit cycle.
  • Lock libraries. Library versions referenced by the project should be locked until the comparison is resolved. Floating library versions can introduce silent tag shifts that cross the threshold.

Verification Procedure After Realignment

After applying any workaround, verify that the comparison view is correctly aligned:

  1. Open the compare result and confirm zero pseudo-networks exist. The navigation pane should show only real networks on both sides.
  2. Spot-check three consecutive networks with known identical content. The diff view should show no color highlights in those networks.
  3. Export the comparison report via Project → Compare → Export to CSV (TIA V16+) and verify the block count matches the project tree.
  4. Re-compile both projects. Compilation results must be identical (no warnings introduced by the alignment marker).
  5. Remove any ALIGN_MARKER networks added during the workaround; recompile once more.
  6. If pseudo-networks persist after a single marker, walk the network list in both projects and look for the next network whose delta exceeds 50%; insert another marker there.
Acceptance criterion: A correctly aligned comparison shows the same number of networks on both sides and zero pseudo-networks. If pseudo-networks persist, the 50% threshold is being crossed by a different network, and additional blank markers are required.

Edge Cases: SCL, STL, GRAPH, and Multi-Instance DBs

The 50% threshold applies to all three of TIA Portal's primary PLC languages, but the implementation details differ:

Language Tokenization Unit Threshold Behavior Workaround Caveat
LAD Network element (contact, coil, FB call) 50% of total element count Blank network insertion works directly
FBD Box (function, operator, input/output pin) 50% of box count Blank network insertion works directly
SCL Statement (assignment, IF, CASE, FOR) 50% of statement count Blank statement lines do not act as markers; use ; or a labeled comment with adjacent code preserved
STL Instruction line 50% of instruction line count Use NOP 0 markers, not blank lines
GRAPH Step + transition Step-level alignment, not network-level Compare is per step; pseudo-network concept does not apply directly

For SCL programs, blank network insertion alone may not realign the view because the engine tokenizes at statement level. The recommended approach is to insert a single no-op statement such as ; (an empty SCL statement) or a comment marker at the corresponding position in both source files. Example:

// ALIGN_MARKER_v16 
;

For STL programs, the documented marker is the NOP 0 instruction. NOP 0 is a neutral CPU instruction that compiles to zero cycles and is preserved across edits.

For multi-instance DBs, the compare function tracks each instance individually. Renaming an instance crosses the 50% threshold in every block that references it. Resolve by renaming in one commit, re-snapshot, then proceed with logic edits.

External Diff Tools and SCL Source Export

For projects with extensive SCL/STL sources, or blocks exceeding TIA's practical thresholds, third-party diff tools that operate on exported source files provide a more deterministic experience:

Tool Source Format Algorithm Notes
TIA Portal Compare (built-in) Compiled block + source 50% token similarity + greedy forward match Subject to pseudo-network cascade
WinMerge (3-way) Exported SCL/STL/DB sources Line-based diff (LCS) Free, deterministic, no threshold artifact
Beyond Compare Exported sources + project XML Rule-based diff Supports folder sync, hex fallback
Git + plain-text export SCL/STL/DB plain-text export Myers diff Best for audit trail and CI integration
SVN/TFS with SCL export Same as above VCS-native diff Built-in audit trail
Export path for SCL/STL: Right-click on the block → Generate source from blocks produces .scl / .awl files in the project source directory. These can be diffed with any text tool independent of the TIA compare engine. Reference: TIA Portal: Generating source files from blocks.

External tools do not honor symbolic tag resolution, so a tag renamed from MotorStart_HMI to bStartMotor will appear as a textual change rather than a semantic equivalence. Engineers using external diff must therefore enforce tag-naming discipline at the project level.

Troubleshooting Matrix

Symptom Likely Cause First Action Second Action
Single pseudo-network after one contact change Edit crossed 50% threshold Insert blank network on the unedited side Re-run compare
Cascade of pseudo-networks after a multi-network edit Each affected network crossed threshold Revert to last snapshot; apply edits one-by-one Use external SCL diff
Pseudo-network on every SCL block Library version drift Lock library version in project properties Recompile and re-snapshot
Compare shows fewer networks than project tree Network truncation (>1024 elements) Split the network into two Recompile and re-snapshot
Identical networks flagged as different Token-level tag rename Insert blank network before the renamed tag block Or revert tag rename
Pseudo-network on GRAPH step Step + transition delta above 50% Compare step-by-step instead of full block Use GRAPH sequence diff view

Frequently Asked Questions

What is the 50% threshold rule in TIA Portal's compare function?

The compare engine considers two networks to belong together only when their token similarity exceeds 50%. If the delta is larger, a pseudo-network titled "No corresponding network found" is inserted and alignment shifts. This is documented behavior in the TIA Portal help chapter "Visualization of the comparison result for LAD/FBD".

Can I disable the pseudo-network generation entirely?

No. The 50% threshold is hard-coded into the compare engine and there is no registry entry, configuration switch, or menu option to disable pseudo-network insertion. The only mitigation is to keep edits below the threshold or insert blank network markers.

Does inserting blank networks affect the compiled S7 program?

An empty LAD/FBD network compiles to zero bytes and zero CPU cycles; it has no effect on runtime behavior. For SCL, an empty statement (;) compiles to no operation. For STL, use NOP 0. Always remove alignment markers before final shipping.

Which TIA Portal versions are affected by pseudo-network cascading?

The behavior is confirmed in V15.1 (Update 4+) and V16 (Update 5+). V17 improved the diff/merge UI but retained the 50% threshold. V18 and V19 retain the same threshold logic. Affected versions and updates are tracked on the Siemens Industry Online Support portal.

How do I compare SCL or STL programs without pseudo-network artifacts?

Right-click the block and select "Generate source from blocks" to export .scl or .awl files. Diff those files with an external tool such as WinMerge, Beyond Compare, or Git. The 50% threshold does not apply to text-based diffs.

Is there a command-line or batch API for the compare function?

TIA Portal V17 introduced the Openness API with limited compare functions, but the threshold logic is shared with the GUI engine and pseudo-networks still occur. For batch processing of large projects, exporting sources to text and diffing externally remains the most deterministic approach.

Back to blog