Preparing a Riverbed Federate Using Code

The HLA integration expects the simulation to include a “factory” function that is responsible for providing the simulation kernel with an instance of a Federate Ambassador. The Federate Ambassador is a C++ class with a set of methods that are invoked by the RTI when an incoming message is received.

The simplest way to achieve this is to include the Federate Ambassador definition and the factory function in the process model (HLA-PM) that resides in the Esys module of the HLA interface node. Riverbed’s High-Level Architecture provides several node models that use this approach:

  • HLA13_Interface.nd.m (for use with RTI 1.3)
  • HLA1516_Interface.nd.m (for use with IEEE 1516 RTIs)
  • HLA1516Pitch_Interface.nd.m (for use with Pitch 1516 RTI)

Note: Each RTI requires a different version of the Federate Ambassador C++ class. Only one of these node models should be present in a simulation.

Note: For backward compatibility with HLA in Riverbed releases prior to 14.5, use the HLA_Interface node model and the mapping approach described in “Preparing a Riverbed Federate Using a Mapping File” on page 21.

The process models for HLA13_Interface, HLA1516_Interface, and HLA1516Pitch_Interface (hla13_cosim.pr.m, hla1516_cosim.pr.m, and hla1516pitch_cosim.pr.m, respectively) include a skeleton integration with the appropriate factory function creating an instance of a class in which all methods do nothing upon being invoked. You can use these process models to develop the custom code needed by your simulation.

To create a custom version, you need to modify the Federate Ambassador class to add appropriate processing for the methods that are likely to be invoked by RTI messages from the HLA federation in which the simulation will be included. Example process models modified in this way can be found in the rpr_tut model located in <reldir>/sys/utilities/hla/example. A description of the rpr_tut model and instructions for running it are contained in the README.txt file in that directory.

When creating the Federate Ambassador methods, you can invoke a subset of the Kernel Procedures. The methods are similar to pipeline stages in a link model in that there is no associated module or processor/queue; as a result, Kernel Procedures that require a module or processor/queue will not be accepted. Trying to use an inappropriate Kernel Procedure will result in an error message indicating what is missing. However, you can use anything that doesn’t rely on a module, such as prg APIs, topo APIs, and most of the event-scheduling Kernel Procedures. If you need a module environment to perform additional processing, you can schedule a forced remote interrupt for the process model on the HLA esys module or some other process model. The esys module ID is provided in the factory invocation for easy reference. The example mentioned previously uses this approach for some of its processing.

The main function of the HLA interface node in this approach is to process incoming RTI events, either directly in the node’s Federate Ambassador or indirectly via remote interrupts to process models.