PID-Controller
More actions
PID Controller
This page is under construction. It is missing images and the Box panel
Stationpedia Description
A PID (Proportional Integral Derivative) controller that provides a closed-loop feedback mechanism that can be used to automatically regulate a process variable (like temperature, speed, position, and similar) so that it tracks a desired setpoint. It does this by continually computing an error signal e(t) = setpoint - measurement, then applying three corrective actions as the Proportional, Integral, and Derivative.
The controller tracks a variable, that can be set by the IN screw to a device (like a pipe analyzer) and then select the variable to track with the VAR screw (pressure, temp, etc.) The chip has three more screws for Proportional Gain (P), Integral Gain (I), and Derivative Gain (D). Unfortunately the chip needs more setup in order to work correctly.
Setting Up
To properly get a PID Controller set up to begin watching a process for you, you need to set the following:
- IN Screw: to a device that reads a value you need to track (typically pipe or cable analyzers. But not limited to these.)
- VAR Screw: needs to be the parameter you are tracking (Like ratio of a gas, temperature, pressure, etc.)
- Setpoint: What you want the process to be at.
- Minimum: The minimum output the Controller will give for your control (can be negative).
- Maximum: The maximum output the Controller will give for your control.
- ProportionalGain: The P constant for the chip.
- IntegralGain: The I constant for the chip.
- DerivativeGain: The D constant for the chip.
When you have made sure all of the above are set, the chip needs to see a Reset signal (1) so that it can reset and load the new values properly. Failing to apply a Reset signal can have the chip be in an incorrect state (tracking previous errors incorrectly) or some settings may not apply (like setpoint, max, or min).
Note: Due to a bug or underlying programming, the PID controller is best set by using an external logic by either logic chips or IC10. The screws on the chip are not everything needed for the chip and can usually cause incorrect controls due to the nature of the chip. It is advisable to have a memory chip, logic writer, and logic button to set up the chip or if the user is comfortable with IC10 programming, to use an IC10 chip to properly set up the PID Controller and provide a reset signal.
How it Works
A PID Controller will look at the process variable you have set it to, calculate the error, and apply the relevant gains. The functionality will work similar to this example: Let's assume we want the temperature of a pipe to be set to 293.15 (20C). You will select the IN screw to be the pipe analyzer attached to the pipe and VAR screw to be temperature. The Setpoint needs to be programmed via logic and set to 293.15 because that is the target you want to reach. The output the chip gives via the Setting is something the user needs to interpret and use for some form of control as defined by the user. This could be a value fed to a pump, or interpreted to mean to activate some devices, etc.
The main point is that the output needs to be used in some process that can directly affect the variable the PID is measuring, ideally in both directions.
Error Calculated will be: E = 293.15 (our setpoint) - Temperature of the Pipe (Pipe Analyzer Temperature reading).
The Output or Setting of the PID Controller is given as Setting = S(P) + S(I) + S(D), where these 3 functions are summed up from the proportional, derivative, and integral gain formulas based on the error.
Effects of Proportional Gain
Proportional Gain is an immediate corrective action you can use. The bigger the gain, the stronger the corrective effect. As the error diminishes, there is a weaker and weaker corrective effect. If the error gets larger, the corrective effect is stronger.
If the temperature of the pipe is 10C (283.15), then the error calculated would be 10.
The proportional Gain will modify the output so that Setting = Error * Proportional Gain. In this case it will be 10 * whatever the proportional Gain would be. If the Proportional Gain is 3, then the output will be 10 * 3 = 30. With a gain of 3, you can see that an error of 20 would give an output of 60, but if the error drops to 2, then the output would be 6. Usually proportional gain cannot fully correct a process or overshoots.
Effects of Integral Gain
Integral Gain is for an accumulation of error as time passes. This isnt an instantaneous check like proportional gain, it keeps a tally of the sum total of error and applies its gain in a way to be a "Memory" for keeping a process stable.
If the temperature of the pipe 15C (288.15), then the error calculated would be 5. The error memory would be 5. If the next check the temperature is 16C (289.15), the error calculated would be 4. The error memory will be 9 (5+4). This total keeps repeating indefinitely.
The output of integral gain can be summed up to: S(I) = ErrorAccumulated * I.
Since Stationeers takes the logic usually in ticks (usually 0.5s), that has a minor effect on how much error accumulates per tick. When the Process Variable is equal to the setpoint, no further error accumulates (Since error is 0), but the accumulted error stays. This in turn helps to provide a kind of "memory" for the chip to keep a specific output to keep the process stable.
Effects of Derivative Gain
Derivative Gain is for the instantaneous change of error. In a sense it can be used as a clamp or a extra boost in output based on how slow/fast the error is changing and what direction the change is.
It decays slowly as time progresses.
If the temperature changes from 14C to 13C, that means that the change of error went from 6 to 7, a total change of 1. This value gets multiplied by the Derivative gain to get the effects of the output. In the next time period, the output of derivative will taper off by about 80% of its current value.
The output of Derivative gain can be summed up to: s(D) = (Error Change * D) + s(D-1)) * 0.8
If the error doesnt keep changing, then it will slowly taper off. But if it changes by 1 again, then that change will get multiplied by the derivative gain and get added to the previous value that is tapering off. The derivative gain usually tries to prevent the error from changing too much too fast. It is rarely needed to control processes in Stationeers though.
Maximum and Minimum
These are values that clamp the PID from exceeding these values. Without these the PID controller could give you numbers far too high or far too low to be useful for your process. It is best to set these to values you expect to need for your control process. Ex. Turbo Volume pumps can only be set to 0-100... If you set your PID limits to -100 and 100, then the PID can give you a value you could use for your turbo volume pump. The magnitude of the value can be used as the setting value for the turbo volume pump, and the sign can determine the direction of the pump.