Emulation is a term that refers to the ability to create simulated programmable logic controller (PLC) logic. If you are simulating a system that will eventually use PLCs, you can use emulation to develop and test the PLC logic within FlexSim without needing to create the ladder logic in other software.
Not every simulation project will necessarily benefit from using emulation. The following are the likely scenarios in which you might use FlexSim's emulation tool:
If these scenarios apply to your simulation project, then emulation might be a useful tool for you.
The process for building an emulation simulation project is shown in the following image:
The following sections will explain each phase of the process and link to other relevant topics for more detail.
Begin by adding objects to your 3D model the way you would with any other simulation project.
Where an emulation project differs from a normal simulation project is the way you'll build the model's logic in process flow. If you want to use emulation in your simulation project, you should integrate PLC-centric logic into your model's process flow early in the model-building process. You'll do this by building your logic in such a way that it resembles the inputs and outputs of a PLC controller.
After building the model logic, you should test and validate your simulation model until you feel confident that you've designed an optimal system. At this point, you can then hand off the simulation model to a PLC programmer and explain the model logic to them. Since the process flow will be designed in a PLC-centric way, it should be fairly easy for a PLC programmer to translate the process flow into ladder logic.
After the PLC has been programmed, you can then use FlexSim to validate that the PLC logic was programmed correctly. You can connect FlexSim directly to the PLC or to the server that the PLC will use. As FlexSim runs and communicates with the PLC, you can compare the results of the simulation model when it was running its internal logic. By comparing the two systems, you'll be able to confirm that the logic is correct or make subtle adjustments to the simulation model or PLC as needed.
You can emulate PLC logic using two different methods in FlexSim. You can add variables and build the logic in the Process Flow tool or you can use the Emulation tool in the Toolbox. In some respects, the tool you choose to use will be a matter of personal preference. However, this guide will generally focus on building emulation in the Process Flow tool because it is good for model documentation and communicates logic in a clear way. Be aware that some of the screenshots in this topic will come from the Emulation tool.
The following are a few terms that are important to understanding the emulation tool in FlexSim:
PLC is a common abbreviation for programmable logic controller. PLCs are computers dedicated to interacting with machinery in manufacturing systems. These specialized computers generally act as the brains of an automated manufacturing system, connecting the system's inputs and outputs to control the system's overall behavior.
In the context of FlexSim's emulation tool, the term connections refers to connections between FlexSim's emulation tool and a server or PLC. Currently, FlexSim can connect via OPC and Modbus.
When you're setting up a connection to a server in FlexSim, you can decide whether to make that connection active or inactive. If the connection is active, FlexSim will read and write data directly from an actual server or PLC. If the connection is inactive, it will instead pull data from the theoretical simulation model you created in FlexSim.
In this context, the term variable refers to any inputs and outputs that are received or sent by the PLC. FlexSim has two types of variables: sensors (inputs) and controls (outputs).
Sensors are the inputs to the PLC. Inputs tell the PLC about the manufacturing environment. For example, sensors might be connected to:
Sensors provide environmental data from inputs to the PLC and then the PLC will decide what actions to take based on that data.
Each sensor can be associated with a series of events. You can specify which events you want that sensor to listen to. For example, if you are listening to a photo eye, you might set up the sensor to listen to the "On Cover" and "On Uncover" events. The specific events that are available for each sensor depends on what kind of object the sensor is connected to in the simulation model. See Key Concepts About Events for more information.
Controls are the PLC's outputs. The controls tell the system how to respond and what to do. For example, controls could issue instructions to:
Based on the inputs (values) it receives, the PLC will issue controls that will tell the system what actions to take.
Ladder logic is a programming language that is used to develop the software for PLCs used in industrial control applications. While you will not use actual ladder logic in FlexSim, you can use process flow activities to communicate how a PLC's ladder logic should be programmed.
When you first set up your emulation project, you'll need to create a server connection. You'll connect all the variables (the sensors and controls) to this connection. By default, this server connection will be inactive, which means that the server connection will only be internal to FlexSim. When the simulation model runs, the server will get inputs from the simulation model. You should leave the server connection inactive if you are building a theoretical or future-state model that has not yet been implemented.
When you move into the phase of the emulation project where you need to test the PLC logic, you can then make the server connection active. You'll need to connect your computer to the actual server and then set up the credentials in FlexSim to access the server. You'll also need to assign all the emulation variables to their appropriate variables on the server.
When you run your simulation model while the server is active, you should ideally only run the model at a speed of 1.00, which means that the model will run in real time. You'll want to keep the simulation model and the actual system running at the same speed so that you can test the PLC logic and compare the actual system with the simulation model. See Validating PLC Logic for more information.
The following sections outlines a few best practices that you should consider when designing PLC logic in FlexSim:
Since the end-goal of an emulation project is to hand off the simulation model to a PLC programmer, you should consider working with the PLC programmer to ensure that the way you build the logic in process flow matches the programmer's expectations. For example, you might want to get advice on how to organize the process flow logic in a way that is easy for the programmer to follow and understand.
Since the goal of emulation is to facilitate communication between the simulation expert and the PLC programmer, it's crucial that you add documentation to your process flow. At the very least, make sure you use clear activity and variable names that indicate the purpose of those elements in the process flow. Consider adding explanatory text to your process flow as well.