16
Chapter16 Methodology: How to Model and Simulate

Chapter16 Methodology: How to Model and Simulate

  • Upload
    sagira

  • View
    27

  • Download
    0

Embed Size (px)

DESCRIPTION

Chapter16 Methodology: How to Model and Simulate. 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. - PowerPoint PPT Presentation

Citation preview

Page 1: Chapter16  Methodology: How to Model and Simulate

Chapter16 Methodology: How to Model and Simulate

Page 2: Chapter16  Methodology: How to Model and Simulate

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.

Page 3: Chapter16  Methodology: How to Model and Simulate

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

Page 4: Chapter16  Methodology: How to Model and Simulate

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.

Packages:•genDevs.simulation..distributed•genDevs.simulation.realtime

Fast-as-can

Packages:•genDevs.modeling•genDevs.simulation

Not available currently for distribution.

Available upon requirest.

centralized Decentralized

Atomic

federate

Coupled

Federate

Categorizing Simulation Modes and Packages in DEVSJAVA

Non threaded threaded

Page 5: Chapter16  Methodology: How to Model and Simulate

Model Development using Model Continuity

Modeling

Implementation/Logical

Simulation

Checks Model Logical Behavior

Model Distribution/Distributed Simulation

Checks Model Logical Behavior

in DistributedEnvironmentDEVS

Formalism

Real-TimeDistributed Simulation/Execution

Checks Model Temporal Behavior

genDevs.simulation

genDevs.simulation.distributed

genDevs.simulation.realTime

Page 6: Chapter16  Methodology: How to Model and Simulate

Even though ViewableAtomic and ViewableDigraph modelscan 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

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 infromationit 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()); } }

atomic

digraph

atomicSimulator

coupledSimulator

coordinator

ViewableAtomic

ViewableDigraph

ViewableAtomicSimulator

coupledRTSimulator

SimViewCoordinator

ViewableAtomic

ViewableDigraph

You can develop models and test them in SimView

Later, when ready for production runs, execute them without change in fast-as-can simulation

Using inheritance and polymorphism to allow easy switching from structure/behavior viewing to fast simulation

simView.ViewableAyato

mic

simView.ViewableDigrap

h

Page 7: Chapter16  Methodology: How to Model and Simulate

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());}

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); }

Using toString() and toObject() to facilitate deploying models in distributed simulation

sender receiver

DEVS simulator uses toString() to encode the entity as a String which is sent across the wire

Page 8: Chapter16  Methodology: How to Model and Simulate

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 now distribute these classes onto one or morecomputers and execute them from jBuilder or from thecommand line as illustrated before.

Later, when ready for production runs, execute them without change in distributed, real0time, decentralizedsimulation

Deploying a coupled model onto a distributed, decentralized, real-time simulation

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)), "192.168.1.101", //RTCoordinatorServer’s address //or if on same machine as the server //you can use "localhost",

Constants.serverPortNumber); }}

This will give you the address needed by clients

You can develop models and test them in SimView

StartVehicleSpaceServer

StartEvaderClient

StartPursuerClient

intranet or internet

You can also distribute hierarchically using RTCoordinatorServerAndClient

Continuity.

StartVehicleSpaceServ

er

Page 9: Chapter16  Methodology: How to Model and Simulate

V&V

Page 10: Chapter16  Methodology: How to Model and Simulate

General System Philosophy

GeneralSystems

(Isomorphism classes of particular systems basedon relational properties)

ParticularSystems(Engineering,

Scientific, Business,etc.)

abstraction

exemplification

• relational properties (focus on relations)• domain independent• interpretation free• e.g. control theory, information theory• theoretically based distinctions

• constituent properties (focus on things)• domain dependent• interpretation dependent• e.g. aeronautical control systems

, business information systems• experimentally based distinctions

Systems

A system is •a set of things• a set of relations over those things

George Klir, “Architecture of General Systems”

Page 11: Chapter16  Methodology: How to Model and Simulate

Mathematical SystemsTheory

Hierarchy of System

Specifications

Framework forModeling and

Simulation

Hierarchy of SpecificationMorphisms

entities

relations

uses the formalism of

is interpreted by

Modeling & Simulation/Systems Theory

Page 12: Chapter16  Methodology: How to Model and Simulate

M&S Framework

Network

Simulation

Modeling

Search

Decision

Collaboration

DEVS

HLA/SOAModel

Real WorldReal World SimulatorSimulator

modelingrelation

simulationrelation

Experimental Frame

Objectives represented by

Layered architecture

Entities formalized as systems; relations as system morphisms

Page 13: Chapter16  Methodology: How to Model and Simulate

• 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

DEVS Modeling & Simulation Framework

• HLA/SOA enables interoperability of existing simulations

• DEVS supports developing new simulation models within an object-oriented computational framework

Page 14: Chapter16  Methodology: How to Model and Simulate

Joint MEASURETM

• Jointly Developed by Lockheed and UA under DARPA ASTT

• Mission Effectiveness Simulator for

System-of-Systems • employs moderate level of resolution

Network

Simulation

Modeling

Search

Decision

Collaboration

HLA

DEVS

ME

* Mission Effectiveness Analysis Simulator for Utility, Research and Evaluation

ThreatDetection

Data

ThreatAnalysis

Relay

Inter-satelliteCommunication

JM Application: C4ISR System-of-System Design

WAN link

Page 15: Chapter16  Methodology: How to Model and Simulate

Hierarchy of System Specifications and Morphisms

Network of systems Network of systems‘

Multi-component system Multi-component system‘

Structured system Structured system‘

I/O system I/O system‘

I/O function I/O function‘

I/O relation I/O relation‘

I/O frame I/O frame‘

Systemspecificationlevels

Morphisms at each level

behaviortostructure

structuretobehavior

V&V loop

experimental testing at low

levels

simulation model

construction at high levels

Page 16: Chapter16  Methodology: How to Model and Simulate

V&V