Quick comparison of PID, PIDE, and PI instructions in RSLogix5000 ...

Ron Beaufort

Lifetime Supporting Member
Join Date
Jul 2002
Location
Charleston, SC
Posts
5,701

the following question was asked in a recent thread ...

Can anyone give me a brief overview of what the key differences are between the PID ladder instruction and the PI & PIDE function block instructions? I found the 1756-rm006 file on the Literature Library, but it only describes each instruction individually, and does not compare them to each other, at least not very obviously.


since the same question comes up quite often in my classes, I've put together a quick down-and-dirty set of experiments to demonstrate some of the major differences – and similarities – between these three "process control" type instructions ...

please keep in mind that this is just an OVERVIEW – not a full discussion of all of the nuts-and-bolts material involved ... for one specific issue: most of these instructions have multiple setups which could substantially change their operation ... again, this is just an OVERVIEW of the basic ideas ...

first let's compare the PID (Proportional Integral Derivative) instruction available in Relay Ladder Logic - with the PIDE (Enhanced PID) instruction available only in either Function Block or Structured Text programming ...

the first thought that naturally pops into the beginner's head is that "enhanced" must somehow mean "better" ... well, the PIDE instruction DOES offer an "Autotuning" feature (if you've paid for the option) ... whether that particular feature is worth its price is debatable ... for some applications it works well – for others not so well ...

(related thread) ...

other than that, the PIDE does offer a LOT (some would say "too many") extra "controls" ... note that these controls are not necessarily going to control the PROCESS (flow, temperature, etc.) ... instead they're used to change the modes, and status settings, etc. of the PIDE instruction itself ...

the last time I counted there were 167 settable "parameters" inside that PIDE function block ... let's do the math on that ... if we decide to just "call out" the name of each one of those parameters – and give just a 30 second explanation of how each parameter BASICALLY works – then we're talking about over 80 minutes of time which would be required just for that little "getting acquainted" session ... about an hour and half just to list the names – and the BASIC functions ...

but that still begs the honest question: will I get BETTER CONTROL over my process by using this "enhanced" PIDE instruction instead of a "regular old-fashioned" PID? ...

well, let's see ...

in the screen shot below, the RED trace shows the output of a PID instruction – compared to the GREEN trace produced by a PIDE instruction ... although the tuning settings APPEAR to be different – the values shown have been calculated to give the same "tuning" for both methods of control ...

TIP: the "time related" functions (Integral and Derivative) are "off" by a factor of 60 ... that's because this configuration of the PID uses SECONDS – and the PIDE uses MINUTES ...

IMPORTANT! ... the signal for the INPUT is NOT being shown in this series of graphs ... the basic idea is to provide a repeatable "dummy" signal (I call this a "profile") as the input to BOTH of the instructions simultaneously ... in other words, the PID and the PIDE are both "looking at" the same input signal – and each instruction is then calculating its own OUTPUT signal ... but NEITHER of the two outputs is actually in control of the process ... specifically, the input signal just ramps up and down – regardless of what the controls (PID and/or PIDE) do in response ... so in this "test" setup, nothing that the PID or PIDE controllers (bless their little hearts) can do will alter the INPUT signal ... this allows us to perform a side-by-side COMPARISON of how the two instructions perform ... I've been using this same "dummy input" technique for years to learn about – and to teach – certain PLC concepts which are exceedingly hard to understand using any other method ... yes, eventually you'll HAVE to have a complete "feedback loop" available in order to actually practice "tuning" – but that's another fish – to be fried another day ...

now back to our story ...

in the screen shot below, we can see that the PID and the PIDE are both giving essentially the SAME RESPONSE to the dummy "profile" input signal (not shown) ...

true, there ARE some sections where the PID's red trace deviates from the PIDE's green trace ... those deviations are the result of a "filter" applied to the Derivative component – which is built into the (old fashioned) PID – but is NOT incorporated in the (new fangled) PIDE instruction ...

so ...

as far as I'm concerned, I'm not seeing that the "enhanced" PIDE has any ability to perform "better control" over a process than the UN-enhanced PID ...

but ...

maybe the optional "autotune" feature is attractive to you – or maybe all of those extra "bells-and-whistles" controls could come in handy – or maybe you just love programming in Function Blocks ... whatever ... if you've got a REASON to go with the PIDE – then go for it ...

personally I don't usually enter into the debate about which method of control is "better" ... but then I'm invariably just teaching my students how to deal with "what they've got" back at the plant ... specifically, my students are usually maintenance technicians – who don't get to choose their battles ...

it usually boils down to this ... once upon a time, a certain "programmer" put this PIDE thing in our plant's program – and now we've got to understand enough about it to get the pump back into operation again ...

when you're troubleshooting a $y$tem with the boss breathing down your neck at 3:00 o'clock in the morning, it's hard to be impressed by 167 "extra" parameters – and wondering if one of those fancy settings just happens to be keeping the pump from running ...

anyway ...

as the chart below shows, I suppose that the PID could actually be considered to give a "smoother" control over the Derivative action than the "enhanced" PIDE ... but for my money, it essentially it looks like a dead heat in the overall "ability to control" competition ...

.

PID_VS_PIDE.PNG
 
going further into the PID vs. PIDE comparison ...

here is one of the advantages that the "book" mentions for the newer PIDE over the older PID instruction:

The PIDE instruction uses a velocity form PID algorithm similar to that used in most DCS systems. This allows "bumpless adaptive gain changes" – You can change gains on the fly without initializing the algorithm.

in the chart shown below, we've made an "on the fly" change to the proportional gain for each instruction - to compare how the PIDE and the PID methods handle this type of operation ...

the "bump" to the PID's red trace is easily seen ... and true to the book's word, the PIDE's green trace has no such "bump" when subjected to exactly the same modification ...

.


PID_VS_PIDE_changed_P.PNG
 
besides the PIDE (Enhanced PID) instruction, RSLogix5000 offers the PI (Proportional Integral) instruction – which can also only be used with either Function Block or with Structured Text programming ... specifically, the PI instruction cannot be used in Relay Ladder Logic ...

the PI instruction offers an interesting feature which is not available with either the PIDE or the PID instructions ... you can use the "gains shaping" feature to alter the Proportional Gain and/or the Integral Gain – based on the amount of "error" (deviation from the setpoint/target) that the instruction "sees" ...

before we perform a simple "gain shaping" experiment, take a look at the chart below ...

here we're comparing the "normal" response of a PIDE instruction – with the "normal" response of a similarly tuned PI instruction ... again the values of the settings are different since the two instructions use different units for their gains – but obviously there is no "better control" available with either of the instructions – at least at this stage of the game ... specifically, the responses are so similar that the PIDE's white trace is almost completely obscured by the green trace of the PI instruction ...

naturally we had to turn the PIDE's Derivative action off (0.0 setting) to give the PI a fighting chance ... but once we leveled the playing field, the PI has no trouble keeping up with the "enhanced" PIDE ...

.

PIDE_VS_PI.PNG
 
the chart below shows two PI instructions ... for the purposes of this demonstration, each PI is using ONLY Proportional action – specifically, the Integral action has been turned off for both of the instructions ... this will make it easier to identify the "gain shaping" feature ...

the GREEN trace shows the "normal" response of a "Proportional only" controller ... the 0.0 setting basically turns OFF the "shaping" feature ...

the RED trace shows the response of the Proportional action being "shaped" by the 2.0 setting ...

in SIMPLEST terms, once the error (the deviation from the desired target) reaches a certain point, the "shaping" comes into play ... this could be regarded as "cranking in some extra" proportional action – but only when it's needed ... I suppose that in some applications, this might come in quite handy ...

the Integral action can also be "shaped" in the same way – it's just harder to identify its response on the chart ...

hopefully this thread will shed some extra light on the BASIC differences between the PID, the PIDE, and the PI instructions available in RSLogix5000 ...

party on ...

.


PI_with_P_Shaping.PNG
 
Ron, thank you for going through this exercise. I wrote some code to simulate the motor I will be controlling so I could test my speed control loop, and could not get the PID and PIDE instructions to provide the same performance. I hadn't picked up on the I and D gains being off by a factor of 60, once I adjusted the gains appropriately they now track each other perfectly.

Depending on your control loop speed, the scan time of the PIDE could be a concern. I think I read that it is around 2x the scan time of a PID instruction. I'm running my simulated speed loop at 10ms right now, so scan time is important, but some of the commands like integral hold on the PIDE are nice to have.

Edit: I just looked in the execution time manual, and for an L62, the PIDE takes 147us to execute, whereas the PID is between 55 and 70us depending on integer/real and what mode it runs in.
 
Last edited:
Does the variable gains only depend on error? If so that is SO WRONG. Changing the gains should be done in response to the system changing, not errors. Changing the gains as a function of something in the system changing is useful. One can change the PID gains on-the-fly can't they?
 
I've done some more playing around with my simulator, and I can recreate a condition where the PIDE does something that I can't quite figure out. On a speed increase command, the PID and PIDE output (and calculated speeds) track each other until just after they reach setpoint, the PID overshoots slightly more. After about 500ms, the PIDE increases output temporarily, causing a brief overshoot further above the setpoint. The dark blue is PID controlled speed, light blue is PIDE controlled speed, orange is PID output torque, and red is the PIDE torque command. Light Green is the ramped setpoint.

I've attached the images of the same event.

Image1.jpg Image2.jpg
 
I figured out that the behavior above was related to my limiting the min and max CV value based on shaft speed. The system was overshooting, then the integrator had to wind down until it got below the max CV setting to reduce the shaft speed to setpoint.
 
glad you got it figured out ...

TIP: if you have to post any more graphs, PLEASE double-click the dark blue icon in the upper left corner and choose a better color than dark-blue on black ...

why on earth do the Rockwell guys always use that combination as the default? ...
 
Very interesting, hope this thread it's not so old: since I'm going to perform a similar test to compare two PID algorithm soon, I'll be grateful to know what kind of "Test Input" you used in this test... just curious. Thank you very much!
 
I'm not going to compare two Rockwell PID... nor compare them a Rockwell system too. Let's say I have two PID codes/FB/AOI and I'd like to compare their behaviour, finding differences on how they work (i.e. effects on modifying their parameters)
 
besides the PIDE (Enhanced PID) instruction, RSLogix5000 offers the PI (Proportional Integral) instruction – which can also only be used with either Function Block or with Structured Text programming ... specifically, the PI instruction cannot be used in Relay Ladder Logic ...

the PI instruction offers an interesting feature which is not available with either the PIDE or the PID instructions ... you can use the "gains shaping" feature to alter the Proportional Gain and/or the Integral Gain – based on the amount of "error" (deviation from the setpoint/target) that the instruction "sees" ...

before we perform a simple "gain shaping" experiment, take a look at the chart below ...

here we're comparing the "normal" response of a PIDE instruction – with the "normal" response of a similarly tuned PI instruction ... again the values of the settings are different since the two instructions use different units for their gains – but obviously there is no "better control" available with either of the instructions – at least at this stage of the game ... specifically, the responses are so similar that the PIDE's white trace is almost completely obscured by the green trace of the PI instruction ...

naturally we had to turn the PIDE's Derivative action off (0.0 setting) to give the PI a fighting chance ... but once we leveled the playing field, the PI has no trouble keeping up with the "enhanced" PIDE ...

.

I think this "gain shaping" is a very interesting feature. Often i thought why most controllers cant adapt the "gain" if the error is big, to get faster to the setpoint, but without increasing the gain at stable conditions. Now i see there is a Rockwell PI which can do that. Thanx Ron.

My question is: Does anyone have experience on implementing a adapative gain in real world machines? Did you use the parabolic curve (like this PI instruction) or a linear one? Is it really a big difference in terms of control?
I want to control temperature and pressure (i know its very vague and it depends on a lot of other factores).

Best regards
crawler009
 
Last edited:
TIP: the "time related" functions (Integral and Derivative) are "off" by a factor of 60 ... that's because this configuration of the PID uses SECONDS – and the PIDE uses MINUTES ...
Thanks for that tip! I used Autotune to get the P, I, D parameters then entered them into my PID, and it was driving me crazy why my PIDE was rock solid but the PID was so unstable. It's because my I & D were off by a factor of 60. It slipped my notice that the time parameters were different. Thanks Rockwell for not making them the same!
 
Last edited:

Similar Topics

I'm trying to import a .prj file and I keep getting the error message: Project import error. i Any ideas how to get around this? Thanks.
Replies
0
Views
51
Hi, I am looking for some help with a GE Fanuc Versa Max Micro Controller model IC200UDR001-BF connected to a Quickpanel mini display...
Replies
3
Views
128
Hello, I want to plot a line on X,Y axis with defined start and end points on Quick Panel+. I use PAC Machine Edition 9.7, and it supports...
Replies
14
Views
1,705
Hello, I want to plot a line on X,Y axis with defined start and end points on Quick Panel+. I use PAC Machine Edition 9.7, and it supports...
Replies
0
Views
332
I have previously shared this elsewhere, so I apologize if you have already seen it. Here is a basic and quick introduction to Python for PLCs...
Replies
10
Views
2,189
Back
Top Bottom