Research and Design of Soft Plc Based on Arm and Siprom

PLC is a dedicated control computer and is extensively applied in the fields such as machine manufacturing and industry control, but openness of its hardware structure and the programming system are not uniform due to different manufacturers. To solve incompatibility issue, the soft PLC concept is proposed in the late 90 s of 20th century. A PID is a closed-loop control system and features simple structure, stronger stability and higher reliability, so it is extensively applied in the industry control field. This paper describes the software and hardware structure of the soft PLC system based on ARM7, analyzes and studies PID control algorithm, and studies the PID parameter setting. The above research simulation completes parameter setting of the PID system, accumulates setting experiences, and improves the PID control function performance of the soft PLC.


INTRODUCTION
As one production-oriented industry control device, the PLC features stronger control capability, higher reliability and flexible and easy operation, so it is extensively applied in the modern industry.It can replace a traditional relay control system, can work as groups, and compose a complicated industry control network system.However application of traditional PLC is severely restricted due to different manufacturers, non-uniform models and bad compatibility and generality between different models.To solve this problem, IEC SC65AWG7 workshop prepares the IEC61131-3 standard via which the software can be used to realize the traditional PLC collection, storage, calculation, programming and control on certain hardware platform.The devices such as IO modules or field bus can collect field signals and output signals, which is called as the soft PLC.Compared to the traditional PLC, the soft PLC hardware system features better openness.A user can select hardware flexibly according to the field requirements.A soft PLC has rich instruction set to facilitate users to flexibly develop PLC programs.A soft PLC has an open software and hardware architecture, so it can better combine the network communication.The new network communication technology can be applied in PLC control to adapt the complicated industry control field [1].
The PID control also becomes PID adjustment, which depends on the linear combination of the offset percent, integral and differential between the given values and feedback values based on the controlled object.The controller based on this method is called as a PID controller.This controller features simple structure, stronger stability, high reliability, easy adjustment and extensive application.
To apply tis control technology, the mathematic model and mechanical parameters of the controlled object should be known.The parameters of the control mechanism can be identified via experiences or field commissioning, so the PID control technology is an effective and easy choice.
The SIPROM language is Boolean language based on the logic expression and is one of five programming languages regulated by the IEC61131 standard.Its logic expression reflects the logic combination of the hardware components [2].The SIPROM language elements are divided into operand, element operand, function command, program block and operator.The SIPROM language connects these elements according to the programming regulation and standard to compose a logic expression and program sentence, the variants are defined and controlled via expressions and sentences.The variants correspond to the physical and logic IO signals via the physical devices.

SYSTEM COMPOSITION BASED ON LPC2368
The LPC2368 is a real-time micro-processor based on ARM7TDMI-S core for the serial communication, which includes one 10/100 Ethernet MAC, one USB2.0full-speed interface, four UART interfaces, two CAN interfaces, one SPI interface, two SSP interfaces, three I2C and one I2S interface.The chip integrates one 512kB high-speed flash memory.The local bus integrates one 32 kB SRAM.The Ethernet interface shares one 16 kB static RAM, and the USB interface shares one 8 kdb static RAM.
Compared to the traditional PLC, the power/reset circuit in the structure corresponds to the power module in the traditional PLC.SDRAM and FLASH correspond to the storage module.This PLC communicates with the upper device via RS-232 or JTAG interface and the upper device can realize the traditional PLC programming function.The program is downloaded to the system for operation via RS232 or JTAG interface.The operation conditions can be monitored via RS232 or JTAG interface during operation.The CAN interface can provide communication data to the program.The Ethernet interface can easily connect the soft PLC to the public network to enhance the communication capability and environment adaptability of the system.
The software part of the soft PLC system can be divided into the operation system (lower device) and development system (upper device) by hardware.Most development systems are based on PC and run on Windows system platform.The programming language complies with the IEC61131 standard and is used to write, compile and simulate user programs.The compiled and debugged programs will be downloaded to the operation system via the RS232 interface.The operation system is divided into real-time system core and soft PLC execution program [3].The real-time system runs on 2 C OS µ − operating system, so the soft PLC system features higher real-time performance and multi-task processing capability.The execution program will embed the PLC ladder language to the RAM chip.This system combines SIPROM with C language.The SIPROM language is used to transform the ladder diagram.The C language is used to write, compile and run the user programs.The realtime system is the core of the whole soft PLC system and can complete system setting, signal processing, program call and signal output.The software system structure is shown as the Fig. (2).

IMPLEMENTATION AND IMPROVEMENT OF PID CONTROL ALGORITHM
The PID control technology features simple structure, easy adjustment and higher reliability and stability and is one of extensively applied technologies in the industrial control.The PID controller is extensively applied at the field job.The principle of the PID control is shown as the Fig. (3).
The mathematical model of the PID control is shown as the formula 1: ( ) u t indicates the control variant and is the output of the PID system.
( ) e t is an offset value and is the error between the sys- tem feedback value and setting.p k is the percent factor of the control system.i T is the integral factor and is the integral time of the control system.d T is the differential factor and is the differential time of the control system.
The formula 1 indicates that the error adjustment capability of the controller is closely associated with the percent factor p k .bigger p k indicates stronger adjustment capability.if p k is too big and the system transition time is too short, it will easily generate vibration and affect system stability, so a proper p k value should be selected for stable error and system stability.From the integral elements, when a system has an error, its control will be reflected.When no error occurs, the integral element is a constant.The integral control can eliminate the stable error, but it will affect the system response speed.The integral factor i T will be identified according to the specific requirements of the control field.If the system requires less response time, a smaller i T is used.If the system requires higher stability, a bigger i T value is used [4].The differential elements will correct the change rate of the error.The differential is used to suppress error change, overcome the system vibration, and The computer is mainly used to process digital values.The previous continuous PID algorithm will be processed discretely and then be stored and executed by a computer.When the samples for the unit time T are collected for discrete processing and k is the sample SN, the equation 1 is transformed to the formula 2.

T en en u n k e n k e i k T T T
n is the sample SN: ( ) u n is the output value of the control system in nth sample.
( ) e n is the control system error in nth sample.Shown as the formula 2, the control variants are computed according to the algorithm definition.All control variants should be computed.This algorithm is called as the full PID control algorithm.When this algorithm is computed, ( ) e n will be accumulated in order to increase the computing workload of the controller.When the system operates for a long period, the final accumulation results may overflow, which will make the executive component execute an incorrect command and lead to a severe accident.To avoid this case, we will use one incremental PID control algorithm to control the change of the output value ( ) u n , namely the change value

( ) u n Δ
of the executive mechanism in case of output.
Based on the formula 2, it can be got: By integrating the formula 2 and 3, it can be got: e n − , so the integral saturation will not occur and the system security and reliability is improved.In addition, the system output is only related to the offset and is independent of the actual position of the executive mechanism.This case can easily realize non-disturbance switching between manual mode and automated mode.Output of the control system is the action increment of the executive mechanism, so the incorrect operation has smaller influence on the system.In theory, a threshold can be set to limit a failure at field where higher security and reliability is required.
The differential step in the PID algorithm mainly corrects the error of the controlled object for the error change rate and overcomes the system's over-adjustment.The differential step is placed behind the proportional calculation in a traditional PID, so it makes the differential step not truly correct the error change rate.To solve this problem, the differential step is placed before the proportional step in order to effectively correct the error change rate and overcome system's over-adjustment, which is called as the different forward method.The integral step aims to ensure system stability.When the adjustment step of the integral step is too strong, it will extend the control adjustment time.This case can not meet the requirements of some systems requiring higher time effect.To overcome this condition, a threshold M can be set to determine if the integral step is introduced, namely the integral part of the algorithm is multiplied with a switch coefficient i k , so the PID algorithm can be expressed as the formula 5.The control flow is shown as the Fig. (4). Wherein: When integral separation is introduced, for one control object, when the PID parameters are same, the regular PID algorithm and integral separation algorithm are compared, shown as the Fig. (5).The integral separation algorithm can significantly reduce the system adjustment time and excess and improve adjustment performance.

PARAMETER SETTING OF PID CONTROL SYSTEM
The PID parameter setting is one key point in PID control and is the key factor to affect the performance of the control system.The so-called PID parameter setting indicates to identify the proportion factor p k , integral factor i T and differential factor d T of the PID control system.In essence, the above influence factors are changed in order to change the system performance and get the ideal control effect.The frequent system setting methods include theoretical computing setting and engineering setting method.The theoretical setting method indicates to compute according to features of the system control model and specific executive components.The obtained data can be used via field debugging and change.The engineering setting method indicates to directly test at the control field according to engineering experiences.The parameters are set via the observation results.This method is easy to grasp and is extensively applied in actual engineering [5].
The frequent engineering setting methods include trial method, critical proportion method and experience method.The trial method indicates to set in the order of proportion, integral and differential.First set the integral elements and differential elements as 0, adjust the proportion factor p k to get a satisfactory control curve, set p k as 5/6 under the pure proportion control, integrate integral step for second adjustment, and get i T .Finally d T is introduced on demand.
Generally the initial d T value is (1/4 ~1/3) i T .The final satisfactory effect is obtained by adjusting the differential factor.The critical proportion method is similar to the trial method.First, use the pure proportion control.When the proportion factor increases till the system generates the constant amplitude vibration, the factor value is a critical value.At this time, p k is marked as u k .The interval of two adjacent pulse times is the critical vibration cycle u T .Based on u k , u T and experience equation, the system parameters are computed to complete parameter setting.The experience rule indicates to compute PID parameters based on a small number of experience according to the experience equation [6].From the strict meaning, the integral factor and differential factor of the critical proportion method are exported by using the experienced equation.The experienced equation is shown as the Table 1.

SIMULATION IMPLEMENTATION AND COMPARISON OF PARAMETER SETTING OF PID CONTROL SYSTEM
To improve the efficiency of the PID parameter and reduce the field debugging time, generally the MATLAB is used for simulation test of the system and know the basic information on PID parameters.Finally the field is debugged.A model is established for simulation in order to intuitively know influence of the proportion, integral and differential factor on the control system.To reduce workload, we model the system for simulation by using SIMULINK graphic interaction tool of the MATLAB.The system model is shown as the Fig. (6).
Based on the parameter setting idea, we first simulate the influence of the proportion factor on the system.The system is set as the pure proportion control.The output in the Fig.   7) indicates that the system has longer response time to the deviation when the system's proportion factor is very small and the set value can not be reached in a long time.The stable error is bigger.When the proportion factor is bigger, the system will quickly respond to the deviation, but the over-adjustment is bigger, so it will easily generate vibration, which will lead to unstable system.
improve the system stability.A bigger d T indicates stronger differential control and can effectively control error change.A smaller d T indicates weaker suppression.A proper d T can fully exert the differential adjustment and facilitate system stability.The proportional control (P control), proportionalintegral control (PI control), proportional-differential control (PD control) and proportional-differential-integral control (PID control) can be obtained according to different combinations of the control modes.

Fig. ( 7
Fig. (7).Influence of proportion factor p k on the PID system under pure proportional control.

Table 1 . Experience equation table of critical proportion algo- rithm. Type of Control Algorithm
p k i T d T