Reseting a PID

darrenj

Member
Join Date
Feb 2005
Location
Ottawa
Posts
1,003
Hi all..I have a PID instruction that is only called when a valve is open, when the valve closes the rung for the PID is false. However the PID still "remembers: the last value of the CV so the next time the valve is opened my CV starts from there..Is there any way i get the CV to start from 0 every time the rung goes true?

I have tried writing a 0 to the PID.SO (That holds it at 0 for as long as the write takes place but then jumps back to the old CV)

any help would be appreciated

Thanks

Darren
 
Darren

Place a 0 in the .SO, place the PID in manual mode, execute the PID instruction again (you can do this more than once during a scan) then place the PID back in auto mode. You can place all this on one rung that executes once on a single shot only when the valve closes.


Caution: If anyone attempts this with a SLC500 or ML (Darren is apparently using a PLC5 here) there are some special concerns that must be addressed - I won't go into them unless needed as it is very late here - just that it won't work on a SLC unless you do it a very specific way.
 
Darren, if you are using the ladder PID instruction in the CLX I believe that you do it the same way as in the PLC5.

However in the CLX I have only used the PIDE. If you were using the PIDE it is much simpler. You just place a 0 in CVInitValue and set the CVInitReq bit. After the PIDE had reset the CV it will clear the CVInitReq bit for you.

Let me know how it works out on the CLX.

Is it possible in your application to just place the PID in manual and leave it in manual and set the .SO to 0 while the valve is to be closed? The PID must execute at least once in manual mode.


Here is a snip from a PLC5 program - I modified the rung logic to show one way you might do it with your valve.
pid0a23wi1.GIF



NOTICE - I'm going to repeat it again for anyone who wants to use this method on a SLC500. This won't work as shown for a SLC500. In the SLC500 if the rung is false the PID instruction will reset the integral sum. In the SLC500 the PID should be programmed on an unconditonal rung, that is a rung with no logic on it ahead of the PID instruction. For initializng the SLC500 PID, the second rung where the PID is placed in manual, executed once, and placed back in auto, must be moved to a subroutine. Then the subroutine is called condtionally only when CV initialization is required. This method prevents the PID from ever being scaned on a rung that is false. This is not a concern in the PLC5 or CLX.
 
Last edited:
The .SO value is only used in the Manual mode. If you were to switch the PID to manual, then back to auto, it would track the output and start from there. A better alternative is to write a zero (oneshotted) to the .OUT or .CV register when either enabling or disabling the PID. This isn't function block (PIDE) is it...cuz that's a different beast entirely.
 
Dr. Watson said:
The .SO value is only used in the Manual mode. If you were to switch the PID to manual, then back to auto, it would track the output and start from there. A better alternative is to write a zero (oneshotted) to the .OUT or .CV register when either enabling or disabling the PID. This isn't function block (PIDE) is it...cuz that's a different beast entirely.

This is the first thing i tried..It LOOKS like every thing is at zero..untill you start the pid again ..then it jumps to the last value..

I was on the right track last night with the .SO and SWM but i never thought about usiung them together..(Lack of sleep!!) I am back in tonight so i will let you know how it goes with the logix platform..

I did try the PIDE last night but couldnt get it to work prperly..(CV stayed real low like about 0.00000001 or so..again i was tired so i know i was missing something silly..)I will take another crack at it tonight..

Thanks Alaric for the ladder..i will see how it works in Clogix..
 
darrenj said:
This is the first thing i tried..It LOOKS like every thing is at zero..untill you start the pid again ..then it jumps to the last value..

This sounds like a timing issue. Most likely, the PID is disabled when the zero is written to it. Since the instruction was not processed at the time the one-shot occured, it remains at its last value. Don't forget that even though the PID is scanned while the rung is disabled, It isn't processing or updating. You would have to write the zero to the .CV and not disable the PID until the next scan for it to be processed. FWIW, I personally would only disable the PID if this is what I WANTED to happen (ie. have the output start out where it left off). If you want it to start from zero, I would typically just latch it in manual (.swm) and write a zero to the output while it is in manual.

But glad to hear you got it working...that's really what matters.
 
Last edited:
Dr Watson,

Yes, the PID must execute at least once to update. The PID does not necessarily update every scan. This can be accomplishe either by a logic construct that has a semaphore bit in parallel with the PID instruction which then places the PID back into auto mode once the rung scans as true, or it can be done by executing a second PID instruction using the same PD file element.

There is a tech note on the AB web site that covers this.
 
Yes, thanks...I do realize this. I've done similar things to switch the control action of the PID in heating/cooling applications. I guess I just figured it was easier to hold the loop in manual.
 

Similar Topics

I will really appreciate if you could help me with this Codesys program in Ladder logic: I am working on a project where I am using TOF function...
Replies
5
Views
2,427
Please Help me! Is the only way possible for reseting a fast counter or HSC the one of the physical inputs or there´s a way of doing it...
Replies
2
Views
1,468
Good day all. May your holidays be merry. When programming using RSLogix (the software used to program Allen Bradley PLC's), how can I have it so...
Replies
6
Views
2,539
Hello i have a problem for controlling of Altivar32 from Schneider. it always says "CANOpen error". "Reset" signal is not helping. i am using...
Replies
10
Views
2,304
I am using an Allen Bradley Micro810 to count cycles on a machine. After 100 cycles a warning light will come on to have maintenance performed...
Replies
3
Views
2,314
Back
Top Bottom