You are on page 1of 48

Modeling and

Simulation
ME 635/IPD 611
Kishore Pochiraju
Agenda

• Syllabus, Evaluation and Policies


• Definitions
• Modeling and Simulation Process
• Software Tools Overview
• Project
Syllabus

Introduction to Modeling and Simulation (3 weeks)


– Definitions & Tools Data Modeling: Curve fits, probability
density functions, …
– Numerical Algorithms: Numerical Integration, Solutions to
PDEs with Finite Element Methods
Syllabus-II
Module I: Mathematical Modeling of Physical Behavior –
Static/Dynamic
• Thermal, Elastic, Electrostatic, magnetic problems
• Coupled problems
– High-Resolution spatial and temporal simulations
Syllabus-III

Module 2: (3 Weeks) Modeling of Dynamical Systems


– Systems Level Modeling - ODES
– Implicit Methods, Explicit Methods
– Reduced Order (ODE) Transient Solutions

Model building/Approximations: Sub-models, interfaces and


Concatenating models to building system-level models

Software Tool: MATLAB/ Simulink


http://www.mathworks.com/videos/getting-started-with-simulink-
69027.html
Syllabus-IV
Module 3: (4 Weeks) Discrete Event Models – Logical
Modeling of Processes
• Process logic
• Resources and Queuing
• Entity Transport

Modeling with uncertainty

Software Tool: ARENA


http://www.youtube.com/watch?feature=player_embedded&v=1KJVeHVaaco
Text Books and Resources

Handouts (Textbook Draft)


• Module 1: Presentations, handouts, manuals
• Module 2: Presentations, handouts, manuals
• Module 3: Simulation with Arena -
Course Policies
• There will be ample time to do assignments.
• All assignments (mid-term, final project, etc) must be submitted on
CANVAS (no exceptions!).
• Please do not email me or the TA assignments.
• Late Policy:
– 1 or 2 time 24 hour extension – Email (kishore.pochiraju@stevens.edu) a
valid reason before the assignment is due.
– +3 Days – 80% of the grade
– +4-7 Days – 50% of the grade
– > 7 Days - 0%
All Assignments are typically due at 11:59 PM. Check the
due date/time carefully.
Plagiarism (copying) will result in all parties getting a
ZERO on the assignment.
Agenda Today

• Definitions
• Modeling Process
• Introduction to Software Tools
• Project
– Teaming
– Project Objective
Definitions

• Model: A representation, abstraction or simplification of


a physical system that can be used as a proxy for the
system
• A model can be
– Physical: Representation of the shape.
– Logical: Representation of the behavior
– Mathematical: Parametrically determine the behavior of
the physical system

10
Physical Models

Which one is the tallest?


• Burj Khalifa: 2717 ft (828 – 830 m)
• Eiffel Tower: 986 ft (300 m)
• Statue of Liberty: (100 m)
– 305.5 ft. (with pedestal)
– 151’11” (base to torch)

Models Approximate –
They do not contain all the information
Measurement to a Scale
Simulation

• Is an instance of the model behavior


• Requires input specification
• Requires solution of the model response

Inputs Model Outputs

14
Parameters/Variables

• Input Parameters: u
• Output parameters: y
• Intermediate or State Variables: q

u
q
y

15
Keep in Mind!

An Approximate Simulation
to an Exact Model is Better than
an Exact Simulation to
An Approximate Model to the Problem

Bad! “If you model the physical


system accurately, you can
Physical get away with a simpler
System solution…”
Best!

16
Area of the Circle with Polygonal
Approximations
Area = p
R=1
3.1415926535897932384626433832795028841971693
99375105820974944592307816406286208998628034
8253421170679 …

Area = 4R2

2R=2

17
A Polygon Model

2R
Side =
R 3
Area = 1 6. 2 R R  3.464101615137R 2
2 3

16 Sided Polygon
Area: 3.1828 R2 Octagon:
Area: 3.3139 R2
100-Sided Polygon
Area: 3.1428 R2

http://www.1728.com/polygon.htm 18
In Class Exercise #1
100 mm

Find the
area of the
cell A.

100 mm
A
Modeling accuracy!

Max Temperature prediction may


be off between 4-5 F – 3 days
out
May be 7-9 degrees off – 7 days
out
Are we becoming better?
How do you measure errors in model
predictions? Precipitation is more difficult
than max. temperature

Red is where rainfall of 0.5” or


less is predicted. Green is
where the rainfall happened.

Error = Hatched area/red area


Model can go wrong two ways –

Amount of rainfall or where it


happens….
Always carry an umbrella!

Models are right about the area only 40% of time (1 day out) –
Area of coverage only 6% of the time.
https://www.wpc.ncep.noaa.gov/verification/mode/mode.php?
vdate=20200121&mdl=hpc&ldt=24&thres=twoi#page=page-1
Verification and Validation are important

• Verification – You are • Validation


simulating the right model Your model is correctly
approximating the physical
system/process.
Easier
Harder – requires physical
observations error
measurements, model
calibration,
Modeling Process

1. Analyze the problem: Study the situation sufficiently to identify the


problem precisely and understand its fundamental questions clearly. At
this stage, we determine the problem’s objective and decide on the
problem’s classification, such as deterministic or stochastic.

2. Formulate a model: In this stage, we design the model, forming an


abstraction of the system we are modeling.
a. Gather data
b. Make simplifying assumptions and document them
c. Determine variables and units
d. Establish relationships among variables and submodels
e. Determine equations and functions

26
Modeling Process - II

3. Solve the model: This stage implements the model. It is important not to
jump to this step before thoroughly understanding the problem and
designing the model.

4. Verify and interpret the model’s solution Once we have a solution, we


should carefully examine the results to make sure that they make sense
(verification) and that the solution solves the original problem (validation)
and is usable. The process of verification determines if the solution
works correctly, while the process of validation establishes if the
system satisfies the problem’s requirements. Thus, verification
concerns “solving the problem right,” and validation concerns
“solving the right problem.” Testing the solution to see if
predictions agree with real data is important for verification.

27
Modeling Process - III

5. Report on the model : Reporting on a model is important for its utility.


Perhaps the scientific report will be written for colleagues at a laboratory
or will be presented at a scientific conference. A report contains the
following components, which parallel the steps of the modeling process:
a. Analysis of the problem
b. Model design
c. Model solution
d. Results and conclusions

6. Maintain the model : As the model’s solution is used, it may be


necessary or desirable to make corrections, improvements, or
enhancements. In this case, the modeler again cycles through the
modeling process to develop a revised solution.

28
Simulation Types
• Static vs. Dynamic
– Does time have a role in the model?
• Continuous-change vs. Discrete-change
– Can the “state” change continuously or only at
discrete points in time?
• Deterministic vs. Stochastic
– Is everything for sure or is there uncertainty?
• Most operational models:
– Dynamic, Discrete-change, Stochastic

29
Simulation Types

Static: Model response and all


parameters are independent of time.

u  u (x)
y  y(x)
q  q (x) Steady state temperature and
velocity profiles

30
Quasi-Static

• Problem is time-history independent and


changes very slowly with time. All time
rate of changes are close to zero.

u  u ( x , t*)
y  y ( x , t*)
q  q ( x , t*)

31
Dynamic Problem

• Parameters are time and time-history


dependent.
– Steady state: Process reaches time independence
after some transient response
– Periodic: response repeats after a certain time
period
– Transient Response: Time dependent response of
the system

Periodic thermal
Vibrations of a molecule

32
Transient Response

Anthropomorphic Test Devices; SID-IIs Side Impact Crash Test Dummy; 5th Percentile
Adult Female,, A Rule by the National Highway Traffic Safety Administration 33
Continuous Vs. Discrete Change

• Continuous Change:
– Variable changes continuously. No Sudden jumps.
– e.g. Y = sin(x). X changes continuously between 0-2p,
Y changes continuously.
• Discrete Change:
– Two workers at a toll both are servicing 50 cars an
hours. A third booth opens with the third worker. The
number vehicles serviced jumps “discretely” to 75.

34
Deterministic vs. Stochastic

– Deterministic: Value of a variable is known to 100%


certainty.
• E.g: Number of apples in a 1-dozen box.

– Stochastic: Value of a variable is NOT known to 100%


certainty. However, the probability of the variable
assuming a value is known.
• E.g: Number of people buying 1-dozen apple boxes in a
grocery store:
– On an average 10, maximum of 20, minimum of 1
– Probability for 1 person or more buying – 20%; 10 persons or
more – 10%; …

35
Process Simulations

The bank lines (one long line many agents) vs.


Grocery store lines (many lines)? Why so?

36
Role of simulation tools
• Simulation tools typically implement models. There are
typically many choices.
– Commercial codes – support, better user experience – but
expensive. Licenses are needed. Code publishers control the
size of the problem and/or how many times/days of use. $$$$
– Open source: Often developed by volunteers – little or no
support – source code is open so extensions, implementation
of new models are possible.
– Avoid Adware.
What tools do we need for this course?

• You need a CAD software with embedded FEM solvers –


Recommend we use FREECAD. You have the option of
using Solidworks, but its installation/licensing issues are
your own.
• We will need Matlab/Simulink or Alternatively,
OpenModelica. Recommend using Matlab/Simulink.
• ARENA – educational version or evaluation version will be
needed. This works only on PCs. Stay tuned for the Mac
OS/Docker solution.
Introduction to Software Tools

• FreeCAD and embedded solvers.


• MATLAB / SIMULINK: General purpose
computational framework for solving models
involving mathematical representations _ or
Octave/Modelica…
http://www.mathworks.com/videos/getting-started-with-simulink-69027.html

• ARENA: Stochastic simulations – specialized for


process modeling
http://www.youtube.com/watch?feature=player_embedded&v=1KJVeHVaaco
Spatial Scalar and Vector Fields (FEM)
Convection (Velocity-vectors)
TEMPERATURE (Scalar)

Water Heating in a vessel


Matlab/Simulink. – Octave/Open Modelica

• Installing and licensing

• Simple Scripts.

• Where to find tutorials:

http://www.mathworks.com/academia/student_center/tutorials/launchpad.htm
l
Matlab/Simulink Example
Matlab/Simulink Solution
Simulink Model
Script with Parameters
Mass= 1; C= 1; K = 1 C=0.1
Stochastic Simulations (Arena/Jaamsim)
Monte Carlo Simulations are easy to do.

• Thanks to a posting on Wikipedia!


• We can calculate Pi with a Monte Carlo simulation
Typical Monte Carlo Models

• Estimate the Value of PI.


• Multiple deterministic simulations are perform with
stochastically varying inputs to determine the variability of
the response.

• Each time a simulation is performed (with deterministic


inputs), the response changes.
• We need to evaluate the statistics of the response from the
results of several trials or simulations.
Monte Carlo style simulation that can be done to
find p
GENERATE RANDOM POINTS
OUT = 0
IN = 0
RUN FOREVER:
X = RAND(0,1)
Y = RAND(0,1)
IF ( SQRT(X^2+Y^2)>1.0) THEN
OUT = OUT + 1
ELSE
IN = IN +1
END IF
PI_EST = IN/(IN+OUT)*4.0

SEE PI_ESTIMATE_MONTE.XLS

You might also like