This is part 2 in my series of blog posts on RTI RID configuration tips. Each of these tips, unless otherwise noted, works in HLA 1.3, HLA 1516-2000, or HLA Evolved. Take a look at part 1 HERE, and stay tuned for future posts in this series.
The RID file is written in MTL. MTL stands for MÄK Technologies Lisp. MTL is basically a limited form of the Lisp programming language. The primary purpose of the RID MTL file is to set specific variables which are parsed by the RTI’s MTL parser and loaded into configuration settings. The same goal could be achieved using other formats such as XML (another popular MÄK configuration file format), but there are advantages to MTL.
The first important thing to understand is the difference between the setq and setqb commands. The "b’ in the setqb command stands for "bound". This command is used to set the bound variables that are recognized by the RTI. So the only variables set using setqb should be those that are documented RID parameters that are accepted by the RTI. The setq command, however, can be used to set any temporary variables you want that can be used in RID processing. Why would you want to do this? Well, used in conjunction with other features of MTL, this can make your life just a little bit easier. Here’s an example:
You work in Massachusetts, and most of the time you’re just running your federates in a local federation. However, you also work with another site in Florida, and once in a while you’ll run a larger exercise in conjunction with them. That means you’re going to have two different configurations: Massachusetts only and Massachusetts-Florida. Does that mean you have to manage two separate RID files? You could, but whenever you made an adjustment to a federate-specific RID parameter (maybe to your processing model or your socket buffer size) you’d need to remember to make those changes to your other RID as well. Rather than maintaining two different RIDs, or having to remember which parameters to change for each federation, you could do the following instead (this may look like a lot of MTL code, but you would have to do all of this configuration anyway in your separate RID files):
(setq siteConfiguration "MA") ;; Possible choices: "MA", "MA-FL"
;; Make sure we have an expected value, otherwise exit.
(if (and (not (equal siteConfiguration "MA"))
(not (equal siteConfiguration "MA-FL")))
(sequence (prin1 "INVALID siteConfiguration")
;; MA only. We’ll use the RTI Assistant to configure our connection parameters,
;; and we’re not using MOM, time management, or DDM, so we’ll disable those.
(if (equal siteConfiguration "MA")
(sequence (setqb RTI_configureConnectionWithRid 0)
(setqb RTI_momServiceAvailable 0)
(setqb RTI_timeMgmt 0)
(setqb RTI_dataDistMgmt 0)
(prin1 "Running in MA only configuration")))
;; Connecting with FL. Now we’re using a forwarder and we have a configured
;; routes file for that, so we won’t be using the Assistant. We’ll have to
;; setup all of our connection parameters manually. They’re also using
;; time management and MOM, so we need to turn those on.
(if (equal siteConfiguration "MA-FL")
(sequence (setqb RTI_configureConnectionWithRid 1)
(setqb RTI_useRtiExec 1)
(setqb RTI_udpPort 4123)
(setqb RTI_destAddrString "126.96.36.199")
(setqb RTI_tcpForwarderAddr "192.168.3.100")
(setqb RTI_distributedForwarderPort 5123)
(setqb RTI_forwarderRoutesFile "MA-FL_routes.mtl")
(setqb RTI_distributedUdpForwarderMode 2)
(setqb RTI_momServiceAvailable 1)
(setqb RTI_timeMgmt 1)
(setqb RTI_dataDistMgmt 0)
(prin1 "Running in MA-FL configuration")))
Now there’s only one file to manage, and you can switch between configurations by changing only a single parameter, siteConfiguration. Much easier.