Simulator Protocol. coordinator simulator Component tN tN. tL After each transition tN = t + ta(), tL = t simulator Component tN tN. tL simulator Component.

Slides:



Advertisements
Similar presentations
How to use TinyOS Jason Hill Rob Szewczyk Alec Woo David Culler An event based execution environment for Networked Sensors.
Advertisements

My Internet Safety Guide I have used scratch to program a guide to internet safety using QR codes.
Computer Architecture
System Integration and Performance
Extended DEVSML as a Model Transformation Intermediary to Make UML Diagrams Executable Jianpeng Hu Dept. of Computer Science and Engineering Shanghai Jiao.
Distributed System Structures Network Operating Systems –provide an environment where users can access remote resources through remote login or file transfer.
Parallel and Distributed Simulation Lookahead Deadlock Detection & Recovery.
Lookahead. Outline Null message algorithm: The Time Creep Problem Lookahead –What is it and why is it important? –Writing simulations to maximize lookahead.
Synchronization Chapter clock synchronization * 5.2 logical clocks * 5.3 global state * 5.4 election algorithm * 5.5 mutual exclusion * 5.6 distributed.
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 3: Input/output and co-processors dr.ir. A.C. Verschueren.
Ordering and Consistent Cuts Presented By Biswanath Panda.
Tutorials 2 A programmer can use two approaches when designing a distributed application. Describe what are they? Communication-Oriented Design Begin with.
1. Explain why synchronization is so important in distributed systems by giving an appropriate example When each machine has its own clock, an event that.
Chapter 13 Embedded Systems
OS Spring’03 Introduction Operating Systems Spring 2003.
DEVS and DEVS Model Dr. Feng Gu. Cellular automata with fitness.
16: Distributed Systems1 DISTRIBUTED SYSTEM STRUCTURES NETWORK OPERATING SYSTEMS The users are aware of the physical structure of the network. Each site.
PRASHANTHI NARAYAN NETTEM.
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
Time, Clocks, and the Ordering of Events in a Distributed System Leslie Lamport (1978) Presented by: Yoav Kantor.
Review. A_DA_A Ball_A Ball_B player_A B_DB_A Ball_B Ball_A player_B Ball_A Ball_B A_A, B_DA_D, B_A Ball_A Ball_B CFSM Player_A  : X  S  S X A = {Ball_A}
Hardware Supported Time Synchronization in Multi-Core Architectures 林孟諭 Dept. of Electrical Engineering National Cheng Kung University Tainan, Taiwan,
© The McGraw-Hill Companies, 2006 Chapter 4 Implementing methods.
DEVS Namespace for Interoperable DEVS/SOA
Discrete Event Modeling and Simulation of Distributed Architectures using the DSSV Methodology E. de Gentili, F. Bernardi, J.F. Santucci University Pascal.
Develop DEVS Models Using DEVSJAVA Dr. Feng Gu. DEVS atomic model Elements of an atomic model input events output events state variables state transition.
REVIEW On Friday we explored Client-Server Applications with Sockets. Servers must create a ServerSocket object on a specific Port #. They then can wait.
Computer Science Lecture 10, page 1 CS677: Distributed OS Last Class: Naming Name distribution: use hierarchies DNS X.500 and LDAP.
Chapter 101 Multiprocessor and Real- Time Scheduling Chapter 10.
CSC264 Modelling and Computation 10. Modelling State Steve Riddle, John Fitzgerald, Maciej Koutny Computing Science Semester /06.
By Ezequiel Glinsky Research Assistant, University of Buenos Aires, Argentina Supervisor: Prof. Gabriel A. Wainer SCE, Carleton University Thursday, November.
1 M. Tudruj, J. Borkowski, D. Kopanski Inter-Application Control Through Global States Monitoring On a Grid Polish-Japanese Institute of Information Technology,
Termination Detection
Copyright ©: University of Illinois CS 241 Staff1 Threads Systems Concepts.
ECE 449/549 Class Notes #1 Introduction to System Modeling Concepts and DEVS Sept
DEVS Based Modeling and Simulation of the CORBA POA F. Bernardi, E. de Gentili, Pr. J.F. Santucci {bernardi, gentili, University.
Chapter 5: Distributed objects and remote invocation Introduction Remote procedure call Events and notifications.
Modeling with Parallel DEVS Serialization in DEVS models Select function Implicit serialization of parallel models E-DEVS: internal transition first,
MODELING EXAMPLES Types of model Conceptual Containing components that have not been clearly Identified in terms of theoretic categories such as state,
Computer Architecture 2 nd year (computer and Information Sc.)
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
CS3773 Software Engineering Lecture 06 UML State Machines.
CSCI1600: Embedded and Real Time Software Lecture 16: Advanced Programming with I/O Steven Reiss, Fall 2015.
Transforming DEVS to Non-Modular Form For Faster Cellular Space Simulation Arizona Center for Integrative Modeling and Simulation Electrical and Computer.
ECE 449/549 Class Notes #3 DEVS Simulators and Executors / Methodology : How to model and simulate Sept
DEVS-based Modeling and Simulation References: 1.B. P. Zeigler, Hessam S. Sarjoughian, Introduction to DEVS Modeling and Simulation with JAVA: Developing.
Lecture 4 General-Purpose Input/Output NCHUEE 720A Lab Prof. Jichiang Tsai.
Approach and Techniques for Building Component-based Simulation Models Bernard P. Zeigler, Ph.D. Hessam S. Sarjoughian, Ph.D. Arizona Center for Integrative.
Chapter 7 Classes and Methods III: Static Methods and Variables Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition)
The Abstract simulator Simulator/Simulation Concepts n Simulator: responsible for executing a model’s dynamics (resented as instructions) in a given.
Parallel Computing Presented by Justin Reschke
ECE 449/549 Class Notes #2 Introduction to Discrete-Event Systems Specification (DEVS) Sept
1 G53SRP: Introduction to Real Time Scheduling Chris Greenhalgh School of Computer Science.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
PDEVS Protocol Performance Prediction using Activity Patterns with Finite Probabilistic DEVS DEMO L. Capocchi, J.F. Santucci, B.P. Zeigler University of.
Topic 4: Distributed Objects Dr. Ayman Srour Faculty of Applied Engineering and Urban Planning University of Palestine.
Simulation Engine (Simulator)‏. Outline Review of discrete time and discrete event simulation Standard simulator for DEVS atomic model Standard simulator.
Basic Computer Organization and Design
Parallel DEVS & DEVSJAVA
Concepts of Object Oriented Programming
Parallel and Distributed Simulation Techniques
Chapter16 Methodology: How to Model and Simulate
DEVS Background DEVS = Discrete Event System Specification
Atomic Model Simulator
Approach and Techniques for Building Component-based Simulation Models
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Distributed Systems CS
DEVS Background DEVS = Discrete Event System Specification
LOOPS The loop is the control structure we use to specify that a statement or group of statements is to be repeatedly executed. Java provides three kinds.
Last Class: Naming Name distribution: use hierarchies DNS
Presentation transcript:

Simulator Protocol

coordinator simulator Component tN tN. tL After each transition tN = t + ta(), tL = t simulator Component tN tN. tL simulator Component tN tN. tL Coupled Model 1 nextTN 2. outTN 3 getOut 4 sendOut 5 applyDelt Simulation of coupled models-- Basic DEVS Simulation Cycle Each simulator reacts to the incoming message as follows: If it is imminent and its input message is empty, then it invokes its model’s inernal transition function If it is imminent and its input message is not empty, it invokes its model’s confluence transition function If is not imminent and its input message is not empty, it invokes its model’s external transition function If is not imminent and its input message is empty then nothing happens. Coupled Model Coordinator: 1. Coordinator sends nextTN to request tN from each of the simulators. 2.All the simulators reply with their tNs in the outTN message to the coordinator 3.Coordinator sends to each simulator a getOut message containing the global tN (the minimum of the tNs) 4. Each simulator checks if it is imminent (its tN = global tN) and if so, returns the output of its model in a message to the coordinator in a sendOut message. 5. Coordinator uses the coupling specification to distribute the outputs as accumulated messages back to the simulators in an applyDelt message to the simulators – for those simulators not receiving any input, the messages sent are empty. For a coupled model with atomic model components, a coordinator is assigned to it and coupledSimulators are assigned to its components. In the basic DEVS Simulation Protocol, the coordinator is responsible for stepping simulators through the cycle of activities shown.

coordinator Atomic Model Atoimc3 coupledSimulator simulators.tellAll("initialize“) simulators.AskAll(“nextTN”) simulators.tellAll("computeInputOutput“) simulators.tellAll("sendMessages") simulators.tellAll("DeltFunc“) message coupledSimulator Atomic Model Atomic Model simulators.tellAll("initialize“) --- at start of simulation simulators.AskAll(“nextTN”) simulators.tellAll("computeInputOutput“) simulators.tellAll("sendMessages") simulators.tellAll("DeltFunc“) DEVS cycle DEVS Simulation Protocol as Implemented in DEVSJAVA coupling The DEVS Simulation Protocol implemented in DEVSJAVA is basically the same as the one just discussed. However, instead of having simulators send their output messages to the coordinator, they exchange messages when told to do so by the coordinator. To be able to do so, they need the coupling that is relevant to their attached models – this is transmitted to them in a a step, called informCoupling, that is performed by the coordinator at start up. genDevs. simulation. coordinator genDevs. simulation. coupledSimul ator For example, the simulator for generator, g in the coupled model gpt, knows that an output on port “out” should be paired with port “in” in a message to the simulator for processor p.

Simulating Large-Scale Models Considering a coupled model that includes thousands of atomic models Two Situations: 1.In every cycle, almost every atomic model are imminent 2.In every cycle, only one or a few atomic models are imminent Question: How to revise the standard protocol to improve the performance of the simulation for these two special situations?

DTSSCoord Atomic Model Atoimc3 DTSSSim simulators.tellAll("initialize“) simulators.tellAll("computeInputOutput“) simulators.tellAll("sendMessages") simulators.tellAll("DeltFunc“) message DTSSSim Atomic Model Atomic Model simulators.tellAll("initialize“) --- at start of simulation simulators.tellAll("computeInputOutput“) simulators.tellAll("sendMessages") simulators.tellAll("DeltFunc“) Situation one: DEVS Simulation Protocol Specialized to Discrete Time coupling For an isolated discrete time coupled model the DEVS simulation protocol can be simplified. Assuming the time advance of each atomic model is always the same, the global tN need not be computed. Further, all components are always imminent, leading to the cycle shown below. Note: This alternative only is more efficient that the standard DEVS protocol under the conditions of very high activity. genDevs. simulation. DTSSCoord.ja va genDevs. simulation. DTSSSim.jav a

Situation two Simulators.tellAll() or AskAll() is not efficient if only one or a few models are imminent in every cycle So, the idea is to get the imminents in every simulation cycle and then only tell those imminents to go through the cycle, instead of telling all simulators to go through the cycle

A new coordinator -- oneDCoord oneDCoord tN = minSelTree.getMin() imminents = minSelTree.getImms() imminents.tellAll("computeOut“,tN) imminents.tellAll("sendOut") imminents = imminents.addAll(influencees) imminents.tellAll("ApplyDelt“,tN) imminents.tellAll(“sendTNUp”) coordinator simulators.AskAll(“nextTN”) tN = compareAndFindTN(); simulators.tellAll("computeOut“,tN) simulators.tellAll("sendOut") simulators.tellAll("ApplyDelt“,tN) minSelTree is a data structure which keeps track of the smallest tN and the associated simulators. The last step of the oneDCoord cycle: imminents.tellAll(“sendTNUp”) updates the minSelTree data structure. The variable imminents are the simulators which has smallest tN in this cycle. The variable influencees are the simulators which are receive messages from the imminent models. Step imminents = imminents.addAll(influencees) updates the imminents to include influencees --- these are the simulators which need to execute ApplyDelt.

Simulate hierarchical coupled model in fast mode Coordinator CoupledCoordinatorCoupledSimulator4 Atomic4 CoupledSimulator3 Atomic3 simulators.tellAll("initialize“) simulators.AskAll(“nextTN”) simulators.tellAll("computeInputOutput“) simulators.tellAll("sendMessages") simulators.tellAll("DeltFunc“) putMessage CoupledSimulator1CoupledSimulator2 Atomic1Atomic2 putMessage putMyMessage Coupled1 sendDownMessage

Real-time Simulation

Time in Simulation Time concepts in simulation: Simulation time Wall clock time Two simulation types Fast simulation – run simulation as fast as possible Real-time simulation -- time are synchronized with the wall clock time

Real-time simulation Why need real-time simulation? Hardware-in-the-loop simulation Human-in-the-loop simulation PC Consider testing a hardware, saying a robot, using simulation methods. The simulation running on PC provides stimuli to the robot to test if the robot moves as expected. Because it takes time for the robot to move, the simulation running on PC has to synchronize with this time. In this case, the simulation running on PC need to be real-time simulation

Real-Time Simulator/Executor When first entering the state, s, the simulator starts a thread to sleep for a time ta(s) If an external event is injected to the model at some time, t ext (no earlier than the current clock and no later than tN), the sleeping thread is interrupted and If t ext == tN the output is generated. Then the input is processed by the confluent or external event transition function, depending on whether t ext coincides with tN or not. genDevs. simulation.realTi me atomicRTSimula tor tL =: t tN =: t + ta(s) When receive m if m!= null and t < tN, s :=  ext (s,t-tN,m) if m!= null and t == tN, s :=  con (s,t-tN,m) if m= null and t == tN, s =:  int (s) s =: s init tL =: 0 tN =: ta(s init ) m timeline inject at time t tN tL Legend: m = message s = state t = clock time tL = time of last event tN = time of next event If t == tN generate output (s) sleep for ta(s) Execution in real time of an atomic model is similar to its simulation in logical or abstract time. The difference is that rather than being controlled by an events list within the coordinator, each simulator governs itself according to the host processor system clock. Thus passage of time in the model is identical to that of a wall clock. This difference is seen in the following alteration of the simulator: real Real time execution of DEVS models is facilitated by the separation of model from simulator which allows the simulator to be “changed out” by one that adheres to a real clock. The ease of migration from simulation to execution enables a design process called model- continuity discussed later.

Simulate coupled model in real time mode -- centralized way RTCentralCoord CoupledSimulator1 Atoimc1 CoupledSimulator3 Atoimc3 CoupledSimulator2 Atoimc2 simulators.tellAll("initialize“) simulators.AskAll(“nextTN”) myThread.sleep( nextTN – currentTime) simulators.tellAll("computeInputOutput“) simulators.tellAll("sendMessages") simulators.tellAll("DeltFunc“) putMessage

RTcoordinator Time synchronization Atomic Model Atoimc3 RTSimulator sideMessage RTSimulator Atomic Model Atomic Model sideMessage Flat Decentralized Distributed Real-Time Simulation with Activities Real World DEVS Activity outputFrom Activity

Simulate hierarchical coupled model in real time mode -- Centralized way RTCentraCoord CoupledCoordinatorCoupledSimulator4 Atomic4 CoupledSimulator3 Atomic3 putMessage simulators.tellAll("initialize“) simulators.AskAll(“nextTN”) myThread.sleep( nextTN – currentTime) simulators.tellAll("computeInputOutput“) simulators.tellAll("sendMessages") simulators.tellAll("DeltFunc“) CoupledSimulator1CoupledSimulator2 Atomic1Atomic2 putMessage putMyMessage Coupled1 sendDownMessage

Simulate hierarchical coupled model in real time mode -- decentralized way RTCoordinator RTCoupledCoordinatorCoupledRTSimulator4 Atomic4 CoupledRTSimulator3 Atomic3 putMessage CoupledRTSimulator1CoupledRTSimulator2 Atomic1Atomic2 putMessage putMyMessage Coupled1 sendDownMessage simulators.tellAll("initialize“) simulators.tellAll("simulate“) simulators.tellAll("stopSimulate")

Running a digraph model in Fast-mode To run any digraph model in fast mode, provide a main function in the class that uses a coordinator, explicitly. Below is the code for the digraph model “HierarModel” in package GenDevsTest. public static void main(String[] args){ HierarModel hm = new HierarModel(); coordinator c = new coordinator(hm); //create a coordinator and pass the digraph model c.initialize();//initialize the coordinator c.simulate(600);//provide the number of iterations to execute }