1 / 21

Simulation and modeling

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

Download Presentation

Simulation and modeling

An Image/Link below is provided (as is) to download presentation 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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Simulation and modeling • presented by • Vidya Sivakumar

  2. 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?

  3. 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.

  4. 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.

  5. 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

  6. 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?

  7. Verification techniques: 1.Modular design 2.Antibugging 3.Structured walkthrough 4.Deterministic models 5.Run simplified cases 6.Trace 7.On-line graphic displays

  8. 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.

  9. 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

  10. 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.

  11. 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.

  12. 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.

  13. A simulation layout

  14. 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().

  15. /* 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); }

  16. public void body() { Sim_event ev = new Sim_event(); int i; System.out.println("About to do body S"); 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;

  17. 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(i>50) break; sim_wait(ev); sim_hold(1.234); sim_schedule(in,0.0,1); } System.out.println("Exiting body S"); } }

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

  19. Timing diagram bean using the simanim package

  20. “Simulation should be closely interwoven with empirical studies where possible; it is not a substitute for physical experimentation”

More Related