Relational functions - NAVADMC/ADSM GitHub Wiki

Rels in ADSM

Relationships or relational functions (rels) are used in situations where one variable is a function of another. For example, the probability of observing clinical signs in an infected herd is a function of the time since the herd was infected. New rels may be entered in ADSM by entering data points or by importing data.

Creating a new rel

The Functions Panel

The rel parameter is used throughout the model and can be created in the Functions Panel. If rels have already been created, they are listed when the Function Panel opens. To add a rel, select the + New Relational Function link, and editable rel window will pop open. Rels require a name, X axis unit, and a set of points. Users may enter data in the fields provided, or use the Choose File button to select a text file of points.

The rel editor window

Selecting a rel will display a graphical image the data, and all the data fields for the rel. Clicking on the Edit or New button in the rel box will change the rel window to an editable format. Users can Overwrite, Make a Variant (save as) or cancel the action. Using the Variant automatically assigns a new name to the rel. When the user has finished data entry, the Apply button saves the changes and updates the image. Note data points are translated into expected order, regardless of data entry order. Edit also provides the ability to delete data points by clicking the Delete button.

Naming the rel

Every new rel must be assigned a unique name. Enter the name in the Function name text box. If you are editing an existing rel, you may rename it in Edit mode by changing the name entered in the Function name text box.

Saving the rel

Once you have created or edited a rel, you need to save it. Use the Apply command in the lower left corner of the rel editor window. If you wish to exit the rel editor window without applying the changes you have made, use the Cancel button in the lower center of the rel editor window.  

Directly editing point values

The x and y coordinates of each point (displayed in the panel of the rel editor window) may be changed directly by editing the values shown in the panel. Enter the desired values, and click on the Apply button to save your changes.

Importing a rel function

If you have defined values for your relational function in another application such as a spreadsheet or statistical package, you may import the point values directly into the rel editor window. Data should consist of two columns (x and y values) and be in a comma-separated (*.csv) file. Values along the x axis should be in units appropriate for the rel. Figure below shows sample data suitable for importing into the rel editor window.

To import points from a file, use the Choose File in the rel editor window.

               x,    y
               0,    10
               20,   20
               50,   40
               80,   75
               100,  95
               120, 100

This image shows a properly formatted *.csv file for importing a relational function. Note that the first row is a header row, which identifies the x and y columns. (Columns shown here are evenly spaced to make them easier to read: uniform spacing is not required in the file to be imported.)