Reading and Writing PLC Memory Areas in SIMIT Simulation via S7-PLCSIM Advanced Couplings

Reading and Writing PLC Memory Areas in SIMIT Simulation via S7-PLCSIM Advanced Couplings

In SIMIT V9.1 utilizing the S7-PLCSIM Advanced V2.0 coupling, directly accessing bit memory markers (%M, Merker) using classic SIMIT ReadMemory and WriteMemory components is not supported because the PLCSIM Advanced API is optimized exclusively for process I/O (%I, %Q) and symbolic Data Block (DB) tags. To read or write internal controller variables between SIMIT and PLCSIM Advanced, map the required simulation signals to a dedicated global Data Block in TIA Portal with 'Standard' (non-optimized) or 'Accessible from HMI/OPC UA' attributes enabled, or map them to unassigned peripheral I/O addresses (%IW, %QW). SIMIT automatically browses, imports, and synchronizes DB tags with complete data type fidelity.

Table of Contents

SIMIT Coupling Architecture: PLCSIM Advanced vs Classic PLCSIM

In virtual commissioning environments combining SIMIT Simulation Platform (V9.1) with S7-PLCSIM Advanced (V2.0) and TIA Portal (V14 SP1 / V15), signal exchange between the behavioral plant model and the simulated controller is governed by specialized communication couplings.

Engineers transitioning from classic STEP 7 / PCS 7 virtual commissioning often expect SIMIT to interact with PLCSIM Advanced identically to the legacy 'S7-PLCSIM' (Classic) coupling. However, the architectural foundation of the two couplings is fundamentally different:

Architectural DimensionS7-PLCSIM (Classic Coupling)S7-PLCSIM Advanced (API Coupling)Target ControllersS7-300, S7-400, WinAC RTXS7-1500, ET 200SP CPU, Drive ControllerCommunication CoreDirect shared memory pointer / S7ProSim.dllSimulation API (UserInterface.dll) via Virtual Switch / SoftbusMemory Address AccessDirect absolute addressing (E, A, M, DB, T, Z)Symbolic DB tags and Process Image Partitions (%I, %Q)Memory Marker SupportSupported natively via memory offset indexingExcluded from API coupling signal synchronization tableReadMemory / WriteMemoryFully operational with gateway configurationIncompatible; blocks cannot resolve memory marker offsets

S7-PLCSIM Advanced treats the S7-1500 as an advanced symbolic controller. Its high-performance API prioritizes cyclic Process Image Input/Output exchange and symbolic Data Block variables, relegating unstructured bit memory (%M) to legacy status.

Why ReadMemory and WriteMemory Fail with PLCSIM Advanced

SIMIT features standard library components named ReadMemory and WriteMemory within its Communication and Gateway palettes. These components were developed specifically for the Classic S7-PLCSIM and Virtual Controller (VC) couplings, where a gateway parameter links directly to controller memory bytes using absolute offset arithmetic (e.g., reading byte offset 10 in memory area M).

When an engineer inserts ReadMemory or WriteMemory and enters the name of an S7-PLCSIM Advanced coupling in the Gateway input, the block fails silently or outputs static zeros. Because the PLCSIM Advanced API does not expose raw marker memory offsets via its communication pipes, the SIMIT gateway cannot route the request. The S7-PLCSIM Advanced coupling in SIMIT only populates its internal signal dictionary from exported TIA Portal symbols (inputs, outputs, and DB variables).

Best Practice Methods for Exchanging Internal Controller Data

To exchange internal variables, simulation overrides, and setpoints between SIMIT and S7-PLCSIM Advanced, implement one of three industry-standard engineering methods:

  1. Dedicated Simulation Data Block (Recommended Best Practice):
    - In TIA Portal, create a global Data Block named DB_Simulation.
    - Define internal variables with exact data types (e.g., Sim_TankLevel : Real, Sim_PumpFault : Bool).
    - Ensure the Data Block property 'Optimized block access' has the tag attribute 'Accessible from HMI/OPC UA' checked, or disable optimized block access (Standard DB).
    - In SIMIT, open the PLCSIM Advanced coupling, click Import, and browse to the TIA Portal project file (.ap14 / .ap15). SIMIT imports all DB tags directly into the coupling signal list, allowing drag-and-drop interconnection to SIMIT simulation models.

  2. Mapping via Unused Peripheral I/O (Alternative Method):
    - If application logic already references physical I/O or memory markers, map the simulation signals to unused peripheral addresses (e.g., %IW 1000..%IW 1020 for analog values, %I 100.0..%I 100.7 for digital signals) in HW Config.
    - SIMIT natively synchronizes all configured process inputs and outputs through the PLCSIM Advanced coupling without special blocks.

  3. SIMIT Shared Memory Coupling (High-Performance Co-Simulation):
    - For complex co-simulations involving third-party dynamic process models (e.g., MATLAB/Simulink, FMI/FMU), utilize the SIMIT Shared Memory coupling or OPC UA client coupling to bridge memory tags independently of the PLC API.

Verification

Verify bidirectional signal synchronization between SIMIT and S7-PLCSIM Advanced through these diagnostic procedures:

  1. Coupling Signal Editor Check: In SIMIT, open the S7-PLCSIM Advanced coupling. Confirm that imported Data Block signals display with active data types, correct scaling, and direction (Input or Output).
  2. Simulation Runtime Test: Start the virtual controller in PLCSIM Advanced and start the simulation in SIMIT. In SIMIT, toggle a simulation switch connected to a DB tag. Open a TIA Portal Watch Table online and verify that the target tag updates instantaneously.
  3. Coupling Diagnostics: Inspect the SIMIT status bar. Verify that communication cycle time is stable (e.g. 10 ms to 100 ms) and that zero coupling packet drops or communication timeout warnings are logged.

Limitations and Operational Precautions

When architecting simulation models in SIMIT with PLCSIM Advanced, adhere to these operational precautions:

  • Cycle Time Synchronization: S7-PLCSIM Advanced can run in 'Single Step' or 'Virtual Time' mode. Ensure SIMIT simulation time slice settings match the PLCSIM Advanced time synchronization mode to avoid buffer overruns or lag.
  • Remove Simulation Logic Prior to Commissioning: If temporary simulation logic is placed inside the PLC program (e.g., reading simulation DBs instead of raw inputs), encapsulate the logic in dedicated simulation Organization Blocks (OBs) or conditional compilation blocks to ensure it is purged before physical plant commissioning.
  • Licensing Requirements: S7-PLCSIM Advanced requires a dedicated runtime license (S7-PLCSIM Advanced V2.0). SIMIT requires either SIMIT Engineering or SIMIT Component Type Edition with coupling options. Verify license availability in ALM.

Engineer FAQ

Can SIMIT write to inputs (%I) when PLCSIM Advanced is running?

Yes. PLCSIM Advanced allows SIMIT to overwrite Process Image Inputs (%I) cyclically, perfectly mimicking physical field hardware and remote I/O modules across PROFINET.

Why are some Data Block tags not visible when importing into SIMIT?

Tags inside Optimized Data Blocks must have the 'Accessible from HMI/OPC UA' checkbox enabled in TIA Portal. If this attribute is disabled, the TIA Openness API hides the variable from external engineering tools like SIMIT.

Does S7-PLCSIM Advanced support S7-400 controllers used in PCS 7?

No. S7-PLCSIM Advanced is exclusively designed for S7-1500 and ET 200SP Open Controllers. For SIMATIC PCS 7 S7-400 AS simulation, engineers must use classic S7-PLCSIM V5.4 or SIMIT Virtual Controller (VC).

Technical References

Related Articles

Related Tags

  • SIMIT V9.1
  • PLCSIM Advanced
  • TIA Portal V14
  • Virtual Commissioning
  • Data Blocks
  • Simulation Coupling
6 respuestas