How do you simulate communication between two CPU modules?
As from S7-PLCSIM V5.4 + SP3 you can use S7-PLCSIM to simulate multiple CPU modules simultaneously in a STEP 7 project and establish communication between the CPU modules. The following communication blocks are supported for communication:
- SFB8 "USEND"
- SFB9 "URCV"
- SFB12 "BSEND"
- SFB13 "BRCV"
- SFB15 "PUT"
- SFB14 "GET"
- SFB19 "START"
- SFB 20 "STOP"
- SFB 22 "STATUS"
- SFB 23 "USTATUS"
During communication, there might be time restrictions because S7-PLCSIM does not support real time.
Please also refer to the information in the S7-PLCSIM readme file, section 7.3. If, when running a large number of Windows programs, you cannot start any more programs or you cannot open any more windows, then you must change the operating system property "desktop heap memory" of your PC. One remedy is described in Table 02.
You cannot test a program of your STEP 7 project with a real CPU (PLC) at the same time as a program with S7-PLCSIM. If you wish to simulate your CPUs with S7-PLCSIM, you must first disconnect all connections to the real CPU.
Proceed as described in Table 01 below to simulate multiple CPU modules simultaneously.
|1||Open S7-PLCSIM in the SIMATIC Manager, either via the menu command "Options> Simulate Modules" or from the menu bar with the "Simulation on/off" icon. The dialog with the instance number "S7-PLCSIM1" with the first simulated CPU opens.|
|2||In the "S7-PLCSIM1" dialog, you select the configured interface parameterization from the drop-down list box for the PG/PC interface. The MPI interface is preset by default. Later, S7-PLCSIM starts with the interface last used. However, depending on your hardware configuration, you can also set the "PROFIBUS", "TCP/IP" (via the IP address), "ISO" (via the MAC address) or "Local" (via the virtual backplane bus) interface.
|3||In the SIMATIC Manager, mark the block folder of your first S7 station and load your blocks in S7-PLCSIM1 via the menu command "PLC > Upload".|
|4||In the "CPU" subwindow in S7-PLCSIM, change the operating mode from "STOP" to "RUN-P". Via the "Add" menu, you can upload the subwindows for the inputs, outputs, markers... in order to monitor and control the program.|
|5||To simulate another CPU, you execute the menu command "Simulation > New PLC" in S7-PLCSIM. The "S7-PLCSIM2" dialog opens.|
|6||For the second CPU to be simulated, you select the interface parameterization (PG/PC interface) configured in the hardware configuration. Fig. 01 shows an example of communication between two S7-400 CPU modules. In S7-PLCSIM1 (simulation for Station 1), EB1 controls counter Z1 and transfers the counter value to the AW1 in S7-PLCSIM2 (simulation for Station 2).
|7||In the SIMATIC Manager, mark the block folder of your second CPU and load all the blocks into the instance "S7-PLCSIM2". You must select the instance "S7-PLCSIM2" before loading. Here, too, you add the subwindows required for the inputs, outputs, markers... .
Repeat steps 4 to 7 for every other CPU to be simulated.
Changing the operating system property "desktop heap memory"
Even if you have sufficient main memory and export memory in your PC, you might get the error message "Not enough main memory" or the program might crash when running a large number of Windows programs. One remedy is described in Table 02.
The attached download "S7_PLCSIM_CPU_Communication" contains a STEP 7 V5.4 project with the communication program described above. Copy the "S7_PLCSIM_CPU_Communication.zip" file into a separate directory and then start the file with a double-click. The STEP 7 project is now unpacked automatically with all the associated subdirectories. You can then use STEP 7 to open and process the extracted project.
S7_PLCSIM_CPU_Communication.zip ( 431 KB )
Table 03 lists the components that have been used to create this entry and verify the function described.
|PC platform||Intel(R) Core(TM)2 Duo CPU P8700 2.53 GHz|
|PC operating system||MS Windows XP SP3|
Out of memory, Multi-instance