Overview of Validating PLC Logic
In this topic, you'll learn more about the phase in which you validate PLC logic by connecting your model to a PLC or server. We'll refer to an OPC DA Connection, but the setup is similar for other connection types.
Once the PLCs have been programmed, you could possibly use FlexSim to then validate whether the PLCs had been programmed correctly before they are actually implemented in a manufacturing system. To validate this logic, you'd need to connect FlexSim to a PLC server.
After inputting all of the server's permissions, you'd also have to assign all your emulation variables to their appropriate tag IDs on the server. You'd then make the connection shared asset active in FlexSim so that it will directly read or write values on the actual server. This will also cause your internal ladder logic to stop working. Sensors will no longer trigger their on Change event, meaning that any event listening activities will no longer be notified when a sensor variable is changed. Instead, this logic will be handled by the PLC.
At this point you could run the simulation model and test that the PLCs are operating the way they should operate in the actual system. In theory, you would have created a simulation of your future business system in FlexSim. So, the PLC will directly control the elements in the simulation model. You can then observe how the actual PLC has been programmed and compare it to the way the simulation model ran before the PLC was directly connected to the model.
Connecting the Server
To connect a PLC server to a FlexSim simulation model:
- Connect the server to the computer on which you'll run the simulation model. You can either run the model on the same computer the server is on or you could connect to it remotely. If connecting remotely, you'll need to ensure that the computer running FlexSim can connect with the computer running the server. You may need to talk to your network administrator to get that working.
- Find your connection variable (either in a process flow or in the Emulation tool)
and set it to active. You can set it to active by changing the
Active property to
- In the Address box, type the server's IP Address if
needed. You can use
localhostif you're running it locally on the same machine as the simulation model.
- In the Server box, browse to find the server you'll connect to at the address you specified.
- If required, you can enter in the necessary credentials in the User Name and Password boxes.
- Set the Update Rate for communicating with the server.
- If needed, you can check the Asynchronous update box. This will cause FlexSim to send write events to the server and then continue running the model without waiting for a response from the server.
Running the Simulation Model
One thing you need to pay attention to when running the simulation model while connected to an active server is the speed at which you are running the model. While you can technically set the run speed to a greater value, you should ideally run it at the 1.00 speed, which means it will run in real time.
Be aware that FlexSim will run in high precision time when the server is active. High precision run time means it will keep the run speed of FlexSim in sync with the run speed of the computer. Stepping will be unavailable while you are connected to an active server.
During the simulation run, it might be good to open the server and watch the values change. You'll be able to better ensure that they match what happens in the simulation model. The ladder logic used with Sensors should no longer be used when the connection is active. You should ensure that there are no tokens moving through this ladder logic during the simulation run.