Pid control - rs logix500

NathBarreiros

Member
Join Date
Jan 2021
Location
Ecuador
Posts
11
Hello everyone!

I've been trying to test the PID block on RsLogix500, replicating examples from some videos, however; I have not found a way to solve the problem I have and I hope you can help me.

I dont have a physical PLC so I am simulating its operation with an emulator. I have an analog input that reads from 0 to 100%, I scaled it from 0 to 16383, for the setpoint, I did the same as I mentioned before. I have created a PID file to load it into the PID block, I moved the setpoint value to the PD9:0.SPS register, in the PID block. The process variable is the first scaled value that corresponds to the analog reading, I saved the control action in another integer register and this one I scaled from 0 to 31208, in order to have the value in the analog output variable.

This corresponds to the first two images.

http://www.plctalk.net/qanda/attachment.php?attachmentid=56968&stc=1&d=1610863052

http://www.plctalk.net/qanda/attachment.php?attachmentid=56969&stc=1&d=1610863056

As can be seen, the setpoint value does not move to the PD9: 0.SPS register, it seems that perhaps the value is overflowing so it even turns negative, however; when raising or lowering the setpoint, the value shown in PD9: 0.SPS, is randomly positive or negative (or at least I could not find any logic).

Then the PID block does absolutely nothing as it does not deliver any control output.

The configuration that I made of the PID is the one shown in the last graph, it is observed that there is no control output, but the gain Kc of the controller actually changes, the Reset Ti value, I set it to 0.1.

http://www.plctalk.net/qanda/attachment.php?attachmentid=56970&stc=1&d=1610863653

I would like to know how to make it right.


Thanks in advance.​

Captura1.JPG Captura2.JPG Captura3.JPG
 
Start off by triggering your PID instruction with the .DN bit of a self-resetting timer, say every 100mS. Having it permanently enable like that is a no-no.

Then see if you get some degree of success.
 
Yes typical PID sampling using a timer to trigger it is between 100ms & 1 second, also ensure the trigger is a one shot not a duty like 100ms on 100ms off.
 
Yes typical PID sampling using a timer to trigger it is between 100ms & 1 second, also ensure the trigger is a one shot not a duty like 100ms on 100ms off.

Which is why I suggested the .DN bit of a self-resetting timer.
 
Yes I was just re-iterating the fact it needs to be a one shot, the OP may be a novice & not familiar with how to create a self resetting timer, Incidentally not sure if it was on an SLC but have had situation where using the not .DN bit on the timer enable did not start the timer from power up, had this a few times so used the not first scan bit as well to give a false to the timer on PLC first scan.
 
... I dont have a physical PLC so I am simulating its operation with an emulator. ..​


Check the emulator documentation: does the emulator implement the PID instruction? For example, RSEmulate 500 6.00.00 does not. It feels cruel that the emulator happily takes the PID instruction with its inputs and output but does nothing with them, but there it is.


That said, it is not hard to implement a PID in ladder, but I expect the goal is to have experience with the actual PID instruction.

All programs are a model of something in the real world, and the emulator is no different; the first design choice of any model is the level of fidelity, and apparently PIDs were not chosen to be faithfully represented in RSEmulate.

Another choice is the result of multiplying two 16-bit INTs: the emulated MUL instruction uses REALs to do the multiply and only keeps the high 24 bits of the product; so if one is interested in the low 15 bits of such a product e.g. for a linear congruential generator, then they cannot use 16-bit INTs.
 
Last edited:
DR is right to check the emulator docs, many emulators do not process certain instructions or special types or instructions & especially types of cards like HSC's, Analogues coms etc.
 
Hey guys!

Thanks for the observation, it makes sense that I need to trigger the PID. So I did it,however it didnt work.

http://www.plctalk.net/qanda/attachment.php?attachmentid=56977&stc=1&d=1610896946

Then I verified what Drbitboy commented that maybe the emulator does not support the PID instruction, I use the RSLogixEmulate 500 6.00.00 emulator and in effect, it does not allow to use some functions including the PID.
o_O

http://www.plctalk.net/qanda/attachment.php?attachmentid=56978&stc=1&d=1610896946

Maybe you know about other emulator software that supports this instruction?

Thank you for all your replies. (y)

Captura4.JPG Captura5.JPG
 
Side note- are you guys sure that you can't leave the PID instruction on an unconditional rung like that in 500? My recollection is that 500 doesn't suffer from the same issue as 5000 where the instruction needs to be executed exactly as often as the loop update time, else the gains get affected. But my it's been a few years since I've done a PID in 500, so I may be mistaken.
 
Last edited:
rupej is correct ... the PID in RSLogix500 has a BUILT IN timer which will take care of its own "triggering" ... AS LONG AS - the TIME MODE setting is set for the "TIMED" option - which according to the screen shots posted the TIME MODE setting is correctly entered ...

specifically, with THIS software, the PID instruction can indeed be placed on an unconditional rung ...

DISCLAIMER: I haven't looked through the rest of the problem - only this one observation ...

QUESTION for the OP: can you post the entire RSS program file? ... note: just ZIP the RSS file and attach it to this forum thread ... if you place it in a "dropbox" instead then there are some of us who will not retrieve it (for security reasons) ...
 
Last edited:
update:

the post about the Emulator just came in while I was typing ... as you've seen, the emulator does NOT process the PID instruction ... you've got to have an actual processor to play with the PID ...

best of luck with your project ...
 
Maybe you know about other emulator software that supports this instruction?




Update: it's LogixPro, cf. http://thelearningpit.com/, 15-day trial, priced at $24 currently for the pandemic.



There is a non-Rockwell programmer-emulator tool (RSLogix500-style; maybe for training?) that was mentioned a few days ago; the filename extension is .rsl. I think the price was under 50USD. IIRC, it also has a trial mode.


I don't know whether it has the PID instruction.
 
Last edited:
rupej is correct ... the PID in RSLogix500 has a BUILT IN timer which will take care of its own "triggering" ... AS LONG AS - the TIME MODE setting is set for the "TIMED" option - which according to the screen shots posted the TIME MODE setting is correctly entered ...

specifically, with THIS software, the PID instruction can indeed be placed on an unconditional rung ...

I never got to play with PID in 500 Ron, thanks for that heads-up, I just assumed that as it is an instruction that uses time as one of its variables that it needed to be kicked on a regular timebase.

It does make you wonder why they dropped the idea for Logix5000, "if it ain't broke - don't fix it".

Along the same lines as another thread I'm subscribed to about the Logix5000 FRD instruction, which does not work correctly ....
 
You guys keep forgetting there is the Hotrod.zip file in the downloads/misc section where I wrote a simulator to simulate Ron Beauforts hotrod students trainers. The ladder is for the SLC500 and ML1500.

I'm confident that you did a much better job than RA's efforts.

Surely it can't be difficult to write an emulator for a Windows PC that emulates a PLC ? And marketing an emulator that does not emulate 100% is... well, just wrong !

Yes of course I understand that speed of execution is going to be a factor, you will not match the scan time of a dedicated PLC, but at least emulate the instructions available, with a caveat that PID terms cannot be relied on. Having said that, they shouldn't be a million miles away, since RA themselves produced SoftLogix to run under Windows.

There will always be some things an emulator cannot do, but what is must do is emulate all instructions, even if it cannot do some as well as it should be able to ....

I gave up on RA emulation way back when I discovered that parameter passing to subroutines was handled in the exact REVERSE ORDER to what a PLC did. This is NOT emulation, in any shape or form. Our company and client standards relied upon the PLC order of parameter passing, so we were left high and dry.
 

Similar Topics

I have S7 1512C controler for controlling 48 PID temperature loop, the output is PWM. Please I need the best, most efficient way to write the...
Replies
13
Views
586
Hi all, I'm having trouble solving a problem I've been working on for several months, and thought you might like a stab at it. The machine runs...
Replies
22
Views
920
How can I connect PID Output to a valve. In ladder logic program is there any logic do I want to add between valve and PID? PV=SP What will be the...
Replies
7
Views
406
I am setting up control for Hypochlorite dosing. The easy part is the dosing calculation for flow pacing but I would also like to setup trimming...
Replies
8
Views
941
Hey guys! I'm a newbie in the control area, so I'm gonna drop some thoughts here... We want to control the opening of big silos (about 1900...
Replies
6
Views
1,484
Back
Top Bottom