Presentation is loading. Please wait.

Presentation is loading. Please wait.

HLA Support in a Discrete Event Simulation Language DiS-RT’99, Greenbelt, MD. Friday, October 22nd, 1999 C. D. PhamR. L. Bagrodia Department of Computer.

Similar presentations


Presentation on theme: "HLA Support in a Discrete Event Simulation Language DiS-RT’99, Greenbelt, MD. Friday, October 22nd, 1999 C. D. PhamR. L. Bagrodia Department of Computer."— Presentation transcript:

1 HLA Support in a Discrete Event Simulation Language DiS-RT’99, Greenbelt, MD. Friday, October 22nd, 1999 C. D. PhamR. L. Bagrodia Department of Computer Science University of California, Los Angeles U.S.A. RESAM laboratory Université Claude Bernard, Lyon FRANCE

2 Outline Overview of HLA and DES The main points for HLA integration into a DES language An example with the Parsec language Conclusions

3 The HLA framework Runtime Infrastructure (RTI) Federation Management Declaration Management Object Management Ownership Management Time Management Data Distribution Management The High Level Architecture calls for a federation of simulations to achieve interoperability and reuse of software. Federation Without HLA, simulations are mostly independents and interoperability is not easy. Logical simulations Hardware, human-in-the loop real-time simulators Display, statistics... 10 Rules for the federation and the federates behavior An Object Model Template to describe the simulation objects An Interface Specification simulator real-time players tools

4 Real system Objects can have attributes HLA: How to interoperate? Interoperability is achieved by subscription and publication of object’s attributes between the federates in the federation execution. communication node throughput, position radio transmitter power, frequency wired node # links

5 RTI Ambassador Federate RTI HLA: Publication and Subscription Publication of an attribute means a federate can produce values for that attribute. Federate Ambassador RTI Ambassador I can provide the position for mobile hosts publishObjectClass I want to know the position of all mobile hosts. startUpdates subscribeObjectClass Attribute reflectAttributesValues Subscription to an attribute means a federate wishes to receive values for that attribute. updateAttributeValues Federate Ambassador

6 HLA: Time management HLA includes advanced time management services with receive order and time stamped messages FEDERATE Time-constrained 25 RTI 21 2729 RO23RO25 Time-regulated FEDERATE 25 Lookahead = 2 RTI 27 29 NO! RO Compute a Lower Bound Time Stamp (LBTS) Ask for time advance grant

7 Discrete Event Simulation A model consists of simulation objects and events. Only time stamped events are exchanged between objects. Objects’ state can only be modified upon reception of an event and by the object itself. Simulated time advances according to the timestamp of the processed events.

8 Support of HLA in a DES language Difficulties come from the differences in… the time management: HLA is still mainly oriented towards real-time while DES is mainly logical. the way simulated objects interact:HLA is publication/subscription-based while DES is event-driven. Easier to develop HLA compliant logical time simulators. Rapid porting of a large number of existing DES simulations into the HLA framework. BUT

9 The solution adopted All the HLA interface specification (v1.3) is supported: users can call the RTI functions directly if needed. Some RTI functions or set of functions are provided by additional high-level functions for sake of simplicity and transparency.

10 Time management Logical time simulations are usually time- constrained and time-regulated. Time advancement is usually transparent in logical time simulations.

11 Time advance RTI Simulated objects interact directly with the RTI but do not wait explicitly for a time advance grant HLA_timeAdvanceGrantRequest() Request and wait for a time advance grant using nextEventRequest. Simulated object blocking function call

12 Translation of notifications Each simulated object can not provide its own set of callback functions. We use pre-defined generic callback functions. A notification from the RTI is translated into a simulation message and sent back to the objects. –Need registration and multicast features. Ensure that both TSO and RO messages can be mixed into the DES system. –RO messages have to be timestamped.

13 Differences introduced by callback messages All messages are timestamped, even those that were initially of the RO type. The handling of the callback functions is done by the object itself: –direct access to the object’s variables

14 Registration and callback masks Simulated objects can register to receive a given set of notification types  callback masks. RTI 2 3 1 callback reflectAttributeValues c1.a1 h has subscribed to c1.a1 has registered to reflect and discover HLA_registerEntity( self, reflect | discover); #define DECLARATION_MANAGEMENT_SET \ startRegistrationForObjectClass|\ stopRegistrationForObjectClass|\ turnInteractionsOn|\ turnInteractionsOff Callback messages of a given type are multicasted to the simulated objects has subscribed to c1.a1 has registered to reflect and discover Receive the notification message

15 Advantages of multicasting Replicated simulated objects in a simulation usually have identical behavior. The multicast mechanism allows each object to take independent actions. The complexity is put in the simulated object rather than in the callback functions. –an object knows exactly which classes it has subscribed to. In HLA Callback notifications are sent on a federate basis: one notification of a given type per federate. Not well-suited for multiple objects simulations More knowledge is put in callback functions to call the appropriate object ’s processing function. Practically, there are as many if statements as the number of object ’s classes the federate has susbscribed to.

16 The PARSEC language LP are programmed as an actor or entity all activities of an entity are initiated on message receipts An LP cannot directly modify the state of another LP Event are represented by message communications e(t,p,a): send message m(e) at time t to LP p On receiving m(e), p executes actions a change its state represented by local variables schedule events (messages) at time >=t LPs are scheduled with a large variety of algorithms Conservative with null-messages, conditional events, synchronous, optimistic and adaptive algorithms. Message-based, process-interaction approach

17 The pcHello example Similar to the HelloWorld but... –Event-driven instead of time-stepped Defines a country with a name and an initial population. Each country publishes its name and population and subscribes to the same attributes. The population increases periodically.

18 Initialization of the federate 1 entity driver(int argc, char **argv) { 2 3 rtiAmb = HLA_createAmbassador(); 4 5 RTI_RTIambassador_createFederationExecution( 6 &ex, rtiAmb, "HelloWorld", "helloWorld.fed"); 7 8 countryId = new Country(self, argv[1], argv[2]); 9 10 while (!Joined && (numTries++ < 20)) { 11 RTI_RTIambassador_joinFederationExecution( 12 &ex,ms_rtiAmb,"USA","HelloWorld", HLACallbackStruct); 13 14 HLA_enableTimeConstrained(); 15 HLA_enableTimeRegulation(0.0, 1.0); 16 }

19 Main simulation loop 94 receive (HLACallback m) { 95 switch (m.type) { 96 case discoverObjectInstance: 97 if (m.theObjectClassHandle == ms_countryTypeId) { 98 /* creates new structures, saves the object handle */ 99 } 100 break; 101 102 case reflectAttributeValues: 103 p = Country_Find(m.theObjectHandle); 104 if (p) Country_UpdateRemote(pCountry, 105 m.theAttributeHandleValuePairSet); 106 break; 107 108 case receiveInteraction: 109 if (m.theInteractionClassHandle == ms_commTypeId) 110 Country_UpdateInteraction( 111 m.theParameterHandleValuePairSet); 112 break; 113...

20 Main simulation loop (con’t) 118 case turnUpdatesOnForObjectInstance: 119 if (m.theObjectClassHandle == ms_countryTypeId) 120 Country_SetUpdateControl(RTI_Boolean_RTI_TRUE, 121 m.theAttributeHandleSet); 122 break; 123 124... 125 } or timeout after(0) {} 126 127 /* Here we update the country state */ 128 receive (Survey theSurvey) { 129 CountryUpdateTime(); 130 } HLA callback messages are checked first

21 Conclusions HLA support in a DES language enables a rapid development of HLA-compliant logical time simulators. We have presented some general design issues, and an implementation within the Parsec language. Future work: more transparency regarding the time advance mechanism.


Download ppt "HLA Support in a Discrete Event Simulation Language DiS-RT’99, Greenbelt, MD. Friday, October 22nd, 1999 C. D. PhamR. L. Bagrodia Department of Computer."

Similar presentations


Ads by Google