Simulation and modeling - PowerPoint PPT Presentation

About This Presentation
Title:

Simulation and modeling

Description:

A discipline of designing a model of actual or theoretical ... The source sends 100 messages to the sink, and waits for acks * Messages are sent via ports ... – PowerPoint PPT presentation

Number of Views:32
Avg rating:3.0/5.0
Slides: 22
Provided by: sivakumart
Learn more at: http://www.cs.albany.edu
Category:

less

Transcript and Presenter's Notes

Title: Simulation and modeling


1
Simulation and modeling
  • presented by
  • Vidya Sivakumar

2
What is simulation?
  • A discipline of designing a model of actual or
    theoretical physical systems,executing the model
    on a digital computer and analyzing the execution
    output.
  • It embodies a principle of learning by doing

3
Characterisation of simulation computer
graphicscomputational study of light and its
effects on geometric objects -key focus was to
produce meaningful rendered images of real world
or hypothetical objects. Animationis the use of
graphics to generate a sequence of frames
which,when passed before your eyes
quickly,produces a n illusion of continuous
motion. Virtual Reality is primarily focussed
on human computer interaction as found in devices
such as HMDs,position sensors and data
gloves. Simulation is anengine that drives the
graphics and VR tchnologies-provides the
infrastructure necessary for the other fields.
4
(No Transcript)
5
Why do simulation? Simulation is essential in the
following areas 1. Model is complex with many
variables and interacting components. 2.Underlying
variable relationships are non_linear. 3.model
contains random variables 4.models output is to
visual as in 3D computer animation.
6
Model classifications
1.Continuous and discrete time models
2.Continuous state and discrete state
models 3.Deterministic and probabilistic
models 4.Static and Dynamic models 5.Linear and
nonlinear models 6.Open and closed
models 7.Stable and unstable models
7
  • Model Verification and Validation techniques
  • Two steps involved in the goodness of a
    simulation model
  • Ensure that the assumptions are reasonable -
    Validation-Are we building the right system?
  • Ensure that the model implements those
    assumptions correctly-verification (also called
    debugging)-Are we building the system right?

8
Verification techniques 1.Modular
design 2.Antibugging 3.Structured
walkthrough 4.Deterministic models 5.Run
simplified cases 6.Trace 7.On-line graphic
displays
9
Model validation techniques Validation
techniques used for one model cannot be applied
to another. Key aspects 1.Assumptions 2.input
parameter values and distributions. 3.Output
values and conclusions.
10
Each of the key aspects are subjected to validity
test with that obtained from the following
sources 1.Expert intuition - brainstorming
meeting 2.Real-system mesurements 3.Theoretical
results
11
Simulation Languages General purpose languages
(C, C, Fortran, Ada, etc.) Simulation
languages (SIMSCRIPT, GPSS, COMNET, SimPack,
etc.) Selecting a language for simulation is one
of the most important choice since incorrect
decision causes long development
times, incomplete studies and failures. Advantages
of Using Simulation Languages 1.Simulation
languages automatically provide most (if not all)
of the features needed in programming a
simulation model. 2.Simulation languages
provide a natural framework for simulation
modeling. 3.Most simulation languages provide
better error detection.
12
Advantages of General purpose languages 1.Most
programmers already know a general purpose
language. 2.General purpose languages are
available on almost every computer. 3.An
efficiently written general purpose language may
require less execution time than the
corresponding program written in a simulation
language. 4.General purpose languages allow
greater programming flexibility.
13
What is Simjava? Simjava is a process based
discrete event simulation package for java A
collection of entities each running on its own
thread. Entities are connected by ports and can
communicate with each other by sending and
receiving objects. A central system class that
controls all the threads and advances the
simulation time. Progress is recorded as trace
messages and saved in a file.
14
A simulation layout
15
  • An Example
  • Constructing a simulation involves
  • Coding the behavior of simulation entities - done
    by extending the sim_entity class and using the
    body() method.
  • Adding instances of these entities using
    sim_system object using sim_system.add(entity)
  • linking entities ports together,using
    sim_system.link_ports()
  • finally,setting the simulation in motion using
    sim_system.run().

16
/ A simple Source and Sink example The source
sends 100 messages to the sink, and waits for
acks Messages are sent via ports / import
eduni.simjava. class Source extends Sim_entity
private Sim_port out private int index
private int state public static final int
SRC_OK 0 public static final int
SRC_BLOCKED 1 public Source(String name,
int index, int state) super(name)
this.index index this.state state
out new Sim_port("out") add_port(out)

17
public void body() Sim_event ev new
Sim_event() int i System.out.println("A
bout to do body S") for (i0 ilt100 i)
sim_schedule(out,0.0,0)
sim_wait(ev) sim_hold(10.0)
sim_trace(1,"C Src loop index is "i)
System.out.println("Exiting body S")
class Sink extends Sim_entity private
Sim_port in private int index private int
state public static final int SINK_BLOCKED
0 public static final int SINK_OK 1
18
public Sink(String name, int index, int state)
super(name) this.index index
this.state state in new Sim_port("in")
add_port(in) public void body()
Sim_event ev new Sim_event() int i 0
System.out.println("About to do body R")
while(true) i if(igt50) break
sim_wait(ev) sim_hold(1.234)
sim_schedule(in,0.0,1)
System.out.println("Exiting body S")
19
class Example1 public static void main(String
args) Sim_system.initialise()
Sim_system.add(new Source("Sender", 1,
Source.SRC_OK)) Sim_system.add(new
Sink("Receiver", 2, Sink.SINK_OK))
Sim_system.link_ports("Sender", "out",
"Receiver", "in") Sim_system.run()
System.out.println("Exiting main()")
Compiling Simulations 1. Add the sim_java
package to the CLASSPATH environment
variable export CLASSPATH/home/rmcn/summ96/simjav
a/classes/CLASSPATH 2.Compile and execute the
code in the normal way 3.After running the
simulation will leave a trace file in the current
directory,containing the trace lines of the
simulation.
20
Timing diagram bean using the simanim package
21
Simulation should be closely interwoven with
empirical studies where possible it is not a
substitute for physical experimentation
Write a Comment
User Comments (0)
About PowerShow.com