Static vs. Dynamic Preferences

There are two types of preferences that can be assigned:

  • Static preferences form the fixed set of options that Modeler has built into it as a part of its interface.
  • Dynamic preferences obtain values for program options that Modeler determines it needs while executing. These preferences differ from static preferences in that they may be based on conditional events in the execution of a program, and thus cannot be considered part of the built-in, centralized option set of a program.

Static preferences have the following properties:

  • They are searched for in the environment shortly after a program begins executing.
  • They can be classified as required or optional.
    • A required static preferences causes Modeler to halt execution if the user does not specify a value assignment for the preference.
    • An optional static preference automatically has a default value assigned if the user does not specify a value assignment.
  • They are documented in Chapter 3 “Program Descriptions” on page 143.
  • They are displayed in the list produced by the help preference.

Dynamic preferences have the following properties:

  • They are searched for in the environment whenever an executing program determines a need for a preference value.
  • When a dynamic preference is requested by a program, and an assignment for this preference is not found in the program’s environment, a prompt is printed on the standard output device that requests the user to enter a value for the preference. The user has the option of entering a value, or simply pressing the <Return> key to automatically assign the default value to the preference. This constitutes a fifth source of values for dynamic preferences, a source not available for static preferences.
  • They are not documented in the list of preferences supported by each program that appears in Chapter 3 “Program Descriptions” on page 143, due to their dynamic and conditional nature.
  • They do not appear in the list produced by the help preference, again due to their dynamic and conditional nature.
  • Their use is limited to the following types of preferences:
    • Font name mappings of GUI-based programs.
    • The arch_suffix preference, a boolean that indicates whether a two-character abbreviation of the host architecture (i.e., CPU type and OS) should be added to the file type suffix of object-code model files.
    • Dynamic requests for simulation preferences made by the Kernel Procedure op_ima_sim_attr_get().
    • Compatibility preferences from previous releases.

Name Wildcards

Simulations use dynamic preferences to obtain values for promoted object attributes. In some cases, the number of dynamic preferences utilized by a simulation can be large; this usually occurs when many nodes and/or modules are involved, each with promoted attributes. Entering values for each dynamic preference by hand in such cases would be tedious, especially if many of the attribute values were the same. To support the assignment of multiple related attributes at the same time, a name wildcard feature is supported.

Simulation object dynamic preferences have a hierarchical naming structure: preference names are divided into a series of dot-separated components, each representing one level of the model hierarchy. Every name component belongs to one of the following categories:

  • subnet name(s) (one or more)
  • node name
  • module name (possibly with a sub-module index, as in tx[4])
  • child process name
  • attribute name

The format of hierarchical object attribute names is always top-down, but the number of name components can vary due to the type of object being identified. For instance, a promoted node attribute would be specified simply as <node name>.<attr name>; on the other hand, an attribute associated with a child process in a nested subnet would have a longer hierarchical name: top.<subnet name>.<subnet name>.<node name>.<module name>.<process model name>.<attr name>.

The wildcard feature allows the wildcard character (the asterisk, “*”) to match any number of alpha-numeric characters (not including punctuation and special characters) in dynamic preference names. Thus parts of a preference name can be separately wildcarded, as shown below.

The wildcard preference name:

	*.*.tx.channel [4].data rate

matches the actual preference names:

	lan0.nd1.tx.channel [4].data rate
	lan0.nd2.tx.channel [4].data rate
	lan1.nd1.tx.channel [4].data rate

An example of this wildcarding feature is shown below: a line in an environment file makes a wildcard assignment to all channels of every transmitter called “tx” in a network model. Notice that the third wildcard character is only matching the initial characters of the third part of the preference name; wildcard matching stops when it encounters a non-alphanumeric character (in this case, “[”).

"*.*.*.*[*].data rate": 9600

The assignment syntax used for wildcarded dynamic preference names is generally not different from the syntax used for those preference names without wildcards. However, command line assignments of wildcarded preference names must have special protective symbols (double quotes) that restrict the command interpreter from interpreting the wildcard character (“*”) as a wildcard for filenames. In addition, the first character of a preference flag must be a dash (otherwise the flag will not be recognized as a flag). The proper syntax for a command line wildcarded preference assignment is demonstrated below.

op_runsim -net_name net "-*.*.qx.priority" 20

Notice that the double quotes encapsulate a whole sequence of characters as an argument to op_runsim, as well as protecting the special meaning of the asterisk character. The preference’s value is not placed inside the quotes, since it is a separate argument to op_runsim.