Matlab3 Simscape
Matlab3 Simscape
Matlab3 Simscape
Simulation with
Simscape
[References]
1. Simscape User’s Guide, Mathworks, 2021.
2. Simscape Getting Started Guide, Mathworks, 2021.
3. Mathematical Modelling Using SimScape (Electrical Systems), Zaer Abo Hammour.
https://www.academia.edu/42834463/_Mathematical_Modeling_Using_SimScape_Electrical
4. Mathematical Modelling Using SimScape (Mechanical Systems), Zaer Abo Hammour.
http://engineering.ju.edu.jo/Laboratories/03_2-%20Mathematical%20Modeling%20Using%2
0SimScape_Mechanical.pdf
5. Physical Modelling with Simscape, Rick Hyde, MATLAB EXPO 2013.
6. Modeling and Simulation of Physical Systems with Simscape, Paul Lambrechts and Tadele
Shiferaw Tadele, MATLAB EXPO 2018.
7. Modeling and Analysis of DYNAMIC SYSTEMS, Ramin S. Esfandiari and Bei Lu, CRC Press, 2014.
2102209 MATLAB – Simscape 1/70
2102209 MATLAB – Simscape 2/70
2102209 MATLAB – Simscape 3/70
2102209 MATLAB – Simscape 4/70
2102209 MATLAB – Simscape 5/70
2102209 MATLAB – Simscape 6/70
2102209 MATLAB – Simscape 7/70
2102209 MATLAB – Simscape 8/70
2102209 MATLAB – Simscape 9/70
2102209 MATLAB – Simscape 10/70
2102209 MATLAB – Simscape 11/70
Introduction to Simscape
• Simscape is a set of block libraries for modeling physical systems in
the Simulink® environment. It employs the Physical Network
approach, which differs from the standard Simulink modeling
approach and is particularly suited to simulating systems that consist
of real physical components such as mechanical, electrical, hydraulic,
thermal, and pneumatic components.
• Simulink blocks represent basic mathematical operations. When you
connect Simulink blocks together, the resulting diagram is equivalent
to the mathematical model of the system under design.
• Unlike Simulink blocks, which represent mathematical operations or
operate on signals, Simscape blocks directly represent physical
components or relationships.
Foundation
Multibody
Electrical
Driveline
Fluids
Simscape
Simulink
Matlab
2102209 MATLAB – Simscape 16/70
Overview of the Physical Network Approach to
Modeling Physical Systems
• In the Physical Network approach, each element is represented by
its non-directional connection ports with the corresponding Through
and Across variables.
component dc_voltage < foundation.electrical.source
% DC Voltage Source
% The ideal voltage source maintains a constant voltage across its
% output terminals, independent of the current flowing through the source.
% The output voltage is defined by the Constant voltage parameter, and
% can be any real value
parameters
v0 = { 1, 'V' }; % Constant voltage
end
equations
v == v0;
end Connections + and – are conserving electrical ports corresponding to the positive
and negative terminals of the voltage source, respectively. The current is positive if
end it flows from positive to negative, and the voltage across the source is equal to the
difference between the voltage at the positive and the negative terminal, V(+) – V(–).
2102209 MATLAB – Simscape 17/70
Connection Ports
• The number of connection ports for each element is determined by
the number of energy flows it exchanges with other elements in the
system, and depends on the level of idealization.
• An energy flow is characterized by its variables. Each energy flow is
associated with two variables, one Through and one Across. These
are the variables whose product is the energy flow in watts. For
example, the basic variables for mechanical translational systems
are force and velocity, for mechanical rotational systems—torque
and angular velocity, for hydraulic systems—flow rate and pressure,
for electrical systems—current and voltage.
• Elements with only two ports are characterized with one pair of
variables, a Through variable and an Across variable. Their
2102209 MATLAB – Simscape 28/70
orientation is defined with one direction. For example, if an element
is oriented from port A to port B, it implies that the Through variable
(TV) is positive if it “flows” from A to B, and the Across variable is
determined as AV = AVA –AVB, where AVA and AVB are the element
node potentials or, in other words, the values of this Across variable
at ports A and B, respectively.
Equation Construction
Based on the network configuration, the parameter values in the block
dialog boxes, the Simscape solver constructs the system of equations for
Transient Initialization
After computing the initial conditions, the Simscape solver performs
transient initialization. Transient initialization fixes all dynamic variables
and solves for algebraic variables and derivatives of dynamic variables.
Transient Solve
Finally, the Simscape solver performs transient solve of the system of
equations. In transient solve, continuous differential equations are
integrated in time to compute all the variables as a function of time.
The solver continues to perform the simulation according to the results
of the transient until the end of simulation.
DC Motor Subsystem
The motor consists of an electrical circuit and a mechanical rotational
circuit, connected by the Rotational Electromechanical Converter block.
The electrical circuit consists of a Resistor block and an Inductor block.
It contains two electrical ports, corresponding to the V+ and V- electric
2102209 MATLAB – Simscape 64/70
terminals of the motor. The mechanical circuit contains a Rotational
Friction block, an Inertia block, and two mechanical rotational ports, C
and R, corresponding to the motor case and rotor, respectively. Notice
how the C and R ports of the Rotational Friction block and the Rotational
Electromechanical Converter block are connected to the C and R ports
of the motor, to preserve the correct direction of variables in the
physical network.
Run the Model
1. Set the Configuration Parameters in Model Settings to log the
simulation results.