Help - Search - Members - Calendar
Full Version: PID in ML1100
Forums.MrPLC.com > PLCs and Supporting Devices > Allen Bradley
mos89
DEar all

I am controlling a stepper motor via PTO function, this motor is driven a proportional valve, i would like to drive my number of pulse via the PID function, do you have a sample of the PID function implementation ?

Best regards

Cedric
paulengr
QUOTE (mos89 @ Nov 9 2009, 11:06 AM) *
DEar all

I am controlling a stepper motor via PTO function, this motor is driven a proportional valve, i would like to drive my number of pulse via the PID function, do you have a sample of the PID function implementation ?

Best regards

Cedric


I'm not entirely sure why you'd be interested in doing that. You've described your output as a stepper motor that controls a valve. What you haven't described is the inputs. The PTO function itself can easily supply you with an exact number of pulses. No PID function is needed for that.
BobLfoot
QUOTE (paulengr @ Nov 9 2009, 09:21 PM) *
QUOTE (mos89 @ Nov 9 2009, 11:06 AM) *
DEar all

I am controlling a stepper motor via PTO function, this motor is driven a proportional valve, i would like to drive my number of pulse via the PID function, do you have a sample of the PID function implementation ?

Best regards

Cedric


I'm not entirely sure why you'd be interested in doing that. You've described your output as a stepper motor that controls a valve. What you haven't described is the inputs. The PTO function itself can easily supply you with an exact number of pulses. No PID function is needed for that.


If I read the original posters request. He has a Stepper Motor cotnrolling a proportional valve. The PTO instruction runs the stepper and gives it the number of steps to take to be open or closed a certain percentage. He'd like to use a PID to derive the number of Steps variable fed into the PTO Instruction. And needs help underatanding the PID instruction to do so.
mos89
QUOTE (BobLfoot @ Nov 10 2009, 07:40 AM) *
QUOTE (paulengr @ Nov 9 2009, 09:21 PM) *
QUOTE (mos89 @ Nov 9 2009, 11:06 AM) *
DEar all

I am controlling a stepper motor via PTO function, this motor is driven a proportional valve, i would like to drive my number of pulse via the PID function, do you have a sample of the PID function implementation ?

Best regards

Cedric


I'm not entirely sure why you'd be interested in doing that. You've described your output as a stepper motor that controls a valve. What you haven't described is the inputs. The PTO function itself can easily supply you with an exact number of pulses. No PID function is needed for that.


If I read the original posters request. He has a Stepper Motor cotnrolling a proportional valve. The PTO instruction runs the stepper and gives it the number of steps to take to be open or closed a certain percentage. He'd like to use a PID to derive the number of Steps variable fed into the PTO Instruction. And needs help underatanding the PID instruction to do so.


My input is a ratio between 2 flowmeter B/A and my proportional valve is controling that mixing by adjusting B component flow
so what i want is that my PID controller adjust me the number of step for my PTO instruction

Is that understandable ?

Thanks
paulengr
QUOTE (mos89 @ Nov 10 2009, 03:14 AM) *
My input is a ratio between 2 flowmeter B/A and my proportional valve is controling that mixing by adjusting B component flow
so what i want is that my PID controller adjust me the number of step for my PTO instruction

Is that understandable ?

Thanks


There are 3 fundamental problems to overcome here. Once you overcome these, then you will have what you need to use a PID loop. Right now I can't really even begin to recommend what you should do since you are dealing with the first derivative of a variable (velocity) for control relative to the appropriate process variable.

Problem #1: Ratios are nonlinear.

PID loops work best if the system they are controlling is linear and time invariant. The process variable you describe is very nonlinear and barely monotonic. But you can linearize it very easily. Let the operator set the "ratio" as a set point. Calculate Ratio * A = desired flow rate for B. Let this be your set point to the control loop rather than the ratio itself. Even though the set point might be constantly changing from the result of this calculation, at least the system will be relatively linear in nature.

Problem #2: Matching variables

You don't know where the valve is. All you can currently command it to do from your description is to move a certain number of increments open or closed. A PID loop works when both the input and output are tied to one another, such as "position" and "valve". You have "flow" and "valve velocity", the derivative of the required variable (valve position). The derivative of flow (changing in flow rates) might work as an input variable for your stepper motor similar to a velocity loop in a drive but it will not work for controlling flow rates.

Problem #3: Valve positioner

You need valve position feedback. I highly suggest you scrap the whole thing and get a true valve positioner that takes a 4-20mA input signal because this will be the simplest and most reliable. This will come with the position feedback sensors built into the actuator and will be much easier to control.

I can't recommend a specific positioner without knowing what kind of valve it is. It is best to call the valve manufacturer and ask.
paulengr
After thinking over my response, yes, you could indeed control the PTO directly.

Set up the loop as you expect. The scaling for the engineering units on the output will be based on the speed of the stepper motor. This is going to be an integrating loop.

First, you need to set the time base that you are going to use on the PID loop. Execute the PID loop either based on a timer (make sure to use a free running timer that is free of scan-rate related deviations), or better yet, put it in a ladder that fires off the STI. Either way, set the time base in the PID loop accordingly. The time base will be limited by the slower of either the sampling rate of the analog input card or the flow meter itself, whichever is slower. This may seem fast but keep in mind that this is a velocity loop...the loop should go to 100% output fairly quickly whenever a move is needed and then begin trimming back the output as the error gets close to set point. This means that the proportional and derivative terms will probably be the largest gains. The proportional output is going to drive the loop into saturation for most large moves, and only when it approaches the set point will the derivative gain begin to slow down the rate of approach towards the set point. Integral is going to be fairly small, relatively speaking, just enough to get the loop to reach zero error with minimal oscillation.

Now, calculate based on the maximum speed (physical or desirable) of the stepper motor the number of steps that can be completed in the selected time base. Let's imagine for a moment that you can complete 10 steps in the chosen time base. Now, set the engineering units equal to +/- that number of units, or "+10 / -10" if it is 10 steps. Set the loop to react to the error signal (PV-SP). Set the raw limits on the loop to +/-100% since this loop can go positive and negative over the same range. The output (control variable) will be directly equal to the number of steps to take. The PTO calculation just uses this number directly.

This is going to be an integrating loop because the output controls velocity...the rate that the flow rate increases or decreases is what the control variable controls, not the flow rate directly. Integrating loops are notoriously difficult to tune, especially by hand. The best way to handle these is to model it. For that, you need a good text book on control loops and modelling software. Otherwise, tuning by hand is difficult at best. When you tune it up, forget about the "A" ingredient initially. Run with just controlling the "B" ingredient. Even once the modelling software has determined an initial set of gains, carefully adjust your loop gains until you get acceptable response by plugging values into the flow rate set point by hand. Only after you've gotten the loop tuned up can you go ahead and run the system the way it is intended.

In terms of setup, usually with this type of setup for operator controls, I would set up the loop with 3 "modes" of operation. The first mode is manual. Set the .SWM bit and use the .SO input to control the loop in true manual mode. The second is "local auto" control. Set it up so that you can feed a set point into the loop from a manual input. The loop should be able to control the flow rate to your manually entered value. The third mode is "remote auto". In this mode, the set point is supplied by the ratio calculation.

The whole system is much easier to manage though if you let someone else figure out the dynamics of an integrating loop. If you buy a positioner, internally the positioner already has a tuned integrating loop which drives the motor of the positioner itself. This simplifies the problem greatly because you only have to deal with the dynamics of the process itself.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.