I want to be able to choose 2 the possibility of increasing the pressure 4 and 8 minutes
Hello, I am not sure I understand this, do you mean this?
Chcę, aby sterownik PLC mógł wybrać jedną z 2 opcji: zwiększenie do stałego ciśnienia końcowego za 4 minuty lub za 8 minut
(I used Google to translate to Polski from "I want the PLC to be able to choose one of 2 options: increase to constant final pressure in 4 minutes or in 8 minutes" - please do not apologize for your English, it is far better than my Polski I am sure)
Anyway, assuming that is correct, then build the model from pieces:
- A timer, Ramp1sTimer, that can generate a rising edge every 1s
- A counter, RampCounter, that will have a preset of either 240 (4 minutes) or 480 (8 minutes).
- A PID that controls the pressure
- A way to enter either 240 or 480 into the counter preset
- A way (HMI? discrete input?) to write a 1 to a bit (boolean) named StartRamp, to start the ramp.
- A bit named RampIsActive: will be 1 when ramping the pressure control PID setpoint
I will assume the pressure starts at 0bar; if it starts somewhere else that changes the arithmetic calculation but not the approach.
There will be several rungs
- Rung 1: a Start/Stop Circuit pattern (see this link) to determine when the ramping is active
- Start: Normally Open test of the StartRamp bit
- Stop: counter is done (accumulator >= preset)
- Implemented here as [Normally Closed] test of RampCounter
- Run: the bit named RampIsActive as both
- the output of the rung, and
- the seal-in branch i.e. [Normally Open] RampIsActive
- Rung 2: the repeating timer Ramp1sTimer with a 1s period, that is active when the value of RampIsActive is 1 i.e. [Normally Open] test of RampIsActive, probably in series with a [Normally Closed] test of Ramp1sTimer
- Rung 3: the counter RampCounter fed by a [Normally Open] test of Ramp1sTimer, so the RampCount counter increments by 1 each time Ramp1sTimer times to 1s
- Rung 4: if RampIsActive is 1, then the result of the following calculation should be put into PID.Setpoint:
- 6(bar) * RampCounter.Accumulator ÷ RampCounter.Preset
- Rung 5: RampCounter should be reset whenever RampIsActive is 0 i.e. [Normally Closed] test of RampIsActive feeding a reset instruction
- Rung 6: if the 1 in StartRamp was written from an HMI, then there should be a rung to write a value of 0 to StartRamp whenever the value of RampIsActive is 1
Once the StartRamp bit puts a 1 in RampIsActive, the seal-in will maintain that 1 in RampIsActive until the counter completes.
When the counter completes, it will put a 0 into RampIsActive, which will stop the repeating timer (rung 2) ; it will also stop writing to PID.Setpoint (rung 4).
Caveats
It will actually take longer tha 4 or 8 minutes to get to 6bar, because the Integral action of the PID will be doing most of the work, and that will only occur when the PID sees non-zero error i.e. when the measured pressure PV is behind the ramping (moving) setpoint. One way to adjust for this would be to ramp over a shorter time e.g. use presets of 230 or 470 in the counter.
At any time, if StartRamp becomes 1 again, the sequence will repeat from a setpoint of 0; this might be a problem if the process is already steady at 6bar. So it might be useful to have some logic to prevent StartRamp becoming 1 from writing a 1 to RampIsActive, e.g. when the PID setpoint is above 0.05bar.
The PID control is left as an exercise for the user. We do not know the process or how the PID output controls the pressure; it could be anything:
- The VFD speed reference of a motor driving compressors or pumps to pressurize a tank or piping system
- The inlet or outlet valve of a tank volume
- A steam valve into a vessel to cure a product via ramp and soak
- etc.
P.S. I agree with the others who said the PID might not be necessary, so you should consider at the entire process.