COMP 522 Modelling and Simulation -...
Transcript of COMP 522 Modelling and Simulation -...
Fall Term 2006
COMP 522
Modelling and Simulation
“model everything”
Hans Vangheluwe
Modelling, Simulation and Design Lab (MSDL)
School of Computer Science, McGill University, Montreal, Canada
Hans Vangheluwe [email protected] Modelling and Simulation 1/37
Hans Vangheluwe [email protected] Modelling and Simulation 2/37
A Variety of Complex Systems . . .
Need to be modelled
• at most appropriate level of abstraction
• in most appropriate formalism(s)
Hans Vangheluwe [email protected] Modelling and Simulation 3/37
Available Information, Questions to be Answered, . . .
⇒ choice of Abstraction Level/Formalism
Hans Vangheluwe [email protected] Modelling and Simulation 4/37
Power Window
Hans Vangheluwe [email protected] Modelling and Simulation 5/37
Power Window: need for multiple formalisms
http://www.mathworks.com/products/demos/simulink/PowerWindow/html/PowerWindow1.html
Hans Vangheluwe [email protected] Modelling and Simulation 6/37
COMP 522A: Modelling and Simulation
• . . . to study (static/dynamic) structure and (dynamic) behaviour
• . . . for analysis and design of complex systems
• . . . for different application domains:
computer networks, software design, traffic control, software
engineering, biology, physics, chemistry, management, . . .
• . . . implemented using Computer Science
• . . . focus on Software Engineering
Hans Vangheluwe [email protected] Modelling and Simulation 7/37
Overview
1. What is Modelling and Simulation ?
2. Which topics does COMP 522 cover ?
3. What are the pre-requisites ?
4. How is evaluation done ?
5. What are the assignments about ?
6. Where do I get the material covered in CS522 ?
Hans Vangheluwe [email protected] Modelling and Simulation 8/37
What is Modelling and Simulation ?
• Modelling: represent/re-use/exchange knowledge
about system structure and behaviour
• Simulation: to accurately and efficiently emulate real behaviour
• Why ?
– cost, danger, . . .
– what-if analysis ?
– optimization (do it right the first time) !
⇒ modelling and simulation based design
Hans Vangheluwe [email protected] Modelling and Simulation 9/37
Modelling and Simulation Based Design
Hans Vangheluwe [email protected] Modelling and Simulation 10/37
M&S in action: Flight Simulation
www.flightgear.org
Hans Vangheluwe [email protected] Modelling and Simulation 11/37
M&S in action: Environment
NATO’s Sarajevo WWTP
www.nato.int/sfor/cimic/env-pro/waterpla.htm
Hans Vangheluwe [email protected] Modelling and Simulation 12/37
M&S in action: Environment
www.hemmis.com/products/west/
Hans Vangheluwe [email protected] Modelling and Simulation 13/37
M&S in action: Traffic
www.engr.utexas.edu/trafficSims/
Hans Vangheluwe [email protected] Modelling and Simulation 14/37
M&S in action: Training
USC Institute for Creative Technologies
www.ict.usc.edu
Hans Vangheluwe [email protected] Modelling and Simulation 15/37
M&S in action: Game AI, Physics, Narratives, . . .
www.info.ea.com/company/company tw.php
Hans Vangheluwe [email protected] Modelling and Simulation 16/37
Modelling and Simulation . . .
• . . . is Computer Science, Artificial Intelligence
• . . . is Numerical Analysis, Computer Algebra
• . . . is Systems Theory, Control Theory
• . . . is Operations Research
• . . . is Application Domain: Mechanical Engineering, . . .
. . . or something more GENERIC ?
Hans Vangheluwe [email protected] Modelling and Simulation 17/37
Real-Worldentity
BaseModel
System S
only study behaviour inexperimental context
experimentwithin context
Model M
Simulation ResultsExperiment Observed Data
within context
simulate= virtual experiment
Model Basea-priori knowledge
validation
REALITY MODEL
GOALS
Modelling and Simulation Process
Hans Vangheluwe [email protected] Modelling and Simulation 18/37
COMP 522 Concept MapHierarchy of System Specifications
Finite State Automata (FSA)
Petri Nets
DEVS
GPSS
Event Scheduling
Activity Scanning
Process Interaction
Discrete Event
Statecharts
Hybrid
Continuous-Time
Forrester System Dynamics
Population Dynamics
Modelica(multi-physics)
CSSLs
continuous-time CBDs
discrete-time CBDs
time-less CBDs
Causal Block DiagramsFormalisms
Animation
is theory behind
visualized using
Hans Vangheluwe [email protected] Modelling and Simulation 19/37
Which topics does the course cover ?
1. Modelling formalism syntax and semantics.
The Causal Block Diagram formalisms.
I O
^−1
IC
IC
4.0 K 1.0 M
1.0 V0
0.0 X0
DEPINDEP
DEPINDEP
PlotTIME
Hans Vangheluwe [email protected] Modelling and Simulation 20/37
2. Untimed Discrete Event Formalisms:
(a) (non)Deterministic State Automata.
(b) Adding Concurrency and Synchronisation: Petri Nets
(e.g., specifying network protocols).
Hans Vangheluwe [email protected] Modelling and Simulation 21/37
(c) Adding Hierarchy and Orthogonality: Statecharts
(e.g., UML, specifying reactive software).
Hans Vangheluwe [email protected] Modelling and Simulation 22/37
3. Communicating Sequential Processes (CSP/kiltera).
process sender[output]:
seq
print ("sender","sending","message")
wait 0 ->
send "message" to output ->
print ("sender","sent message")
process receiver[input]:
seq
print ("receiver","waiting for input")
wait 2 ->
receive msg from input ->
print ("receiver","received",msg)
main
channel a in
par
sender[a]
receiver[a]
Hans Vangheluwe [email protected] Modelling and Simulation 23/37
4. Timed Discrete Event Formalisms:
Hans Vangheluwe [email protected] Modelling and Simulation 24/37
(a) Event Scheduling.
(b) Activity Scanning.
(c) Three Phase Approach.
(d) Process Interaction for queueing systems (GPSS).
FN112
0
2V2
V1 PH1
LR PH1
V1 H2
P2NEP1
S PH1
LNKS
R PH1
1
LR PH2 R PH1
LNKS
1
S PH2
FN1120
Function: 1LNKS10
Hans Vangheluwe [email protected] Modelling and Simulation 25/37
(e) DEVS as a rigourous basis for hierarchical modelling.
5. Deterministic Simulation of Stochastic Processes:
(a) Pseudo Random Number Generation.
(b) Gathering Statistics (performance metrics).
6. Animation
7. Continuous-time Formalisms:
(a) Ordinary Differential Equations, Algebraic Equations,
Differential Algebraic Equations.
(b) CSSLs: sorting and algebraic loop detection.
(c) Forrester System Dynamics, Population Dynamics.
Hans Vangheluwe [email protected] Modelling and Simulation 26/37
Predator Prey
Grazing_efficiency
uptake_predatorloss_prey
predator_surplus_DR
prey_surplus_BR
2−species predator−prey system
predator
prey
trajectories
0 10 20 30
200
400
600
(d) Object-oriented Physical Systems Modelling:
non-causal modelling, Modelica (www.modelica.org).
8. Hierarchy of System Specifications, Systems Theory.
Hans Vangheluwe [email protected] Modelling and Simulation 27/37
Assignments cover these topics
1. A Causal Block Diagram simulation tool.
2. Petri Net model and analysis.
3. Statechart model and software synthesis.
4. kiltera model
5. GPSS (process interaction) model of a queueing system.
6. A DEVS model of a traffic system.
Hans Vangheluwe [email protected] Modelling and Simulation 28/37
Project
• For a formalism of choice (possibly construct your own):
build a modelling and/or simulation environment.
• Using an existing modelling/simulation system:
study a specific problem.
Hans Vangheluwe [email protected] Modelling and Simulation 29/37
Exam: mini-quiz(es)
Hans Vangheluwe [email protected] Modelling and Simulation 30/37
What are the pre-requisites ?
• COMP 251 (data structures and algorithms),
• COMP 302 (programming languages and paradigms),
• COMP 350 (numerical computing).
. . . or equivalent (see me).
Note:
• all assignment/project programming in Python (where
appropriate)
• no prior knowledge required, read Tutorial at www.python.org
Hans Vangheluwe [email protected] Modelling and Simulation 31/37
How is evaluation done ?
• 60% on assignments.
• 30% on the project (work, correctness, presentation).
• 10% on a mini-quiz(es).
Together, assignments, mini-quiz(es) and project cover the entire
course.
Hence, there is no final exam.
Hans Vangheluwe [email protected] Modelling and Simulation 32/37
Assignment/project rules of the game ?
• Completely in HTML form: requirements, design, code, discussion.
• Submit via WebCT.
• All coding in Python www.python.org (where appropriate).
• Assignments and projects in teams of 2. Clearly describe work
distribution !
• Original work, some presented in class.
• Respect deadlines (or do more work to compensate).
• Alternate subjects may be proposed.
Hans Vangheluwe [email protected] Modelling and Simulation 33/37
Need help ?
• Use the discussion forum in WebCT
• Come and see me Monday 16:00 - 18:00 in MC328
• See the TA (Ximeng Sun) in MC202
• Send TA or me e-mail
• Talk to me after class or make an appointment
• Assignments/projects are never fully specified ! Give feedback !
Hans Vangheluwe [email protected] Modelling and Simulation 34/37
Undergraduate or Graduate course ?
• Challenging course (work load)
• ”graduate” flavour (independent thinking)
• some of the highest grades ever were obtained by ugrads
Hans Vangheluwe [email protected] Modelling and Simulation 35/37
What are the project subjects ?
• Model/simulate a particular application (e.g., traffic, biology)
• Build a modelling/simulation/animation tool for a particular
formalism
Give suggestions !
Hans Vangheluwe [email protected] Modelling and Simulation 36/37
Where do I get the material covered in CS522 ?
moncs.cs.mcgill.ca/people/hv/teaching/MS/
• Class presentations/notes online in PDF format.
• Some handouts during the term.
• Links and references for background info.
Hans Vangheluwe [email protected] Modelling and Simulation 37/37