Professional Documents
Culture Documents
Practical Lab
INTRODUCTION LAB(1)
SimEvents Simscape
Discrete Event Physica) System
modeling modeling
Introduction to Simscape
Simscape software is a set of block libraries and special simulation features for
modeling physical systems in the Simulink environment.
Connecting Simscape blocks together is analogous to connecting real components,
such as pumps, valves, and so on. In other words, Simscape diagrams mimic the
physical system layout.
SimMechanics
Resistor
Variable type example:
The following example illustrates a Physical Network representation of a double
acting hydraulic cylinder.
Variable type example:
The element is represented with three energy flows: two flows of hydraulic energy through
the inlet and outlet of the cylinder and a flow of mechanical energy associated with the rod
motion. It therefore has the following three connector ports:
A —Hydraulic conserving port associated with pressure p 1 (an Across variable) and flow
rate q 1 (a Through variable)
B —Hydraulic conserving port associated with pressure p 2 (an Across variable) and flow
rate q 2 (a Through variable)
R —Mechanical translational conserving port associated with rod veiocity v 3 (an Across
variable) and force F 3 (a Through variabie) ----------- — <
92 j.
A
Pi
Connection guidetines
* Solver configuration block * Domain specific reference block
Important Blocks
S PS
Stmuhnk PS PS-Stmuhr^
Corwertef Converter
Meehan ica!
Eiectrica!
rotationai
domain
Dtode
domain
Gear Box
Useful Sh. rtcuts
* Type: ssc_/?eM/ to open a new simscape model
'Right Click; and (drag) for copy/ blocks.
* Space or mouse wheel to zoom.
* Ctrl-click and Ctrl-click to automatically create connection.
* Ctrl-click for a new branch.
* Hold down mouse wheel to pan.
* Adding blocks toy typing) name.
*Type: ;c&fK__,gr4?%t//7/%!? to get all the units in MATLAB simscape.
Modeling single-Domain physical system using simscape
Building a simscape Model-Electrical Domain:
Example.1: simple battery stop time 100
Model the equivalent circuit of the battery, which has the following electrical schematic, in
simscape and simulate it to measure the current flowing throw the circuit.
Vo!tage Sensor
Scopel
Resistori
0 005 > PS S
^WW Ohm
PS-Simulink Scope
Resistor Converter
Current Sensor
O.OIOOhm
DC Vo!tage Sourcel Capacitor
4 2V 5000F
^Scope — D X
Solver
Configuration
0 10 20 30 40 50 60 70 80 90 100
Modeling single-Domain physical system using simscape
Example 2(Simu)ink/Simscape):
-Mode) of the series RLC Circuit in Simscape and in Simulink and by
using the scope, compare between the voltage across the capacitor in the
two circuits. The values of the constants are as following:
Vmax=10 V;
R =10 Ohm;
C = 1 F;
L = 1 H.
Step
Gainl
Scope
Sotver
Configuration
Modeling single-Domain physical system using simscape
Example 3(Simu)ink/Simscape):
The following schematic represents a simple model (of a (car suspension. It
consists of a spring and damper (connected to a body (represented as a
mass), which is agitated by a force.
It has the! following parameters:
- M = 1 Kg.
- C = 100 N-s/m
- K = 1000 N/m
Modeling single-Domain physical system using simscape
The following schematic represents st simple model of a car suspension.
It consists of a spring and damper connected to a body (represented as a
mass), which is aoitated bv a force.
B/m <1—
Gainl
k/m<*
Activate Windows
Gain2
200 S PS
PS-Simuiink Vetocity
tdeat Transtationat
Converter
Motion Sensor
PS-Simuiink Position
Converterl
f(x) = 0
Mechanicai
Sotver Transtationat
Configuration Reference
Modeling single-Domain physical system using simscape
Example 4:
Mode) the hydraulic circuit using blocks from the simscape library:
Modeting singte-Domain physical system using simscape
H.W
Design an operational amplifier which has the parameters as shown in
the circuit diagram below.
Next Lab
Required from the students:
>Quiz to test your understanding for this lab
Modeling & Simulation
Practical Lab
M 0 D E LI NG MU LT" I- D 0 M AI IN & SI MD RI VIE LI N E P HYSICA L SYSTEMS
LA B (2& 3).
Physical parameters
/n - 1 kg
k=50N/m
1 N/(m/s)
Initial conditions
Mass initial velocity — 0 m/s
Ix?ft spring initial deformation = 0.1 m
Right spring initial deformation = 0.0 m
Simulation parameters
Stop time — 4s
Solver = ode23t
Solution
In This Lab:
^Creating multi-domain physical components.
> Dividing components into subsystem.
> Setting initial conditions.
> Introduction to Simdriveline.
Physical components spanning multiple physical system
> DC-motor
Electrical system
Rotational Mechanical system
Rotattona!
Etectromechantca! DC Motor
Converter
Mechanical system(simscape)
Mechanical system(simscape)
^gearA -p
Component polarity ' gearA
TgearB
/ ^gearB
TgearB
gearA
^gearA * )gearB
T = R * T
'gearA **' ' gearB
^gearB " Ig^^gearA
Mechanical system(simscape)
Gear Ratio=2
Damper (Default)
f(x)=O ,
Mechanical
Rotational Reference
Activate Windows
Gn tn Sett inns tn activate Windows
Creating subsystems
Port names
displayed on
subsystem
Creating subsystems
DC-motor configuration
Electrical Characteristics Mechanical Characteristics (Default Values)
w B
DC Motor Scope
Subsystem
Battery Pack
Subsystem
Ref
f&)=0 -
Gear
Sub^stem
Soh/er
Configuration Mechanical
Rotational Reference
LueisAs leDiueLpeujCLUoei^
Setting initial conditions
Parameters; Mwtabte* I___________________________
inertia initia! condition spedty pretty v<** UnK
Settings
Vehicte Body
z* ncneange Modeling (Variables)
nt Mass of the vehicle
A Height of vehtcle center of gravity (CG) above the ground
a, A Distance of front and rear axies, respectively, from the norma) projection point of vehicte CG onto
the common ax)e ptane
V, Vetocity of the vehicte When v, > 0, the vehicte moves forward When v, < 0, the vehicte moves
backward.
Wind speed When > 0, the wind is headwind When v* < 0, the wind is tailwind.
n Number of wheets on each axte
Longitudinat forces on each wheet at the front and rear ground contact points, respectively
Ay Normal toad forces on each wheet at the front and rear ground contact points, respectively
A Effective fronta) vehtcte cross-secttonal area
Ci Aerodynamic drag coefficient
z? Mass density of air
Ai Aerodynamic drag force
Vehicle Body Modeling
> Vehicle Dynamics and Motion:
- "Tiie vehicle motion is a result of the net effect of all the forces
and torques acting on it.
- The longitudinal tire forces push the vehicle forward or
backward. - The weight mg of the vehicle acts through its center
(of gravity (CG).
- Depending (on the incline angle, the weight pulls the vehicle to
the (ground and pulls it either backward (or forward.
- Whether the vehicle travels forward (or backward, aerodynamic
drag (slows it down as shown in the equations below:
Vehicle Body Modeling
Vehicle Dynamics and Motion:
' sin /?
f+ F„)
Wheel radius
L /
Wheel-tire inertia, such that the effective mass is equal to
Tire modeling (Ports)
>Input:
N — Normal force
• Physical signal input port associated with the normal force acting on
the tire.
^Output:
IS — Slip
• Physical signal output port associated with the relative slip between
the tire and road.
^Conserving:
/A — Axle
• Mechanical rotational port associated with the axle that the tire sits on.
H — Hub
• Mechanical translational port associated with the wheel hub that
transmits the thrust generated by the tire to the remainder of the
vehicle.
Tire modeling
Wind and terrain effects
Creating speedometer and odometer
Creating speedometer and odometer
Solid
Rotational
degree of freedom
Translational
degree of freedom
Coordinate
frame
Center of mass
Terminology - Coordinate Frames:
Translating Coordinate Frames
fransiating Coordinate Frames
Terminology - Coordinate Frames:
Rotating Coordinate Frames
Rotating Coordinate Frames
Standard Axis Arbitrary Axis
Modeling Suspension System:
Wortd
reference
frame Wortd Frame
Gravity
Mechantsm Configure! an
Defining Solids:
Defining Solids
3 Geometry
Shape Brick v
Dimensions [4.511] cm v
Inertia
Graphic
Dimensions [4.511] cm
Inertia
Type Calculate from Geometry v
Based on Density_______________________________ Bg
Density 3000 kg/[m^3) v
! 3 Graphic
f(x) = 0
Solver
Configuration
Mechanism Configuration
Rotate about z axes
MENU AND TOOLBARS
untitled
0"^ Mechanism_Configuration
World_Frame
Sohd_____________
iqid Transform
l+)"Connection Frames
Sotver
Configuration
Solid
Mechanism Configuration
Visualizing and inspecting:
Modeling & Simulation
Practical Lab
M O DE LING & SIM ULATI ON! DYNAMIC SYSTEM S USING SI M SCAP E MULTI BO DY
LAB (4).
Solid
Rotational
degree of freedom
Translational
degree of freedom
Coordinate
frame
Center of mass
Terminology - Coordinate Frames:
Translating Coordinate Frames
fransiating Coordinate Frames
Terminology - Coordinate Frames:
Rotating Coordinate Frames
Rotating Coordinate Frames
Standard Axis Arbitrary Axis
Modeling Suspension System:
Wortd
reference
frame Wortd Frame
Gravity
Mechantsm Configure! an
Defining Solids:
Defining Solids
3 Geometry
Shape Brick v
Dimensions [4.511] cm v
Inertia
Graphic
Dimensions [4.511] cm
Inertia
Type Calculate from Geometry v
Based on Density_______________________________ Bg
Density 3000 kg/[m^3) v
! 3 Graphic
f(x) = 0
Solver
Configuration
Mechanism Configuration
Rotate about z axes
MENU AND TOOLBARS
untitled
0"^ Mechanism_Configuration
World_Frame
Sohd_____________
iqid Transform
l+)"Connection Frames
Sotver
Configuration
Solid
Mechanism Configuration
Visualizing and inspecting:
Quiz
Insert Solid using CAD design
narasoiia^.X-tj
Parasolid Binary (*.x_b)
IGESC.igs} '
RFimlvFd__ I* ri'l
STEP AP203 (*. step;*, stp)
.ave As
STEP AP214(*.step;*.stp)
I FC 2x3 C.ifc)
IFC4(*.ifc)
AC I S(*. sat)
^antze^ NeVDAFS (*.vda)
VRML C.wrl}
STL (*.stl)
Additive Manufacturing File (Tamf)
eDrawings (*eprt)
3DXML(*3dxm)}
OneDrive - Per;
Microsoft XAML (Txaml)
Dream High2' CATIA Graphics C.cgr)
' ProE/CreoPart(Tprt)
This PC HCG (Thcg)
HOOPS HSF (*.hsf)
I Desktop Dtxf C.dxf]
Dwg(*'dwg)
Adobe Portable Document Format (*.pdf)
File name: Adobe Photoshop Files (*.psd)
Generate a system in simscape using CAD systems to control and simulate the movement.
B Other Add ins
3 SimMechanics Link B < 1!
OK Cancel
Simmechanics link
H kobby-mendez-dOoYF3hm4GI-unspla... 2/3/2023 11:25 PM JPG File 2,037 KB
u Mechanics Explorers
Partl.SLDPRT » smimport('Asseml2')
base_Default_sldprt.STL smimport('Assemi2')
base.SLDPRT
Asseml 2.xn
Importing model: Asseml D
semi .xml
Generating subsystem (5/5): x4_1_RIGID
nere are three options to handle the input: you can use it as is,
ter input, or provide the input derivatives through additional signal
)rts. Input filtering also provides time derivatives. The first-order
ter provides one derivative, while the second-order filter provides
e first and second derivatives.
a ra meters