1. System Definition
2. Design of a P controller
3. Design of a PI controller
4. Design of a PID controller
The model of a harmonic oscillator corresponds to a second order system with ut as the input and yt as the output. The system is defined by the angular frequency ω, the attenuation θ, and the gain A.
Angular frequency ω
The system is defined with the following differential equation
The transfer function that results from this differential equation can be obtained using the DynamicSystems[TransferFunction] command.
Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u⁡soutputvariable=y⁡stf1,1=ω2⁢As2+2⁢ω⁢θ⁢s+ω2
The step response for the corresponding system can be observed by changing the slider values for θ and ω in the following application.
In this example, θ controls the damping, such that a system with θ<1 results in a system that is under damped and results in an overshoot. For the cases with θ>1⁢the system is over damped and the response has no overshoot. If θ=1 the system is critically damped, resulting in the fastest rise time of the system without overshooting the final value. The parameter ω is the natural frequency of the system.
The amplitude A is set to 1 for this example.
Uncontrolled Step Response
set θ value
set ω value
Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1⁡soutputvariable=y1⁡stf1,1=Kp⁢ω2⁢As2+2⁢ω⁢θ⁢s+Kp⁢ω2⁢A+ω2
The response to the system to changing proportional gain controller can be seen below. It is important to note that the P controller is not able to get the system to actually reach the desired final value. The controller has an offset error.
Controlled Step Response - P controller
Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1⁡soutputvariable=y1⁡stf1,1=A⁢Kp⁢ω2⁢s+A⁢Ki⁢ω2s3+2⁢ω⁢θ⁢s2+Kp⁢ω2⁢A+ω2⁢s+A⁢Ki⁢ω2
The effects of adjusting the proportional controller gain Kp and integral controller gain Ki values is displayed below. In most cases, the offset error can be eliminated by adding an integral component to the proportional controller.
It is important to note, that a system may become unstable and begin to oscillate out of control if the value of Ki is too large and the value of Kp too small (relative to Ki).
Controlled Step Response - PI controller
PIDcontroller≔Kp + Kis+Kd⋅s
Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=u1⁡soutputvariable=y1⁡stf1,1=A⁢Kd⁢ω2⁢s2+A⁢Kp⁢ω2⁢s+A⁢Ki⁢ω2s3+Kd⁢ω2⁢A+2⁢ω⁢θ⁢s2+Kp⁢ω2⁢A+ω2⁢s+A⁢Ki⁢ω2
The system response to changes in the proportional, integral and derivative gains are shown below.
Controlled Step Response - PID controller
Download Help Document