For discussion of all aspects of measurement and control in the process industries, such as pharmaceutical, power, pulp and paper, chemical, etc.
If you have any questions or comments, please post them here. If you see a question that you can answer, or perhaps add your insight, please use the reply to add to the thread.
An internet based research
by
Anyone likes an internet based research in the electrical eng. field esp. control and automaton
contact me please, it is non-profital and anyone esp.
early graduated or students can attend just for their
interests.
thank you
arash aria
Can anyone tell me where i can find the information about
"designing the PID(or PI,PD) controllers using
Op amps" ??
My requirement is to have fairly low response times, of the order of say 4-5 micro seconds
Nayak,
Its been a long time since I delt with analog PID controllers--although the digital PID algorithms I work with are just equations that emulate the analog controllers. I checked the old manuals in my basement to try to find a good diagram of an electronic PID controller. After digging through the dust and mold I found that I must have thrown them out.
If you look at my PID tutorial at http://www.jashaw.com/pid/tutorial/pid3.html and find the diagram near the bottom there is a block diagram of a PI controller. The Op Amp implementations were similar. You use the inputs to the op amp to add several signals:
The measurement,
the setpoint (one must be subtracted from the other), the output of the op amp through a first order filter or resistance/capacitance lag (for the reset or integral),
and the rate of change of the measurement. (the difference between the actual measurement and the measurment though a first order filter).
If I can find a diagram of an electronic analog controller (I should have one from a Taylor Instrument 1300R) I will try to scan it and post it on my site.
B.C.Kuo in his famous control systems book gives the circuit of analog PID controller. In fact analog PID controller is not a very complicated circuit and can be found in many other books on control systems. The op-amp for I must be a high impedance op-amp and the DC gain must be limited with the help of a resistor parallel to the Capacitor. A resistor in series with the D capacitor is a must. The component values can be according to your requirements.
A splendid uS timescale PID loop is to be found in the following research paper. Email me if you do not have access to this journal - I'll mail it over to you.
"Teaching physics with 670nm diode lasers - experiments with Fabry-perot cavities"
R.A.Boyd et. al.,
American journal of physics 64 (9), September 1996. Page 1109.
Don't let the rather eclectic title put you off - it's a fab paper.
I need ABB DCS Model B Control Modules, termination panels and associated equip for expansion. Would be willing to buy partial or complete obsolete systems. matt.beasley@geosc.com 770 748 1200 ext 283.
I used to work at Georgia Pacific Toledo Paper Mill in Oregon. They had ABB Mod 300. I believe that the plant in Bellingham Washington did too but that plant may be closed down. If you send me an email I will pass it along to my friends at the Toledo mill and leave it up to them to respond to you.
I would like to share with you the success story (see below) from a BESTune user. I was also surprised by this success story because I thought BESTune could only tune PID controllers with fixed sample time.
When the user told me that his process (I guess it is a rotating wheel with lots holes and the problem is to control the time that elapsed from one hole to another, this way the speed of the wheel is under control), I started to think about how to solve the problem and finally I developed a scheme which I believe can solve the PID control problem with varying sample time. But the user said BESTune could solve the problem before I wanted to ask him to try my new scheme for varying sample time control problem.
Still I believe the new scheme should be used to deal with varying sample time control problem.
Dan
----------------------
Dan,
This has been very interesting.
The varying sample time was not accounted for in my integrator. Your program indicated I needed no Kd. Your program came up with completely different Kp and Ki terms that settled 20 % faster and with no oscillations.
Would you consider offering a stripped down version that I could incorporate into our Visual Basic Controls. I would supply the sample data set, the
sampling rate, dead time, and tightness could be passed constants. Your program would calculate Kp and Ki and pass them back to me. I think the graph of the raw data then tuned results would be good. I would not want manual tune or testing. We would support our customers.
We only make 3-5 machines a year. Initially there would be more as existing users update, probably 10 to start with. These would need to be versions
that do not expire.
You can leave your name on the program with all copyright info. I would recommend an About box for those who have other uses for this type of program. The users of these machines are Automotive Manufactures and Paint manufactures in quality control labs.
"I prepare a demo system today to understand and examine your Bestune. The demo ststem is a vantilator and air speed sensor. The vantilator speed is controlled by motor controller. I wrote a parallel PID for the system. I also added delays to the sensor by means of software and harware filters to slow down the response of the system. I also wrote a program to transfer data to Bestune. Everything worked well! I tune the system and it worked almost excellent. I even did not make fine tuning..."
Hello,
I have a problem with a first order feedback system having a distrubance. With the increase of the Gain(Kp) of the proportional controller, the distrubance will reduced. However, will the system become unstable (oscillate) if the Gain is too large? Why?
Yes, a control loop with proportional only control, or with integral, will become unstable and oscillate if the gain is too high. It is the same thing as if you have a PA system with the mike near a speaker. If you turn the volume (amp gain) up too high the speaker will oscillate.
Can you tell me how can I do for implement a PID controller with an opamp (but only one opamp) without affect the part proportional to the derivative, the part proportional to the integral, the part integral to the proportional, the part integral to the derivative, the part derivative to the proportional and the part derivative to the integral, please help, I only have founded a circuit, but the parts of the ciruit are affected for them selves.
Por favor, no si conseguiste el circuito del PID, con Amplificadores operacionales y su configuración si lo tienes por favor me puedes mandarlo por favor
Hola
Soy un estudiante de telecomunicaciones que esta haciendo el proyecto fin de carrera.Estoy tratando de buscar ejemplos de codigo fuente en C, de un PID para controlar un motor DC "Maxonmotor", con un encoder de 500 pulsos por vuelta, conectado a un Interbus, mediante voltage y frecuencia.
Agradeceria mucho que me pudieras decir donde puedo encontrar algun tipo de codigo fuente, al que pueda echarle un vistazo, pues nunca he programado nada parecido. Da igual que este no sea para controlar un motor, pero del que pueda sacar ideas acerca de como funciona un PID, pues tras mucho buscar no doy encontrado nada ilustrativo en internet.
I am looking for a good example of a functional specification. We are trying to develop a "Control Vision" philosophy and the functional specification is where we need to start.
Have you tried using grafcet (IEC848), we use it in our company 'Macro Automation' in NZ, and can give you an example if you care to send me an email at the above address, (not the address this is coming from but john.minnee@macro.co.nz)as I am away from the office at the moment)
For a school project, we have to design a PID controller for a system with a plant (transfer function) approximated as P(s)= (3.87*10^7) / s^2 . We were given some specifications such as overshoot, settling time, etc. If anyone has any suggestions as where to get started, I'd appreciate it. Our Professor is no help at all.
You tune the inner (slave or secondary) loop first, just as if it were a stand alone loop not part of cascade. Then with the inner loop tuned and running, tune the outer (master or primary) loop, just as if it were a standalone loop.
There should be a big difference in speed of the two loops, with the inner loop at least four time as fast as the outer loop. If this is not the case, reduce the reset rate (make it slower) of the outer loop.
I heard that it's very hard to realize a PID controller as a circuit because of the 'I' term.
But I don't know exactly why..
Please tell me why it's difficult..
It is more difficult to make an analog circuit hold a voltage for any length of time. That is what an integrator does. Adding, subtracting (which is what differentiation does) multiplying and dividing can all be done easily with analog circuits.
But holding a charge is difficult. A capacitor can be used for very short time, but it "leaks", and looses charge over time. There are ways to compensate, but they are complicated and usually not easy to implement in a production environment.
Hi.
When using a thermocouple, in this case a 'Type S' thermocouple, how much load can you apply?
E.g. what is the lowest input impedance that is reasonable to use in the following input stage?
hi, i would like to thank you for receiving my massage.
would you please send me some notes :
"analytical measurements in automatic control"
on my e-mail?
Great site I found here! I have to control pulp transport (screw conveyor) so I put my hands on PID algorithms and so the question as in title. Or can I use something different than PID?
(1) PID controller can be used to control most industrial processes. Always try PID controller first.
(2) It is traditionally believed that, when using PID controller to control processes with long dead-time, it is not easy to find a good set of values for the three PID constants (e.g. Kp, Ki, and Kd). This difficulty is history with the recently developed excellent PID tuning software BESTune. Visit BESTune's web site:
Could any one please point out to me the fundamental difference between Distributed control systems (DCS) and supervisory control and data aquisition systems (SCADA).
Hi
DCS stands for distributed control system
Now this is a piece ( a big piece ) of hardware, with its own proprietary software and programming language. Here algorithms can be coded and executed. The data acquisition is mainly through a gateway.
Whereas SCADA is the software which sits on the operating system like Windows and has data acquisition , filters GUI and its own programming language. Some SCADAs even accept VB Script.
A typical medium/large process plant is composed of a number of geographically distributed unit processes which should be monitored and controlled in real time. For the efficient management of such plant, it is necessary to control unit processes in distributed manner while supervising total plant behavior at a central location. A distributed control system is used for this purpose.
SCADA:
-----
SCADA is an acronym for Supervisory Control And Data Acquisition. SCADA systems use computer and communication technologies to automate the monitoring and control of industrial processes. These systems are integral parts of most geographically dispersed, or complex industrial environments because they are able to collect information from a large number of sources very quickly, and present it to an operator in a user-friendly form. SCADA systems improve the efficiency of the monitoring and control process by providing timely information so that appropriate operational decisions can be made.
Some popular SCADAs are FIX32, RsView, Plantscape etc.
DCS: Distributed Control Systems were introduced in the early 80s as the new thing compared with the central process computer. The DCS computer power is distributed in opposite to the mainframe computer centralised computer power.
SCADA: Supervisory Control And Data Acquisition. This is just an expression for the computer systems gathering data, organising data, serve office systems, doing external control in contrast to the DCS which is used for the regular plant control (PID control, Shut Down, Alarm handling etc) used by the operators. The SCADA system may have the DCS as one of its sources for data.
However, both these expressions/systems are now being replaced by new technologies which are worthwhile studying.....
DCS : Distributed Control System
Control is distributed over a network. We can assign safety & related interlock for a part or portion of the plant to a particular node or a combination of nodes.
For ex: In a power station we can assign each RTU/ controller for the control of a every boiler, so that the trip/problem with a controller is not going to affect the operation of another boiler or controllers.
SCADA: Supervisory control & data aquisition system.
Primary objective is data aquisition for monitoring and supervisory control. If a failure affect any part of the system, the affect will be on the complete system due to the supervisory control function originated from a supervisory system.
If required, please feel free to contact for further details.
How feasible is it to implement PID using 8051 assembly language? This is needed for kiln temperature control. Are there any algorithms or code available that anyone knows of?
ANY help is greatly appreciated!!!!
Jay Risko
jrisko@myrelbox.com
Ready Made PID controller on 8051 micro-controller
by
We have developed 8051 based PID controller which is capable to do much more than just PID control. The solution is also available with versatile front-end software for configuration and application suitable for any medium scale process control application. If interested, please contact me. The solution we can offer will be ver cost-effective
Yes, we do have computer interface and Windows based controller configuration/monitoring/dala logging programme. Please do let me know your exact application, number of controllers to be implemented, the type of operator interface you are looking for etc.
how can i send you a file to show you what i need. pls let me know ur e mail and telephone no so thst i can talk to you.my tel. is 0171-2520380,2521380
vipan sarin
> I am Muthupandi.K.
> I am studing now III'rd year Electronic and communication in Thiayagarajar college of Engg in madurai.14
>Now I am working in 8051 microcontroller
>And I need on project based on microcontroller Applications
> Please replay mail
Hi,
I am doing a course in mechtronics. I am practising samll programmes on 8051 controller traning kit.Iwant to know about implementing PID algorithm on 8051. My backround is Mechanical Engineering so that certain concepts of electronics I am not able to understand.
So please help me.
Sir,
I am the student of B. Tech. final year in Electronics & Instrumentation. I want to make 8051 based PID controller in my final project. I want that you helped me in my project. Please send me the circuit detail and program for it. i hope that you send me as soon as possible.
respected sir
i want to design a 16 bit microcontroller optimized for pid application using vhdl language,
can you suggest me what are the controling parameters i should take . which approach i should use.
thanku sir
reply me soon
Ready-made 8051 based PID controller with front end software
by
We have developed 8051 based PID controller which is capable to do much more than just PID control. The solution is also available with versatile front-end software for configuration and application suitable for any medium scale process control application. If interested, please contact me. The solution we can offer will be ver cost-effective
Hello Mr. Manoj.
i am interested in your pid controller. please specify me your details regarding controller. Give the details regarding the ADC and DAC used as well as the algorithm in 8051 and its interfacing design. .Thankyou
Saheel Shah.
Hello Mr. Manoj.
i am interested in your pid controller. please specify me your details regarding controller. Give the details regarding the ADC and DAC used as well as the algorithm in 8051 and its interfacing design. .Thankyou
Saheel Shah.
We have developed 8051 based PID controller which is capable to do much more than just PID control. The solution is also available with versatile front-end software for configuration and application suitable for any medium scale process control application. If interested, please contact me. The solution we can offer will be ver cost-effective
Currently I'm looking for a controller of two aircondition unit (ACU) on a transmitter site.
Our first requirement is to control the on and off time of the two ACUs alternately.
Second, if an event one of the ACU operation is not sufficient the controller will turn on the other ACU to assist.
Third, if power failure occurs the controller will provide a delay time to turn on the ACU.
Currently I cannot find any supplier that will provide such operation. Would a PID controller too much for this requirement.??
Any help or suggestion is deeply appreciated. We are willing to buy in quatities if such product already on market. Our company is situated in Hong Kong.
A controller like the Siebe Microzone 8000 could easily take care of all those tasks or any other programmable controller.
A lot of them are available on the market you could check in your local area for a distributor of DDC controller equipment that would fit best your requirements.
Is it possible to apply pid algorithm in pic?
lets say a temperature sensor send a analog outputto A/D coverter, then the A/D output is send to pic,pic perform pid algorithm, then output to liquid control valve. In this case,does pic will do? And how we covert the c programming into pic code? Is it any pid algorithm that already exist?
I hope someone can clear my doubt.If u knew any related links, please tell me. Thanks in advanced.
I am not sure what you mean by "pic". Do you mean Programmable Logic Controller (PLC)? If so, they usually have built in PID algorithms, but you will have to refer to the manufacturer's information for details.
Background:
In a gas plant, we are trying to control a Fractionator bottom product using one the trays temp. The Fractionator is 47-Tray with two reboilers.
Problem:
I am trying to calculate a “Temp PID Controller†setting using open loop method. When I step the output, it takes about 30 min for process to reach steady state, which is to long for such process. Someone toaled me to use Clausius-Clapeyron Equation to compensate temperature for pressure. The problem I have with this is, the feed composition is changing so fast which makes it difficult to have a dynamic prediction of composition at tray-8 without simulation.
I am a college student and i would like to ask you about pid (proportional integral derivative)controller. i had been assigned a project title related to PID controller. my project is design a hardware and software (c programming) PID controller to control the fuel rate in boiler.
i am going to use temperature as plant. when the temperature is exceed setpoint then feedback to pid controller and thus control position of electrical valve( fuel rate).
The fuel that i going to use is fluid.(oil)
but, i am wondering which type of pid controller i should use since i can affort for the lowest price pid controller. and which brand are famous in Asia area? siemens? farnell? please recommend. thanks.
I would like to ask how to program PID algorithm (c programming)into PIC ? And how to let PIC works as PID controller. If possible, please show me the circuit diagram.
besides, the design of software of PID controller also make me worry since i am poor in programming C. and how can we program into pid controller? using parallel port?
i would to as also how to do the simulation using matlab? what should i concern more based on my project? and is it any method to know the result or the improvement through PID controller? what i meant is how to analyze the process. do i need to know any specific value of the valve, current value, temperaure measurement before plot graph?
do anyone seen the project before in any website? please be kind to tell me. thanks in advance.
I am not familiar with the controller market in Asia, so I don't know what is the lowest price. Do you have to actually buy a controller, or just recommend what you would buy?
Normally the choice about the controller would be based on more than just the temperature loop. Typically a boiler has several loops-drum level, feed water flow, steam pressure, etc. One control system, for example a Distributed Control System (DCS), a Programmable Logic Controller (PLC) or a hybrid system would be used to control all of the loops and to allow the operator to start up and shut down the equipment.
If a commercial controller is used, the controller will already have the PID software in it. You will have to supply the gain, integral, and derivative values. These are normally set by tuning the controller during the initial startup of the plant.
I assume that you are to design the PID algorithm as if you were designing a new controller. For simulation purposes, you will need to pick a temperature range. Assume that the output will be from 4 ma to 20 ma. 4 will completely close the valve and 20 will completely open it.
(1) How to optimally tune my PID control loops?
(2) How to assess the performance of my existing PID control loops?
(3) Do I need to retune my PID loops? How large are the benefits?
ISA-the Instruments, Systems, and Automation Society (formally known as the Instrument Society of America) is located at http://www.isa.org. They have a collection of web resoures at http://www.isa.org/techtalk.
ISA also offers a large number of books. On the ISA site they can be found at: http://www.isa.org/reference/. If you are a member of ISA you can get a discount from this site.
I have added a selection of recommended books on my web site at http://www.jashaw.com/books. (You can order them from the site.) The process control book by G. Shinskey is available at some public libraries.
The sample code posted assumes a one second sample time. The system I am working with only samples data every 10 seconds. This can not be avoided due to the nature of the system. What changes need to be made to the sample code to compensate for this. It would seem that I would replace the number 60 with a 6 in the calculations. Is there more to it or any other recomendations you would give to tune the system.
Jim,
Yes, you replace 60 with 6 if the loop is executed every 10 seconds. The 60 is the number of executions per minute. I am assuming in the code that tuning is done in repeats per minute and execution is 1 second.
John
John,
According to your pid source code, what would be a resonable set of the gain, resetrate, derivative, and filter. I have some lags (process dead time) about 50-60 seconds.
Thanks,
Tom
Kp =(dela input/delta output)/ delta time
Tr = 2*Lambda + Td
Kc = Tr/(Kp(lambda*Td)^2)
Ttotal = Trec = 6lambda
where:-
Td = deadtime
Kp = process gain
Tr = integral time
Kc = controller gain
Ttotal = total time to recover
Lambda = your chosen closed loop time constant
Ah! poles and zeros, you cannt beat em, no Zeigler Nichols here!!!!!!!!
Regards Mark Kelly Control Engineer (England)
but taught by a master from Canada whos expertise you see above.
I am developing an application for a simple electric motor speed governor using an 8051 micro.
Where can I find some example 8051 assembly code that will help me to implement a PID control loop?
Hallo Paola,
Im am developing a motor control and searching for a PID controll algorithm in assembler for an 80C535.
You wrote Dean:
"I may help you, show you the assembly code
that I used to get PID on microcontroller."
Please be so kind and help me to.
Best wishes Ralf Dunker.
Hallo Paola,
Im am developing a motor control and searching for a PID controll algorithm in assembler for an 80C535.
You wrote Dean:
"I may help you, show you the assembly code
that I used to get PID on microcontroller."
Please be so kind and help me to.
Best wishes Ralf Dunker.
hello paola
i'm a student working on PID algorithm on 8051 to build a temperature control system i would be thankful if you show me your PID code for microprocessor
i really need it
thank you
puya-g-afshar
Hi,
I'm interested on contolling of motor speed
i use pid as the algoritm of the system controll..
but i still have an error on pid ..
the plant is ac motor...
i use an optocouplr for feedback
i use 8051 ...
please helpme...give me the code of pid
thanks.......
info: on using microcontroller(8051) for controlling speed
by
sir
i am a bsc electronics student .as i am trying to do a project on using 8051 to control speed, i would like to get informations (circuits+details) on using microcontroller(8051) as a speed sensing or controlling device
For my thesis i"m doing control speed. But i used neural network method. Do you have any idea based on your research about speed control but using neural network method
I am having difficulty tuning a PI controller on a level loop. We are controlling the outflow of a tank with a control valve and the inflow is process dependent. Any tuning rules (easy to apply) that would result in a stable response ?
Thank you
It really depends upon what you want to do with the level control. Do you need to hold the level at its setpoint during changes in the in flow to the tank? Or do you want the tank to be able to absorb changes in in flow and provide a more constant outflow? Actually, that is asking what the purpose of the tank is.
If the tank is to provide some surge capacity to the process (most common case) then you may be better off with a P only controller using manual reset. For either case, a low gain would be used. If using a PI controller a low reset (repeats/min) or a long reset time (mins. of reset) would be used. Do not attempt to tune this loop using any of the standard tuning methods. The objective tuning that will cause the discharge valve to fully open by the time that the level reaches its highest permissable value and close by the time the level reaches its lowest permissable level. This will result in the greatest surge capacity for the tank.
If you need to keep the level at the setpoint (as in a boiler drum, de-aireator, and a few other cases) then you will probably have a high gain and low reset. Such a loop could be tuned with the ZN closed loop method (see http://www.themestream.com/gspd_browse/browse/view_article.gsp?c_id=13253). This will likely result in a very high gain.
Kp =(dela input/delta output)/ delta time
Tr = 2*Lambda + Td
Kc = Tr/(Kp(lambda*Td)^2)
Ttotal = Trec = 6lambda
where:-
Td = deadtime
Kp = process gain
Tr = integral time
Kc = controller gain
Ttotal = total time to recover
Lambda = your chosen closed loop time constant
Ah! poles and zeros, you cannt beat em, no Zeigler Nichols here!!!!!!!!
Regards Mark Kelly Control Engineer (England)
but taught by a master from Canada whos expertise you see above.
Hi, I am interested with the algrithm of optimal PI or PID design for second order system without delay. Who can tell me some information about it.
Thanks
Chris,
I don't know of any tuning methods designed to minimize ISE (or IAE, etc.) The ZN methods do not optimize for any of the integral functions.
I was wondering what you meant by "optimal" because some people mean minimal IAE (integral of absolute error) and others mean ISE and a few prefer some of the other integral functions. I have no opinion about which is better.
If the loop is on a simulated process the you could find the tuning by trial and error (I have done this with automatic searches running for hours on a simulator). If it is a real process, I doubt if there is any way.
respected sir
i want to design a 16 bit microcontroller optimized for pid application using vhdl language,
can you suggest me what are the controling parameters i should take . which approach i should use.
thanku sir
reply me soon
I am always confused about grounding used by
instrument and control system, versus the ground
in electric system (Line, Neutral, Ground).
Any Comments?
I have understood two types of grounding in instrumentation. They both are somewhat similar to the earth ground in electrical systems meaning the signal needs a return line to the source. The first ground is the power supply ground. This refers to the negative side of the power supply and usually all devices needing a minus or negative power source will be tied to this line. This negative line can be tied to the earth ground side of electrical system to provide shock hazard grounding. However, this system must be isolated by transformers in the power supply to reduce ground loops. The second type is the signal ground. This type of ground may or may not be tied directly to the actual power supply ground. In other words it is a floating ground. This signal ground will be isolated by transformers or capacitors to block the DC component or power supply ground. This floating ground is sometimes used to connect sensors that may source their own signal and can not be referenced to the power supply. The main idea to remember is to avoid ground loops. If the floating ground is shunted to the power supply ground, then there is problem. Readings with a VOM Meter will not read correct. Most ground loops come from faulty signal wire shields not terminated correct. Take for example a 4-20mA loop system, if both ends of the shield are connected to ground, then a possible ground loop will exist. Only one of the ends of the shielded wire should be terminated. This provides sheielding from EMF coming from other unwanted sources. When both shields are connected, then a loop via the earth ground could exist and false readings can be noticed. The earth actually can be a return wire so to speak and this is not good for instumentation systems.
I wonder if is there anybody that knows how to implement a discrete PID whith many input variables and many output variables. Think about adjusting a mirror position in 3D
My current problem here is that I have to design some type of circuit that will control the amount of current flowing through a small 200 watt heater, by sensing the downstream temperature with a thermistor. The process control setup is a little air flow loop and I have the thermistor mounted down stream from the heater and fan and then the output is going through an instrumentation amplifier circuit so that my output ranges 0-10 volts based on a temperature signal of 20 to 60 degrees celcius. I am using a Z-world controller to control the temperature command signal and have the software written that will send out the PID values to the control circuitry. The problem is that I am having a very hard time trying to come up with a circuit to control the heater current and I have an output analog signal which I can vary from 0-10 volts which needs to control the amount of current to the heater from 0-100 percent. I have tried using an off the shelf dimmer switch and then putting in an optoisolator in place of the potentiometer, but with out much luck. I have also tried using a bridge rectifier and then taking the unregulated dc signal and applying that to the heater but I can not find a way to linearly control the current flow. I have to do this for a demo using analog instead of digital. I have the system working with a PIC microcontroller using PWM but I am afraid that my old analog skills are sorely lacking. Any help on a type of ac or dc analog circuit arrangement that would work would be greatly appreciated.
Thanks
Ron O"Driscoll
I've collected some links on Basic Process Control, Advanced Process Control, Model-Based Controllers and some related software. I'll add more links very soon.
I have a big problem of understanding something which appears to be very simple. All the text books indicate that with proportional term, an offset is created. I fail to gat this. if the ouput is given by: OUTPUT = GAIN * ERROR, where does the offset come from?
Typically, the equation for the process might look like:
Measurement = Output * Gp + Kp
where Gp is the gain of the process, and
Kp is a bias in the process, or a load.
Of course, the actual equation would be more complex, with non-linearities, etc.
The units of measurement is percent of scale of the measurement element. Likewise, output is measured in percent of opening of the valve. A very important part of the equation is Kp, a bias. For example, if we have a heat exchanger heating water by a controlled flow of steam. Kp would be the temperature of the water leaving the exchanger if the steam valve were fully closed. As the steam valve is opened, the temperature would increase by Gp percent (of temperature span) for every percent the valve is opened. A process disturbance, such as the change in the inlet temperature of the water to be heated, may cause Kp to change.
We have a controller equation of OUTPUT = GAIN * (setpoint - measurement) + Bias., or
Output = Gain* Setpoint - Gain * Measurement + Bias
This bias is known as "manual reset". It may be a value that is adjustable by the operator or technician, or it may be what ever value it takes to balance the equation, "locked in" when the controller is switched from manual to automatic. Using this equation, if the measurement changes, the output will change.
Assume that inlet temperature changes. Kp in the first equation will change, resulting in a new value for the measurement. This will cause the error in the controller equation to change, resulting in a change in the output, a further change in the process equation, causing a change in the measurement, etc. Eventually the pair of equations will level out output will be found that will satisfy the pair of equations. However, although the equations are satisfied, the new measurement may not be the same as the original measurement and the setpoint.
So, in the pair of equations:
Measurement = Output * Gp + Kp (process) and
Output = Gain* Setpoint - Gain * Measurement + Bias (controller)
to compensate for a change in Kp there must be a change in Bias.
John,
I am not a great believer in Z&N tuning for PID loops, a much better alternative is pole/zero cancellation (where possible) or pole placement. This way you can determine what the dynamics of a controlled response will be. Further more, I would say that I also don't agree with "plugging in numbers" for the tuning parameters; all I will say is that if you can establish a good set of process dynamics (FROM BUMP TESTING)then you are half way there with the above methods, remembering that you only have a finite number of poles and zeros in the equation to play with.
What kind of plant do you work in where you have time to analyze the loop in order to work with poles and zeros? Most of us "plug in numbers" from experience for most loops (followed by a little tweeking) because that's all we have time for. For some problem loops we use ZN or other methods (most very similar). Also, in my experience most of the loops are tuned by technicians who do not have the education to work with the poles and zeros, and have even less time to do tuning that the engineers.
Rich
A control loop that does not perform, ie oscillates or does not respond to either a load or setpoint change will introduce variability within the process. This has the property of costing the company off spec product or wasted energy. Take for example a process that is "fitted with advanced multivariable control such as DMC". the advanced control can only produce maximun benifits if all the loops that it manipulates are well tuned. It pays to do the simple stuff well. I do not believe that just sticking in numbers works, can you tell me the cut off frequency of any of your PID loops, I guess not if you just tweak the numbers. Think of the impact when chasing a process problem, is it the process?, can you control it?, how bad is the tuning? I could talk for hours but must go, I am interested in your comments. As far as loop tuning, then train your technicians its not too hard.I am an engineer, do design commissioning etc etc, but still tune loops, further more I design in where possible the dynamics to enable good control to be facilitated.
Regards Mark
Mark,
I agree with the first part of your comments, up to "... can you tell me the cut off frequency of your PID loops..."
About 30 years ago (before my time <g>) frequency analysis and bode plots were in vogue. However, the object is to get a loop that responds properly to setpoint changes and disturbances. There are simple ways of doing this. If one has experience, one can easily start with numbers based on experience and then adjust the values based on observation and simple tests. Otherwise, the ZN methods (open and closed loop) are easy to perform and can be tought to technicians. These methods will result in properly tuned loops.
Rich
ZN tuning dates from the 40's for anti aircraft guns I believe, so 60ish years on we must strive to do things better, attention to detail and not just the big picture apply. What is your indusrty? and you have the drop on me with years
Cheers Mark
ps I will include some simple tuning rules next time.
Mark and Rich,
Let me jump in here. I am interested in ZN tuning; I have been teaching it to technicians and engineers for years. The Ziegler Nichols tuning methods (open and closed) were published in about 1940 by John Ziegler and Nick Nichols, both of Taylor Instrument Companies of Rochester, NY (where I used to work, but long after Ziegler and Nichols). The instruments sold by Taylor were not used for anti-aircraft guns. I doubt that the method would even be appropriate for such control. Taylor's controllers were used for refinery, chemical plant, paper mill, power plant, and other process industries. Ziegler, although best known for the tuning method, was primarily interested in sugar refining. (Both Ziegler and Nichols died last year).
Since the ZN methods were published other methods have come and gone. In the 60's and 70's, not long before I joined Taylor, frequency domain methods became very popular. By the time I got into the business (mid 70's) interest in those methods had died off because the amount of effort required did not produce the expected results. The reason for the continued use of the ZN methods are:
1) They are easy to teach to technicians and engineers, and easy and relatively fast to use; and
2) They work well.
I (like many others) have taught ZN and other tuning to many people who were able to successfully apply it in plants. I have published several papers about tuning methods, even pointing out the type of dynamics that the ZN methods work best for and the dynamics they have the most problems with, and analyzing the many variations on the ZN methods that improve the performance.
While it does not necessarily produce the best tuning, ZN almost always produces very good tuning which can then be tweaked as necessary. I have not seen other methods that can be used in real plants, under real start up conditions, that will consistently out perform the ZN methods. The work on auto tuning should produce some better methods, and I am sure it will. However, many of the best auto tune routines use methods derived from, or very similar to, the ZN methods.
There are, of course, many other methods to tune loops. I look forward to seeing your tuning rules.
John
John I have bought your book and it is definitely useful one. But Zn tuning somehow does not seem to work. I have tune PID loops by Direct Synthesis and Lambada tuning and I find these methods much simpler.
Well as fas as the Cut-off period is concerned I would say it should be 2*3.14*Closed loop time constant. I have used time series analysis (Power spectrum , Total Accumulated Power , Auto-Correlation) for optimizing the PID loops and Cut-off period that was used did make sense to me.
Hi. Thanks for some excellent reading on PID-control.
Im about to install a homemade PC-controlled PID-algorithm. The unit controls a small electric kiln used for ceramics. Volume 250 litres. Max temp 1300 C.
Can you give me some advice of the approximate values of the P, I, (and D) parameters, in an application like this?
It would be nice to have a feeling of what values to be looking for, before applying Ziegler-Nichols etc.
Advisability of using PID in a small 8051 microcontroller
by
I am redesigning a hand-held, battery powered, medical instrument that must keep a small 1" specimen platform at a constant 43 deg C using a resistive heater. The device uses a small 8051 micro running at 25Mhz. The software will be in C with floating point available. The old existing device used simple on/off control and drastically needs improving in both control to SP and reduction in warmup (ramp up) time. I am considering using a PID to improve this temperature control.
My question... would using a PID be too complicated for this application. I would like to accomplish this in a week or less, and don't want to get bogged down in this area as this is only a small part of this project. Any advisements and comments will be greatly appreciated.
Re: Advisability of using PID in a small 8051 microcontroller
by
Doug,
The PID algorithm should give better control to setpoint than on/off control and does not need to be too complicated for a small processor.
I doubt if it would reduce warmup time if the on/off control simply kept the heater on until setpoint was reached. It should reduce overshoot if that is a problem.
Re: Advisability of using PID in a small 8051 microcontroller
by
John,
Are you aware of any successful PID implementations on small 8-bit micros? I'd like to review a project case history if I could find one.
On the reduced warm up time... this is one of the project goals. It currently takes the old device about three minutes to warm to SP. Out of curiosity I connected this heater block through a switch to the same battery type used. A thermocouple was placed near the actual devices sensor. I flipped the switch and measured the time to SP. It took about 45 seconds. The switch was turned off at SP. The temperature continued to rise and overshot the 43 degC SP and peaked at 55 degC. The heater block is regularly burned in at 80 degC so that overshoot temperature won't hurt it.
Would it be OK to raise the initial SP to 55 degC and when 43 degC is crossed, lower the SP to 43 where it would remain. Would the PID be stable.
Some time ago there was an applications note on the microchip web site : http://microchip.com that related to carrying out PID control on the PIC micro.
The text included a full listing of the code, including comments.
If it is of interest, and not available, I might still have a copy on another machine. Feel free to email and I will look further.
It looks very interesting and comprehensive...32 pages. It was written for a DC servo motor application and uses Microchips larger 17C micro which is about equal in performance with most 8051's. Most of the code is in C so a port to the 8051 shouldn't be too difficult.
Simple Analog PID/PI Peltier temperature regulation?
by
Hello all
Sorry this is somewhat long but
at the risk of belaboring you all with a "design my circuit" request let me describe what I am trying to do, and maybe someone can be gracious and offer some help or a pointer (but certainly wouldn't refuse a full solution either <BG>)
While I do have an atrophied Electronic Engineering background It is mostly unused, ancient and unfortunatley never did focus on control circuitry.
Presently I am an amateur astronomer and have built several CCD astro cameras.
This camera uses a Peltier to cool the CCD chip to a delta T of around -35C. Due to the length of the exposures (up to a couple of minutes)
The temperature regulation strongly affects the "dark Current" detected in the images. It would be desirable to maintain a 0.1C
regulation on this Peltier and CCD. (The "Dark current" per second in the image doubles for every increase of 6 C)
These cameras are built as an amateur DIY kit,
so cost does becomes a major factor, as such a full blown commercial PID is very hard to justify.
The original Peltier supply design ran "wide open" at from 5 to 7.5 volts at around
3 amps (voltage regulation only). 10-12 regulated volts at about 3.5 amps is relatively easy to provide with the existing power supply.
Presently there is a thermister mounted in the "drain" (aluminum block) between the Peltier and the CCD. There is a thermistor in the Drain connected to a thermometer. This thermistor or another can easily be used for the feedback device.
Someone else has provided a simple inexpensive (<$20) 1 chip, Proportional Controller with current limiting design that apparently will maintain to about 1- 0.5C (I ve built it but haven't tested it yet)
As there is an unused op amp in the design, it would seem that it might be a fairly easy conversion to a PI type controller?
If this would in itself increase the devices overall temperature stability? .
I am certainly not adverse to a completely new design) I have seen several comments about noise and the "D" side of the controller I have the feeling that the cooling Fan on the Peltier's Heatsink will add enough noise (if this constitutes the noise being considered?)to make PI more feasible for this application than a PID design?.
Most of the documentation, tuners and emulators I have seen understandably address the commercial controllers. While it may be nice to have
digital interactive controls and remote setability, It would be just as satisfactory to have a simple analog type controller with "very simple" setability requirements (max regulatable output/cooling for the current ambient temperature)
I will repost a URL with the schematic of the proportional controller I am referring to this message, in case you have the time to shed some light on it.
If anyone knows or can suggest of a low cost commecial solution that will work within the
ranges of upto 12 volt (Car battery) input I would also be very interested.
(Existing Peltier runs max DT at about 6.5V 3.5 amp,
but other ranges are possible)
The international amateur astronomy community and certainly myself would be in your debt if you can shed some light in this area.
"if you can shed some light in this area."
(Joke: you stay up all night and then complain about being in the dark?)
A temperature controller is usually stable enough for the D term to be used. If you are concerned about electronic noise there are several ways to go. (afterthought: optical coupling might help, filtering out your low frequency signal might help, A recient Embedded Systems mag (with russian dolls in dolls on the cover) noted that sending a high frequency signal and heterdodyining it down can add precision, fiber optics do not collect noise)
Get a good book on grounding practices. Follow them. Shield all cables. Terminate the shields. Find a Ham radio person to explain this if the books are confusing.
Take inspiration from the old vinal record player making industry: make sure there is a amphilfier as close to the sensor as practical. Of course do not let the amphlier's heat bother the heat sensor, but keep things as short as practical.
"Someone else has provided a simple inexpensive (<$20) 1 chip, Proportional Controller with current limiting design that apparently will maintain to about 1- 0.5C (I ve built it but haven't tested it yet)" -- you
If someone is to help, this part needs to be identified.
I saw a solution somewhere on some PID net information source. It looked like this: Get a electronics cookbook. Create 4 amplifiers: a proportional, a differential, an intergral, and a summing amp. Hook them up so that the signal goes into each of the PID amps and their output goes into the summing amp. Ensure that the gain of each is either settable inside the appropiate amp, and/or the % that they add to the summing amp is settable at the summing amp. Then tinker with the PID tuning until you get it working, and then measure all components, and copy. Check that the copy works. Publish.
"I am certainly not adverse to a completely new design) I have seen several comments about noise and the "D" side of the controller I have the feeling that the cooling Fan on the Peltier's Heatsink will add enough noise (if this constitutes the noise being considered?)to make PI more feasible for this application than a PID design?.
"
Or did I make a false assumption: is it thermal noise you are worried about? I thought that the electrical noise would be your worry.
Check out the wheatstone design idea in the "simulate a heater discussion". You are
designing an upside down heater. You should find wheatstone designs in most "cookbook" style electrical books.
Forrest Mims has a good set of books for the overly rusty. Check out the links to PID design with out the math.
You are designing to .1%, yet you can only get the relitive -35 degrees from ambiant. Ambiant will change more than that over the time frame desired. Is .1% realistic? Would absolute temp be better if it could be done?
I too am a rusty EE w/o much control theory. I have learned much by looking on the web and on the links I can find from one forum to the next.
My forte is firmware. But that would be expensive to build, mostly in the debug instrumentation, but also in all the support compilers, EEPROM or FLASH programmers, etc. Once done it can be inexpensive if the design and developement costs do not have to be put on each chip, or if there are many chips.
Could you just measure the dark current in one part of the CCD and use that to factor out any dark current variations?
I have just read your message which you posted about a year ago. I have the same type of questions concerning peltier temperature controller. I am much interested to know whether you have found a suitable controller for your system. I would be much thankful, if you could give me some information. I would like to use Atmel AVR or some other microcontroller, but I have not decided yet.
help me : I have a problem to program keypad in microcontroller 68hc11. I want use the keypad because i want adjuct gain Kp, Ki and Kd.
what the range gain of Kp, Ki and Kdd in PID controller.
Feel free to post your favorite links as replies to this message. Links are value added to the forum, and finding them in one place would help the order/tidyness of the forum.
There is a old retired process engineer who is willing to help a bit, and he has started a forum. I feel that this and his forum should know about each other because both are small and moderated by a knowledgable person. He is a bit hard to find on the 'net.
For his web page, see www.starboundtech.com/pid.htm. It has links to other sites.
hello..i'm doing my final project..
i want to know about the
DESIGN OF PID CONTROLLER WITH ANTI WIND UP CONTROL
i just design it using matlab programming..
so..can u help me?
I am working on a control loop for a complex level control on a stock (very thin, consider it water) chest. The chest is 200 in. high. The water flows in a varing rates. Most of the water leaves the chest through a valve controlled by an old pneumatic level controller (Fisher) that has the valve fully closed when the level is at 50 inches and fully open when the level is at 100 inches. We have just added a second valve and pipe to send excess water to another part of the mill. That valve controlled by a PLC. (I don't know the make, it is part of another system). I am told that the PLC loop was tuned with a high gain, some reset, and a setpoint of 120 inches. So with the valve closed and the level well below 120 inches, I would expect the valve to stay closed. Instead, when the level quickley rises (due to a break) from, say, 60 inches to 70 inches, the valve opens sending stock to another area of the mill even though it is not in excess in this area.
Why does the valve open when the level is so far below the setpoint? We had the system integrator increase the gain and increase the setpoint (it was 100 inches) but neither helped. The system integrator (this is really outside his scope) doesn't know what the problem is. Would anyone know the problem. It is driving us crazy.
Sue,
It sounds like the problem with the new controller is what I was just discussing with Dave: the velocity form of the PID algorithm. I just recently had a question from a client on a very similar problem.
What I think may be happening is that, when the output is at a limit, the gain term of the “integrated velocity form” PID algorithm pulls the output away from the limit even though the measurement did not cross the setpoint.
In the equations:
Out = Outlast + gain*(error-errorlast + reset*error)
IF Out < 0 then Out = 0
Outlast = Out
errorlast = error
assume error is negative and constant. The reset*error term will try to move the output below zero, but the IF statement (output limiter) will limit the output to zero. If the gain is large and the reset is small and error increases (but is still negative) then gain*(error – errorlast) will be larger than gain*reset*error. Therefore the change in output will be positive, opening the valve.
If the equation looked like:
Out = gain*error + gain*reset*[integral calculation to big to fit here….]
IF Out < 0 THEN Out = 0
then the output would never increase above zero when the error was negative.
The best thing to do, unless the controller allows you to choose algorithms, is to decrease the gain and increase the reset. Set the setpoint at the level you wish the second valve to open. The valve should then stay closed until the level reaches that setpoint.
My suggestion to this problem is to check the PLC input and output ladder logic to the PID. Some PID blocks in PLC's need a fast update in the data that is transfered to the PID function. As with Allen Bradley SLC 500 PLC's the analog input and output need another control block installed between the actual analog signal and the PID control block. This gives instant update to the PID control blocks. If there is any scaling done or other data collection between the blocks, then there will not be an accurate update to the PID. This has caused valves to not react to the PID's output and\or feedback input from the valve to the PID. Lots of lag time is involved to be dealt with. Also another area to look at is the valve itself. Is there any deadband applied at the valve itself? In my experiance, there should be no deadband applied at the valve. If there is, then a window has to be overcome and could cause the valve to overshoot or oscillate.
I'm trying to run theoretical modeling using Simulink PID. I found out that the best tuning results that I got are foe example -.1, -20 and when I try to apply them to the actual process using Labtech Notebook, I find out that the best tuning are always the reverse (1/p,1/I ,1/D)for the previous numbers will be -10, -.05. Is this possible or resonable?
Dear list,
I designed a PID using a model process and Matlab.
I got the parameters for the PID. Now I have to implement this PID in a DCS. My PID includes transfer functions of the embedded controller in DCS, the current/pressure converter, the actuator and the valve. How could set the parameters in the DCS for the embedded controller?
Thanks
Your input is not the same as your output.
Examples: input in degrees F, output in volts.
Input in tach pulses per second, output in phase angle fired. Etc.
So you need a transfer curve.
Please see discussion labled: "PID zeroed? Try linearization. Interpolation code follows"
for talk about this and a few code examples.
I am intime doing a placement for my MSc studies in which I am implementing a laser to fiber incoupling with two pizomotors (x,y) the fiber output is observed by a diode as feedback. As a controller I am using a microcontroller (SAB 80C535).
My problem now is (as I am a mathematical goofy:-)) to find an algorithm (or the mathematical name of the problem so I can search in the internet) that finds in an N*N big array a maximum.
The value distribution in this array is more or less gaussian like (as the beam profile is not very nice).
A simple two point-gradient approach does not work (it is likely that it is going to be caught in side maximas).
I already implemented a three point-gradient approach with two different itterations changing the resolution of the observing photodiode and changing to a smaller piezo step size. Which works
quite well (but not a 100%) but not perfect my next guess will be an algo which scans the whole array which is pretty secure to find a maximum but might turn out to be too slow.
Scanning the array will take N*N at least.
If you want just to find a Max value you may want to scan grid points for a maximum value, then take the top 16 grid points and scan more tightly around them, then more tightly around the next top 16 grid points, etc.
Finding maximum values will help find the curve's maximum inflection point.
Alternitively, look how you are reading in and storing the data. If you are already reading in the data in a way that you must handle every data point, do the find_the_max_value stuff there.
An array is ok, but you might want to explore binary or K-nary trees. They are tricker to do, but usefull for the time when you do not want to store the whole array.
Sean
Thanks for your help. Scanning the whole array would probably take too long and is not a very nice solution .
I will try an sequential simplex approach next.
Ideally when the process's setpoint changes, the controled variable would instantly follow it.
This does not happen in real life.
I have found a way of measuring how close the two track each other: either the RMS value of the error, or the Std deviation of the error. These two computations are both close to each other in the 2 times I tried them. I like RMS error (per time peroid) for a quality term. I feel that it truly tracks the quality I am looking for.
Your own system may have different needs.
Math majors: what amount of damping would produce the lowest RMS (Root-Mean_Square) value for a response to a step function? Assumptions: the system is as stable and quiet as it can be before the step is applied.
Sean
As if there weren't enough forms of the PID equation ... I'm looking at a spec for a product that uses the velocity form of the equation. In their words, "this means that the gain terms are applied to the change in the value of the error or PV, not the value of error or PV."
I've worked with systems that were configurable as to whether the PV or the error was used, and to whether the rate and reset terms were independent or dependent, but I've never worked with the "velocity form". Is this commonly used?
The velocity form is sometimes known as the incremental form of the PID algorithm. It was commonly used back in the days when the output of a process control computer usually went through an analog instrument that was connected to the process. The analog instrument would receive incremental “up/down” signals from the computer and move the valve open or closed accordingly. This instrument would serve as a backup to the computer to hold the output, and allow the operator to manipulate it, while the computer was down. By transmitting only incremental up/down signals from the computer to the analog instrument the amount and rate of change could be limited, further protecting against computer errors. Also, when the operator switched from analog control to digital control, the computer would start moving the valve from its position at the time of transfer to computer control, eliminating any need for tracking.
On transfer to computer control ErrorLast and ErrorLastLast are made equal to error.
This equation is the first derivative of the familiar PID equation. (The final part of the equation is the second derivative of the error.) The analog instrument, by converting the up/down signals to actual outputs would, in effect, integrate the above equation.
These days computers, microprocessor based controllers, DCSs, PLCs, etc. usually output a 4-20 ma. signal for direct connection to the process without the need for an analog backup instrument. Most use the more standard full value or “position” form of the PID. I worked with a process control computer before 1985 that was designed to either output an incremental signal to a backup instrument or output a 4-20ma signal directly (Taylor Instrument Pol*3 or Mod 3100). In that computer the equation looked like the above equation except that the integral of the equation was used:
Out = OutLast + gain*(Error-ErrorLast + reset*Error + Derivative*(Error – 2 ErrorLast + ErrorLastLast))
If Out>100 then out=100
If Out<0 then Out=0
OutLast = Out
I call this algorithm the “integrated velocity form”. I assume that if the product does not output an incremental signal to an integrating device (very unusual these days) they must use some version of this integrated form.
The velocity form works the same as the more common position form except for the action taken when the output is pegged at its limit of 100% or 0%. I haven’t seen the velocity form used lately; I would be interested to know the reason it is used in this case.
Thanks for the info, John. It appears that Rockwell Automation will be using your "integrated velocity form" in their next release of their ControlLogix processor. Rockwell has been partnering with Honeywell, so I'm curious if it's coming from them. I'll try to find out if there's some particular reason they chose it.
In some respects, I find the velocity form more intuitive, since those incremental up/down adjustments in controller output are what an operator sees in practice. It certainly makes the PI elements easier to explain.
We're migrating to this product, so I'm faced with the task of migrating the tuning parameters from one platform to the other, hopefully without having to re-tune a bunch of loops. Rockwell's product will allow me to choose either dependent or independent gains, and to choose either error or PV. I'm hoping that if I can make those selections to match our previous controller and keep the units straight, I can make the switch cleanly, since the underlying coefficients are not affected by taking the first derivative.
The tuning parameters of the velocity form and the positional form (calculating the output directly each execution of the algorithm) should be the same. The major difference between the two, assuming you are not using an analog backup device between the digital system and the process, is how they behave when the output is held at an upper or lower limit (valve wide open or fully closed) and certain reset windup conditions. I have an old paper on that subject; if I can find the floppy (yes, that old) I will dust it off and post in on my site.
As for the ability to choose either dependent or independent gains, I assume this means the difference between:
out = gain(error + ResetRate * integral of error)
and
Out = gain * error + ResetRate * integral of error
Note lack of () in second.
Most controllers use the first equation. That will have a large effect on loops whose gain is not close to 1.
I use frecuently velocity algorithm in
Time-proportioning control. Last time was to control moisture of a "smoked oven" (controling steam inlet).
I recommend the use of this algorithm when you have the following conditions:
-End element has only two states -ON/OFF (Contactor, solenoid valve,step motor,etc)
-When you only can make a correction of the error by adding product or material to the process, or when you only can make a correction of the error subtracting product or material to the process.
-when there is a dangerous situation resulting of the increment of the PV over the SP( PV>sp).
I recently have done a project where I've used the velocity form to control a gas flame heater. We used a motor driven gas valve with to inputs, open and closed. The integration is done by the gas valve
Hi. I have several questions regarding PID tuning...
1) The Ziegler-Nichols Tuning method assures quarter wave decay. Does it provide any numbers for the percentage of overshoot and settling time? I would really like to know these figures.
2) Are there algorithms/equations out there that optimizes
a) settling time
b) minimum overshoot
c) best stability once settled
If anyone can help me out with these I would really appreciate it!
Thanks in advance!
1) The Z-N methods provide moderate overshoot, whatever moderate means to you. There is no particular amount.
As for settling time, the decay ratio is a measure of settling time. I don't know of any way to convert to any other method of measuring settling time.
2) Good questions. I don't know of any. I am away from home and my collection of old books and papers, so I can't look anything up for a while.
It would take some definition of optimizing settling time. 1/4 wave decay is a comprimise of "pretty good" settling time and "not much" overshoot. An increase in gain will usually reduce the settling time (to say... 1/8 wave decay) but at the cost of more overshoot.
Most loops can be tuned to give no overshoot (the only way I know to be sure it is at its minimum) but at a real cost of time to respond to setpoint change and ability to reject disturbances. So it is a trade off.
Maybe somebody out there has some answers. If so, please respond!
See John's remarks to me, I wish his example was updated too.
by Sean Cleary
I also complained about this, and was partially answered. So, see John's remarks to me, but I wish his example was updated too. It is nice, but it lacks enough completeness and sense to be compiled.
Variable InputDF1 should be set equal to variable InputD whenever the loop is in manual.
There normally would be much more code than this in any reasonable real world implementation. The additional code would include things like mode switching, handshaking with the rest of the system, and other housekeeping maters. For example, a paper listing of the complete PID algorithm for one major DCS was about an inch thick.
PI of PID software posted for free. Real working copy.
by
Here is my software in C.
It works and is debugged. That will have to be good enough.
Some of the inputs and outputs are rather different. My data is very noisy. I am sending this software the data that is closest to the set point of: raw data, short running average, long average. This keeps the program from jumping around every time the noise hits.
Some of the noise is systematic: there is a spool of wire that unreels and then jerks then unreels then... This is a bother, but must be lived with.
Here then is the program. Use it as you will, and
do not send questions to me. Send updates to this forum if you improve it. For instance, putting in a D term would be nice.
global variables because the montior program
needs global variables:
INT32S iIntegral =0; // start value, was -4000.
INT32S iIntegralPlus;
INT32S iError;
INT32S iTimeInMs;
INT32S iFeedback;
INT32S iOutput;
INT32S iControlpt;
#define MOTOR_BOTOM_LIMIT 300
/*
This controls a tach based motor. The Tach interrupts are timed, and
are where the control happens. For non-agressively tuned systems,
the timing difference mainly mean that most commercial software
is very poor at working with the data.
*/
// This is really a PI controler, the data is far to noisy for the D term.
// This is a hand tuned system, not that agressive.
// The data is between 1000 and 10000 for the motor speed in
// percent times 10. The change_motor_output calls a routine that tries to linearize
// the motor speed. With excel and graphs I have gotten this down fairly well.
//void PIDCorrection(INT32U Input, INT32U Controlpt)
INT32U PIDCorrection(INT32U Input, INT32U Controlpt)
{
static INT32S OldError;
// running average will do in place of waiting for large
// error factor to go away. --- I now plan to add code to wait until startup is over
//iIntegralPlus = (iIntegralPlus + (iError * (iTimeInMs))/100)/2;
iIntegralPlus = (iIntegralPlus + (iError)/10)/2;
// allow a greater change when the sample rate is lower.
if ( iIntegralPlus > 0 )
{
if (iIntegralPlus > iTimeInMs*3){ iIntegralPlus = iTimeInMs*3;}
}
else
{
if (iIntegralPlus < -iTimeInMs*3){ iIntegralPlus = -iTimeInMs*3;}
}
// if motor is not going as slow as it can, then add the Integralplus
// to the integral. If the motor is going as slow as it can, but
// IntegralPlus is positive, add it in.
if (( iOutput > MOTOR_BOTOM_LIMIT ) || (iIntegralPlus >0))
{
// also please note that gain for iIntegralPlus may not be the gain
// for the contribution of the integral to the whole term.
iIntegral += iIntegralPlus;
}
// limit the intergral to motor control limits
if ( iIntegral > 11000L ) iIntegral = 11000;
if ( iIntegral < -11000L ) iIntegral = -11000;
//if ((( 0 > oldError) &&(0 < iError)) || (( 0 < oldError) &&(0 > iError)))
// {
// graph just changed direction...
// went through an inflection point
//iIntegral = (iIntergral * 7)/10; reduce the intergral? Reduce to zero would be too much,
// The current graph is counting on the old value of intergral
// }
iFeedback = ((iIntegral*10)/10) + ((iError));
iOutput = (INT32S) iControlpt + (iFeedback*3/10);
if ( iOutput > 11000L ) iOutput = 11000; // more than 1100 IPM
if ( iOutput < MOTOR_BOTOM_LIMIT )iOutput = MOTOR_BOTOM_LIMIT; // less than 50 IPM
if ( iIntegral+ iOutput > 15000 ) iIntegral = 15000 - iOutput;
//sUserProg[0].dwWireSpeed = iOutput; // for display? if used kills
// all knowlege of setpoint.
Change_Motor_Setup(iOutput, SlaveSpeed() ); // 0 to 10K expected input range
return ((INT32U)(6000+iFeedback));
}
I learned and did:
I had to learn what way the error term should go: negitive or positive.
I had to change the software to get a predictable squarewave in my control point.
I plotted the results in Excel, looked for the contributions of each factor, and made corrections. I plotted the error term, the input, the output, the integral term, the control points. These plots quickly allowed me to understand the contributions of each component.
I am working on a system whose response should be in milliseconds. But this, with modifications, should work with any time frame.
I am using a 80386Ex as my processor. But this should work on any processor that can handle the interrupt task. The interrupt calls this routine, as well as others. If you are using a PID company's controller, you should not need a program. But for the few of us that are using microcontrollers, a program is all we have.
Each of the terms has a potentially different gain. But unity gain for all seems to work for my example
The rate that the error is added to the Integral term is important, and different from the percent of the integral term that is added to the final error term.
I had the gain way up at first. I had problems until I divided the gain by 1000. Then I slowly reduced the division term until I started to get what I liked.
The idea of not updating the integral when a big change came did not work well at all. For all input the integral did not changes. No doubt a program flaw, but dropping it and going back to what I had was easier.
I have changed from supplying the input term an average to just using raw data. The error response is quicker and I am getting a smoother curve. The jerkyness that was a result of a feeding spool moving, stopping and restarting (it has considerable inertia) has been greatly reduced.
With my noisy data, an attempt to add a derivative term made things much worse.
Also there are many things outside of this small routine. This is called from an interrupt. Some of the control inputs are activated when the setpoint is moved, and some from this routine. So the whole system response has not been completely integrated. And If it keeps me happy, may never be.
The integral term, when positive, can keep the system turned on when the system is supposed to be rapidly shut down. Special consideration should be given to this. Even when the system should be shut down, the speed input still shows the speed it should be going at (at least in my system) and can not be relied upon to give fast shutdown. I have changed the program to check for shutdown variables/conditions and turn off the motor when that happens.
More when I learn more,
Sean
\\This is the update, incorporating several \\changes and lessons learned:
// IPM goes from 100 to 1000, and is *10 to give fixed point control.
// IPM is inches of wire per minute. Wire is pushed by outside of wheel.
// global variables for monitoring and static storage
INT32S iIntegral =0; // start value, was -4000.
INT32S iIntegralPlus; // what is added to the intergral each time
INT32S iError; // the computed error signal
INT32S iMsTime; // The sample time in milliseconds
INT32S iFeedback; // broken out so that we can use elsewhere
INT32S iOutput; // output to the motor, the controlling value
INT32S iControlpt; // the setpoint
#define MOTOR_BOTOM_LIMIT 300
//void PIDCorrection(INT32U Input, INT32U Controlpt)
INT32U PIDCorrection(INT32U Controlpt, INT32U Input)
{
INT32S MotorOnToken;
// output the motors speed to another routine via global variable
last_motor_speed_stub = Input;
// get global for monitoring software
iControlpt = Controlpt;
// compute error
iError = (INT32S)((INT32S)Controlpt - (INT32S)Input);
// compute time in milliseconds. The wheel is 1 inch in diameter,
// has 16 slots,
// and is counted in terms of a 0.5us resolution counter.
iMsTime = ((INT32S)IPM10xCounts/Input)/1000; // sample rate
// running average will do in place of waiting for large
// error factor to go away.
// (gain factor for integral here is 1/10 )
iIntegralPlus = (iIntegralPlus + (iError)/10)/2;
// 58 was rough average of iMsTime with run of 3000,6000,3000,6000 with even
// number of samples for each speed. // this did not work well:
//iIntegralPlus = (iIntegralPlus + (((iError *58) / iMsTime)/10))/2;
// allow a greater change when the sample rate is lower,
// and the ms sample time is greater.
// handle negitive and positive change limits to avoid saturation,
// and to reduce sensitivity to noise spikes.
if ( iIntegralPlus > 0 )
{
if (iIntegralPlus > iMsTime*3){ iIntegralPlus = iMsTime*3;}
}
else
{
if (iIntegralPlus < -iMsTime*3){ iIntegralPlus = -iMsTime*3;}
}
// Keep the motor going, no slower than a minimum, so:
// if motor is not going as slow as it can, then add the Integralplus
// to the integral. If the motor is going as slow as it can, but
// IntegralPlus is positive, add it in.
if (( iOutput > MOTOR_BOTOM_LIMIT ) || (iIntegralPlus >0))
{
iIntegral += iIntegralPlus;
}
// limits to the integral so that it does not get into wind-up problems
if ( iIntegral > 11000L ) iIntegral = 11000;
if ( iIntegral < -11000L ) iIntegral = -11000;
iFeedback = ((iIntegral) + (iError));
// remember this is fixed point or integer math.
// total system gain is the term by which feedback is multiplied
iOutput = (INT32S) iControlpt + (iFeedback* 3/10);
// limit iOutput to sensible values
if ( iOutput > 11000L ) iOutput = 11000; // more than 1100 IPM
if ( iOutput < MOTOR_BOTOM_LIMIT )iOutput = MOTOR_BOTOM_LIMIT; // less than 50 IPM
// limit total control to sensible values.
if ( iIntegral+ iOutput > 15000 ) iIntegral = 15000 - iOutput;
// normally turn on motor
MotorOnToken = TRUE;
// quickly and certainly turn off motor
// if any motor-halt conditions occurs
if (
(IDLE == weld_state) ||
(GAS_FAULT == weld_state) || (POST_PURGE == weld_state) ||
(BURN_BACK == weld_state) || (END_WELD == weld_state)
)
{ // motors turned off
MotorOnToken = FALSE;
}
// turn on motor if INCH_ON override button is pressed
if ((INCH_ON == PressedLast ))
{ // motors turned on
MotorOnToken = TRUE;
}
//----
// determine what to do and only do it once.
if ( TRUE == MotorOnToken )
{
Change_Motor_Setup(iOutput, SlaveSpeed() ); // 0 to 10K expected input range
}
else
{
Change_Motor_Setup(0, 0 ); // 0 to 10K expected input range
}
// Return is not much used now.
return ((INT32U)(20000+iFeedback));
}