Editing lgrConfig.xml

The lgrConfig.xml file contains commands that get run when you start the Logger. The default configuration file starts the Logger with initialization commands to load plug-ins and connect to the HLA network.

Each ./bin directory has a version of lgrConfig.xml that is customized to the protocol used by the version of the Logger in that directory. Default versions of lgrConfig.xml are in ./data/backups. These files are named by protocol so that you know which one to use if you need to revert a particular lgrConfig.xml to the default values. You can also use a default version by specifying it with the --configFile command-line option.

The file is written using XML syntax. It has essentially two sections – variable definitions and commands. Variable definitions are specified in the <defaults> block. Commands are specified with a series of <command> entries within one of two <commands> blocks. You can use any Logger command in a configuration file. (For a list of commands, please see "Command Descriptions“ on page 470.

Note: Some command line options have a matching variable name in the defaults section of the configuration file. If you change or remove the name of one of the variables in the default configuration file, it will break the command line option associated with it.

Additionally, if you add a new variable and give it a name that matches an existing command line argument, you will get unexpected behavior. Being careful about how you name new variables should eliminate any risk of this error occurring.

The following is a heavily edited version of a configuration file for HLA that shows the main components:

<lgrConfig>
   <!-- Variable formatting -->
   <defaults>
      <var name="messageLevel" type="int" value="2"/>
      <!-- HLA Settings -->
      <var name="execName" type="string" value="VR-Link"/>
      <var name="federateName" type="string" value="Logger"/>
      <var name="fedFileName" type="string" value="VR-Link.fed"/>
      <var name="fomMapperLib" type="string" value=""/>
      <var name="fomMapperInitData" type="string" value=""/>
      <var name="rprFomVersion" type="double" value="1.0"/>
      <var name="rprFomRevision" type="int" value="1"/>
      <var name="ignoreAdvisoriesValue" type="bool" value="false"/>
      <var name="useEmptyFomMapperValue" type="bool" value="false"/>
   </defaults>

   <!-- Initialize commands executed after the command line is parsed -->
   <!-- Parameter variables must be defined in the defaults group -->
   <commands name="init">
      <command domain="System" protocol="None" command="SetNotifyLevel">
         <param name="lgrLevel" var="messageLevel"></param>
      </command>
   </commands>

   <commands name="startup">
      <command domain="Simulation" protocol="HLA 13"
         command="SetConnectionParameters">
         <param name="federateName" var="federateName"></param>
         <param name="federationName" var="execName"></param>
         <param name="fedFile" var="fedFileName"></param>
         <param name="fomVersion" var="rprFomVersion"></param>
         <param name="fomRevision" var="rprFomRevision"></param>
         <param name="fomMapper" var="fomMapperLib"></param>
         <param name="fomMapperData" var="fomMapperInitData"></param>
         <param name="ignoreAdvisories" var="ignoreAdvisoriesValue"></param>
         <param name="useEmptyFomMapper" var="useEmptyFomMapperValue"></param>
      </command>
      <command domain="Simulation" protocol="None" command="Connect"/>
   </commands>
</lgrConfig>

Command Syntax

Commands that do not take arguments have the format:

<command domain="domain" protocol="protocol" command="command"/>

where:

The following is an example of a command that does not take arguments:

<command domain="Simulation" protocol="None" command="Connect"/>

Commands that take arguments have the format:

<command domain="domain" protocol="protocol" command="command">
   <param name="name" var="variableName"></param>
</command>

where:

  • name is the name of a command argument as listed in the command descriptions in "Command Descriptions“ on page 470.
  • variableName is the user-defined name of a variable that is to be defined in the <defaults> section of the configuration file.

The following is an example of a command that takes arguments:

   <command domain="System" protocol="None" command="SetNotifyLevel">
      <param name="lgrLevel" var="messageLevel"></param>
   </command>

Variable Syntax

Variable entries take the format:

 <var name="variableName" type="type" value="value"/>

where:

  • variableName is a variable that is specified by a command in the commands section of the configuration file.
  • type is the argument type for the variable, as defined for each command argument in "Command Descriptions“ on page 470.
  • value is the value you want to assign to the variable.

For example:

<var name="messageLevel" type="int" value="2"/>

Adding a Command to lgrConfig.xml

When you add a command to the configuration file, you will usually add it to the startup commands section. The only time you would add a command to the init section is if you are adding a command to load a plug-in.

Suppose that you want to add the NewFile command to lgrConfig.xml. This command creates a new file for recording. If you add it to the configuration file, every time you start the Logger, it will create a new file with the specified name.

Procedure 146: Example: Adding a Command to lgrConfig.xml

  1. Add a new command in the <commands name="startup"> section, similar to the following:

    <commands name="startup">
       <command domain="Recorder" protocol="None" command="NewFile">
          <param name="filename" var="newfile"></param>
       </command>
    </commands>
    

    In the command definition, the domain is Recorder, which you know because NewFile is listed with the commands in the Recorder domain in "Command Descriptions“ on page 470. Protocol is None, because the command is protocol independent. The command is NewFile.

    The command definition shows that NewFile takes an argument, filename, of type string. Therefore, add a parameter definition to the command. The name is filename. This must be exactly the same spelling as in the definition. The variable name is a user-defined name that will be defined in the variable definition.

  2. Add a variable definition for the variable newfile, similar to the following:

    <var name="newfile" type="string" value="newfilename.lgr"/>
    

    The name, newfile, matches the variable name in the command entry. The type is the type listed in the command definition. The value is whatever value you want to assign, in this case, the name you want to give to the Logger file that will be created on startup.

Adding a String List to lgrConfig.xml

Some commands require specification of multiple strings. As with other commands, you specify a variable to take the data. Then you provide the strings as a list of listitems. For example, here is how you could specify a subscription list for HLA:

Procedure 147: Example: Specifying a Subscription List for HLA

  1. In the command section of the configuration file, add an entry for the SetSubscriptionLists command, as follows:

    <!-- To Disable auto-connection remove this command -->
       <command domain="Simulation" protocol="None" command="Connect"/>
    </commands>
    
    <command domain="Simulation" protocol="HLA 13"
       command="SetSubscriptionLists">
       <param name="objectClasses" var="objectSubscriptionList"></param>
       <param name="interactionClasses" var="interactionSubscriptionList">
          </param>
    </command>
    

    Since the SetSubscriptionLists command takes two arguments, we define two parameters for it.

    Note: We include the Connect command, which is in the default configuration file, because the Logger must be connected before you can issue a SetSubscriptionLists command. When you use Logger commands, you must take into account any prerequisites that they have.

  2. Add a variable definition for each of the parameters defined in the command. Within each variable definition, include a listitem for each string you want to include in the list.

    <var name="objectSubscriptionList" type="list" listtype="string">
       <listitem>ObjectRoot.BaseEntity.PhysicalEntity.Platform.Aircraft
          </listitem>
       <listitem>ObjectRoot.BaseEntity.PhysicalEntity.Radio</listitem>
    </var>
    
    <var name="InteractionSubscriptionList" type="list" listtype="string">
       <listitem>InteractionRoot.WeaponFire</listitem>
    </var>
    

    Note: The subscription list created by this example is identical to the one that would be created by the example command in "Using Logger Commands on the Command Line" on page 468 and "Using Logger Commands in the Text Interface" on page 469.

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com