Resolving TIA Portal V16 PLC Upload Errors and Library Conflicts

David Krause16 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

Resolving TIA Portal V16 PLC Upload Errors and Library Conflicts

Uploading a project from a Siemens S7-1200 or S7-1500 PLC back to a TIA Portal V16 engineering station frequently produces a cryptic "error while loading" when the user attempts to compile, simulate, or go online. This reference consolidates the field-verified root causes—library type version mismatches, know-how protected (KHP) blocks that cannot be extracted from the target, missing archive metadata, and incompatible type conversions—into a single engineering document with the exact resolution sequence and verification steps. The procedures below are anchored to the official Siemens upload documentation and are written for automation engineers who must restore operability of a TIA Portal V16 station with minimal downtime.

1. Problem Description and Operational Context

  • The S7 program opens, but Start simulation (PLCSIM) returns "Error while loading" immediately or during compile.
  • Library objects in the project tree show a small triangle icon indicating they remain linked to a master/library type that is not present on the engineering station.
  • Several function blocks (FBs) are visible in the program structure but their bodies are inaccessible, displaying the message "Block is know-how protected. Upload is not possible."
  • The project archive supplied by the site is incomplete; only loose .s7p or .ap16 files exist without a complete folder structure.
  • Compile warnings of the form "Type conversion from INT to WORD is implicit" or similar appear in the message window.

None of these symptoms, taken individually, prevent the program from running on the real CPU. They do, however, prevent simulation, online editing, and clean re-download. The fix is a defined sequence of reconciliation steps that must be executed in order.

2. Official Upload Procedure from PLC to PC

Before any troubleshooting begins, the upload itself must be performed using the documented Siemens workflow. Per the official TIA Portal help, the procedure to upload a complete device to a new project is:

  1. In TIA Portal, open or create a target project.
  2. Select the project root in the project tree.
  3. From the Online menu, choose "Upload device as new station (hardware and software)".
  4. Select the correct PG/PC interface (e.g., TCP/IP, PROFIBUS, or the S7-1500 accessible node discovery).
  5. Select the target CPU in the accessible nodes dialog and confirm.
  6. Decide whether to upload with or without the HMI. For a pure PLC recovery, uncheck the HMI option.
  7. Wait for the upload to complete. The station, hardware configuration, program blocks, and PLC tags are created in the new project.

Reference: Uploading project data from a device – TIA Portal Help.

Engineering note: This procedure must be executed on a TIA Portal version equal to or newer than the project version that originally targeted the CPU. TIA Portal does not perform a downward conversion. A V16 project can be opened in V16, V17, V18, V19, or V20, but a V20 project cannot be opened in V16.

3. Root Cause Catalog

The "error while loading" failure has a small, well-defined set of root causes. Treat the list below as a diagnostic matrix and work the items in sequence.

# Root cause Observable symptom Fix category
1 Library master copy version mismatch Triangle icon on FBs/FBs; "type used in project is older than the master" warnings Library reconciliation
2 Library default version differs from project version Compile halts; cannot download to simulated PLC Set default or update project
3 Know-how protected (KHP) blocks Block body inaccessible; "Uploading is not possible" tooltip Cannot recover; request source from integrator
4 Incomplete archive (loose files instead of .zap16) Missing project, system data, or IM folder; cannot open in TIA Re-archive as .zap16
5 Implicit type conversion (INT → WORD, REAL → DINT) Compile warnings, not errors Cast explicitly, generally non-blocking
6 I/O addresses used but not configured Hardware compile errors for symbols in unused FBs (e.g., simul FB) Decouple or remove the unused FB instance
7 PLCSIM does not support the CPU firmware or technology objects Simulation loads but the OB does not run, or simulation refuses to start Match PLCSIM version to firmware, or use a different simulator
8 Missing support package / HSP for the CPU CPU not in device catalog, hardware compile fails Install Hardware Support Package matching the CPU

4. Library Type Version Conflicts (Primary Cause)

Most upload errors in TIA Portal V16 trace back to a library structure. TIA Portal allows the user to maintain master copies of FB/FC/DB/UDT types in a project library or in a global library. Each instance of a type in the program is either:

  • Inlined – a standalone block, not linked to any master. Edits in the project do not affect the library.
  • Type-bound (linked) – identified by the small triangle on the block icon. Changes to the master copy propagate to the instance on next compilation, and changes to the instance can be propagated back to the master.

When the project is uploaded from a CPU, the instance of the type is preserved, but the master copy is not stored on the PLC—it lives only in the original engineering project. If the library default version on the receiving station differs from the version the instance was derived from, TIA Portal cannot determine the correct type definition and either flags the instance as invalid or refuses to compile the project for the simulator.

4.1 Resolution Path A – Match the Library Default

  1. Open the project library (right side panel in TIA Portal) or the global library under Libraries.
  2. Locate each type that has a triangle icon in the program blocks (FB, FC, or UDT).
  3. Inspect the version of the type in the project (right-click → Properties → Version).
  4. In the library, find the matching type and version, right-click, and select "Set as default version".
  5. Recompile the project. The triangle icon should disappear if the versions match.

4.2 Resolution Path B – Update the Project to the Library Default

  1. Open the library, right-click the type you want to update.
  2. Choose Update → Project.
  3. In the dialog, select the devices in the project that should be updated. If multiple S7 stations exist, select the relevant CPU only.
  4. Optionally enable "Delete unused library objects from the project" to clean up dangling references.
  5. Confirm. TIA Portal rewrites the instance to match the new default version.

4.3 Resolution Path C – Terminate the Library Connection

If the master copy is unavailable and the project owner does not intend to maintain the library relationship, sever the link:

  1. In the program blocks, identify every block with the triangle icon.
  2. Right-click the instance and select "Terminate connection to type".
  3. The block becomes a regular, standalone block and can be edited in place. TIA Portal will not warn about missing library versions afterward.
Trade-off: Once the connection to the type is terminated, the block will not receive future updates from the library. This is acceptable for a one-off recovery project; it is not acceptable for a fleet that is maintained centrally.

5. Know-How Protection (KHP) Limitations

Know-how protected blocks are SCL, FBD, or LAD/FBL blocks whose source has been encrypted against unauthorized viewing. When the original integrator compiles the project with the Know-how protection attribute set, the block is downloaded to the CPU in its encrypted runtime form. The unencrypted source remains only in the engineering project (or in the master copy of the library if it was sourced from a library).

Implications for the field engineer:

  • You can download the encrypted block back to the same CPU and the CPU will run.
  • You can monitor the block online.
  • You cannot edit the block, nor can you add new calls to its internal logic.
  • You cannot simulate the project in PLCSIM if the KHP block is in a call chain that PLCSIM must resolve, unless the simulator supports encrypted blocks (PLCSIM V16+ does, but the KHP block is still opaque to debugging).

The only resolution is to obtain the unencrypted source from the original integrator or vendor. There is no back-door or recovery tool to defeat know-how protection; the AES-128 key derivation depends on the password set at the time of protection.

6. Archive Format: .zap16 vs. Loose Files

A frequent error in field handovers is that the engineer copies the project folder with Windows Explorer and ships it as a .zip. The project folder, however, is not a portable artifact; the absolute paths, the Windows junctions to the TIA Portal installation, and the local IM (installation metadata) folder will not survive a move to a different machine.

Use TIA Portal's native archive mechanism:

  1. Open the project in TIA Portal.
  2. From the menu, select File → Archive.
  3. Choose a name with the correct extension: .zap16 for V16, .zap17 for V17, .zap18 for V18, and so on.
  4. Select "With respect to confidentiality" if password protection is required.
  5. Save the archive to a network share or USB device.

To restore on a different engineering station:

  1. Launch TIA Portal V16 (or a later version).
  2. Select File → Retrieve and choose the .zap16.
  3. Specify the target directory and confirm.
Engineering note: If the project was uploaded from a CPU and you wish to share it, the project you created by "Upload device as new station" is itself archiveable. Re-archive it as .zap16 before transmission. The project will not contain KHP-block source, so this is the maximum amount of information you can provide to a third party.

7. Type Conversion Warnings (INT → WORD)

TIA Portal emits a compile warning—not an error—when an INT tag is assigned to a WORD tag, or vice versa. The compiler performs an implicit bit-pattern copy. This is generally benign when the programmer intends a bitwise view of the same 16 bits. It is dangerous when the programmer intended a value conversion between signed and unsigned representations.

Source type Target type Implicit action Risk
INT WORD Bit-pattern copy Sign bit interpreted as magnitude; high values look negative
WORD INT Bit-pattern copy Same; high bit treated as sign
REAL DINT Truncation toward zero Silent precision loss; rounding errors downstream
DINT REAL Exact for values up to 2^24 Acceptable in most PLC code
BOOL INT 0 or 1, never any other value None

If the warning is a non-issue in your context (the code worked on the CPU for years), it can be left in place. It is not the cause of the "error while loading" message in PLCSIM. Treat the conversion warning as cosmetic.

8. I/O Addresses Used in Unused FBs (e.g., simul)

It is common practice to leave test or simulation FBs (typically named simul, sim, test, or debug) in the program with a condition under which they run only in PLCSIM. These FBs reference I/O addresses that are not configured in the real hardware. When you compile the project for the physical CPU, the compiler flags these as unconfigured I/O errors.

Resolution depends on intent:

  • If the simul FB is required in the offline project but should not be compiled into the production download, wrap it in a conditional compile region (TIA Portal V16 does not natively support preprocessor #ifdef; use a DB-controlled enable tag and a hardware identifier instead, or maintain two projects).
  • If the FB is a leftover and not needed, delete the instance DB and the call from the OB. The unconfigured I/O errors disappear.
  • If the FB is needed and the I/O is genuinely attached, configure the missing module in the device view.

9. PLCSIM and Modbus TCP Simulation

PLCSIM V16 simulates an S7-1500 CPU on the engineering PC. It does not include a real Ethernet adapter by default; the simulated CPU is reachable on a virtual network inside the PC. If your project uses a Modbus TCP client block (e.g., MB_CLIENT from the Modbus TCP library), you must run a second instance of PLCSIM or a third-party Modbus server on the engineering PC and point the MB_CLIENT connection at it.

For engineering practice, consider the following options:

  1. PLCSIM Advanced (formerly NetToPLCSIM) – allows a real Ethernet adapter to bridge to the simulated CPU, useful when external tools must talk to the simulated PLC.
  2. Third-party Modbus TCP server simulator – many free Windows tools can act as a Modbus server holding register values. The engineering PC runs both PLCSIM and the simulator, with MB_CLIENT pointed at 127.0.0.1 on a chosen port.
  3. Modbus TCP library compatibility – the legacy Modbus TCP block library was retired in TIA V16 for the S7-1500; the modern path is to use the MODBUS TCP blocks delivered with the ModbusTCP global library, versioned for V16, and installed via TIA Portal's Options → Manage Global Libraries.

For step-by-step guidance, follow the official SolisPLC Modbus TCP tutorial referenced in the field discussion; the procedure is compatible with TIA V16 and the MB_CLIENT / MB_SERVER instruction set.

10. Step-by-Step Resolution Workflow

  1. Verify TIA Portal version. Open the project; the title bar will show "V16". If the receiving station has V18, the project is upward-compatible. If it has V15, it is not.
  2. Re-archive the project. If the project was received as a .zip of loose files, ask the source to provide a .zap16, or retrieve the loose project on the original engineering station and re-archive.
  3. Compile (software, all blocks). Read the message window. Errors are flagged with red ✗, warnings with yellow !. Address all errors before addressing warnings.
  4. Resolve library conflicts. For each block with the triangle icon, choose path A, B, or C from §4. Recompile.
  5. Decide on KHP blocks. Identify every padlock icon. If the block must be edited and source is unavailable, escalate to the integrator. If the block can remain opaque, proceed.
  6. Configure or remove unused I/O FBs. For each unconfigured-I/O error, decide whether the FB is needed; if not, delete the instance.
  7. Install missing hardware support packages. If the device catalog lacks the CPU, download the matching HSP from Siemens Support (entry ID 109751676) and install it via Options → Support Packages.
  8. Compile again. Confirm zero errors.
  9. Start PLCSIM. From the toolbar, click Start simulation; PLCSIM V16 launches, downloads the project, and runs the OB1 cycle.
  10. Go online. From the project tree, right-click the CPU and select Go online. Confirm that the actual program and the offline program match in the compare editor.

11. Verification Checklist

Step Expected result
Compile (software) 0 errors, 0 warnings on critical blocks
Library reconciliation No triangle icons on FBs/FCs/UDTs
KHP block identification All padlock blocks accounted for; source noted as N/A if uneditable
PLCSIM start Simulated CPU in RUN, green status, no Error while loading
Online compare Online / offline identical, no diff highlighted
Modbus TCP MB_CLIENT connection status = 16#0001 (active) when simulated server is running

12. Field-Commissioning Notes and Edge Cases

Edge case 1 – Program uploaded but the S7-1500 firmware is newer than TIA Portal V16 supports: S7-1500 CPUs in the field are often updated to firmware V2.9 or V3.0. TIA V16 supports up to firmware V2.9.x on the S7-1500/ET200 CPUs in its device catalog. A V2.9.x CPU downloaded with V16 may upload, but a V3.x CPU will not be downloadable from a V16 project. Install the appropriate HSP, or upgrade the engineering station to TIA V18/V19.

Edge case 2 – Re-download after upload overwrites the encryption password: If the original integrator protected a block with password P, and you upload to a new station, TIA Portal remembers P locally if you have the original project. A bare upload from the CPU does not transmit the password. Any subsequent download to the CPU will be rejected unless you re-enter P on the receiving station or the original engineering project is available.

Edge case 3 – Web server credentials: If the project configured the S7-1500 web server with a hashed password, the upload to PC will not recover the cleartext password. Reset the web server user via TIA Portal after recovery.

Edge case 4 – Display devices (HMIs) excluded from upload: When uploading a complete station, uncheck any Comfort Panel / KTP HMI that the station serves. HMI images and screen libraries inflate the project size and can introduce additional library version conflicts. Recover the HMI project separately if needed.

Edge case 5 – Cross-version simulation: PLCSIM V18 cannot simulate a V16 project without a TIA Portal V18 opening the project. Conversely, a project upgraded to V18 in TIA V18 cannot be simulated in PLCSIM V16. Match the PLCSIM major version to the TIA Portal major version of the engineering station.

Safety constraint: Never download a recovered project to a running safety CPU (S7-1500F / S7-1500F/TM) without a full safety acceptance test. The F-runtime group signature changes when program blocks are recompiled, even if the logic is byte-for-byte identical. A safety CPU will require a new PROFIsafe acceptance test per IEC 61784-3.

13. FAQ

Why does PLCSIM V16 show "error while loading" after uploading a project from the CPU?

The most common cause is a library type version mismatch: the instance in the program still references a master copy in the project or global library that is not present (or not the default) on the receiving station. Reconcile the library (§4) by either setting the matching version as default, updating the project to the current default, or terminating the connection to the type. KHP blocks and unconfigured I/O addresses in unused FBs are secondary causes.

Can know-how protected blocks be recovered by uploading from the CPU?

No. The PLC stores only the encrypted runtime form of a KHP block. An upload returns the encrypted block, which is executable on the CPU and monitorable online, but its internal logic remains opaque. The unencrypted source must be obtained from the original integrator, the project archive, or the master copy of the library if it was library-sourced.

What is the correct file extension for a TIA Portal V16 project archive?

Use .zap16 for V16, .zap17 for V17, .zap18 for V18, and so on. Create the archive from File → Archive in TIA Portal. Do not ship loose project folders or generic .zip files; absolute paths and IM metadata are lost outside the original machine.

Will opening a V16 project in TIA V18 introduce library issues?

Not directly, but if the project library referenced types that were later updated in the global library, V18 will detect the version drift on the first compile. The resolution is the same: set the matching version as default in the project library, update the project to the new default, or sever the link with "Terminate connection to type".

How do I simulate Modbus TCP traffic against a PLCSIM V16 instance?

PLCSIM V16 includes a virtual Ethernet adapter reachable on the engineering PC. Run a Modbus TCP server simulator (many free Windows tools) on the same PC, and configure the MB_CLIENT block with the loopback address 127.0.0.1 and the simulator's port (default 502). If external devices must connect, use PLCSIM Advanced with a real network adapter in TAP mode.

Are implicit type conversion warnings (INT to WORD) the cause of the simulation failure?

No. INT to WORD and similar implicit conversions produce compile warnings, not errors, and do not prevent the project from loading into PLCSIM. They are cosmetic and may be left in place when the program logic intentionally relies on the bit-pattern copy.

What happens to a safety (F-CPU) program after upload and recompile?

The F-signature of the safety program changes on every compile, even with no logic change. Before re-downloading to the F-CPU, perform the full PROFIsafe acceptance test per IEC 61784-3 and the S7-1500F manual. Skipping this step will leave the safety program in a non-accepted state and the F-CPU will refuse to enter RUN.

Back to blog