hla support in a discrete event simulation language

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

Upload: maddox

Post on 12-Jan-2016

34 views

Category:

Documents


0 download

DESCRIPTION

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

TRANSCRIPT

Page 1: HLA Support in a Discrete Event  Simulation Language

HLA Support in a Discrete Event Simulation Language

DiS-RT’99, Greenbelt, MD.Friday, October 22nd, 1999

C. D. Pham R. L. BagrodiaDepartment of Computer Science

University of California, Los AngelesU.S.A.

RESAM laboratoryUniversité Claude Bernard, Lyon

FRANCE

Page 2: HLA Support in a Discrete Event  Simulation Language

Outline

Overview of HLA and DES

The main points for HLA integration into a DES language

An example with the Parsec language

Conclusions

Page 3: HLA Support in a Discrete Event  Simulation Language

The HLA framework

Runtime Infrastructure (RTI)Federation Management Declaration ManagementObject Management Ownership ManagementTime 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 loopreal-time simulators

Display, statistics...

10 Rules for the federationand the federates behavior

An Object Model Template to describe the simulationobjects

An Interface Specification

simulator

real-timeplayers

tools

Page 4: HLA Support in a Discrete Event  Simulation Language

Real system Objects can haveattributes

HLA: How to interoperate?

Interoperability is achieved by subscription and publication of object’s attributes between the federates in the federation execution.

communication nodethroughput, position

radio transmitterpower, frequency

wired node# links

Page 5: HLA Support in a Discrete Event  Simulation Language

RTI Ambassador

Federate

RTI

HLA: Publication and Subscription• Publication of an attribute means a federate can produce

values for that attribute.

Federate FederateAmbassador

RTI Ambassador

I can provide theposition for mobile hosts

publishObjectClass

I want to know theposition of allmobile hosts.

startUpdates

subscribeObjectClassAttribute

reflectAttributesValues

• Subscription to an attribute means a federate wishes to receive values for that attribute.

updateAttributeValues

FederateAmbassador

Page 6: HLA Support in a Discrete Event  Simulation Language

HLA: Time management

HLA includes advanced time management services with receive order and time stamped messages

FEDERATE

Time-constrained

25

RTI

21

27 29

RO 23 RO 25

Time-regulated

FEDERATE25Lookahead = 2

RTI

27

29

NO!

RO

RO

Compute a Lower BoundTime Stamp (LBTS)

Ask for timeadvance grant

Page 7: HLA Support in a Discrete Event  Simulation Language

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.

Page 8: HLA Support in a Discrete Event  Simulation Language

Support of HLA in a DES languageDifficulties 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

Page 9: HLA Support in a Discrete Event  Simulation Language

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.

Page 10: HLA Support in a Discrete Event  Simulation Language

Time management

• Logical time simulations are usually time-constrained and time-regulated.

• Time advancement is usually transparent in logical time simulations.

Page 11: HLA Support in a Discrete Event  Simulation Language

Time advance

RTI

Simulated objects interact directly with the RTIbut do not wait explicitly for a time advance grant

HLA_timeAdvanceGrantRequest()

Request and wait for a time advance grant using

nextEventRequest.

Simulatedobject

blocking function call

Page 12: HLA Support in a Discrete Event  Simulation Language

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.

Page 13: HLA Support in a Discrete Event  Simulation Language

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

Page 14: HLA Support in a Discrete Event  Simulation Language

Registration and callback masks• Simulated objects can register to receive a given

set of notification typescallback masks.

RT

I

2

31

call

back

reflectAttributeValues

c1.a1

c1.a1 h

has subscribed to c1.a1

has registered to reflectand 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 reflectand discover

Receive the notificationmessage

Page 15: HLA Support in a Discrete Event  Simulation Language

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.

Page 16: HLA Support in a Discrete Event  Simulation Language

The PARSEC language

LP are programmed as an actor or entityall activities of an entity are initiated on message receipts

An LP cannot directly modify the state of another LP

Event are represented by message communicationse(t,p,a): send message m(e) at time t to LP p

On receiving m(e), p executes actions achange its state represented by local variablesschedule events (messages) at time >=t

LPs are scheduled with a large variety of algorithmsConservative with null-messages, conditional events,synchronous, optimistic and adaptive algorithms.

Message-based, process-interaction approach

Page 17: HLA Support in a Discrete Event  Simulation Language

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.

Page 18: HLA Support in a Discrete Event  Simulation Language

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]); 910 while (!Joined && (numTries++ < 20)) {11 RTI_RTIambassador_joinFederationExecution(12 &ex,ms_rtiAmb,"USA","HelloWorld", HLACallbackStruct);1314 HLA_enableTimeConstrained();15 HLA_enableTimeRegulation(0.0, 1.0);16 }

Page 19: HLA Support in a Discrete Event  Simulation Language

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;101102 case reflectAttributeValues:103 p = Country_Find(m.theObjectHandle);104 if (p) Country_UpdateRemote(pCountry,105 m.theAttributeHandleValuePairSet);106 break;107108 case receiveInteraction:109 if (m.theInteractionClassHandle == ms_commTypeId)110 Country_UpdateInteraction(111 m.theParameterHandleValuePairSet);112 break;113 ...

Page 20: HLA Support in a Discrete Event  Simulation Language

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;123124 ...125 } or timeout after(0) {}126127 /* Here we update the country state */128 receive (Survey theSurvey) {129 CountryUpdateTime();130 }

HLA callback messages are checked first

Page 21: HLA Support in a Discrete Event  Simulation Language

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.