Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter16 Methodology: How to Model and Simulate

Similar presentations


Presentation on theme: "Chapter16 Methodology: How to Model and Simulate"— Presentation transcript:

1 Chapter16 Methodology: How to Model and Simulate

2 M&S Methodology First think about your objectives- find a level of difficulty that seems achievable in the time available. Develop the experimental frames first to meet these objectives. Develop your atomic models and coupled models and and test them in hierarchical stage wise fashion in SimView. Start your exploratory phase -- get some preliminary results of execution within experimental frames. What is the “lay of the land”? Which factors appear to matter most? Start your production runs (for final results) by concentrating on the factors that seem to be important from your initial exploration. If you need better performance, remove all unessential code, including output and print statements. Switch execution from SimView to fast-as-can simulation as shown next. For greater performance migrate your model to parallel/distributed fast-as-can simulation (not currently available). If your objectives were to develop real-time execution models, migrate them to real-time execution (distributed, non-distributed) as shown next.

3 Suggested Project Report Outline
Problem statement – Objectives of the Project General Description of the System to be Studied Objectives of the Modeling and Simulation Study The Simulation Model System Entity Structure or Hierarchical diagrams and explanation of operation Illustrative DEVSJAVA code or pseudo code Experimental frame and how it serves to achieve the Objectives Experiments Results ( or expected results) Conclusions (what did you learn from this work Future Work References Appendix: more details or code

4 Categorizing Simulation Modes and Packages in DEVSJAVA
Non Distributed Distributed Real-time SimView supports visual behavior validation. Using real-time simulation on a single workstation allows checking timing. Tunable real-time coordinator used by SimView allows speed as well. Packages: genDevs.modeling genDevs.simulation simView genDevs.simulation.realtime Only decentralized is currently available for distribution. Centralized available upon requirest. genDevs.simulation..distributed Fast-as-can Not available currently for distribution. Available upon requirest. centralized Decentralized Atomic federate Coupled Federate Non threaded threaded

5 Model Development using Model Continuity
Implementation/ Logical Simulation Model Distribution/ Distributed Simulation Real-Time Distributed Simulation/ Execution Modeling Checks Model Logical Behavior Checks Model Logical Behavior in Distributed Environment Checks Model Temporal Behavior DEVS Formalism genDevs. simulation. distributed genDevs. simulation. realTime genDevs. simulation

6 Using inheritance and polymorphism to allow easy switching from structure/behavior viewing to fast simulation atomic digraph atomicSimulator coupledSimulator coordinator Viewable Atomic Digraph ViewableAtomic Simulator coupledRTSimulator SimView Coordinator Later, when ready for production runs, execute them without change in fast-as-can simulation Even though ViewableAtomic and ViewableDigraph models can hold information intended for SimView, they need not be altered to run outside of SimView. For example, to run a ViewableDigraph model in a main routine define: public static void main(String args[]){ ViewableDigraph d = new (Random,rule30CellSpace): r = new coordinator (d); r.initialize(); //to measure execution time if desired: initTime = System.currentTimeMillis(); r.simulate(100); termTime = System.currentTimeMillis();} This can be executed in JBuilder of by changing directory to DevsJava/classes and entering on the command line – >java Random.rule30CellSpace You can develop models and test them in SimView simView. ViewableDigraph To understand how this is possible, consider that in atomicSimulator the Devs Simulator Cycle implementation includes “hooks” within its methods, e.g., public void computeInputOutput(double t){ if(equalTN(t)) { output = myModel.Out();} else{output = new message();} computeInputOutputHook1() ;} These hooks are dummy methods within atomicSimulator, e.g., protected void computeInputOutputHook1() {} In ViableAtomicSimulator the hooks are given definitions that allow the SimViewCoordinator to get the infromation it needs to display in SimView, .e.g., protected void computeInputOutputHook1(){ if (listener == null) return; ContentIteratorInterface iterator = output.mIterator(); while (iterator.hasNext()) { ContentInterface content = iterator.next(); listener.contentOutputted((content)content,\ viewableAtomic, content.getPort().getName()); } } simView. ViewableAyatomic

7 Using toString() and toObject() to facilitate deploying models in distributed simulation
receiver sender DEVS simulator uses toString() to encode the entity as a String which is sent across the wire public message out( ){ message m = new message(); m.add(makeContent("out", new vect2DEnt(x,y))); return m; } public void deltext(double e ,message x){ for (int i=0; i< x.getLength();i++) if (messageOnPort(x,“in",i)) { entity en = x.getValOnPort(“in",i); position = vect2DEnt.toObject(en); } The modeler must define toString() for the simulator to use polymorphically. For example: public String toString(){ return doubleFormat.niceDouble( x ) + ","+doubleFormat.niceDouble(y); } public String getName(){ return toString(); The modeler also needs to define toObject() and use this method in decoding the message. public static vect2DEnt toObject(String nm){ int commaIndex = nm.indexOf(","); String xs = nm.substring(0,commaIndex); String ys = nm.substring(commaIndex+1,nm.length()); return new vect2DEnt(Double.parseDouble(xs),Double.parseDouble(ys)); } public static vect2DEnt toObject(entity ent){ return toObject(ent.getName());

8 Deploying a coupled model onto a distributed, decentralized, real-time simulation
For the coupled model define a RTCoordinatorServer,e.g.,: public class StartVehicleSpaceServer{ public static void main(String[] args) { try{ System.out.println("For use by clients, this host is " +InetAddress.getLocalHost().getHostAddress()); }catch(Exception c){} new RTCoordinatorServer(new vehicleSpace(), 10);} You can develop models and test them in SimView This will give you the address needed by clients For each component model define a RTCoordinatorClient, e.g.,: public class StartEvaderClient{ public static void main(String[] args) { new RTCoordinatorClient( new vehicle("evader",new vect2DEnt(40,40)), " ", //RTCoordinatorServer’s address //or if on same machine as the server //you can use "localhost", Constants.serverPortNumber); }} StartVehicleSpaceServer StartEvader Client StartPursuer Client Continuity. StartVehicleSpaceServer intranet or internet Later, when ready for production runs, execute them without change in distributed, real0time, decentralized simulation You can now distribute these classes onto one or more computers and execute them from jBuilder or from the command line as illustrated before. You can also distribute hierarchically using RTCoordinatorServerAndClient

9 V&V

10 General System Philosophy
George Klir, “Architecture of General Systems”

11 Modeling & Simulation/Systems Theory
Mathematical Systems Theory Hierarchy of System Specifications Framework for Modeling and Simulation Specification Morphisms entities relations uses the formalism of is interpreted by

12 M&S Framework DEVS HLA/SOA Layered architecture Collaboration Decision
Objectives represented by Model Real World Simulator modeling relation simulation Experimental Frame Network Simulation Modeling Search Decision Collaboration DEVS HLA/SOA Layered architecture Entities formalized as systems; relations as system morphisms

13 DEVS Modeling & Simulation Framework
DEVS = Discrete Event System Specification Provides sound M&S framework Derived from Mathematical dynamical system theory Supports hierarchical, modular composition and reuse Can express Discrete Time, Continuous and hybrid models Event-orientation enables efficient simulation HLA/SOA enables interoperability of existing simulations DEVS supports developing new simulation models within an object-oriented computational framework

14 JM Application: C4ISR System-of-System Design
Joint MEASURETM Jointly Developed by Lockheed and UA under DARPA ASTT Mission Effectiveness Simulator for System-of-Systems employs moderate level of resolution Inter-satellite Communication Network Simulation Modeling Search Decision Collaboration HLA DEVS ME Threat Detection Data JM Application: C4ISR System-of-System Design Relay Threat Analysis WAN link * Mission Effectiveness Analysis Simulator for Utility, Research and Evaluation

15 Hierarchy of System Specifications and Morphisms
simulation model construction at high levels System specification levels Morphisms at each level V&V loop structure to behavior behavior to structure experimental testing at low levels

16 V&V


Download ppt "Chapter16 Methodology: How to Model and Simulate"

Similar presentations


Ads by Google