PID FB + Autotune 28/9/05 Table Of Contents PID FB........................................................................................................................................................................ 1 FB Operations......................................................................................................................................................... 1 PID Autotune.......................................................................................................................................................... 1 Examples ................................................................................................................................................................ 2 PID Configuration ...................................................................................................................................................... 3 PID Function Parameters........................................................................................................................................ 3 Run Auto-Tune........................................................................................................................................................... 7 Auto-tune Parameters ............................................................................................................................................. 7 Run PID...................................................................................................................................................................... 9 Pause Integral & Derivative Calculation .................................................................................................................. 11 Read Control Components ....................................................................................................................................... 13 Error Integral ............................................................................................................................................................ 15 General Background: How PID Works .................................................................................................................... 17 About PID and Process Control............................................................................................................................ 17 Inside the PID Function........................................................................................................................................ 18 Proportional Band ........................................................................................................................................... 18 Integral Action ................................................................................................................................................ 19 Derivative Action............................................................................................................................................ 20 PID Status Messages ................................................................................................................................................ 21 PID Tips ................................................................................................................................................................... 23 Background: the Proportional Band and PV ........................................................................................................ 23 PID Analog Input Tips ......................................................................................................................................... 23 PID Range Settings: PV Low and PV High limits.......................................................................................... 23 PID via Digital Output (Contactor, Solenoid Valve, SSR)................................................................................... 25 Manual Loop Tuning............................................................................................................................................ 25 Index......................................................................................................................................................................... 27 i PID FB The PID FB enables you to use system feedback to continuously control a dynamic process. The purpose of PID control is to keep a process running as close as possible to a desired Set Point. VisiLogic's PID FB includes auto-tune. In order to ensure proper PID function, you should use Autotune. During the Autotune process, the PID function collects certain essential data. Unitronics' proprietary PID algorithm uses this data to run smooth, accurate PID. FB Operations PID Configuration Run Auto Tune Run PID Pause Integral & Derivative Calculation Error Integral Read Control Components PID Autotune Auto-tuning loops enables the system to set the parameters for PID. The picture below shows the elements of a basic PID application with Auto-tune. 1 PID FB + Autotune After Auto-tune runs, the P, I, and D values are automatically written to the Configuration parameters and the Auto-tune vector is also filled with the Auto-tune parameters. Note ♦ Note that, once you have run Auto-tune, you can back up the P, I, and D values, the sample time (ST), and the 32 MI-long Auto-tune vector into a Data Table. You can then transfer these values to another Vision controlling an identical system, in order to run PID without tuning the loop. Examples PID Tips can help you with certain PID applications, such as those using SSR switches. Sample applications may be found in the VisiLogic Examples folder. This folder contains field-tested VisiLogic (.vlp) sample applications. You can open this folder via the Help Menu. The folder is typically located at: C:\ProgramFiles\Unitronics\VisiLogic\Examples\Verx.xx, where x.xx indicates the version of VisiLogic. 2 PID Configuration To place a PID Configuration: 1. Select PID Configuration from the FBs menu, then place the function in the net; the PID parameter box opens. 2. The Select Operand and Address box opens; prompting you to link operands to the PID parameters. Note ♦ To enable PID, values must be provided for: Set Point Input Range:PV Low Limit & PV High Limit Output Range:CV Low Limit & CV High Limit These values are used to Auto-tune the loop. After Auto-tune runs, the P, I, D and Sample Time values are automatically written to the Configuration parameters. PID Function Parameters Parameters: Inputs Type Function SP: Set Point MI SP is the target value for the process. In a heating system, this is the temperature value set for the system. Note that the Set Point and Process value must be given in the same type of units (degrees Celsius, bars, meters per second, etc.) PV: Process Value MI PV is the feedback from the process. PV is output from the process and input to the PID function. In a heating system, the temperature measured by a temperature sensor provides the PV. Kp: Proportional Band MI Use this parameter to define the proportional band, in units of 0.1%. The proportional band is a percentage of the total Process Value (PV). It is a range defined around the Set Point. When the PV is within this range, the PID function is active. Ti: Integral Time MI Use this parameter to define the integral time, in units of 1 second. Integral action responds to the rate of change in the controller’s CV output relative to the change in Error. The integral time you set is the amount of time, as calculated by the controller, required to bring the process to Set Point. 3 PID FB + Autotune Note that integral (wind up) error may be initialized via the Force Error Integral operation. Td: Derivative Time MI Use this parameter to define the derivative time, in units of 1 second. Derivative action responds to the rate and direction of change in the Error. This means that a fast change in error causes a strong response from the controller. The derivative action ‘anticipates’ the PV’s value in relation to the Set Point and adjusts the CV accordingly, thus shortening the PID function’s response time. ST: Sample Time MI Use this parameter to define the intervals between PID function updates, in units of 10mSecs. Action: 0: Heat, 1: Cool MB Select Off to activate Reverse Action (control type = heating), ON to activate Direct Action ( control type = cooling ). Input Range: Process Value Low limit MI Use this parameter to define the lower limit for the Process Value. Input Range: Process Value High limit MI Use this parameter to define the upper limit for the Process Value. Output Range: Control Value Low limit MI Use this parameter to define the lower limit for the Control Value. Output Range: Control Value High limit MI Use this parameter to define the upper limit for the Control Value. Parameters: Outputs Type Function CV: Control Value MI CV is the output from the PID function. CV is output from the PID function and input to the process. Note that this output signal may be an analog or time-proportional variable value. Status Messages Initialized to 0 when Configuration is activated. MI Value Message >=0 FB status OK <0 4 -1 Proportion band zero. -2 Input range is invalid (PV input). -3 Output range is invalid (CV output). -4 Integral has reached maximum of 100,000. PID will not allow the Integral value to increase any further. -5 Error in Auto Tune vector addresses, ex., the vector exceeds the final address in the MI data type. PID Configuration Auto-tune parameters Note ♦ MI -6 Set Point less then Input low range or Set Point more then Input high range. -7 to-10 Auto tune error. -11 Noise is more then 5% of Input Range. The start of a 32 MI-long Auto-tune vector that contains the Auto-tuned parameters. Note that, once you have run Auto-tune, you can back up the P, I, and D values, the sample time (ST), and the 32 MI-long Auto-tune vector into a Data Table. You can then transfer these values to another Vision controlling an identical system, in order to run PID without tuning the loop. 5 Run Auto-Tune The Run Auto-tune operation uses the Configuration's parameters: Set Point Input Range:PV Low Limit & PV High Limit Output Range:CV Low Limit & CV High Limit These values are used to Auto-tune the loop. After Auto-tune is run, the Auto-tune MB turns ON, and all of the Auto-tune parameters are written into the Autotune Parameter MI vector that is defined in the PID Configuration. Note ♦ Note that, once you have run Auto-tune, you can back up the P, I, and D values, the sample time (ST), and the 32 MI-long Auto-tune vector into a Data Table. You can then transfer these values to another Vision controlling an identical system, in order to run PID without tuning the loop. In order to Auto-tune the loop, the PID Run operation must be suspended. Auto-tune Parameters Parameters: Inputs Type Function Stage # The number of Stages aids the system to determine accurate Auto-tune parameters. The Default is 3. The higher the number of stages, the longer the Auto-tune time, however choosing a lower Stage may result in less accurate Auto-tune parameters. Auto-tune Done MB After Auto-tune is run, the Auto-tune MB turns ON, and all of the Auto-tune parameters are written into the Auto-tune Parameter MI vector that is defined in the PID Configuration. 7 Run PID In order to run a PID loop, the Run operation must be included in the application following the PID Configuration. In order to Auto-tune the loop, the PID Run must be suspended. 9 Pause Integral & Derivative Calculation If conditions require, you can suspend this value and prevent it from changing. This may prove useful, for example, in a temperature application, when an opened oven door can cause a temporary temperature drop. 11 Read Control Components This function enables you to scale down very large PID control values to smaller, more logical values. The current functions factors the PID control values by a value in an MI, then stores the values in the output MIs. Parameters Type Function Resolution Factor # This is the value used to factor the PID control values. Control Value: Proportional Output MI Stores the factored Proportional Output. Control Value: Integral Output MI Stores the factored Integral Output. Control Value: Derivative Output MI Stores the factored Derivative Output. 13 Error Integral You can read and write to the Integral Value. Read Error Integral Use this operation to store the current error in the linked ML. Force Error Integral Use this to initialize or change the error value while the application is running. You can erase wind up error by writing '0' into the linked register. 15 General Background: How PID Works The PID function uses system feedback to continuously control a dynamic process. The purpose of PID control is to keep a process running as close as possible to a desired Set Point. About PID and Process Control A common type of control is On-Off control. Many heating systems work on this principle. The heater is off when the temperature is above the Set Point, and turns on when the temperature is below the Set Point. The lag in the system response time causes the temperature to overshoot and oscillate around the Set Point. PID control enables you to minimize overshoot and damp the resulting oscillations. PID enables your controller to automatically regulate your process by: 1. Taking the output signal from the process, called the Process Variable (PV), 2. Comparing this output value with the process Set Point. The difference between the output Process Variable and the Set Point is called the Error signal. 3. Using the Error signal to regulate the controller output signal, called the Control Variable (CV), to keep the process running at the Set Point. Note that this output signal may be an analog or time-proportional variable value. In the figure below, a system is regulated according to temperature. 17 PID FB + Autotune Inside the PID Function The PID function is based on 3 actions, Proportional, Integral, and Derivative. The PID output is the combined output of all 3 actions. All of the PID functions are activated by changes in the process Error, the difference between the Process Value and the process Set Point value (E = SP – PV). Proportional Band The proportional band is a range defined around the Set Point. It is expressed as a percentage of the total Process Value (PV). When the PV is within this range, the PID function is active. Note ♦ The proportional band may exceed 100%. In this case, PID control is applied over the entire system range. Proportional Action Proportional action begins after the PV enters the proportional band; at this point, the Error is 100%. The action outputs a value that is in direct linear proportion to the size of the Error value. A broad proportional band causes a more gradual initial response from the controller. Typically, Set Point overshoot is low; but when the system stabilizes, oscillations around the Set Point tend to be greater. 18 General background How PID Works A narrow band causes a rapid response that typically overshoots the Set Point by a greater margin. However, the system does tend to stabilize closer to the set point. Note that a proportional band set at 0.0% actually forces the controller into On-Off mode. The drawback of proportional control is that it can cause the system to stabilize below set point. This occurs because when the system is at set point, Error is zero and the control value output is therefore pegged at zero as well. The majority of systems require continuous power to run at set point. This is achieved by integrating integral and derivative control into the system. Direct and Reverse Action Direct action causes the output to change in the same direction as the change in Error, meaning that a positive change in Error causes a positive change in the proportional band’s output. Reverse action creates an inverse change in the output, meaning that a positive change in Error causes a negative change in output. Integral Action Integral action responds to the rate of change in the controller’s CV output relative to the change in Error. The integral time you set is the amount of time, as calculated by the controller, required to bring the process to Set Point. Note that if you set a short integral time, the function will respond very quickly and may overshoot the Set Point. Setting a larger integral time value will cause a slower response. Integral time is sometimes called Reset. The controller’s CV output may reach and remain at 100%, a condition called saturation. This may occur, for example, if the process is unable to reach Set Point. This causes the Error signal to remain stuck in either the positive or negative range. In this situation, the integral action will grow larger and larger as the Error accumulates over time. This is called integral "wind up", which can cause the controller to overshoot the set point by a wide margin. This situation can be prevented by setting an MB to clear the accumulated Integral error when saturation is occurs. 19 PID FB + Autotune Derivative Action Derivative action responds to the rate and direction of change in the Error. This means that a fast change in error causes a strong response from the controller. The derivative action ‘anticipates’ the PV’s value in relation to the Set Point and adjusts the controller’s CV output accordingly, thus shortening the PID function’s response time. 20 PID Status Messages PID error indications are given in the Status Messages MI in the PID configuration. Status Messages Initialized to 0 when Configuration is activated. MI Value Message 0 FB status OK 1, 2, 3 Auto-tune in progress 4 PID running 5, 6 Setpoint change in progress 7 Integral-wind up 8 integral-wind down 9 Pause mode, Integral and Derivative values are not currently being calculated 10, 11 CV exceeds proportional band, no calculation performed 12, 13 AT parameter mismatch Note that this means that PID will run without Auto-tune. The user may either rewrite the PID values to the 32-MI long Auto-tune vector, or may re-run Auto-tune -1 Proportion band zero. -2 Input range is invalid (PV input). -3 Output range is invalid (CV output). -4 Integral Overflow has reached maximum of 100,000. PID will not allow the Integral value to increase any further. -5 Error in 32-MI long Auto Tune vector addresses, ex., the vector exceeds the final address in the MI data type. -6 Set Point less than Input low range or Set Point more than Input high range. -7 to-10 Auto tune error, failed to calculate PID parameters -11 Noise is more than 5% of Input Range. 21 PID Tips Background: the Proportional Band and PV The proportional band is a range defined around the Set Point. It is expressed as a percentage of the total Process Value (PV). When the PV is within this range, the PID function is active. Note ♦ ♦ The proportional band may exceed 100%. In this case, PID control is applied over the entire system range. The PV and Setpoint must be the same unit type. You can set PV limits by assigning Power up values as shown below. Note ♦ ♦ A broad proportional band increases the stability of the system, but also increases fluctuations during the stable phase. A proportional band that is too narrow will cause the system to react as though to ON-OFF control, and greatly overshoot and undershoot the setpoint. You can increase the proportional band or the integral time to decrease overshooting and stabilize the system. PID Analog Input Tips PID Range Settings: PV Low and PV High limits. If your PID PV is based on an analog input using current or voltage, you can use the analog range units to set the PV low and PV high limits. If this is done, you must also 'normalize' the setpoint to this range. 23 PID FB + Autotune In general, it is recommended that you linearize the ranges to Engineering Units (EU). In this case use the analog reading ranges for X1 and X2, and use engineering units for Y1 and Y2. Note ♦ Input resolution Reading Range 10 bit, (0 to 10V, 0-20mA) 0-1023 units 10 bit (4-20mA) 205 to 1023 12 bit (0 to 10V, 0-20mA) 0-4095 12 bit (-20mA) 818-4095 14 bit (0 to 10V, 0-20mA) 0-16383 unit 14 bit (4-20mA ) 3277-16383 If you are using a PT100 or Thermocouple input, the values do not have to be linearized. This is because the input value is already in degrees Celsius or Fahrenheit ( 0.1° resolution) according to the Hardware Configuration. Example: If the MI that is linked to a temperature input, set to Celsius, contains the value 385, the temperature reading is 38.5°C. Example: Temperature, Thermocouple type 'J' Example: Linearizing to bars (pressure EU) Assume that you are using a 14-bit input, 4-20mA with a pressure transducer with a range of 0-10 bars. Set Linearization parameters as shown below. Although you can set the PV limits to the input range, this may not produce accurate results. 24 PID Tips Example 1: Assume that the 14-bit pressure transducer mentioned above is in a system with range limits of 0-5 bars. If you set the PV Low to 0 and the PV high to 1000 (10.00 bars), this is the range that will be used by the PID function. PID will work properly. However, you can achieve better PID control by setting the PV Low to 0 and the PV High to 600 ( 6 bars). Since the error is a function of the PID working band, Example 2 will run with approximately 40% greater accuracy than Example 1. Example 2: Thermocouple type 'J' has as range of -200 to 760°C. Assume that this is the input for a PID system with an ambient temperature that can reach a low of 10°C to a maximum setpoint of 250°C. If you set the PV Low to 0 and the PV High to 300°C, PID control will function with approximately 3 times greater accuracy than if you set the PV range to cover the entire -200 to 760 input range. PID via Digital Output (Contactor, Solenoid Valve, SSR) You can use the PWM (Pulse Width Modulation) FB to control a PID system. PWM FB enables you to control the ratio between the ON and OFF status of a selected MB (Duty Cycle) within the defined cycle time, which is given as ticks of 2.5 milliseconds. The ratio is given as an ON pulse percentage on the range of 0-1000 (0100%). In order to control PID with the PWM FB, you must set the PID CV range to 0-1000 (0-100.0%). Since the PWM cycle time is set in ticks of 2.5 ms, e.g. 1 s = 400. If the output is a relay/contactor/solenoid valve, the recommended cycle time range is between 2000 and 12000 (5 to 30 sec). Example: As the PWM output MB pulses ON and OFF, the pulse ON time is proportional to the CV. If the cycle time is = 4000 (10 sec), and the CV is 100 (10.0%), the output bit will be ON for 1 second and OFF for 9 seconds, thereby supplying 10% of the energy to the system. If the switch is an SSR, the recommended cycle time range is between 200 and 1000 (0.5 to 2.5 sec). Transistor outputs are preferable. If you use an SSR, you can use a Unitronics PLC that supports a high-speed output. In Hardware Configuration, set the Frequency (F=1/CT) parameter's Power-up Value to 5 to 10Hz ( which is 0.2 -0.1s cycle time). Link the PWM Duty Cycle MI to the CV. Note that in order to activate the output pulses, you must SET the RUN MB linked to the HSO in Hardware Configuration. Manual Loop Tuning In certain cases, you may already have the PID values required by you application. However, you should still perform Autotune in order to ensure proper PID function. This is because during the Autotune process, the PID function collects certain essential data. Unitronics' proprietary PID algorithm uses this data to run smooth, accurate PID. 25 Index A Auto tune ................................................1, 3, 7, 9, 23 C configure...................................................................3 CV ........................................1, 3, 7, 9, 11, 13, 15, 23 E Error .................................................................21, 23 F FB .........................................................11, 13, 15, 23 P PID............................1, 3, 7, 9, 11, 13, 15, 17, 21, 23 S Status messages ..................................................... 21 27 28

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertising