An Introduction to Schneider’s PLC & HMI Simulation Using Machine Expert
Introduction
Simulating PLCs and HMIs plays a crucial role in modern industrial automation. It offers engineers the ability to test and validate their control systems without the need for physical hardware, saving time and resources while ensuring reliability and safety. Simulation allows for thorough testing under various conditions, detecting errors early in the development process, and optimizing performance before deployment.
Schneider's Machine Expert is a comprehensive software suite designed to streamline PLC and HMI development. It provides a unified environment for configuring, programming, and simulating automation projects. Machine Expert simplifies the process of designing and testing control systems, offering a user-friendly interface and powerful simulation capabilities.
In this tutorial, you will learn how to leverage the simulation tools in Schneider's Machine Expert to simulate PLC and HMI applications. We will start by exploring PLC simulation, covering activation, login, program loading, and variable monitoring. Then, we will delve into HMI simulation, configuring communication nodes, and executing the simulated HMI application.
Prerequisites
To follow along with this tutorial, you will need an installation of Machine Expert.
Also, we advise you to go through the Schneider PLC programming and HMI programming tutorials to have a full grasp of this tutorial’s content.
Project presentation
We will build upon the previous project we created in the Schneider PLC & HMI programming tutorials. During these tutorials, we programmed a simple motor control PLC program and an HMI dashboard to interact with it. During this tutorial, we will explore the simulation tools that Machine Expert offers to try to run our PLC and HMI applications.
Let’s start by opening the Machine Expert project. You can notice that it contains a PLC section (Hardware and software configuration) and an HMI section.
Open the Application tree tab where we can find all the software components of the PLC/HMI programs. The PLC side consists of an FB (FB_Motor_Control) that contains the actual motor control application.
This FB is called by the main program (SR_Main which is called by the MAST task).
The used variables are defined in the GVL (Global Variable List). You can find more details about all the above in the Machine Expert overview tutorial and Schneider PLC programming tutorial.
PLC simulation
Now that we are familiar with the project we will use, let’s head to the PLC simulation first. Before anything, we need to activate the simulation.
Accessing the simulation
To activate the simulation, open the “Online” menu and click on “Simulation”
If you look at the bottom bar of the software, you will find that a red “Simulation” indicator has appeared which tells that the PLC simulation is active but we are still not connected to it.
Logging into the simulated PLC
The simulated PLC behaves like an actual PLC connected to your PC. This means that we need to log in to it to access its content. To do this, open the “Online” menu and click on “Login.”
A first message will appear asking if you want to change the node address to “MachineExpert_Simulation.” Click on “Yes.”
After that, Machine Expert will attempt to load the PLC program to the simulated PLC. Another message will appear asking you if you want to load the actual program. Click on “Yes.”
After the loading process is done, we are now logged to the simulated PLC with the PLC program loaded into it. You can notice that many indicators have appeared in your interface; The Application name is now with a green background indicating that it is the online program; a “STOP” indicator appeared next to the “Simulation” indicator which displays the PLC’s state; and the values of the variables are now shown in the variable defining zone and in the programming zone.
Creating a watch table
Although the values of the variables are now displayed, we can make it way more practical by creating a watch table which will allow us to select the variables we want to monitor and organize them in a table. To do this, open the “View” menu, move to the “Watch” section, and click on “Watch 1.”
The watch table will appear in a separate section below the programming zone.
Let’s add variables to the watch table. We will add the three variables defined in the GVL (Start_button, Stop_button, and Motor_state). First, click on the first row of the table. This will make a three-dotted button appear, click on it.
This will open an “Input Assistant” window where you can browse through all the data in your project/PLC.
The GVL variables can be found by opening the PLC_1/Application/GVL section. Once done, select the “Start_button” variable and click on “OK.”
You will see the variable appearing in the watch table.
Repeat the same operation to add the two missing variables (Stop_button and Motor_state).
Executing the program
We are set to execute the program and interact with it. The first thing we need to do is to turn the simulated PLC to “RUN” mode. To do this, click on the “Start” button. A message will appear asking you if you want to perform a start operation, click on “Yes.”
The red “STOP” indicator will turn into a green “RUN” indicator. This means that the PLC is running and it is executing the program.
Modifying the variables’ values
Since the program is being executed, we can monitor and modify the values of the variables through the watch table. Changing a variable’s value is a two-step operation: We need to select a prepared value and then write it to the PLC.
By default, all variables are initialized to 0 (False), let’s try setting the Start_button variable to 1 (True). In the watch table, click on the “Prepared value” section of the Start_button variable. This will display a “TRUE” indicator which means that this variable will be set to 1 upon writing.
Next, we need to write the prepared value into the PLC. To do this, open the “Debug” menu and click on “Write values.”
A message will appear asking you if you are sure to write the values, click on “Yes.”
The Start_button variable is now set to 1 and appears as “TRUE” in its “Value” section. Since this variable is used to control the motor, setting it to 1 will also turn the Motor_State variable to 1.
Let’s try now to turn off the motor. For this, we need to set Start_button to 0 and Stop_button to 1. It is possible to prepare values for multiple variables and write them all at once. Prepare the “FALSE” value for the Start_button and the “TRUE” value for the Stop_button.
Then, same as earlier, write the values through the “Debug” menu or by pressing Ctrl+F7.
And as intended; Start_button becomes “FALSE,” Stop_button becomes “TRUE,” and Motor_State becomes “FALSE” which indicates that the motor has been turned off.
After that, we can simply turn the Stop_button back to “FALSE” using the same steps.
Note: Be sure to keep the simulation active and the PLC in RUN mode during the HMI simulation section.
HMI simulation
Now that we covered the basics of PLC simulation, we can head to the HMI side. Let’s first open the HMI project. In Machine Expert, go to the Application tree and double-click on “Vijeo Designer Project Container” under the “Global” section.
This will open Vijeo Designer and display the HMI dashboard we created in the Schneider HMI programming tutorial.
Configuring the nodes
Before we can execute anything, we need to configure the communication nodes to tell the HMI application that we need to connect to the simulated PLC.
In the Navigator, open the “I/O Manager” section and double-click on the HMI node (SOM_HMIG5UE_HMIDT952). This will open the node’s configuration window.
The HMI node must have a name for it to be able to connect to other devices. In the “Equipment Address or Node Name” section, type the node name of your choice. Here, we’ll be simply using the “HMI_node” name. Once done, click on “OK.”
After that, we need to do the same to the PLC node (SOM_PLC_1) but we cannot use any node name. We have to specify the name used by the simulated PLC.
Go back to Machine Expert. Head to the Devices tree and double-click on the “PLC_1” section. This will display the PLC settings where you can find the node name we have to use (MachineExpert_Simulation).
Now, return to Vijeo Designer and open the PLC node settings (SOM_PLC_1).
Then, type the node name of the simulated PLC (MachineExpert_Simulation) in the “Equipment Address or Node Name” section. Once done, click on “OK.”
Running the simulated HMI
Everything is now set and ready to execute the HMI simulation. To run it, simply click on the “Start simulation” button.
Wait for the program compilation and building to be done. The HMI application will start right after.
Once done, the HMI application will open in a new window. From here, we can interact with the dashboard which controls the PLC program.
Let’s try interacting with the application. Click on the green “Start motor” button.
You should see the red lamp in the center turn green indicating that the motor has been turned on.
After that, click on the red “Stop motor” button. This should turn the lamp back to red indicating that the motor has been turned off.
Conclusion
In this tutorial, you learned how to effectively utilize simulation tools in Schneider's Machine Expert environment to simulate PLC and HMI applications. You acquired key skills such as activating and logging into PLC simulation, loading and monitoring program variables, and executing control logic. Additionally, you gained insights into configuring communication nodes, running HMI simulations, and interacting with HMI dashboards to control PLC operations.
Implementing simulation in the Machine Expert environment proves to be both efficient and straightforward. Machine Expert offers a unified platform for PLC and HMI development, simplifying the process of designing, programming, and testing automation projects. Its intuitive interface, coupled with powerful simulation capabilities, enables engineers to simulate and validate control systems with ease. By providing a virtual environment to test and refine PLC and HMI applications, Machine Expert significantly reduces development time and costs while ensuring the reliability and performance of automation solutions. Overall, integrating simulation into the Machine Expert workflow enhances productivity and facilitates the creation of robust and efficient industrial automation systems.