PID is Proportional – Integral – Derivative control. It is the very commonly used in process control, heating control and motion control.
The PID function calculates the “error’ value between a measured process variable and the desired set-point. It adjusts an output in an attempt to minimize the error. This adjustment occurs on a regular period. Each time an adjustment is made, it takes into account the magnitude of the error (Proportional), the accumulated total of the error over time (Integral), and the rate of change of the error (Derivative).
If you are new to PID there is a good description of PID on Wikipedia.
In vBuilder, PID control is a background task. That means that you Start it and it will continue to run in the background, constantly calculating the error, integrating it and determining its rate of change and updating the output based on these factors combined with the constants that you set up. Once started, the PID will operate until it is Paused
The basic PID equation used in the PID function of vBuilder is :
O = P*E + I * ∫ E dt + D * ΔE/dt
- O: Output
- P: Proportional constant (sometimes referred to as the Gain)
- I: Integral constant (sometimes referred to as Reset)
- D: Derivative constant (sometimes referred to as Rate)
- E: Error
- dt: change in time
PID only has to be started once. It will continue to operate until it is Paused.
Start/Continue uses the following parameters:
- Output: This is what the PID is actually adjusting. The Output should have a direct impact on the value of the Process Variable. For example, a butterfly valve controlling the gas supply to a boiler’s burners has a direct impact on the temperature of the boiler.
- Output Max: The maximum value allowable for the Output. Regardless of the result of the PID calculation, the Output will be restricted to no more than this value. [any variable type except Bit and ui8]
- Output Min: The minimum value allowable for the Output. Regardless of the result of the PID calculation, the Output will be restriced to no less than this value. [any variable type except Bit and ui8]
- Process Variable: This is the measurement of the parameter that you are trying to control.
- Set Point: This is the desired value of the Process Variable at this time
- Input Max: The maximum value of the Process Variable measurement that will be used for the PID calculation. If the actual measurement goes above this value, this value will be used.
- Input Min: The minimum value of the Process Variable measurement that will be used for the PID calculation. If the actual measurement goes below this value, this value will be used.
- Proportional: The constant multiplier to the error.
- Integral: The constant multiplier to the integral of the error.
- Derivative: The constant multiplier to the derivative of the error.
- Sample rate: The amount of time between each PID calculation/adjustment, in milliseconds.
- Freeze bias: This is a selectable option. If selected, it is used to limit the impact of integral portion of the equation to no more than the entire Output range. This is useful in preventing overreaction after a time period where some factor prevented the actual control of the Process Variable [which could possibly result in a huge integral value].
When you Start a PID, it will continue operating at the defined sample rate, behind the scene. In other words, once you start it, you don’t need to continue to execute PID Start/Continue blocks for operation. It doesn’t hurt anything if you do. Its just not necessary.
A PID Pause block stops the PID from operating.
Select the Output variable of the PID that you want to pause, as shown on the right.
A PID Reset sets the Integral value to the value required to produce an Output equal to the Reset Value. You should do when starting a PID. The Start/Continue does not initialize the Integral value, because it does not know whether this is the actual Start or whether it is a Continue. When you place a PID Reset in a flow chart, select the Output variable of the PID that you want to reset, as shown on the right. Select the value of the PID output to start the PID with.
PID with digital output?
It’s not useful to connect a PID to a digital output, because the PID produces a continuous (versus discrete) signal.
You need some way to make that continuous output relevant to the hardware components. This is most commonly done with PWM – pulse width modulation – in which the output is turned on for a varying length of time depending on the PID output. However, some hardware components don’t like being switched on and off quickly, so you may need to limit the rate at which the valve switches (by running the control loop at a low frequency).
https://www.support.aceautomation.eu/knowledge-base/subroutines-to-download-for-vbuilder/ See “PID to PWM conversion”
With the digital output, you will lose some of the advantage of the PID. You have to compare the output for on/off with the set-point. Essentially, it often takes a long on/off cycle time to protect the hardware components.
In Ladder: How to execute tasks only once at startup?
Useful for defining the starting value of certain tags or for background tasks.
Note: Since some tools are background tasks, it is not necessary to run them every PLC cycle. If you run it every cycle, the tool will not work properly because you are constantly configuring it.
Just add a "BIT" that will be turned ON right after.
|All your lines that only need to start once at startup :
Note: You can use any name for the ColdStart bit.