Simulation and
Modeling
Debtanu Pal
Abhishek Chandra
Aman Saraswat
Vivek Kumar Pal
INDEX
● INTRODUCTION
● A MODEL OF A BOUNCING BALL
● A MODEL OF SPRING MASS SYSTEM
● A MODEL OF TRAFFIC FLOW
Introduction to Simulation
System, Model, and Simulation
● System is the articulate object, which exists in the real world and operates under definite
conditions of time and space.
● A model is a simplified representation of a system at some particular point in time or space
intended to promote understanding of the real system.
● Simulation of a system is the operation of a model in terms of time or space, which helps
analyze the performance of an existing or a proposed system. In other words, simulation is the
process of using a model to study the performance of a system.
System State Variables
The system state variables are a set of data, required to define the internal process within the
system at a given point of time.
● In a discrete-event model, the system state variables remain constant over intervals of time
and the values change at defined points called event times.
● In continuous-event model, the system state variables are defined by differential equation
results whose value changes continuously over time.
A Model of Bouncing Ball
Ball Bouncing Model
● The bouncing ball problem is a classic
example of a hybrid dynamic problem,
involving :
○ Continuous dynamics
○ Discrete transitions where the
system dynamics can change and
the state values can jump
Continuous Dynamics of the Model
●
Discrete Transitions of the Model
●
Zeno Phenomenon
● Characterized by an infinite number of events occurring in a finite time interval for
certain hybrid systems.
● As the ball loses energy in the bouncing ball model, a large number of collisions with
the ground start occurring in successively smaller intervals of time. Hence the
model experiences Zeno behavior.
Using Two Integrator Blocks to Model a Bouncing Ball
Bouncing Ball Model
With two integrator blocks
✓ The state port of the position integrator and the corresponding comparison result is used
to detect when the ball hits the ground and to reset both integrators.
✓ The state port of the velocity integrator is used for the calculation of v+
● To observe the Zeno behavior, confirm that 'Algorithm' is set
to 'Non-adaptive' and that the simulation 'Stop time' is set
to 25 seconds, in the 'Zero-crossing options' section of the
Solver pane of the Configuration Parameters dialog box.
● Observation:
○ The simulation errors out as the ball hits the ground
more and more frequently and loses energy.
○ Consequently, the simulation exceeds the default
limit of 1000 for the 'Number of consecutive zero
crossings' allowed.
● Now ,in the 'Zero-crossing options' section, set the
'Algorithm' to 'Adaptive'. This algorithm introduces a
sophisticated treatment of such chattering behavior.
Therefore, we can now simulate the system beyond 20
seconds.
Results:
Using One Second Order Integrator Block to Model a Bouncing Ball
Using One Second Order Integrator Block to Model a Bouncing Ball
Bouncing Ball Model
With one second order integrator block
Results:
● Confirm that 'Algorithm' is set to
'Non-adaptive' in the 'Zero-crossing
options' section and the simulation 'Stop
Time' is set to 25 seconds. Simulate the
model.
● Observation:
○ The simulation encountered no problems. We
were able to simulate the model without
experiencing excessive chatter after t = 20
seconds and without setting the 'Algorithm' to
'Adaptive'.
Comparison between two Models
● Second-Order Integrator Model is the Preferable Approach to Modeling Bouncing Ball.
● We can analytically calculate the exact time t* when the ball settles down to the
ground with zero velocity by summing the time required for each bounce. This time is
the sum of an infinite geometric series given by:
● Here x0
and v0
are initial conditions for position and velocity respectively. The velocity
and the position of the ball must be identically zero for t > t*.
Comparison(Contd):
• Alongside figure conclusively shows that
the second model has superior
numerical characteristics as compared
to the first model.
• In the figure, results from both
simulations are plotted near t*. The
vertical red line in the plot is t* for the
given model parameters.
• For t<t* and far away from t*, both
models produce accurate and identical
results.
• However, the simulation results from
the first model are inexact after t*; it
continues to display excessive
chattering behavior for t>t*. In contrast,
the second model using the
Second-Order Integrator block settles to
exactly zero for t>t*.
• The second differential equation dx/dt = v is internal to the
Second-Order Integrator block. Therefore, the block
algorithms can leverage this known relationship between the
two states and deploy heuristics to clamp down the
undesirable chattering behavior for certain conditions.
A Model of a Spring Mass
System
Spring Mass System
● Objective : To study the motion of a body under
the constraint of a spring and damping effect
● Basic Model :
○ m : mass of the body under consideration
○ F : Force experienced by the body
○ k : stiffness constant of the spring
○ b : damping constant
Working of the Model
●
The State Equation
Undamped Oscillations
●
Simple Harmonic Motion
● Equation
● Natural Frequency
Observations from Simulated Environment
M = 10kg
x0
= 1(Initial disp.)
v0
= 0(initial velocity)
b(damping constant) = 0
A(amplitude of vibration) = 1
K = 100 N/m (stiffness constant)
If Damping Coefficient in not 0
SHM in Spring Mass Damper System
● Equation of Motion (Free Oscillations) and Solution:
● The motion of the system is affected by the magnitude of damping: under-damped,
critically-damped or over-damped.
Under-Damped, Critically-Damped and Over-Damped Conditions
DAMPING COEFFICIENT
Underdamped Oscillation
Critically Damped Oscillation
Over-Damped Oscillation
Comparison:
A Model of Traffic Flow
Car Following Model
● Describes how one vehicle follows
another vehicle in an uninterrupted flow.
● Based on two assumptions;
○ higher the speed of the vehicle,
higher will be the spacing between
the vehicles and
○ to avoid collision, driver must
maintain a safe distance with the
vehicle ahead
Mathematical Model
Let ∆xn
t
is the gap available for nth
vehicle, and let ∆xsafe
is the safe distance, vn
t
and vn-1
t
are the
velocities, the gap required is given by,
∆xn
t
= ∆xsafe
+ τ.vn
t
…(1)
where τ is a sensitivity coefficient. The above equation can be written as :
xn-1
t
− xn
t
= ∆xsafe
+ τ.vn
t
…(2)
Differentiating the above equation with respect to time, we get
vn-1
t
− vn
t
= τ.an
t
an
t
= (vn-1
t
− vn
t
)/τ …(3)
Mathematical Model (contd.)
Now assume that T is the reaction time, or time taken by a driver to observe what is going on around
them and to update his velocity, then :
an
t + T
= λ(vn-1
t
− vn
t
) …(4)
where λ = 1/τ. The solution of (4) can be a steady-state solution, where all vehicles move at a
constant velocity, or it can be a superposition of exponential solutions of the form
vn
t
= eαt
.u …(5)
where u and α are constants. Differentiating, we get :
an
t + T
= αeαT
.eαt
.u …(6)
Mathematical Model (contd.)
Substituting in (3):
αeαT
.eαt
.u = λ(S.eαt
.u − I.eαt
.u) …(4)
where I is the identity matrix of degree equal to the dimensions of the system and S is the “shift”
matrix that, when it multiplies a vector on the left, cyclically permutes the entries of the vector.
[ S − [1 + (α/λ)eαT
] I ] u = 0 …(5)
Thus u is an eigenvector for S with eigenvalue 1 + (α/λ)eαT
.
Simulink Model
Results for λ = 0
Velocities Positions
Results for λ = 0.8
Velocities Positions
Results for λ = 2
Velocities Positions
Thank You !

Simulation And Modelling

  • 1.
    Simulation and Modeling Debtanu Pal AbhishekChandra Aman Saraswat Vivek Kumar Pal
  • 2.
    INDEX ● INTRODUCTION ● AMODEL OF A BOUNCING BALL ● A MODEL OF SPRING MASS SYSTEM ● A MODEL OF TRAFFIC FLOW
  • 3.
  • 4.
    System, Model, andSimulation ● System is the articulate object, which exists in the real world and operates under definite conditions of time and space. ● A model is a simplified representation of a system at some particular point in time or space intended to promote understanding of the real system. ● Simulation of a system is the operation of a model in terms of time or space, which helps analyze the performance of an existing or a proposed system. In other words, simulation is the process of using a model to study the performance of a system.
  • 5.
    System State Variables Thesystem state variables are a set of data, required to define the internal process within the system at a given point of time. ● In a discrete-event model, the system state variables remain constant over intervals of time and the values change at defined points called event times. ● In continuous-event model, the system state variables are defined by differential equation results whose value changes continuously over time.
  • 6.
    A Model ofBouncing Ball
  • 7.
    Ball Bouncing Model ●The bouncing ball problem is a classic example of a hybrid dynamic problem, involving : ○ Continuous dynamics ○ Discrete transitions where the system dynamics can change and the state values can jump
  • 8.
  • 9.
  • 10.
    Zeno Phenomenon ● Characterizedby an infinite number of events occurring in a finite time interval for certain hybrid systems. ● As the ball loses energy in the bouncing ball model, a large number of collisions with the ground start occurring in successively smaller intervals of time. Hence the model experiences Zeno behavior.
  • 11.
    Using Two IntegratorBlocks to Model a Bouncing Ball Bouncing Ball Model With two integrator blocks ✓ The state port of the position integrator and the corresponding comparison result is used to detect when the ball hits the ground and to reset both integrators. ✓ The state port of the velocity integrator is used for the calculation of v+
  • 12.
    ● To observethe Zeno behavior, confirm that 'Algorithm' is set to 'Non-adaptive' and that the simulation 'Stop time' is set to 25 seconds, in the 'Zero-crossing options' section of the Solver pane of the Configuration Parameters dialog box. ● Observation: ○ The simulation errors out as the ball hits the ground more and more frequently and loses energy. ○ Consequently, the simulation exceeds the default limit of 1000 for the 'Number of consecutive zero crossings' allowed. ● Now ,in the 'Zero-crossing options' section, set the 'Algorithm' to 'Adaptive'. This algorithm introduces a sophisticated treatment of such chattering behavior. Therefore, we can now simulate the system beyond 20 seconds. Results:
  • 13.
    Using One SecondOrder Integrator Block to Model a Bouncing Ball
  • 14.
    Using One SecondOrder Integrator Block to Model a Bouncing Ball Bouncing Ball Model With one second order integrator block
  • 15.
    Results: ● Confirm that'Algorithm' is set to 'Non-adaptive' in the 'Zero-crossing options' section and the simulation 'Stop Time' is set to 25 seconds. Simulate the model. ● Observation: ○ The simulation encountered no problems. We were able to simulate the model without experiencing excessive chatter after t = 20 seconds and without setting the 'Algorithm' to 'Adaptive'.
  • 16.
    Comparison between twoModels ● Second-Order Integrator Model is the Preferable Approach to Modeling Bouncing Ball. ● We can analytically calculate the exact time t* when the ball settles down to the ground with zero velocity by summing the time required for each bounce. This time is the sum of an infinite geometric series given by: ● Here x0 and v0 are initial conditions for position and velocity respectively. The velocity and the position of the ball must be identically zero for t > t*.
  • 17.
    Comparison(Contd): • Alongside figureconclusively shows that the second model has superior numerical characteristics as compared to the first model. • In the figure, results from both simulations are plotted near t*. The vertical red line in the plot is t* for the given model parameters. • For t<t* and far away from t*, both models produce accurate and identical results. • However, the simulation results from the first model are inexact after t*; it continues to display excessive chattering behavior for t>t*. In contrast, the second model using the Second-Order Integrator block settles to exactly zero for t>t*. • The second differential equation dx/dt = v is internal to the Second-Order Integrator block. Therefore, the block algorithms can leverage this known relationship between the two states and deploy heuristics to clamp down the undesirable chattering behavior for certain conditions.
  • 18.
    A Model ofa Spring Mass System
  • 19.
    Spring Mass System ●Objective : To study the motion of a body under the constraint of a spring and damping effect ● Basic Model : ○ m : mass of the body under consideration ○ F : Force experienced by the body ○ k : stiffness constant of the spring ○ b : damping constant
  • 20.
    Working of theModel ●
  • 21.
  • 22.
  • 23.
    Simple Harmonic Motion ●Equation ● Natural Frequency
  • 24.
    Observations from SimulatedEnvironment M = 10kg x0 = 1(Initial disp.) v0 = 0(initial velocity) b(damping constant) = 0 A(amplitude of vibration) = 1 K = 100 N/m (stiffness constant)
  • 25.
  • 26.
    SHM in SpringMass Damper System ● Equation of Motion (Free Oscillations) and Solution: ● The motion of the system is affected by the magnitude of damping: under-damped, critically-damped or over-damped.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
    A Model ofTraffic Flow
  • 34.
    Car Following Model ●Describes how one vehicle follows another vehicle in an uninterrupted flow. ● Based on two assumptions; ○ higher the speed of the vehicle, higher will be the spacing between the vehicles and ○ to avoid collision, driver must maintain a safe distance with the vehicle ahead
  • 35.
    Mathematical Model Let ∆xn t isthe gap available for nth vehicle, and let ∆xsafe is the safe distance, vn t and vn-1 t are the velocities, the gap required is given by, ∆xn t = ∆xsafe + τ.vn t …(1) where τ is a sensitivity coefficient. The above equation can be written as : xn-1 t − xn t = ∆xsafe + τ.vn t …(2) Differentiating the above equation with respect to time, we get vn-1 t − vn t = τ.an t an t = (vn-1 t − vn t )/τ …(3)
  • 36.
    Mathematical Model (contd.) Nowassume that T is the reaction time, or time taken by a driver to observe what is going on around them and to update his velocity, then : an t + T = λ(vn-1 t − vn t ) …(4) where λ = 1/τ. The solution of (4) can be a steady-state solution, where all vehicles move at a constant velocity, or it can be a superposition of exponential solutions of the form vn t = eαt .u …(5) where u and α are constants. Differentiating, we get : an t + T = αeαT .eαt .u …(6)
  • 37.
    Mathematical Model (contd.) Substitutingin (3): αeαT .eαt .u = λ(S.eαt .u − I.eαt .u) …(4) where I is the identity matrix of degree equal to the dimensions of the system and S is the “shift” matrix that, when it multiplies a vector on the left, cyclically permutes the entries of the vector. [ S − [1 + (α/λ)eαT ] I ] u = 0 …(5) Thus u is an eigenvector for S with eigenvalue 1 + (α/λ)eαT .
  • 38.
  • 39.
    Results for λ= 0 Velocities Positions
  • 40.
    Results for λ= 0.8 Velocities Positions
  • 41.
    Results for λ= 2 Velocities Positions
  • 42.