Simulation Study of PLC Control System Based on Human-Machine Interface
2026-04-06 06:20:25··#1
0. Introduction PLCs, with their advantages of simple structure, good versatility, convenient programming, high flexibility, and high reliability, have become standard equipment in industrial control and are widely used in industrial automatic control. However, the development, design, verification, and debugging of PLC control systems still rely on physical models for simulation experiments, a method that is inefficient, costly, and unsafe. Furthermore, PLC control systems require numerous input and output points, which is beyond the capabilities of general physical models or simulation software. To achieve simulation, human-machine interfaces (HMIs), frequently used in industrial control, can be utilized. These interfaces allow for the design of various input and output devices to simulate static and dynamic states; they can draw desired scenes; and they provide registers, programmable subroutines, timers, counters, and other features for user use. Therefore, developers can easily and quickly build a simulation model for the PLC control system using HMIs to verify and debug the developed program. 1. PLC Simulation Implementation The PLC is the core of the PLC control system, so implementing PLC simulation is crucial for achieving overall system simulation. The essence of PLC simulation is to enable a device to mimic all input and output devices in a PLC control system except for the PLC itself, and for these devices to operate according to user programs (such as ladder diagram programs). To achieve this, a human-machine interface (HMI) was chosen as the simulation device. It has abundant input and output indicators, designed to simulate various field devices and display their operating status in real time. The simulated master controller can be directly operated on the touchscreen. It also has a large internal register and powerful macro instruction application methods, allowing the HMI to perform numerical calculations, logical judgments, flow control, numerical transmission, numerical conversion, timers, counters, etc., through internal macro instruction functions. It can also simulate the needs of more intelligent control devices. Furthermore, its operation mode is similar to that of a PLC, using a cyclic scanning method. More importantly, register data between the PLC and the HMI can be directly read, as shown in the variable column of Figure 1. This effectively solves the problem of user program input and recognition, thus realizing PLC simulation. 2. Simulation Implementation of External Devices External devices can be divided into three categories: controllers (such as buttons and switches), actuators (such as various indicator lights, cylinders, motors, and electromagnets), and sensors (such as various limit switches and proximity switches). 2.1 Simulation Implementation of Controllers Controllers come in various forms, such as alternating, holding, reset, and numerical input buttons. The human-machine interface (HMI) is relatively easy to implement. Simply draw the button using HMI editing software (Figure 2), and then confirm the button type in the button properties (Figure 1, function bar). During simulation, simply press the screen to operate the button. Figure 1 Component Properties Figure 2 Button Figure 2.2 Simulation Implementation of Actuators Actuators also vary widely in real systems. For ease of simulation, they are divided into two categories: opening/closing components and reciprocating components. Opening and closing components refer to actuators with short strokes, high speeds, and a binary choice, such as the on/off state of an indicator light or the operation of a motor. Actuators with relatively long strokes, slow speeds, and pauses within a stroke range of ~9n-I are categorized as reciprocating components, such as cylinders and lead screws. The following uses an indicator light for an opening and closing component as an example to illustrate the method of simulating actuators. On the simulation interface, draw an indicator light as shown in Figure 3. In the indicator light properties as shown in Figure 4, rewrite the variable readings to PLC addresses, directly controlling it via the PLC. 2.3 Simulation Implementation of Sensors Corresponding to actuators, sensors are also divided into two categories: opening and closing sensors and reciprocating sensors. Opening and closing sensors are used to determine the opening and closing state of the actuator; reciprocating sensors are used to detect whether the reciprocating component is in a certain position. Here, an opening and closing sensor is used as an example to illustrate the method of sensor simulation. Figure 3 Indicator Light Diagram Figure 4 Indicator Light Property Block Diagram Figure 5 shows a ball screw transmission control system driven by a stepper motor. The two ends of the lead screw are photoelectric position limit switches, requiring the motion platform to be controllable both manually and automatically. In automatic control mode, after startup, the platform first runs towards location A, then automatically returns to location B, and so on. In manual control mode, it can start at location A or B, stop at the destination, and must be manually restarted to continue operation. Emergency stop control is also available. The simulated X6 and X7 photoelectric switches can be programmed using HMI editing software, creating a subroutine as shown in Figure 6. This subroutine reads the status (data) of the measured actuator from the execution status variable based on the actuator's code. When the predetermined position (predetermined value) is reached, the output result is sent to the PLC input terminals and the sensor indicator lights. Figure 5: One-dimensional position control schematic diagram. Figure 6 : Subroutine 3. Handling relationships between external devices For a device in a PLC control system, its movement depends not only on the PLC instructions but also on its relationship with other devices. For example, a PLC instruction drives a cylinder, which pushes object A, which in turn pushes object B. For object B to move, not only must the cylinder directly controlled by the PLC have relative movement, but object A must also be in the appropriate position. This is the so-called external logical relationship. These relationships may be composed of external electrical, pneumatic and hydraulic circuits, and mechanical structures, and are sometimes quite complex. However, the human-machine interface editing software has a wealth of macro instructions, which can simulate various external logical relationships. Users can also compile several subroutines according to their own requirements to reflect their complex logical relationships. This can more accurately replace the logical relationships between external devices to achieve the simulation effect. 4. Overall framework of the simulation system Figure 7 is the overall framework of the entire simulation system. Its working process is as follows: Figure 7 Overall block diagram of the simulation system (1) The sensor operation module reads the status variables of the actuator, processes them, and stores the detection results in the PLC status variables representing the virtual PLC input terminals; (2) The user's ladder diagram program processes the PLC status variables and the status of the master controller control according to the status of the PLC status variables and outputs the final result to the actuator operation module; (3) The actuator operation module drives the actuator action according to the input instructions and refreshes the actuator status variables according to the status of the actuator; (4) Some actuators need to be processed by external logical relationships according to the status of other actuators, and then the actuator operation module drives the actuator. Both the actuators and sensor processing modules have manual input functions, which are intended for manually setting faults. Figure 8 is a flowchart of the human-machine interface program compiled based on the overall block diagram of the simulation system. The overall structure of the simulation program adopts a scanning working mode, which conforms to the working characteristics of a real PLC. Figure 8 Flowchart Program Execution Process 5. Application Example Using the PLC control system simulation platform introduced in this paper, a simulation model for one-dimensional position control was established, as shown in Figure 5. Fourteen PLC input and output points were used, and the total program length was 196 lines. Two subroutines were written for the simulation model of this system built on the human-machine interface. Although the system is not too complex, all components are complete (such as the master controller, actuators, and sensors), reflecting the basic laws of a general control system. In addition, the simulation model can be simulated multiple times offline and online using the human-machine interface editing software, which can verify the correctness and reliability of the system design.