Title: HLA Support in a Discrete Event Simulation Language
1HLA Support in a Discrete Event Simulation
Language
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
DiS-RT99, Greenbelt, MD. Friday, October 22nd,
1999
2Outline
- Overview of HLA and DES
- The main points for HLA integration into a DES
language - An example with the Parsec language
- Conclusions
3The HLA framework
- Without HLA, simulations are mostly independents
and interoperability is not easy.
- The High Level Architecture calls for a
federation of simulations to achieve
interoperability and reuse of software.
10 Rules for the federation and the federates
behavior
An Interface Specification
An Object Model Template to describe the
simulation objects
4HLA How to interoperate?
communication node throughput, position
Objects can have attributes
radio transmitter power, frequency
wired node links
- Interoperability is achieved by subscription and
publication of objects attributes between the
federates in the federation execution.
5HLA Publication and Subscription
- Publication of an attribute means a federate can
produce values for that attribute.
- Subscription to an attribute means a federate
wishes to receive values for that attribute.
I can provide the position for mobile hosts
I want to know the position of all mobile hosts.
Federate
Federate Ambassador
Federate
Federate Ambassador
RTI Ambassador
RTI Ambassador
updateAttributeValues
RTI
6HLA Time management
- HLA includes advanced time management services
with receive order and time stamped messages
7Discrete 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.
8Support 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 interactHLA is
publication/subscription-based while DES is
event-driven.
9The 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.
10Time management
- Logical time simulations are usually
time-constrained and time-regulated. - Time advancement is usually transparent in
logical time simulations.
11Time advance
Simulated objects interact directly with the
RTI but do not wait explicitly for a time advance
grant
blocking function call
HLA_timeAdvanceGrantRequest()
Request and wait for a time advance grant using
nextEventRequest.
RTI
12Translation 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.
13Differences 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 objects variables
14Registration and callback masks
- Simulated objects can register to receive a given
set of notification types?callback masks.
- Callback messages of a given type are multicasted
to the simulated objects
has subscribed to c1.a1
1
has registered to reflect and discover
3
callback
RTI
2
has subscribed to c1.a1
has registered to reflect and discover
15Advantages of multicasting
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.
- 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.
16The PARSEC language
Message-based, process-interaction approach
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
gtt LPs are scheduled with a large variety of
algorithms Conservative with null-messages,
conditional events, synchronous, optimistic and
adaptive algorithms.
17The 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.
18Initialization 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, argv1,
argv2) 9 10 while (!Joined (numTries lt
20)) 11 RTI_RTIambassador_joinFederationExecuti
on( 12 ex,ms_rtiAmb,"USA","HelloWorld",
HLACallbackStruct) 13 14 HLA_enableTimeConstrain
ed() 15 HLA_enableTimeRegulation(0.0, 1.0) 16
19Main 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_UpdateInteracti
on( 111 m.theParameterHandleValuePairS
et) 112 break 113 ...
20Main simulation loop (cont)
118 case turnUpdatesOnForObjectInstance 119
if (m.theObjectClassHandle
ms_countryTypeId) 120 Country_SetUpdateCo
ntrol(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
21Conclusions
- 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.