Difference between revisions of "HLAExample"

From Nsnam
Jump to: navigation, search
m (Description)
m (Description)
Line 9: Line 9:
 
= Description =
 
= Description =
  
The objective here is to make a simple ns-3 script that publishes and subscribes to an object ```PingPong``` with attributes ```Msg``` and ```MsgType```. Before we could start with this we need to send an initialisation method. Let us first look as what variable we have at our disposal and what is their importance.  
+
The objective here is to make a simple ns-3 script that publishes and subscribes to an object '''PingPong''' with attributes '''Msg''' and '''MsgType'''. Before we could start with this we need to send an initialisation method. Let us first look as what variable we have at our disposal, let's look at the initialisation variables .  
  
* g_Seconds : Number of Times time advance request is expected. Normally, can be taken as length of simulation
+
* Seconds : Number of Times time advance request is expected.  
* g_SyncPhase : The string that is used by federates for synchronisation in RTI
+
* SyncPhase : The string that is used by federates for synchronisation in RTI.
* g_Fomfile : Name of the file that has the object model
+
* Fomfile : Name of the file that has the object model
* g_FederationName : Name of the federation
+
* FederationName : Name of the federation (Should be same in all federates)
* g_FederateName : Name of the federate produced
+
* FederateName : Name of the federate (ns3)
*
+
* RtiTimeResolution : What time steps are required by the model (Default is 1.0)
 +
 
 +
== Initilisation ==
 +
 +
The above variables are used for initialisation. Ns-3 will create a federation <FederationName> or can join the same if already created by other federates. It will register in the federation as federate <FederateName> and with a synchronisation phrase <SyncPhrase> and RTI will use the object model in <FomFileName>. The simulation will run for <Seconds>*<RtiTimeResolution> seconds and will advance in <RtiTimeResolutionSteps>     
 +
 
 +
== Objects ==
 +
 
 +
Now lets look at how the objects are published, subscribed and used.
  
 
= ns-3 script =
 
= ns-3 script =

Revision as of 07:09, 20 August 2012

Before Getting Started

The tutorial will talk about using hla model for ns-3 to make ns-3 participate in distributed simulation with other federates through a Run Time infrastructure. The code for the tutorial can be found in .cc and .fed files. We will be referring to the ns-3 hla model Wiki, it has mostly model related explanation, only few sub-sections are required for the tutorial. Information about HLA and RTI. on Wikipedia.

If you want to know more about the source code of the hla model, please read the design and see the diagram here and here. Also reading this would be useful. The code can be found here.

The tutorial will assume that you have a working copy on ns-3 with hla which can be obtained here and familiarity with writing and running ns-3 scripts. Please download and install the required packages listed here

Description

The objective here is to make a simple ns-3 script that publishes and subscribes to an object PingPong with attributes Msg and MsgType. Before we could start with this we need to send an initialisation method. Let us first look as what variable we have at our disposal, let's look at the initialisation variables .

  • Seconds : Number of Times time advance request is expected.
  • SyncPhase : The string that is used by federates for synchronisation in RTI.
  • Fomfile : Name of the file that has the object model
  • FederationName : Name of the federation (Should be same in all federates)
  • FederateName : Name of the federate (ns3)
  • RtiTimeResolution : What time steps are required by the model (Default is 1.0)

Initilisation

The above variables are used for initialisation. Ns-3 will create a federation <FederationName> or can join the same if already created by other federates. It will register in the federation as federate <FederateName> and with a synchronisation phrase <SyncPhrase> and RTI will use the object model in <FomFileName>. The simulation will run for <Seconds>*<RtiTimeResolution> seconds and will advance in <RtiTimeResolutionSteps>

Objects

Now lets look at how the objects are published, subscribed and used.

ns-3 script

Object Model file

Running

Testing