Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

Modeling and Simulation of Electromechanical

Systems

Dhirendra Singh
dhirendra.singh@mathworks.in Vivek Raju
Application Engineer Application Engineer

© 2015 The MathWorks, Inc.


1
Challenges

 Working with Multi-Domain systems (Mechanical, Electrical)

 Modeling Kinematics & Mechanisms of Mechanical design

 Determine the sizing of the electrical components like motors and optimize the parameters

 Develop appropriate control logic (Field oriented control and event based control logic)

 Perform real-time simulation for rapid control prototyping and hardware-in-the-loop simulation

2
Demo
 Electrically Assisted Power Steering

3
Challenge 1:

Working with Multi-Domain systems (Mechanical,


Electrical)

To address this challenge

We need to have a platform which allows working with Electrical, Mechanical


and Control system in a single environment

4
Introduction to Simscape

 Enables physical modeling (acausal)


of multidomain physical systems
 Eases process of
modeling physical systems V+
– Build models that reflect
structure of physical system
V-
– Leverage MATLAB to create
reusable models
 Used by system and control
engineers to build models
with the same structure
as the physical system

5
Develop Complex Multidomain Systems
Inputs and outputs Physical connections
Software components Simultaneous equations

Physical A B
Hardware
+- PID

T P T
S1
if (..)
x = … S3 S2
else Software &
x =
Algorithms

Use the right language for the right task


Use Model-Based Design on the entire system

6
Challenge 2:

Modeling Kinematics & Mechanisms of Mechanical


design

To address this challenge

We need to have platform to model kinematics and mechanisms of mechanical


systems and simulate the dynamics.
We also require to import existing enterprise CAD models.

7
Modeling Kinematics & Mechanisms of Mechanical design

 Enables multibody simulation


of 3D mechanical systems

 Construct model using


bodies, joints, and forces
– Model matches structure of system
– No need to derive and program equations

 Primary uses
– System-level analysis of
mechanical and multidomain systems
– Control development in Simulink

8
Modeling Mechanical Systems

 Foundation library of basic


mechanical components
– Mass, spring, damper
– Friction
– Translational or rotational
– Mechanisms (gear, rack-pinion)
 Combine components to create
reusable systems
 Combine with Simscape Driveline
and Simscape Multibody
to model more complex systems

9
Working with
Simscape Multibody

 Build components
– Predefined solids
– Extrusions defined in MATLAB

 Parameterize components
– MATLAB variables
– Custom dialog boxes

 Connect with joints


– Sense and actuate
– Guide assembly

10
CAD to MATLAB
to Simscape Multibody CAD
1
1. Export from CAD to MATLAB code CAD2MATLAB_SolidWorks.swp
– SolidWorks:
CAD2MATLAB_SolidWorks.swp robot.m part.STL
– Other CAD System: Adapt code
2
to your CAD system’s API >> robot.m

2. Run MATLAB code to create


smiModel
data structure in MATLAB
3
>> data2smixml(smiModel,’robot.xml’)
3. Run data2smixml.m to generate
Simscape Multibody XML file
robot.xml
4. Import Simscape Multibody XML file 4
to create Simscape Multibody model >> smimport(‘robot.xml’)
parameterized with STL files
for animation. robot.slx

11
Key Takeways

 Provides libraries for modeling


3D mechanical systems

 Use 3D visualization to animate


simulation results and explore model

 Connect to other physical domains


and controller in a single environment

12
Challenges

 Working with Multi-Domain systems (Mechanical, Electrical)

 Modeling Kinematics & Mechanisms of Mechanical design

 Determine the sizing of the electrical components like motors and optimize the parameters

 Develop appropriate control logic (Field oriented control and event based control logic)

 Perform real-time simulation for rapid control prototyping and hardware-in-the-loop simulation

13
Challenge 3:
Determine the sizing of the electrical components like
motors and optimize the parameters

To address this challenge

We need to model the motor, analyze the behavior by simulating the model and
optimize the parameters of the electromechanical system.

14
Model and Simulate DC Electromechanical System.

Model:

DC Motor

+
- Motor
Servoamplifier

Problem: Model a DC motor with


a configurable PWM controller
in the Simulink environment

Solution: Use Simscape Electronics


to model the mechatronic system
15
Modeling 3-Phase Electrical Systems

Model:

a
b
c

Problem: Build a modular,


intuitive model of a 3-phase
electric motor without deriving
equations.
Solution: Use Simscape Power
Systems to model the System. 16
Estimating Model Parameters of Motor

Model: R = Resistance
L = Inductance
J = Inertia
+ 12V B = Friction
-
K = Back EMF Constant
Down Up
V- V+

Up Down

Problem: Simulation data does not


match measured data because the R L J K B
parameters are incorrect
4.03
3 1e-4 0.11 0.45
0.01 0.01 0.02 1.07
0.5
Solution: Use Simulink Design
Optimization to automatically tune
model parameters 17
Challenge 4:

Develop appropriate control logic (Field oriented


control and event based control logic)

To address this challenge

We need to tune the proportional and integral values to an


appropriate level for a smooth steering control.

18
Optimize System-Level Performance
and Meet Design Requirements

u + s1 s2
y
s3

Controller Plant

 Simulating plant and controller in one environment allows you to optimize


system-level performance

19
Demo: Field Oriented Control of PMSM
Desired
RPM Vsq_ref
Isq_ref + Inv_Park Vs_alpha
PI PI
Transform Space
_ _
Vsd_ref
Vector 3-Phase
Isd_ref d,q Vs_beta
To
PWM Inverter
PI alpha,beta
_

Is_q Va Vb Vc
Park Is_alpha Clark
Transform Transform Ia

Ib
alpha, beta a,b,c
Is_d to Is_beta to
d, q alpha, beta

theta PMSM
Motor

RPM Position & Speed


Sensing
20
Challenge 5:

Perform real-time simulation for rapid control prototyping and


hardware-in-the-loop simulation

To address this challenge

We need to have a real-time operating system to quickly prototype the control


system before implementing in an embedded processor and also perform an
hardware-in-the-loop simulation.

21
Simulink Real-Time Enables Real-Time
Simulation and Testing
Rapidly create real-time applications from Simulink
models and run and test them with your hardware under
Metso was able to
test at normal operating frequencies, speeds, and timing. achieve multiple goals
simultaneously. They
were able to developed a
sophisticated controller
for digital hydraulics that
is more reliable, accurate,
and efficient than
previous systems, and
they were able to
accelerate their
development.

“Simulations in Simulink
and real-time testing with
Simulink Real-time
helped us deliver an
exceptionally reliable
control system.”

Kari Leminen, Metso

22
Real-Time Simulation and Testing Tasks:
Rapid Control Prototyping

0
I/O Output I/O Input

Wiring and
Signal Conditioning
Target Computer Hardware Physical Plant Hardware
23
Real-Time Simulation and Testing Tasks:
Hardware-in-the-loop (HIL) Simulation

Wiring and
Signal Conditioning
Embedded Controller Hardware
Target Computer Hardware 24

You might also like