Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 13

Exercises:

Servo System Modeling

Control
Measurements Controller Outputs
Computing

Sensors Actuators

1 Copyright © Open Source Modelica Consortium


Control Theory Perspective
Feedback Control System

Controller Plant
(Physical System)

r (t ) reference (setpoint) error


e (t ) measured process variable (plant output)
y control output variable (plant input)
(t )
u (t )

Usual Objective
Plant output should follow the reference signal.

2 Copyright © Open Source Modelica Consortium


Exercise Goal: Servo System with Controller using
Different Modeling Techniques
Below: Clocked discrete-time controller using sample, hold and clock
blocks from the Modelica_Synchronous library

3 Copyright © Open Source Modelica Consortium


Modeling the Physical System
Basic model of a DC Permanent Magnet (DCPM) machine

4 Copyright © Open Source Modelica Consortium


Exercise A: Physical System Modeling

Goal: Exploring different modeling styles for the


DC Permanent Magnet (DCPM) machine in three
steps:

1. Textual equations wrapped in graphical “block”


component with causal data-flow connectors.
2. Graphical component based model using acausal
connectors.
3. Model for testing and comparing the two components.

5 Copyright © Open Source Modelica Consortium


Exercise A1: Wrap Textual Motor Equations in
Graphical Block Interface

u_A phi

phi_der

tau_L tau_m

block DCPMMotorTextual
extends Modelica.Blocks.Interfaces.BlockIcon;
import SI = Modelica.SIunits;
parameter SI.Resistance R_A = 7.38 "Armature resistance";
parameter SI.Inductance L_A = 4.64e-3 "Armature inductance";
parameter SI.Inertia J_R(min=0) = 1.9e-6 "Armature moment of inertia";
parameter Real k_e(final unit="V.s/rad") = 3.11e-2 “Electromotive force
constant";
parameter SI.ElectricalTorqueConstant k_t = 3.11e-2 "Motor torque constant";
/* TODO: Build the block interface by drag and drop of connectors from package
Modelica.Blocks.Interfaces */
equation
/* TODO: Fill in equations */
end DCPMMotorTextual;

6 Copyright © Open Source Modelica Consortium


Exercise A2: Build a Component Based Model Using
Acausal Connectors

Interface
(optional: Create a nice icon) Internal structure

7 Copyright © Open Source Modelica Consortium


Exercise A3: Build a Model for Testing and Comparing
the two Motor Model Components

8 Copyright © Open Source Modelica Consortium


Exercise B: Design a Controller

Goal: Exploring different modeling styles for


designing a digital controller for the DCPM machine:
1. Continuous-time controller reference design.
2. Digital controller using Modelica 3.2 constructs
(not clocked).
3. Digital controller using Modelica 3.3. clocked
constructs.
4. Closed-loop model for testing and comparing the
different controllers.

9 Copyright © Open Source Modelica Consortium


Exercise B1: Continuous-time Reference Controller

• Take the height of the step as 130. The driving voltage should not
exceed 24V.
• Locate the continuous-time PI controller in the MSL and tune it until
you get satisfactory results.

10 Copyright © Open Source Modelica Consortium


Exercise B2: Model Digital Controller Using
Modelica 3.2 Un-clocked Constructs

u y

Boolean event = sample(0,Ts);


when event then
// TODO: Fill in equations
end when;

11 Copyright © Open Source Modelica Consortium


Exercise B3: Model Digital Controller Using
Modelica 3.3 Clocked Constructs

   

Real Ts = interval(u) "Sample period(periodic or


non-periodic)";
equation
when Clock() then
// TODO: Fill in equations
end when;

12 Copyright © Open Source Modelica Consortium


Exercise B4: Create Model for Testing and Comparing
the Three Model Components

Clocked controller uses sample,


hold and clock blocks from the
Modelica_Synchronous library

13 Copyright © Open Source Modelica Consortium

You might also like