PID for MicroLogix 1500 - conversion issues ...

Ron Beaufort

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



first of all, your original forum doesn't do a good job of handling pictures and other attachments ... so I’ve posted something which might help you here ...



as near as I can tell, the problems that you’re having are related to the manner in which the MicroLogix 1500 displays - and interprets - the decimal places for the settings of Kc, Ti, and Td ... this first picture shows how the PID setup screen will appear with the RG (Reset/Gain) bit turned off ... note that this picture is provided for comparison only ... once you’ve taken a quick look at it, just move on to the next picture ... I’ll concentrate only on that one for the rest of this discussion ... notice that with the RG bit turned off, the Kc and the Ti settings each have only one decimal place of resolution ...



pidrg0.JPG





normally we turn the RG bit ON because that technique gives us more resolution (one more decimal place) for our Kc and Ti settings ... note: the Td setting is NOT affected by the RG bit status ... as near as I can tell, the RG bit is included in the PID setup in order to make the PID backwardly compatible with older style processors that would not support the higher resolution ... in my opinion, there is no reason to leave the RG bit in its default state of 0 ... personally, I always just set it to 1 and leave it that way ... now note the extra decimal places for Kc and Ti in this picture ...



pidrg1.JPG




now let’s look at the actual values which are stored in the data tables for this PID ... keep in mind that these are INTEGER values and so no decimal places are allowed here ...



pidrg2.JPG





so ... note that the data table locations contain the following example integer values:



Kc = 123

Ti = 234

Td = 345



but look back at the second PID picture (with the RG bit set to 1) and you’ll see that the PID INTERPRETS these same values as follows:



Kc = 1.23

Ti = 2.34

Td = 3.45



specifically notice that each one of these parameters has TWO decimal places indicated on the screen ... the PID will use these “decimal place” interpretations for its calculations ...



now ... as near as I can tell by what you’ve posted so far, any remaining problems that you’re having will be the result of differences in the “units” that exist between your original calculations for an “Independent Gains” system and the calculations required for a “Dependent Gains” system ... and yes, I am aware that the term “units” doesn’t really fit into a discussion of “unitless/dimensionless” numbers ... still, I have a hunch that your original calculations were NOT done for an Allen-Bradley PLC-5 controller using the “AB/Independent” gains system ... specifically, I think that you are basing your calculations on some type of “mathematical” model - or possibly on some other brand of PID controller ... am I correct in that assumption? ... if so, then the decimal places that you’re showing in your original calculations MIGHT make more sense to that model or that other controller ... but ... the conversions for the MicroLogix 1500 seem “out of line” ...



just as a quick rule of thumb, let me give you a range of numbers which would “make sense” for most PID applications using a MicroLogix1500 controller ... IMPORTANT! ... at this point, I don’t even know what application you’re trying to tune so these are NOT meant to be suggested settings for your parameters ... all I’m trying to do is give you some guidance as to a range of numbers which would seem “reasonable” in a great many cases ... analogy: “6 to 26 miles per gallon” would be a “reasonable” range of values for gas mileage on a passenger car ... but ... the range “126 to 456 miles per gallon” would seem outlandish ... in that regard, some of the numbers that you calculated for your tuning parameters would certainly seem “out of line” in most applications ... with all of that in mind, these are some values which (again in MOST applications) would seem “reasonable” on a PID setup screen for a MicroLogix 1500 system ...



Kc = 0.50 to 2.00 (16.00 would not be unheard of)

Ti = 0.01 to 2.00 (10.00 would not be unheard of)

Td = 0.01 to 0.90 (anything much higher would be rare)



I really hesitate to post these for fear that you or someone in the future might mistake them for “minimum and maximum” values ... they are NOT intended to be that ... they are merely intended to give you a “ballpark” idea from which to work ... I hope that this helps ... if you need more than this, it would be a good idea to tell us something about your application ... and about how you arrived at your original values ...



just as a final tip: MOST problems with PID on Allen-Bradley systems hinge upon “timing” issues ... specifically, in MOST systems the “Time Mode” entry should be changed from its default setting of “STI” to “TIMED” operation instead ... basic idea: if the PID is left in the “STI” mode, then the PID will calculate a new output value each and every time that the PID rung is scanned by the processor ... this will significantly increase the Integral action and make it “run away” ... it will also adversely affect the Derivative action ...



as a rule of thumb ... in MOST MicroLogix applications, the PID rung should be located in a continuously scanned ladder file (ladder file #2 is recommended) ... and the PID rung should be “unconditional” (having no other instructions other than the PID) ... and the “Time Mode” setting should be set for “TIMED” instead of for “STI” ... if you need help with these concepts, please post again ...



I hope this helps ... and welcome to the PLCs.net forum ...
 
Hello again..

I'm trying to move a DC geared motor that will move an autotransformer or variac and then I will get a voltage at the output (0 to 127 V).

I simulated all my process in MATLAB (I hope you know MATLAB)
and I get this

Matlab.JPG

with
Kp=6
Ki=0.55
Kd=0.05


Then I tried with those constants on the PLC and I get (I plot the output with LABView, and I'm controlling the PLC wit the DSC module from LABView)

nonstable.JPG



So I try to tune the PID by "test-fault" and for a perfect output I get

pid_plc.JPG

with
Kc=5
Ti=1000
Kd=25

Plotting the output...
output.JPG



So I'm trying to validate my model on MATLAB wit my real sistem In fact there many factors affecting the system but at least should be very similar

So in my first post I was trying to convert the PID constants from the PLC to unitless constants for MATLAB, and compare the behaviour
 
first question: is your PID rung located in an STI (Selectable Timed Interrupt) file?

possible answers: "yes" ... or "no" ... or "I'm not sure what you mean" ...

if the PID rung is NOT located in an STI file, then you have a MAJOR issue with your "Time Mode" setting ...

jesuspid.JPG


change this setting to "TIMED" and start tuning the PID all over again ... the numbers should make a lot more sense then ...

basic idea: if the timing of the PID's execution is not right, then the values for Ti and for Td are totally meaningless ... I've got a hunch that this is causing most of your problem ...

second question: what do you have programmed on your PID rung? ... there SHOULD be nothing on that rung except for the PID instruction ...

suggestion: zip your .RSS file and post it here ... we can give you much more detailed help once we see your program ...
 
1st question
Maybe yes.. but I'm not sure what you really mean...

I upload the file...

I'm using just the PID from the PLC micrologix 1500
I read and write into the registers through an OPC Server..

There is no much instruccions on PLC..

the function of the PLC is to provide a PID.. and then in the future it will serve to coordinate several protections and functions

I took the program from the examples on the
"MicroLogix™ 1200 and MicroLogix 1500 Programmable Controllers" manual.. 1762-rm001

 
jesus_adan,

You need to go into the setup menu for the PID and change the timed mode from "STI" to "Timed". Do this by double clicking on it and you can arrow down to the Timed selection. Because the PID is in Lad 2, which is a continous scan file, the PID must be in Timed Mode.
STI mode would be used when the PID is in a routine (Lad 3 for example) that is setup as a Select Time Interupt (STI) routine. An STI routine executes it's scan at a contstant interval, 10ms for example.
Hope this helps.

Patrick
 
sportster is absolutely correct ... change the “Time Mode” setting to “TIMED” before you do anything else ...



here’s what’s happening now ... your current “Loop Update” setting of “1.00” is telling the PID that your program will execute the PID once each second ... that value is currently being used by the PID for its internal calculations for the Integral action and for the Derivative action ... (note the Proportional action is not based on time - so it is unaffected by this setting) ...



so ...



you’ve told the PID that your program will execute the PID once each second ... BUT ... your “STI” Time Mode setting actually forces the program to execute the PID each and every time that the processor scans the PID rung ...



that’s why your Integral action is running so fast ... and that’s why the values that you’ve calculated for Ti don’t even come close to working ...



the units for the Ti setting are “repeats per minute” ... your current Ti setting of “1000.0” means that it SHOULD take 1000 minutes (over 16 hours!) for the Integral action to duplicate the action of the Proportional component ... obviously it’s NOT taking that long ... the reason is that you’re executing the PID much more rapidly than just once per second ...



worst case scenario: suppose that you leave the “STI” setting in place and that you finally do get the PID adequately tuned ... whether you know it or not, the tuning will be based directly on the processor’s scan time ... now suppose that you add more and more program rungs to your program ... this will increase the processor’s scan time and DETUNE the PID ...



so ... do what sportster suggested ...



next issue ... whatever you’re planning to do with B3/2 on your PID rung, it’s probably wrong ... basic idea: if B3/2 is ever executed with FALSE logic, then the PID will clear out its internal registers for the Integral action ... that’s probably NOT something that you want to do ...



suggestion: tell us what you were trying to accomplish when you programmed the B3/2 instruction and we’ll help you do it the right way ...
 

Similar Topics

dear all: we have a automated vehicle which runs on a magnetic tape. we are taking analog input [0 to 10] volts from a reader this has a...
Replies
3
Views
3,664
First,i apologize to everyone for my stupid english! Lately,i am suffering from the PID founction of A-B's PLC which is MicroLogix1500. This...
Replies
2
Views
3,667
I have a Micrologix 1500. Need to control with PID for digital outputs open/close. There is no SRTP function (Split Range Time Proportional) in...
Replies
2
Views
3,259
I need to control about 12 pid loops in a program i am writing. My questions are: 1) is there a max. Number of pid instructions that can be...
Replies
1
Views
2,319
We are looking to upgrade our industrial waste water treatment plant. It has a couple of SLC5/03 (don't want to replace just yet) and an iFix PC...
Replies
0
Views
1,895
Back
Top Bottom