Time proportional regulator

Varri

Member
Join Date
Jan 2020
Location
South
Posts
30
Hello!

I need to make a pulse length / time proportional regulator in somachine basic, this is to control a digital output for adding chemical to waste water. We measure the pH and thats process value.

the output should be:

(process value - setpoint)
------------------------------- X process reaction time
proportional band

Is there anyone who have made a function like this from scratch?
 
PID May Not Be Necessary

For many basic applications, PID may be overkill. Proportional control can be simply proportional without the need of Integral and Derivative calculations. Stick with Proportional and use "Timed Proportional" control commonly used for digital output control of valves, dosing pumps, and other on/off actuators. Therefore, this only requires a few basic math instructions.

For example, if a 4 second timer is used and the Proportional output value is 50%, the digital output is on for 2 seconds and off for 2 seconds. 75% would be on for 3 and off for 1 and so on.

Below is not a specific programming language, but it should be sufficient to get an idea of rudimentary timed proportional control.

Using PH and a dosing pump as as an example, this could be done to keep a solution from being acidic:



  • IN = pH Probe Input value
  • MAX = 7.5 pH
  • PBand = 1pH
  • Error = MAX - IN
  • LOW = (MAX - PBand)
  • Timer_PRE = 4000 Milliseconds
  • Timer_ACC = Accumulated time
  • Timer_DN = Timer done
  • Percent = 0 - 1.00
  • Output_Time = Timer_PRE * Percent
  • Dig_Out = Dosing Pump on
// First Determine the percentage
If (IN < LOW) Percent = 1.00;
If ((IN > LOW)&&(IN < MAX)) Percent = (Error/PBand);
If (IN > MAX) Percent = 0;
// Compare the timer's accumulated value to the output time to set the digital output. This timer resets continuously. Use a minimum requirement to inhibit the output from chattering. In this case, 1/2 second (500 Milliseconds).
If ( Output_Time < Timer_ACC) Turn off Dig_Out;

If (Timer_DN) {
Reset Timer;
If (Output_Time > 500) Turn on Dig_Out;
}
This can be reversed for adding Acid(downward targeting). There can also be more complex features added such as ramping, variable set points and offsets. No PID instructions are necessary. Different control systems will react exactly the same without having to deal with multiple proprietary configurations. The only "tuning" necessary is the timer preset length and the PBand size.




Cheers!
 
Thank you for a very good reply!

I will now try to use a level transmitter to get a estimate of the batch size.
 
Hello!

Could you show me how you reverse this? my setpoint is 3,5pH and its downward targeting
IN = pH Probe Input value
MAX = 7.5 pH
PBand = 1pH
Error = MAX - IN
LOW = (MAX - PBand)
Timer_PRE = 4000 Milliseconds
Timer_ACC = Accumulated time
Timer_DN = Timer done
Percent = 0 - 1.00
Output_Time = Timer_PRE * Percent
Dig_Out = Dosing Pump on
// First Determine the percentage
If (IN < LOW) Percent = 1.00;
If ((IN > LOW)&&(IN < MAX)) Percent = (Error/PBand);
If (IN > MAX) Percent = 0;
// Compare the timer's accumulated value to the output time to set the digital output. This timer resets continuously. Use a minimum requirement to inhibit the output from chattering. In this case, 1/2 second (500 Milliseconds).
If ( Output_Time < Timer_ACC) Turn off Dig_Out;

If (Timer_DN) {
Reset Timer;
If (Output_Time > 500) Turn on Dig_Out;
}
 
I got it working.

This line: If (IN > MAX) Percent = 0;

If the input where to match the SP suddently, the timer output would use its last calculation. Changing the line to greater or equal fixed it, a simple thing to spend hours on....
 
I got it working.

This line: If (IN > MAX) Percent = 0;

If the input where to match the SP suddently, the timer output would use its last calculation. Changing the line to greater or equal fixed it, a simple thing to spend hours on....

by the same token the (IN < LOW) expression should be (IN <= LOW)
 
“Not rocket science”

Sorry about the delay. You are correct about adding the “=“ especially if there is a stabilized condition where the input hovers within that range. My haste in the language can waste time.

To reverse for “Downward Targering”, the MAX and LOW are reversed along with the Error calc. I would change the original settings to the following using the addition of the “=“ condition:

LOW = 3.5 pH
PBand = 1pH
Error = IN - LOW
MAX = (LOW + PBand)

If (IN > MAX) Percent = 1.00;
If ((IN > LOW)&&(IN <= MAX)) Percent = (Error/PBand);
If (IN <= LOW) Percent = 0;

This is an effective way to control “rubber band” conditions. Another example would be for temperature control. If the temperature rises when the output is on and then falls when it is off, no PID control is required. Pulse Width Modulation can also be excessive with outputs cycling too much.

The reverse function works the same with dropping temperatures or pressure.

This approach can also be used for analog outputs. Simply remove the timer and convert the “Percent” to an analog signal.

“If it’s not rocket science, don’t make it rocket science.”

Cheers!
 

Similar Topics

hello, I am trying to connect the analog proportional regulator from Festo (VPPM-6L-L-1-G18-0L6H-A4P-S1) to automation direct analog output...
Replies
6
Views
1,381
Anyone ever PWMd the coils of a bang-bang valve? I tried it recently so that I could reduce machine setup-time by eliminating the manual flow...
Replies
41
Views
5,112
Anyone have experience w/ this module/application. I have been tasked w/ using this module to control the flow of chemicals w/ a iQ Tesla...
Replies
4
Views
1,438
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...
Replies
14
Views
2,615
Hi, Fairly new to plcs so sorry for the noob question. I have a honeywell hc 900 PLC that has a PID loop with PB% of 25, I=.45, D=0. I have...
Replies
17
Views
4,067
Back
Top Bottom