Difference between revisions of "Component: PID Control (DSP Operators)"
Line 113: | Line 113: | ||
As with other DSP components the raw signals and values can be seen in the data recorder and console windows. | As with other DSP components the raw signals and values can be seen in the data recorder and console windows. | ||
+ | |||
+ | |||
Latest revision as of 10:26, 20 October 2023
Author | Matrix Ltd |
Version | 1.2 |
Category | DSP Operators |
Contents
PID Control component
Control algorythm based on Proportional, Integral and Differential error. P/PI/PID - Mathematical control process to get to the setpoint as fast as possible, similar to the process in the human brain when steering a car. Used to accurately control things like motors, temperatures etc.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_DSP_PIDControl.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_DSP_PIDControl.fcfx
Detailed description
No detailed description exists yet for this component
Examples
Setpoint = Value that the user wishes the system to be running at. e.g. the temperature control knob for an oven.
Feedback = Measurement to monitor the value we are controlling. e.g. the temperature reading inside the oven.
Control Signal = The value we want to output to the device. e.g. the signal sent to the heat element inside the oven.
Proportional (P) - Provides an instantaneous kick to try and get the control variable to the setpoint as quickly as possible. P control alone will generally always end up with some form of steady state error. If this is acceptable then P control alone is very easy to perform and stable as long as the P gain is not excessive.
Integral (I) - Provides an accumulation of error over time to try and minimise any steady state error. PI control alone can be a very suitable option for controlling a lot of systems. A potential problem with I control is if the control variable goes into saturation and cannot for whatever reason reach the setpoint. This can cause the I accumulator to get larger and larger and then if the saturation is removed the system can become very unstable. Integral clamping allows the integral accumulator to be held within a certain range and avoid excessive windup.
Derivative (D) - Provides a delaying effect when the error is changing fast. This can have the effect of dampening oscillations and allowing the P and I gains to be increased further to provide faster and more stable responses. The D term can be tricky to get right and too much especially when used with a noisy feedback signal can lead to instabilities. The D filter allows for some high frequency noise to be removed from the feedback.
Here is a project file showing an PID control system for a system such as an high accuracy temperature controller e.g. a 3D printer hotend.
The setpoint is set via an analogue input which controls the desired temperature of the system.
In this first example the feedback is provided using the simulated load DSP component which simply takes a percentage of the last output and combines with a percentage of the new output.
This allows easy moddeling of systems such as devices that heat up and cool down over time which allows you to see the system in action.
You assign a setpoint and then the system will get to temperature and then maintain the temperature by automatically adjusting the output duty.
PID Control Simulated Output Example
In this second example the feedback is provided via a temperature sensor component. This shows how you would do it with a real system using a sensor to complete the feedback loop.
As with other DSP components the raw signals and values can be seen in the data recorder and console windows.
Macro reference
ChangePID
![]() |
ChangePID |
Allows the P, I and D control parameters to be changed on the fly during a program. | |
![]() |
P |
![]() |
I |
![]() |
D |
![]() |
Return |
GetPIDPortions
![]() |
GetPIDPortions |
Collects a single contribution from the PID output. | |
![]() |
Index |
0=P, 1=I, 2=D | |
![]() |
Return |
Process
![]() |
Process |
Processes the current value from a buffer. | |
![]() |
Return |
ProcessArray
![]() |
ProcessArray |
Processes an entire buffer, either by performing the control operation to every value in the buffer or just the last value. | |
![]() |
Return |