With today’s general OPC interface it is easy to connect a PLC to a simulation tool for, e.g., verification purposes. However, when verifying PLC control code with this method, one might encounter several unexpected problems due to free-wheeling. Free-wheeling is defined in this paper as asynchronous execution of the PLC and simulation tool. These problems will indeed affect the result and lead to unreliable verification. The problems identified in this paper can be divided into four main categories, namely: time delay, jitter, race condition, and slow sampling. These will be described in detail in the following subsections. OPC UA, which was mentioned earlier, does not introduce any mechanism that would solve this problem, so the rest of this paper will only deal with OPC DA, since it is the most commonly used specification today.
A PLC controlled sheet metal shear will be used as an example to explain the different problem categories, see Fig. 2. A typical shearing line is used to produce sheet metal blanks of the desired length. In this example two actuators, 1 and 2, are used to drive the shear blade up and down. Two sensors, Sensor_1 and Sensor_2, are used to level the shear blade at the upper position. Each actuator is equipped with a position feedback sensor to be able to control the lower position limit. A kinematic simulation model of the described process was implemented and then connected to a real PLC via OPC to demonstrate the phenomena. The PLC has a cycle time of TPLC. A simplified PLC code example of the low level control is shown in Fig. 3. It will represent the PLC (8) in the model described in Fig. 1.
To be able to perform an accurate and reliable simulation, all values from the simulation should be considered in the PLC and vice versa. The tools (hardware and software) that have been used in this paper are as follows.