Simulation and modeling - PowerPoint PPT Presentation

1 / 21

Simulation and modeling. presented by Vidya Sivakumar. 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”. What is simulation?.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

Simulation and modeling

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Simulation and modeling

• presented by

• Vidya Sivakumar

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”

What is simulation?

Characterisation of simulation:

computer graphics:computational study of light and its effects on geometric objects -key focus was to produce meaningful rendered images of real world or hypothetical objects.

Animation:is 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 HMD’s,position sensors and data gloves.

Simulation is an”engine” that drives the graphics and VR tchnologies-provides the infrastructure necessary for the other fields.

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.model’s output is to visual as in 3D computer animation.

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

• 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?

Verification techniques:

1.Modular design

2.Antibugging

3.Structured walkthrough

4.Deterministic models

5.Run simplified cases

6.Trace

7.On-line graphic displays

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.

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

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.

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.

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.

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.

A simulation layout

• An Example:

• Constructing a simulation involves :

• Coding the behavior of simulation entities - done by extending the sim_entity class and using the body() method.

• finally,setting the simulation in motion using sim_system.run().

/* 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");

}

public void body() {

Sim_event ev = new Sim_event();

int i;

for (i=0; i<100; 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;

public Sink(String name, int index, int state) {

super(name);

this.index = index;

this.state = state;

in = new Sim_port("in");

}

public void body() {

Sim_event ev = new Sim_event();

int i = 0;

while(true) {

i++; if(i>50) break;

sim_wait(ev);

sim_hold(1.234);

sim_schedule(in,0.0,1);

}

System.out.println("Exiting body S");

}

}

class Example1 {

public static void main(String args[]) {

Sim_system.initialise();

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/simjava/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.

Timing diagram bean using the simanim package

“Simulation should be closely interwoven with empirical

studies where possible; it is not a substitute for physical

experimentation”