Modelling and Simulation
Some key questions
Why is math-based modeling important to industry?
What does "math-based modeling" mean?
What does "simulation" mean?
What are "mechatronic systems"?
Why is math-based modeling important to industry?
Increased complexity of components and systems
Need for higher reliability means need for more testing
Need forfaster design of new products
Better integration can be achieved between design and manufacturing
planning
Models and Simulation
Assume now that for different reasons the experiment on the system
cannot be carried out, but a model of the system is available. The
model can then be used to calculate or decide how the system would
have reacted. This can be done analytically, that is, by mathematically
solving the equations that describe the system and studying the an-
swer. This is the way in which models typically are used, for example,
in mechanics and electronics
With effective computer power, a numerical experiment can be per- formed
on the model. This is called simulation (from the Latin sim- ulare which
means pretend). Simulation is thus an inexpensive and safe way to
experiment with the system. However, the value of the simulation results
depends completely on the quality of the model of the system
Loosely put, a model of a system is a tool we use to answer questions about the
system without having to do an experiment. In this way we use models in everyday
life all the time. It is, for example, a model of a person's behavior to say that he is
"kind." This model helps us to answer the question of how he will react if we ask him
for a favor. We also have models for technical systems that are based on intuition and
experience "in the back of our heads." We call such models mental models. To learn
to drive a car, for example, consists partly of developing a mental model of the car's
driving properties. The operator's picture of how an industrial process reacts on
different actions is also a mental model developed by training and experience.
But the models that we will work with in this book are of a fourth kind:
Mathematical models. By this we mean that the relationships between quantities
(distances, currents, flows, unemployment, and so on) that can be observed in the
system are described as mathematical relations in the model. Most laws of nature are
mathematical models in this sense.
Example
For the System "a mass point," Newton's law of motion gives a rela- tionship
between force and acceleration. For the system "a resistor," Ohm's law describes the
connection between current and voltage.
How to Build Models
There are also two types of areas of knowledge for the model con- struction itself.
One is the domain of expertise. This is about under- standing the application and
mastering all the facts that are relevant for this model. The other area is that of the
knowledge engineer, who has to put the expert's knowledge into practice in a usable
and explicit model. These terms are usually used in the construction of expert
systems (or knowledge-based systems), but are just as important for mathematical
model building. This book thus aims at describing the tools the knowledge engineer
needs to construct mathematical models from the domain of expertise.
There are two basic and quite different principles for model con- struction.
Physical Modeling
One principle is to break down the properties of the system to sub- systems whose
behaviors are known. For technical systems this means that the laws of nature that
describe the sub-systems are used in gen- eral. What happens when the capacitor and
the resistor are connected follows Ohm's law and the relationship between charge and
current for a capacitor. For nontechnical systems (economic, sociological, bi-
ological, and the like), such well-known laws of nature are usually not available,
even for simple subsystems. Then hypotheses have to be introduced or generally
recognized relationships have to be used.
Identification
The other basic principle is to use observations from the system in or- der to fit the
model's properties to those of the system. This principle is often used as a
complement to the first one. For technical sys- tems the laws of nature are themselves
mathematical models, which once were based on observations of small systems.
Hence these models according to the first basic principle are also originally based on
obser- vations of the system. This is sound, since our models of the system ultimately
have to be based on experience.
Precise description of components and their interconnections (preferably
in a form that is computable)
Schematics and idealized elements
Mathematical graphs
Equations
Tables of performance data
Computer programs
What does "simulation" mean in a environment?
Exercising a math model by computing its behavior (not necessarily its
formal solution)
Software is involved (e.g., MATLAB).
Models are constrained by software characteristics.
Software predictions are constrained by implementation of algorithms and
by their application.
Validation is still required at some level.
What are "mechatronic systems"?
Mechatronics: combination of mechanical and electronic subsystems (Japan,
late 1960s)
D Has evolved to mean inclusion of intelligence to get "smart" products
Major components to be integrated:
o Mechanical stuff (solids and fluids) o Electrical/electronic stuff
(circuits, sensors and actuators) o Control stuff (feedback action) o
Computer stuff (intelligent decision-making)
What are "mechatronic systems"?
(cont.)
o Systems involve structural ideas:
o Inputs and outputs
o Connections among model components
o Hierarchical arrangement (subassemblies)
o Various internal models possible as long as I/O description is
maintained
Mechatronics modeling
Energy is a guiding principle for getting physics into mathematical form.
• Energy has various forms
• Time-rate of energy transfer is power
• Signals denote transfer at very low energy levels (called information
transfer)
• Individual components have ports for interacting (power and/or signal
types)
• Components are connected between pairs of ports by power bonds or
signals
• Transducer devices convert between energy forms
Mechatronics modeling (cont.)
Some transducers commonly used in engineering:
• Mechanical energy translation/rotation: rack and pinion
• Electrical/mechanical rotation: dc motor
• Fluid power/mechanical translation: hydraulic ram
• Electrical/thermal energy: resistance heater
• Chemical energy/thermal: a match
Mechatronics modeling (cont.)
Some transducers commonly used in engineering:
• Mechanical energy translation/rotation: rack and pinion
• Electrical/mechanical rotation: dc motor
• Fluid power/mechanical translation: hydraulic ram
• Electrical/thermal energy: resistance heater
Main Simulation Objectives
S/N Simulation Type Simulation Type
I. Motor Dynamics Motor Dynamics
Simulation Simulation
II. Hydraulic Jack Hydraulic Jack
Lifting Model Lifting Model
III. Control Input Control Input
Simulation Simulation
IV. System Response System Response
Over Time Over Time
V. Load & Force Load & Force
Simulation Simulation
VI. Power Supply Power Supply
Behavior Behavior
3.9.2 DC Motor Dynamics Simulation
The motor equations:
di ( t )
V m ( t )=L + Ri ( t )+ K e ω (t)
dt
T m (t )=K t i ( t )
x ˙( t )
ω ( t )=
r
Simulate:
Input Voltage: Step input of 12V (on/off)
Outputs: Armature current i(t), speed ω(t), torque Tm(t)
Purpose:
Verify if motor has enough torque to lift the load.
.
3.9.3 Mechanical-to-Hydraulic Conversion Simulation
k t (i)(t)
m ẍ ( t )+ b ẋ+ mg=
r
Simulate:
Lifting displacement x(t)
Lifting speed x˙(t)
Purpose:
Estimate how fast the jack lifts
Check if jack can fully extend under load
3.9.4 Control Input Simulation
Simulate:
A step function from the mobile app at t=2s
Output voltage Vm(t) from Arduino control chain
Simulate switch bounce or delayed response (optional)
Tools:
MATLAB/Simulink/python: Logical blocks, Step input, Relay blocks
Proteus or Tinkercad: For virtual Arduino + relay test
3.9.5 Full System Time Response
Put everything together:
App Input →Vm (t)→i(t ), ω (t), x (t )
Simulate:
Total lift time (how many seconds to reach full extension)
Jack position vs time
Motor current over time
Purpose:
Estimate total lifting duration
Ensure current stays within motor/relay rating
3.9.6 Load Analysis & For
Simulation
F (t)=PA=mg+bx ˙(t)
Simulate:
Whether system can lift varying weights: 1000 kg, 2000 kg, etc.
How much torque Tm is required
Compare against motor stall torque
3.9.7 Power & Thermal Behavior
Simulate power demand:
P(t )=Vm (t)⋅i(t)
And cumulative energy:
E(t)= ∫ 0 t P(τ ) dτ
Purpose:
Confirm the power supply (e.g., 12V battery) has enough capacity
Estimate energy consumed per lift
Consider heat generation in motor
3.10 Methodology Involved in The Simulation Using Python NumPy, matplotlib
, SciPy libraries.
The full Python code used to perform the simulations, including load analysis,
power behavior, motor dynamics, hydraulic jack lifting, control input modeling, and
system response, is available in the Appendix section.
A. Describe the physical parameters and constants.
The simulation begins by specifying the system's mechanical, hydraulic, and
electrical characteristics:
i. Motor Parameters:
Vs: Supply voltage
R, L: Armature resistance and inductance
Ke, Kt: Motor constants for back EMF and torque
ii. Mechanical Load:
m: Mass of the object being lifted
g: Gravitational acceleration
b: Damping coefficient
r: Mechanical conversion ratio (rad → m)
iii. Hydraulic Piston:
A: Piston area, based on diameter
B. Define the Control Input
To replicate the command from the mobile application, a digital step input function
was developed:
def control input(t):
return 1 if t >= 2.0 else 0
Before t = 2s, the motor is OFF
After t = 2s, the motor receives full voltage (12V)
C. Formulate the Differential Equations
This is the core model, defining how system states evolve over time.
i. State Variables:
i(t): Motor current
x(t): Lifting position
ẋ(t): Lifting speed
Equations Modeled:
Electrical Equation (from DC motor theory):
dt Vm ( t )−Ri ( t )−Ke ω ( t )
= , whereω (t)=rx ˙ /(t)
di L
Mechanical Equation (Newton's 2nd law):
F ( t ) −bx ˙ ( t )−mg
x ¨ ( t )=
m
where F (t)=Tm (t )/r ,Tm (t )=Kt i(t)
These were wrapped in a function system dynamic (t, y) to be solved numerically.
D Solve the ODE System
Using SciPy. integrate. Solve ivp, the system of equations is solved over a 10-
second window.
Initial Conditions: All set to 0: [i(0), x(0), ẋ(0)]
Time Evaluation: Dense time points for smooth plots (t_eval=np.linspace(...))
E. Quantities After Processing and Derived
Several numbers were computed after the system's solution:
Angular velocity:
t
ω (t)=x ˙
r
Motor Torque:
Tm (t)= Kt ⋅i(t)
Input Voltage Over Time:
From control input, applied across time
Power Consumption:
P(t )=Vm (t)⋅i(t)
Cumulative Energy Consumption:
E(t)= ∫ 0 t P(τ )dτ (vianumerical integration)
F. Visualization
Six plots were produced:
Control Voltage Vm(t): To show when the motor is activated
Current and Torque: Electrical response of the motor
Lifting Position & Speed: Mechanical displacement of the jack
Power Consumption: Real-time demand
Cumulative Energy: Battery load over time
G. Discussion and Analysis of Results
The Python code plot produced the findings.
The full Python code used to perform the simulations, including load
analysis, power behavior, motor dynamics, hydraulic jack lif