Model INI File

From Planimate Knowledge Base
Jump to navigation Jump to search

Planimate supports having configuration files external to a model which can be used to set run specific details. These settings are stored in an INI file. This is distinct to the INI file which configures Planimate itself.

Planimate will look for the INI file specified using Edit->Select Model INI File when the model (or PBA) is loaded. It looks in the same directory as the PBA. It can also be directed to use a specific INI file using the /INIFILE= command line option. This will override any model INI file specified in the model.

The INI file contains sections for different classes of data. These are explained in the sections below.

File Name Remapping

References to file names in a model used in the Change Object File Access operations are run through a remapper. This enables the names referenced in the model to be customised and repointed to actual files/paths. This lets an user specify exactly where files are without them being hard coded in the model.

The mappings are placed in a section called [FILES] in the INI file.

[FILES]
"<from-name>" "<to-name>"


Note that all names must be quoted.

Example:

[FILES]
"TEST1.DAT" "c:\rick\sv\data\test1.dat"
"TEST2.DAT" "d:\moredata\test2.dat"
"c:\rick\data\test3.dat" "d:\moredata\test3.dat"

Note that even names that included paths can be remapped.

Sub File Names

For advanced configurations, an internal name in PL can include the bar symbol "|" to break it up into separate sections. At runtime, the bars are stripped out and the sections of file names are then separately remapped.

This can greatly simplify the INI file where only the prefix path of a file needs to be changed.

eg: In Planimate, the following file reference is used:

"dataroot|path|data_3.dat"

then the details provided in an INI file:

[FILES]
"dataroot" "q:\"
"path"     "files\mydata\"

Note that text following a "|" is never remapped unless there is a bar after it, eg: data_3.dat above would not be checked by the remapper unless another "|" was added after it.

Attribute Values

Portal attributes can be set from the INI file. This is done in a portal section using the ATT command which expects 2 quoted strings, as follows.

[<Object List Name>]
ATT "<attribute name>" "<formatted-value>"

It is assumed that the Object List Name identifies a portal in the object label list.

Examples:

[Portal 1]
ATT "test1" "123"
ATT "test2" "1:23"
ATT "test3" "blue"

[Test Setup]
ATT "test1" "456"
ATT "test2" "1:23"
ATT "test3" "blue"
ATT "test4" "no"

[Configurations]
ATT "expert user" "0"

These set the named attributes to the values given, in portals "Portal 1","Test Setup" and "Configurations" respectively.

Mapping Shares

Planimate can run under different user credentials than the user who launches it. This is useful where Planimate needs access to data files that the user should not have access to. The command line options /USER and /SHARES are used. The /SHARES command line option enables an INI file to be specified with the mappings for these. Planimate will establish network shares using names in the [SHARES] section, as follows.

[Shares]
"S:" "//SERVER/DATA1"
"T:" "//SERVER2/MOREDATA"

Note that this section of the INI file is only read if the /SHARES command line option is used. It can co-exist with other initialisation sections that the model uses, if desired.

Sockets

Network Socket configurations can be customised by an INI file. This is useful where an application is being used in a number of locations with different network configurations

This is achieved using a sockets section:
[SOCKETS] "<socket-name>" "<address>" "<port>"

address specifies an IP address or name. It should be empty if the socket is configured as a server (this cannot be overridden here). Example:

[SOCKETS]
"Server"  "192.168.100.50" "5500"
"MyListener"  ""  "5601"