PID to time proportional

Skidood

Member
Join Date
Oct 2016
Location
Ontario
Posts
215
All this recent talk of PID brought me back to an issue I was looking at a few months ago.
My next project will involve cycling a valve to provide a PID controlled heating function.
In the screenshot below, we see an example provided by Rockwell in the SLC instruction set manual of how to convert a PID CV output to a "time proportional" digital output.
But they managed to obscure an address with an arrowhead. See the red circle. Can someone take a guess as to what is under that arrowhead?
Thank you kindly!

Untitled.png
 
It looks like Bit 13 of PID Control Word 0 is a one-shot that is 1 one the single scans when the PID updates.

Cf. this link, page 296, as noted by @Steve Bailey.
Untitled.png

Untitled2.png
 
Now how do you do this without a timer but assume you are executing the PID every 10 ms using a timed interrupt. Think about it.

Trick question, because PLC programs are about time, and are never without a timer of some sort, including the scan cycle itself; the only question is the fidelity requirement vs. capability.
 
Assume you are using timed interrupts. Assume the CV is 0 to 100. The upper limit isn't that important but I will assume the CV range is 0 to 100.
The trick is to accumulate the CV or add the output of the CV to a CV_SUM. Now it the CV_SUM is >=100 then the output is on and 100 is subtracted from the CV_sum. Otherwise the output is off. The amount of code for this is small. You can see the upper limit of the output doesn't make much difference.
If using a real DtoA converter with a range of 0-4095 then the upper limit is 4096. There is no need to scale the output to a round number like 0 to 100 or 0 to 1000.
Simple.
 
The Rockwell strategy above to convert the CV to "time proportional" didn't appeal to me, plus I can't use double divide, not supported on my PLC, so I came up with my own logic which was a lot simpler, in my mind.

The problem I'm having now that I can't get the PID instruction to execute.
I have read all the documentation.
Tried it in an STI...can't even get the STI to work.
Tried it a normal routine...didn't work
Im using an integer like 10000 as a setpoint, with no limits set on the CV
My PV is 1000 which is also a integer
Mode is auto and timed. Interval is 0.1 seconds.

Using RSEmulate and I can see the program running, no problem. The PID rung is green as it should be. I give up. I have enough problems in life, I don't need this silliness.
 
The Rockwell strategy above to convert the CV to "time proportional" didn't appeal to me, plus I can't use double divide, not supported on my PLC, so I came up with my own logic which was a lot simpler, in my mind.

The problem I'm having now that I can't get the PID instruction to execute.
I have read all the documentation.
Tried it in an STI...can't even get the STI to work.
Tried it a normal routine...didn't work
Im using an integer like 10000 as a setpoint, with no limits set on the CV
My PV is 1000 which is also a integer
Mode is auto and timed. Interval is 0.1 seconds.

Using RSEmulate and I can see the program running, no problem. The PID rung is green as it should be. I give up. I have enough problems in life, I don't need this silliness.

RSEmulate does not emulate the PID instruction.

Cf. here and here.
 
Last edited:
That said, it would not be difficult to code a Program File that emulates the SLC 5/xx PID instruction.

The size of the task depends how many features are to be included. E.g. P and I action, and Auto/Manual would take but a handful of lines. Any single timing mode should not be too tough' handling all timing modes would be a bit (pun intended) more involved.
 
I would love to immerse myself in that but at some point a guy's gotta do things like eat and attend to personal hygiene. But yeah, I'm just using P and I....and Auto...haven't even looked at the equation yet. If I do, I'm in trouble. I just got a PO in for 90K for something unrelated to PLCs so my mind is going a little haywire right now. (as per usual).


That said, it would not be difficult to code a Program File that emulates the SLC 5/xx PID instruction.

The size of the task depends how many features are to be included. E.g. P and I action, and Auto/Manual would take but a handful of lines. Any single timing mode should not be too tough' handling all timing modes would be a bit (pun intended) more involved.
 
Writing a PID is easy. The SLC500 PID uses integers. I would use floats.
I don't know what drbitboy means by timing modes. The time between PID executions should be fixed and put in a timed interrupt so updates are done a relatively equal intervals. If the PID is to run in the main scan then it is necessary to read the system clock to compute the time since the last time. There should be NO need to enter a scan time. Most of the calculations could be done in a few compute blocks.
 
I don't know what drbitboy means by timing modes.


The SLC 5/xx PID instruction has two timing modes, both of which @Peter Nachtwey describes, even though he claims not to know what they are (there is nothing new under the sun ;)); which mode is active is determined by the state of a bit in the Control Block word 0 (TM, bit 0).

What I was referring to was whether a manually-coded PID would have such a configuration option and would model both timing modes of the SLC PID instruction.
 
...
But they managed to obscure an address with an arrowhead. See the red circle. Can someone take a guess as to what is under that arrowhead? ...
The bit number is text in that PDF, so even though the arrow is covering it, it can be double-clicked to select the text (see image below), then copied, then pasted somewhere else to read it.
Untitled.png
 

Similar Topics

I want to use a proportional valve for controlling the pressure in a tank/cylinder. In our design we need to have two profiles for PC valve. The...
Replies
5
Views
2,056
I'm trying to improve tuning on Watlow 'Series PD' PID controller and am using some tuning guides to help. Application is simple temperature...
Replies
7
Views
7,077
Hello everyone. I have a proportional air valve FESTO MPPE-1/4-420-B. It controls pressure for a spray gun. The operational pressure is 800...
Replies
17
Views
5,435
I found this question in my Personal Message box ... not sure why the sender didn’t just post it to the open forum ... the questions are valid and...
Replies
7
Views
7,662
Hi. First let me say I've been reading this board almost daily since last July when I first started PLC programming, and have found it to be a...
Replies
6
Views
18,197
Back
Top Bottom