Harmonic Oscillator - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Applications and Example Worksheets : Applications : applications/HarmonicOscillator

Harmonic Oscillator

1. System Definition

2. Design of a P controller

3. Design of a PI controller

4. Design of a PID controller

 

 

 

1. System Definition

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.

 

Parameters

Variables

Attenuation θ

Input ut

Angular frequency ω  

Output yt

Gain A

 

The system is defined with the following differential equation

 

sysdeⅆ2ⅆt2yt+2ωθ ⅆⅆtyt+ω2yt=ω2Aut

sysdey..t+2ωθy.t+ω2yt=ω2Aut

(1)

 

The transfer function that results from this differential equation can be obtained using the DynamicSystems[TransferFunction] command.

withDynamicSystems:

systfTransferFunctionsysde,inputvariable=ut,outputvariable=yt:PrintSystemsystf

Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable=usoutputvariable=ystf1,1=ω2As2+2ωθs+ω2

(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 &theta;<1 results in a system that is under damped and results in an overshoot.  For the cases with &theta;&gt;1the system is over damped and the response has no overshoot.  If &theta;&equals;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.

Step Response Plot Routine

Uncontrolled Step Response

set &theta; value

set &omega; value

      

  

2. Design of a P controller

PcontrollerKp&colon;

OpenLoopEqPcontrollersystf:-tf1&comma;1

OpenLoopEqKpω2As2+2ωθs+ω2

(3)

(4)

ClosedLoopEqsimplifyOpenLoopEq1&plus;OpenLoopEq

ClosedLoopEqKpω2AKpω2A+2ωθs+ω2+s2

(5)

ClosedLoopSysTransferFunctionClosedLoopEq&colon;

PrintSystemClosedLoopSys

Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable&equals;u1soutputvariable&equals;y1stf1,1&equals;Kpω2As2+2ωθs+Kpω2A+ω2

(6)

 

The response to the system to chaging 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

&theta; value

&omega; value

      

  

Kp value

3. Design of a PI controller

PIcontrollerKp&plus;Kis

PIcontrollerKp+Kis

(7)

OpenLoopEq1PIcontrollersystf:-tf1&comma;1

OpenLoopEq1Kp+Kisω2As2+2ωθs+ω2

(8)

ClosedLoopEq1simplifyOpenLoopEq11&plus;OpenLoopEq1

ClosedLoopEq1Kps+Kiω2AAKpω2s+AKiω2+2ωθs2+sω2+s3

(9)

ClosedLoopSys1TransferFunctionClosedLoopEq1&colon;

PrintSystemClosedLoopSys1

Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable&equals;u1soutputvariable&equals;y1stf1,1&equals;AKpω2s+AKiω2s3+2ωθs2+Kpω2A+ω2s+AKiω2

(10)

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

&theta; value

&omega; value

      

  

Kp value

Ki value

4. Design of a PID controller

PIDcontrollerKp &plus; Kis&plus;Kds

PIDcontrollerKp+Kis+Kds

(11)

 

OpenLoopEq2PIDcontrollersystf:-tf1&comma;1

OpenLoopEq2Kp+Kis+Kdsω2As2+2ωθs+ω2

(12)

ClosedLoopEq2simplifyOpenLoopEq21&plus;OpenLoopEq2

ClosedLoopEq2Kds2+Kps+Kiω2AAKdω2s2+AKpω2s+AKiω2+2ωθs2+sω2+s3

(13)

ClosedLoopSys2TransferFunctionClosedLoopEq2&colon;

PrintSystemClosedLoopSys2

Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable&equals;u1soutputvariable&equals;y1stf1,1&equals;AKdω2s2+AKpω2s+AKiω2s3+Kdω2A+2ωθs2+Kpω2A+ω2s+AKiω2

(14)

 

The system response to changes in the proportional, integral and derivative gains are shown below.

(15)

Transfer Functioncontinuous1 output(s); 1 input(s)inputvariable = u1soutputvariable = y1stf1,1 = ω2AKds2+ω2AKps+ω2AKis3+2ωθ+Kdω2As2+ω2+Kpω2As+ω2AKi

(16)

Controlled Step Response - PID controller

&theta; value

&omega; value

      

  

Kp value

Ki value

 

Kd value


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam