SLC500的PID问题 点击:395 | 回复:2


  • 精华:0帖
  • 求助:0帖
  • 帖子:9帖 | 49回
  • 年度积分:1
  • 历史总积分:114
  • 注册:2011年6月01日
发表于:2013-06-26 11:38:07




  • 精华:11帖
  • 求助:1帖
  • 帖子:432帖 | 10265回
  • 年度积分:0
  • 历史总积分:24711
  • 注册:2004年7月09日
发表于:2013-06-26 12:53:07

Basic PID Programming and Setup for SLC 500 and PLC 5  

The realm of process control is varied and complex, however, with a few tips and programming examples, you can be incorporating PID control easily.  The information presented here should suffice for at least 60-70% of all loop control which is in operation today.  

These rungs are all that you need to put PID control to work for you in any process.  There are some comments to make surrounding them:  

· Most process loops can be controlled by using simple P and I control.  

· Refer to the Allen-Bradley instruction set manuals for detailed information on the PID instruction.  

· Standard auto/manual control is employed.  

· Programming for use with operator interface has been done  

Regarding the incoming and outgoing data; The analog input which measures the PV (process variable) needs to be given to the PID instruction in an unscaled format (the data needs to be presented in the analog input modules' default resolution -for example: 0-4095 for 1771-IFE, 0-65535 for High Resolution analog modules).  The actual value of the data will be scaled in the PID instruction itself.  

The output data from the PID instruction is given back to the program as a percentage of 4095 (0-100%).  Note that an output device is typically fully ON (100%) or fully OFF ( 0%).  

With this in mind, do not scale either the input or output anywhere except in the PID instruction.  The scaling is done in the PID instruction.  

We have three options available to discuss: SLC 500, PLC 5 using an integer control file, and PLC 5/40 and higher, using PID data type control file.  Examples of all are given.  

Lets assume the following loop parameters.  

· Level loop in a tank  application  

· Objective : To maintain a fixed liquid level  

· Setpoint - 0.2 - 8.2 Feet  

· Output - Flow proportional valve 0 - 100% controlling liquid input into the tank  

· Sensing Device - 4-20 ma ultrasonic level detector - Range 0-20.0 Feet  

· Analog Input Range 0-4095  

· Analog Output Range 0-4095  

Note : The SLC 500 analog series of modules scale to 0-16383, as does the PID instruction.  Using a 4-20 ma signal, the input data is from 3277-16383.  Follow the program in the SLC 500 manual to de-scale the data to 0-16383.  

PLC 5/40 using PD data type  

· Control Block : PD10:10

· Process Variable : N60:53

· Control Variable : N170:5

· PLC 5 using Integer data type

· Control Block : N10 :0

· SLC 500 (uses an integer data type)

· Control Block : N10:0

Once we have determined the absolute range for our input data, then we can concentrate on the PID routines.  


The following is a discussion on the basic program required to implement a PID loop, with operator interface interaction in mind.  PLEASE NOTE THAT NO DIAGNOSTICS HAVE BEEN INCLUDED.  This could range from lost input signal, ramping output without any PV change, etc.  

RUNG 1-2 : The first two rungs are the auto/manual control from the operator interface.  This was discussed in the first issue of 'The Software User'.  

RUNG 3 : The PID instruction needs to be aware of the desired operating mode.  The .SWM bit tells the PID instruction that the loop has been put in manual.  

Note: For integer control block, replace PD10:10.SWM with N10:0/01.  

Note : For integer block (PLC 5), add a parallel output instruction (OTE) with the address of N10:0/04 (Set Output Mode).  This is needed to output the Set Output data to the loop output.  

RUNG 4 : If we are in automatic, then move the setpoint from the operator into the setpoint word of the PID block.  Depending upon the  device you are using for the setpoint entry, a decimal point may not be available.  Manipulation of the data to imply a decimal point could occur, as it is in this example.  

Note : For integer control block, replace PD10:10.SP with N10:03  

RUNG 5 : When the loop is placed into manual, the operator manipulates the output directly by placing a value of 0-100% into the loop SET OUTPUT word.  When the loop is in auto, the output is manipulated by the PID math function.  At the point when the loop is placed into manual, the present output needs to have already been placed into the SET OUTPUT value word, so that the output doesn't change from its' current value, and create a possible large disturbance.  

Note : For integer control blocks, change PD 10:10.OUT to N10:10 for PLC 5 and N10:16 for SLC 500.  

RUNG 6 : If the loop is in manual, then the operator has the opportunity to change the position of the output device to effect a change on the process variable.  The value should be conditioned so that an incorrect value cannot be inputted.  The SET OUTPUT word in the loop is automatically transferred to the device output.  

Note : For integer control blocks, change PD10:10.SO to N10:10 for PLC 5, and N10:16 for SLC 500  

RUNG 7 : This rung transfers the analog data from the analog module in its unscaled format (0-4095, 0-16383), and places it into the process variable word in the PID instruction.  The PID instruction scales the PV to the proper values, so that the setpoint and associated data can be entered in the units of the process (i.e. PSI, GPM, etc.).  

RUNG 8 : The PID instruction itself.  Note that the math function (or algorithm as it is called), is based on time and the error.  Because of this, the loop needs to know how long it has taken for the change in error to occur.  This time is used in the math calculation, and thus the PID instruction MUST be executed at the same time interval.  A free running timer would need to be programmed to provide this.  

Loop update times are selected based on the loop. It determines the time interval at which the output will change.  A fast acting loop would be described as a PV which changes almost simultaneously with the CV.  An example would be your kitchen faucet.  Open it up full and the water flow increases immediately.  

A slow loop would be the opposite.  An example would be hot tub or spa.  When filled with cold water, it takes a while for the temperature to rise, even with full heater power.  

It is not a problem to have an update time too fast (except on an SLC 500, where it could be too fast), but it is a problem to have an update time too slow.  The effect on the scan time of the PLC and the analog modules need also need to be taken into account.  Due to these delays, a loop update time of less than 100 milliseconds may not be feasible (changing the output 10 times per second).  

The loop update time needs to be at least 5 times faster than the 'Natural Period' of the system for proper PID calculations to be accurate.  To ball park the natural period, make a change to the loop output in manual.  Measure how long it takes for the PV to react, which is termed the dead time or lag.  Multiply this value by 4, and this would be the natural period.  

The data files for the PID loop instructions should be set up as shown in the attached screen shots.  Please note that this is for a basic normal loop.  

The gains (PID values) are set at a default for a reason.  Setting these values takes care and skill.  There are third party tuning software packages available, which are introduced elsewhere in this issue.  

PID Loop Instruction Data  
Most of the information required for the PID loop block is explained in the documentation from Allen-Bradley.  There are some which need some additional verbiage.  

Using an Integer File Control Block  
The data coming into the PID block for the PV is assumed to be 12 bit, or a 0-4095 data value.  The Min and Max scaled input setting allow you to put in a process value which relates the 0-4095 data to a real world setting.  

For example, our level loop uses a sensor which has a real range of 0.2 to 8.2 feet.  The value coming from the analog input is 0-4095.  This means that the minimum value should be set at 0.2 and the maximum value be set at 8.2.  

An integer file, however, can only treat data as whole numbers.  The values would be 2 and 82.  Also be aware that the response of the loop will only be as precise to 1/10th of a foot, since the integer data can only be whole numbers  (You could make the scaling values 20 and 820 to increase the precision).  The setpoint data will also have to be 'scaled' from 2 to 82.  

This translates into an error of +/- 1/10th of a foot.  Due to rounding, however, it is somewhat less.  

The alarm bits in the PID block can be used in the program to trigger audible indications or additional program conditioning.  The Setpoint data SHOULD NEVER be allowed to be transferred from an operator input device to anywhere else in the program without being conditioned!  

Using a PD Data File Control Block  
This data file type adds more options to the control scheme.  Using our basic program, basic data formats, and a basic loop, most of the options do not have to be considered.  

The engineering unit Max. and Min. sections are to scale the incoming data, and to provide scaling data for the setpoint as well.  The Input Range Max. and Min. is where you tell the loop the analog input data range coming from the analog input card, normally 0-4095.  

The output from the PID loop is 0-100%.  The data given to the output or Control Variable address, is from 0-4095.  The data in our example, N107:5, will have a value of 0-4095 in it.  The analog output module would need to be scaled from 0-4095 for Min. to Max.  operation.  

Since the PID instruction using the PD data block, deals with this data as floating point, the resolution of the analog input signal is maintained.  

Using an SLC 500  
You do not need to use an external free running timer to use the PID instruction based on time.  Simply use the 'Time Mode Bit', and the 'Loop Update' time in the loop configuration.  

Remember that the incoming data is expected to be in the range of 0-16383!  

The SLC 500 doesn't scan as fast as the PLC 5.  To accommodate this the SLC 500 allows for Selectable Timed Interrupt operation, which would allow the PID loop to scan at a interrupt time, as opposed to a time which is dependent on the CPU scan.  Bit 'TF' in the control word (N10:0/6 in our example), would be set if the scan time is too slow for the update time which we had selected.  



  • 精华:0帖
  • 求助:0帖
  • 帖子:3帖 | 82回
  • 年度积分:17
  • 历史总积分:1010
  • 注册:2004年6月10日
发表于:2013-07-11 06:29:10