Harmonic Oscillator
? Maplesoft, a division of Waterloo Maple Inc., 2008
This application illustrates a second order harmonic oscillator under different control strategies. The proportional (P), proportional-integral (PI), and proportional-integral-derivative (PID) controller structures are shown.
System Analysis
The model corresponds to a second order system with
as the input and
as the output. The system is defined by the angular frequency
, the attenuation
, and the gain
.
Input variable
Output variable 
Parameters:
|
Angular frequency
|
Attenuation
|
Gain
|
Model Description
The system is defined with the following differential equation (DE):
 |
(2.1) |
The transfer function that results from this DE is:
 |
(2.2) |
# Uncontrolled Step Response
By changing the slider values for θ and ω, the step response for the corresponding system is displayed.
In this example, θ controls the damping, such that a system with results in a system that is under damped and results in an overshoot. For the cases with the system is over damped and the response has no overshoot. If 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 is set to 1 for this example.
|
P Controller
Open Loop Transfer Function
 |
(3.1) |
Closed Loop Transfer Function
 |
(3.2) |
# P Controller Step Response
P
|
|
The values of the parameters and are obtained from the dial settings in the previous sections.
By changing the value of the P gauge, the proportional controller gain is adjusted and the response is displayed.
Note that the final value of the controlled system does not actually reach the desired final value. The controller has an offset error.
|
PI Controller
 |
(4.1) |
Open Loop Transfer Function
 |
(4.2) |
Closed Loop Transfer Function
 |
(4.3) |
# PI Controller Step Response
By changing the value of the P dial (for the value of ) and the Tn slider, the proportional controller gain and the integral controller gains are adjusted and the response is displayed.
Note that by adding the integral component to the proportional controller, the offset error can been eliminated.
However, if the value of is too small and combined with a relatively high P gain, the system may become unstable and begin oscillating out of control.
|
PID Controller
 |
(5.1) |
Open Loop Transfer Function
 |
(5.2) |
Closed Loop Transfer Function
# PID Controller Step Response
By changing the value of the P slider and the Tn slider, the proportional controller gain and the integral controller gains are adjusted and the response is displayed.
The values of and corresponding to the derivative controller are set as follows:
|