PID in ControlLogix and CompactLogix Environments

devo.xx

Member
Join Date
Jan 2013
Location
Edmonton
Posts
69
I have been struggling pretty bad with setting up a PID loop for my existing ControlLogix controller.
And immediately after this project, I need to set up another loop on a CompactLogix controller. I'll explain both systems, then get in to where I am having issues.

ControlLogix:
CV: Control the Speed of extension of a Hydraulic Cylinder (4-20mA signal over DeviceNet, controlling a Proportional Valve)
PV: Encoder on the Cylinder, measuring the absolute distance. Using the PLC to determine the average velocity of this extension (Quadrature Signal coming in on my 1754-HSC/B)
Control: Create a constant speed of extension during a Boring operation.

CompactLogix:
CV: Control the Position of extension of a Hydraulic Cylinder (4-20mA signal on my 1769-OF8 Analog out card)
PV: Pressure transducer on the Inlet side of a Hydraulic motor at the end of my cylinder (4-20mA signal in on my 1769-IF8 Analog in card)
Control: As the pressure rises at the inlet, raise the cylinder.

These two systems are NOT part of the same project, they just coincide at this particular time. I haven't had a look at testing my CompactLogix code yet, because I can't get the ControlLogix PID to work... Solve one problem, then the next will be a cake walk, right?

Alright, so my struggle comes from setting up my PID to respond at all...
When I turn on my system, give it a Velocity to tune to, the PID loop turns on the output to 100% (unless I cap my CVmax) for a bit, then turns it to 0% for a bit. Maybe 0.5 seconds on either side, sometimes it holds high for longer, sometimes for shorter. I have Trended my responses on my HMI so I can see what it looks like, and it is just wrong. The cylinder itself jolts down ~0.5inch, then stops, then jolts... As I would expect from the outputs I am observing too.

So I have been searching high and low for ANY sort of GOOD documentation on PID tuning with Allen-Bradleys... Nothing to be found. I see a lot of posts by Ron Beaufort, but nothing that explains what any of these Parameters in the PID are actually looking for.
Boiling this down to a few pointed questions, and please ask me for more so I can rectify this sooner rather than later:

1) Ron explained that I need to add a Timer in front of my PID loop. One AB manual says that it is necessary too, but to me it makes no sense. I have a Parameter called: "Loop Update Time: __seconds" Shouldn't this parameter tell the PID when to change the value, and when to hold..? Seems counter intuitive. For now, the Timer is in, but I don't understand.

2) Scaling values... Do I need to pre-scale my values, and leave the Parameters in the PID control at their defaults? Again, Ron has some posts talking about the NECESSITY of scaling your PV to the PID, then post-scaling the CV to the AO card.
PV: 0.000-0.400 inch/sec
CV: 0-3276 counts (as determined in the DeviceNet card, I only need operation in one direction, then I offset it manually later because the PID loop won't accept true values. ie. 1658-4954 is the real range that I need to operate, with 1658 being fully open)
Engineering Unit Max/Min, what is this value for?
Compared to Unscaled Max/Min?

3) In my world, I program Mitsubishi controllers primarily. Their documentation is EXCELLENT, and their tech support is free from my VAR, just a really experienced programmer. Any time I call AB, the end result is "We don't know, you will have to figure it out on your own," so why do I pay for TechConnect...? Their solution for my PIDs was this "You just enter the Parameters, and it will work. There is nothing else to it." And "Scaling values will scale your PID" thanks Tips, but it still ain't working.
Is there a good online database with documentation that actually explains how some of these instructions work?
The "best" section of the Help files for AB is this:
Code:
No derivative smoothing		Enable or disable this selection (.NDF).
No bias calculation		Enable or disable this selection (.NOBC).
No zero crossing in deadband	Enable or disable this selection (.NOZC).
PV tracking			Enable or disable this selection (.PVT).
Cascade loop			Enable or disable this selection (.CL)
I don't exactly carry around my Textbook from my PID course I took several years ago. And I don't always have an internet connection when I'm on site. These help files are brutal, I need something better, that can actually give me insight as to what I am doing. My solution was to actually look at my Mitsubishi manual that has these same options, but it reminded me of what these settings actually control. None of which I need in my particular installation, but I wouldn't have known without these other manuals.

And just because I have only experienced this level of frustration with Allen-Bradly, here is an interesting problem I came across last year:
I had a 1769-L32E controller that was running some new code. This was a brand new installation, and I was about 3 days in to testing, right in the middle of a sequence, the Cart stopped dead in it's tracks. I checked all the breakers, fuses, overloads, estops... everything was fine. So I went online to the controller and got the standard message "No Program detected. Would you like to Download to the Controller?" I didn't trust that particular CPU, so I returned it to my vendor for another brand new one, then flashed the Firmware and Downloaded... 1 full day wasted basically. After commissioning, this exact problem occured again about 3 months after. I had to fly out to site to get online and Download the code back in to the controller. AB's solution was "Install an SD card with your code on it in case this happens again." To me, this should NEVER HAPPEN. Am I wrong?
 
Do you need to use closed loop control? You didn't mention any specifications.

You are hung up on the PID. Have you tried simply using open loop?
The existing system uses a series of 5 Hydraulic valves.
1 for extend
1 for retract
1 for fast
1 for slow speed 1
1 for slow speed 2

But the cylinder does not keep constant speed through the extension.

We are attempting to use a Proportional valve, with feedback from the encoder to determine speed of extension.
So yes, I need closed loop, it is the whole purpose of this project.
 
So yes, I need closed loop, it is the whole purpose of this project.
If so then why didn't you buy a 1756-M02AS which is a hydraulic motion control card for the Control Logix?

I know you seem to think that the PID is the big problem but it isn't. You don't have the right tool for the job.

When I turn on my system, give it a Velocity to tune to, the PID loop turns on the output to 100% (unless I cap my CVmax) for a bit
Well duh. If the position is at 4 inches and you change the set point to 10 inches the error is huge so the control output goes to 100% very quickly. Limiting the control output does little by itself because the integrator still winds up unless you limit the integrator too. What you to do is change the SP every 5 to 10 milliseconds or so the SP changes its position smoothly proportional to the desired speed. This way the integrator will not wind up so there will be little need for the actuator to over shoot to unwind the integrator.

From the last post I can see there are high speed and slow speed valves. How did you intend to change the speeds? You probably want a fast approach and then a slow speed to contact.

This isn't just a PID problem. There is a lot of programming that is required to move the set point at constant intervals and at two different rates.

Ron is right about activating the PID at constant intervals. The derivative gains become useless if the data is sampled and acted on at constant intervals. PLCs are not the most deterministic controllers for this.

About scaling. A real motion controller would allow you to scale the feed back device into engineering units like inches or mm.

Normally a hydraulic servo system uses -10 to +10 volts to a valve with on board electronics. If the valve is a true servo valve then the -10 to +10 volts is converted to -20 to +20 ma or -50ma to +50ma depending on the valve.

Using DeviceNet in the loop is asking for problems. DeviceNet is too slow and not deterministic.

Is there hose between the valve and the cylinder? If so it should be removed and replaced with solid piping better yet the valve should be mounted on the cylinder and all the piping removed. The piping acts like a spring and that makes tuning much more difficult.

I would have used MDT feedback with a SSI interface.
I would use a servo grade proportional valve with on board electronics that takes a -10 to +10volt input.

But the cylinder does not keep constant speed through the extension.
Why not? Is it because the load changes or the supply pressure change? The supply pressure can be kept from changing much by using an accumulator.
 
The existing system uses a series of 5 Hydraulic valves.
1 for extend
1 for retract
1 for fast
1 for slow speed 1
1 for slow speed 2

But the cylinder does not keep constant speed through the extension.

We are attempting to use a Proportional valve, with feedback from the encoder to determine speed of extension.
So yes, I need closed loop, it is the whole purpose of this project.

The canned PID instruction will not work very well for motion and in particular hydraulic motion.

Hydraulic positioning loops have at least two parts.

Position loop(Generates motion profile and calculates postion error) output drives....

Velocity loop(Usually controls valve or pump). The velocity loop has to be able to run faster than the Position loop to prevent oscillation.

Electric Servo positioning usually has one more stage(Torque Loop)

For what you are doing the Micro 850 might work as it is based on PLC_Open and has canned motion but unless you are familiar with the Micro 800s it might have a steep learning curve.
 
Last edited:
The canned PID instruction will not work very well for motion and in particular hydraulic motion.
This is true.

Hydraulic positioning loops have at least two parts.

Position loop(Generates motion profile and calculates postion error) output drives....

Velocity loop(Usually controls valve or pump). The velocity loop has to be able to run faster than the Position loop to prevent oscillation.
There usually isn't a velocity loop because there usually isn't a velocity feedback unless there is a tachometer on a hydraulic motor.

Electric Servo positioning usually has one more stage(Torque Loop)
The hydraulic equivalent is the net force for a cylinder or pressure drop across a hydraulic motor. The torque generated by a hydraulic motor is proportional to the pressure across the pump.

For what you are doing the Micro 850 might work as it is based on PLC_Open and has canned motion but unless you are familiar with the Micro 800s it might have a steep learning curve.
devo.xx should get a hydraulic motion controller. It will take too long to re-invent the wheel and it won't be as round.
 
All great and everything, but this equipment should have no problem doing what I need it to do.

Thank you Peter Nachtwey for your suggestion to Ramp my SP up towards the desired speed. Now my PID is actually tuning.

However, the problem has now gone from bad to worse.
The PID loop is tuning to whatever the hell it wants. Doesn't care what I put in.

The scales are all set correctly, and when I run Open Loop, the speed is ALWAYS correct +/-0.005in/s which is better than what I need.
That is, I send signal 3750 to my Analog card, Speed reports as 0.200in/s.

When I turn on the PID loop, it outputs 3500 sometimes, 4000 sometimes, 4200 sometimes... And the speed of the ram proportionally is incorrect. But then the PID loop decides "You asked for 0.200in/s, so I gave you 0.115in/s. That's it, I'm gonna call it a day" and sits at that speed.
This PID instruction just isn't listening.
 
All great and everything, but this equipment should have no problem doing what I need it to do.

Thank you Peter Nachtwey for your suggestion to Ramp my SP up towards the desired speed. Now my PID is actually tuning.

However, the problem has now gone from bad to worse.
The PID loop is tuning to whatever the hell it wants. Doesn't care what I put in.

The scales are all set correctly, and when I run Open Loop, the speed is ALWAYS correct +/-0.005in/s which is better than what I need.
That is, I send signal 3750 to my Analog card, Speed reports as 0.200in/s.

When I turn on the PID loop, it outputs 3500 sometimes, 4000 sometimes, 4200 sometimes... And the speed of the ram proportionally is incorrect. But then the PID loop decides "You asked for 0.200in/s, so I gave you 0.115in/s. That's it, I'm gonna call it a day" and sits at that speed.
This PID instruction just isn't listening.

What version of Logix are you using and is the loop in a Ladder or Function block program?
 
Ron explained that I need to add a Timer in front of my PID loop. One AB manual says that it is necessary too, but to me it makes no sense. I have a Parameter called: "Loop Update Time: __seconds" Shouldn't this parameter tell the PID when to change the value, and when to hold..? Seems counter intuitive. For now, the Timer is in, but I don't understand.

We usually put our PID blocks in a periodic task (set to 250ms) and set the PID block to the same time frame

The value in the PID block is for its internal use, not to determine when the block executes (without a periodic task or timer in front, the block would update its values every scan)

Regards
Dave
 
However, the problem has now gone from bad to worse.
The PID loop is tuning to whatever the hell it wants. Doesn't care what I put in.
This statement doesn't make sense.


The scales are all set correctly, and when I run Open Loop, the speed is ALWAYS correct +/-0.005in/s which is better than what I need.
Good, that is why I suggested it in the first place.

That is, I send signal 3750 to my Analog card, Speed reports as 0.200in/s.
3750 means nothing to me or anybody else now or in the future that may have to support this system. That depends on scaling.
What percent of valve flow does that equate too? Have you used a multimeter to maker sure?

When I turn on the PID loop, it outputs 3500 sometimes, 4000 sometimes, 4200 sometimes...
Yep, I have seen this before. It is due to quantizing error. The resolution of your encoder isn't fine enough or the sampling times as very irregular. The feed back should have a resolution of a few microns.

And the speed of the ram proportionally is incorrect. But then the PID loop decides "You asked for 0.200in/s, so I gave you 0.115in/s. That's it, I'm gonna call it a day" and sits at that speed.
Yep, all expected.

This PID instruction just isn't listening.
It it listening. It is just somewhat deaf.

Have you implemented feed forwards yet? Do you know what feed forwards are?

We usually put our PID blocks in a periodic task (set to 250ms) and set the PID block to the same time frame

The value in the PID block is for its internal use, not to determine when the block executes (without a periodic task or timer in front, the block would update its values every scan)

Regards
Dave
250 milliseconds is way to slow for a motion control application.

devo.xx, do a search for Peter Nachtwey hydraulics.
I can save you a lot of time on both projects. It won't be cheap but it will be cheaper than wasting your time and the end result will be better.
 
This statement doesn't make sense.
Good, that is why I suggested it in the first place.

3750 means nothing to me or anybody else now or in the future that may have to support this system. That depends on scaling.
What percent of valve flow does that equate too? Have you used a multimeter to maker sure?
3750 = 0.200in/s
4400 = 0.080in/s

Yep, I have seen this before. It is due to quantizing error. The resolution of your encoder isn't fine enough or the sampling times as very irregular. The feed back should have a resolution of a few microns.
My encoder has a sensitivity of 25 pulses/mm nominal. So it's resolution is 0.001575 inch
Sampling gives me an error of about +/-0.005in/s which is better than I need for this process.

Have you implemented feed forwards yet? Do you know what feed forwards are?
That's exactly what I've done. Feedforward my known rate until the Velocity calculation has time to catch up. Then let the PID hold the value around SP.
There's no need to be so arrogant.

250 milliseconds is way to slow for a motion control application.
This all depends on what the system is doing, and the design characteristics.

devo.xx, do a search for Peter Nachtwey hydraulics.
I can save you a lot of time on both projects. It won't be cheap but it will be cheaper than wasting your time and the end result will be better.
I don't hire *******s. But thanks for the advice.
 
My post r.e. 250 mS was in response to one of the original questions asked,

Ron explained that I need to add a Timer in front of my PID loop. One AB manual says that it is necessary too, but to me it makes no sense. I have a Parameter called: "Loop Update Time: __seconds" Shouldn't this parameter tell the PID when to change the value, and when to hold..? Seems counter intuitive. For now, the Timer is in, but I don't understand.
and was not specific to this application. My apologies if any confusion was caused.

Regards
Dave
 

Similar Topics

Morning all, Could anyone shed some light on whats happening with my PID Loop? On our plant we have a 'fast ramp' on the PID Instruction done...
Replies
14
Views
7,514
Hello, I have a PID that I am using for an oxygen valve that regulates the pressure. Often when the header pressure is too low, the output will...
Replies
4
Views
1,235
Hello all, I have a pump that has operational limits 15-100% Speed (9-60Hz). 1. On the PID instruction would you limit (.MINO=15% and...
Replies
21
Views
5,079
Why is my PID .PV (Process Variable) getting continually overwritten with some strange value every time the rung my PID Instruction is on goes...
Replies
4
Views
2,118
Hi there, I have a PID which I limit at MINO = 25% and MAXO = 100%. When the PID runs for the first time it takes time to start reacting at 25+%...
Replies
3
Views
3,042
Back
Top Bottom