In order to solve the drawbacks of low calibration efficiency and low test accuracy of manual debugging parameters in the original PLC production process, a small PLC automatic controller is designed and implemented. The functions of AIO module, DIO module, PTA module and CPU module in PLC hardware are analyzed in detail. Based on the functions of these modules, the module self-automatic detection scheme of small-scale PLC automatic controller is designed, and the automatic detection process of AIO module is emphatically analyzed.
The realization process of matrix switch and upper computer software in automatic controller is described. The least square fitting method is used to calibrate the data in AIO module to reduce the interference of system error and improve the detection accuracy. The experimental results show that the testing scheme of each test module of the designed automatic controller is feasible and has high testing accuracy.
Due to the rapid development of information technology, the application value of automatic detection technology based on PLC in the field of product quality detection has been constantly improved, and it has a wide application value in the field of industrial production. In order to solve the disadvantage of low calibration efficiency and low test accuracy of manual debugging parameters in the original PLC production process, a small PLC automatic controller is designed and implemented based on embedded modular design principle. The small-scale PLC adopts modular design, which mainly consists of PLC bottom board, CPU module, I/O module, communication module and temperature acquisition module. The communication module is composed of CAN communication module and network communication module.
Fig. 1 is the architecture of a small PLC with a single floor configuration. Among them, CPU module is the key module, and the bottom board is used to communicate among the modules. A single CPU module can serve 16 I/O modules.
In order to enhance the quality of data communication in CPU module, this paper designs a protocol processor in CPU module to process the input/output of CPU module data. The main CPU and protocol processing use shared data area to complete data interaction. The software system structure of small PLC is shown in Figure 2. The software system of PLC is composed of system software and application software. Among them, AIO module of PLC hardware is analog input/output module, which consists of 16 groups of input/output channels. The input channel collects the signals of voltage source, current source and Pt100 sensor, and the output channel outputs the voltage control signal of 10 V. DIO module is a digital input/output module, which can be allocated channels through 1-16 channel bit input/output, and uses LED to present different channel states. PTA module is an analog input module, including 16 groups of input, using 12 groups of input channels to collect temperature. The values in the input configuration register are regulated [4], and the input acquisition modes of the other four groups of input channels are configured online. The CPU processor module adopts Powerpc technology, the processor chip is 8280, and equipped with a 3 V button lithium battery. It is the command station of the overall small PLC, completing system configuration, data interaction and program operation.
Based on the characteristics of each PLC module analyzed in Section 1, the module automatic detection scheme of PLC automatic controller is designed, and the automatic detection process of AIO module is emphatically analyzed. Embedded small-scale PLC automatic controller is a closed-loop detection system, which consists of upper computer, modules that need to be tested and different peripheral components. The detection results are analyzed by upper computer. The I/O module is composed of AIO module, DIO module and PTA module. The detection content of I/O module is to analyze whether the module can accurately identify the input signal, the accuracy of the input signal and the load performance caused by the accuracy of the output signal. Its structure is shown in Figure 3, including PC, I/O module to be tested, PLC test floor, switch, multimeter and matrix switch, etc.
The programmable power supply supplies power to the general controller to simulate the input signal required by the I/O module; the output signal of different modules and the input signal of the power supply terminal are all transmitted to the multimeter; the detection reference value of the I/O module is the signal in the multimeter; the transformation of the detection circuit and peripheral equipment is completed by the matrix switch [6]. When I/O module is tested, the digital multimeter is regarded as the actual value and the reference value of the module to be tested to form a closed-loop system, and the I/O module is tested and calibrated. This paper focuses on the design and implementation of AIO module automatic detection system. The efficient configuration of rows and columns of matrix switches can meet the detection requirements of different modules. According to the requirement of closed-loop control system of small PLC automatic controller, a large-scale matrix switch based on FPGA is designed in this paper. The key part of its control logic is the FPGA, which can rotate and transform the channel [7]. The schematic structure of the matrix switch is shown in Fig. 4. The automatic controller designs two 8 *32 matrix switches, including 8 line signal lines and 32 line signal lines. The signals of different lines and columns can be transformed. The control core of small PLC automatic controller is the upper computer. The upper computer can display different data interfaces, manage the controller, detect and parse the data.
The process of AIO module detection by PC is shown in Fig. 5 [9]. The parameters of AIO module are set according to the module number and other parameters selected by users, and the output of signal source is regulated to obtain the status value of AIO module. The identification of status register is checked [10].
The upper computer acquires the input signal of AIO module by switching matrix transformation temperature signal, gets the reference value of the input signal through multimeter, analyses the reference value and actual data, and obtains the test result. The upper computer stores the set value of voltage and output to the register of data area of AIO module, and uses matrix switch to switch. The set value of voltage is compared with the actual value of voltage output of multimeter to complete the voltage output detection of AIO module. The AIO module of the small-scale PLC automatic controller designed in this paper needs to realize the detection of 0-20 mA current input and 10 V voltage output. The upper computer automatically draws the waveform according to the detection data, as shown in figs. 6 and 7. The detection time of voltage input is 21 seconds, and the maximum error is 0.45%. The detection time of 0-20 mA current input detection channel is 20 s, and the maximum error is 0.13%. After analyzing these data, the AIO module is calibrated by the controller designed in this paper. The error value of each channel under different detection conditions is less than 1% of the maximum error value.
This shows that the error after calibration meets the requirements. The design of AIO automatic detection scheme in small PLC automatic controller is effective. The temperature recording module PTA should carry out 0-20 mA current input detection and Pt100 input detection. The results are shown in figs. 8 and 9. The voltage input detection method is consistent with AIO. The single channel test time of 0-20 mA current input test is 20 s, thermostatic element and the maximum error is 0.
1%. The input test method of Pt100 is the same as that of AIO. The total test time of single channel is 25 seconds, and the maximum error is 0.45%. By analyzing these test data, it can be concluded that the experimental error of PTA module in different channels after calibration is less than 1% of the maximum error, which indicates that the calibrated error meets the requirements. The PTA automatic detection scheme of the small PLC automatic controller designed in this paper is feasible and has high precision. Based on the principle of embedded modular design, this paper designs and implements a small PLC automatic controller. The experimental results show that the testing scheme of each test module of the designed automatic controller is feasible and has high testing accuracy.