GMM stores all configuration settings in a simple XML-format text file.
The file is global to all users, and if it does not exist will be created the first time GMM runs. This file will need to be edited when the application first runs, but once setup correctly shouldn't need to be edited again.
Platform | Configuration File |
---|---|
Linux | /var/.GormanMoistureMeter/GormanMoistureMeter.cfg |
Windows | C:\ProgramData\GormanMoistureMeter\GormanMoistureMeter.cfg |
There are two types of settings stored in the .cfg file: global, and prefixed:
GMMWnd
.a_device
and b_device
. Every tab in GMM has a unique prefix.Configuration | Type | Default Value | Description |
---|---|---|---|
*_chart_redraw_ms | Prefix | "1000" | How long GMM waits between updates to the window and re-drawing the chart. See *_chart_redraw_ms for details. |
*_comm_str | Prefix | "..." | See *_comm_str for details. |
*_device | Prefix | "..." | The serial communication device to open. See *_device for details. |
*_export_image | Prefix | "false" | Whether to save the chart image to disk. See *_export_image for details. |
*_interval_ms | Prefix | "250" | The length of time (in milliseconds) between attempts to read the serial port. |
*_last_kiln | Prefix | "1" | Internal value used to store the last known kiln number. This value is automatically updated by GMM. |
*_last_pkg | Prefix | "1" | Internal value used to store the last known package number. This value is automatically updated by GMM. |
*_last_run | Prefix | "1" | Internal value used to store the last known run number. This value is automatically updated by GMM. |
*_name | Prefix | "..." | The name to display for this tab. See *_name for details. |
*_opc_kiln_register | Prefix | "N75:3" | The OPC register to read to obtain the kiln number. The results are then stored in *_last_kiln . |
*_opc_pkg_register | Prefix | "N75:5" | The OPC register to read to obtain the package number. The results are then stored in *_last_pkg . |
*_opc_run_register | Prefix | "N75:4" | The OPC register to read to obtain the run number. The results are then stored in *_last_run . |
*_opc_via_csv_filename | Prefix | "..." | Another method by which RSLinx OPC data can be fed to GMM. No longer supported. |
*_opc_via_csv_regex | Prefix | "..." | Another method by which RSLinx OPC data can be fed to GMM. No longer supported. |
*_read_len | Prefix | "11" | The number of bytes to read from the serial port. |
*_regex_pattern | Prefix | "\s*([\d.]{4})\s([\d.]{4})\s*" | The regular expression used to parse the data read from the serial communication port. See *_regex_pattern for details. |
*_run_simulation | Prefix | "FALSE" | Whether to simulate the data, or actually read from the serial port. Except when testing, this should be kept at "false" . |
allow_user_to_close | Global | "TRUE" | Whether the GMM window can be closed by the user clicking on the titlebar "X". When set to "false" , GMM can only be closed via Windows Task Manager. |
get_motd | Global | "TRUE" | Whether to download and display a text message from the GMM web site. |
get_version_number | Global | "TRUE" | Whether to check to see if there is a new version from the GMM web site. |
GMMWnd | Global | "..." | Internal value used to store the window geometry. This is automatically updated by GMM and shouldn't be modified by hand. |
number_of_items_to_load | Global | "..." | Internal value used to store the number of items to load on startup. This is automatically updated by GMM and shouldn't be modified by hand. |
opc_console_application | Global | "opcconsole.exe" | The application and arguments to run to start the GMM OPC Console. |
opc_group | Global | "INFEED" | The OPC group name. |
opc_output_filename | Global | "..." | Internal value used to identify a filename to communicate between GMM and OPC Console. |
opc_show_console_window | Global | "TRUE" | Whether the OPC Console is shown or hidden. |
opc_url | Global | "opcda://localhost/RSLinx OPC Server" | The URL to use to connect to the OPC server. |
output_directory | Global | "C:\\22m2k\\data\\%Y\\boardmc\\" | The directory where the output files will be saved. The "%Y" will be replaced with the current 4-digit year. |
warn_board_threshold | Global | "1500" | If a package contains this number of boards or more, a warning is shown to the user. This requires that warn_if_package_contains_too_many_boards is set to "TRUE" . |
warn_if_package_contains_too_many_boards | Global | "TRUE" | Determines if warnings are shown to the user if a package contains too many boards. See Boards for details. |
warn_seconds_between_warnings | Global | "300" | The number of seconds that must elapse before a 2nd warning is shown to the user. |
Note that GMM itself modifies the .cfg file, such as when it is updating the GMMWnd
value. If you modify the .cfg file by hand while GMM is running, your modifications will be overwritten/discarded when GMM eventually exits!
The *_chart_redraw_ms
configuration variable determines the length of time between iterations of the main GMM GUI loop. Initially, this was used to redraw the chart on the screen – thus the name of the configuration variable – though now it contains much more functionality.
The loop drives a number of items, and the loop interval directly determines how often they happen. By default, the interval is usually set to 1000 milliseconds. The actions that occur once per loop are:
The *_comm_str
configuration string determines how the serial port is initialized. The string is passed as-is to the Win32 function call BuildCommDCBA()
.
Additional information on how to use this configuration string can be found by doing a Google search on functions such as BuildCommDCBA()
, BuildCommDCBAndTimeoutsA()
, or how to use the mode
command to configure a serial communication port.
For example, refer to https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/mode for help with the mode
command.
Several common strings to try:
Description | comm_str |
---|---|
Flow control none | "baud=9600 parity=N data=8 stop=1 to=on xon=off odsr=off octs=off dtr=on rts=on idsr=off" |
Flow control hardware | "baud=9600 parity=N data=8 stop=1 to=on xon=off odsr=off octs=on dtr=on rts=hs idsr=off" |
Flow control xon/xoff | "baud=9600 parity=N data=8 stop=1 to=on xon=on odsr=off octs=off dtr=on rts=on idsr=off" |
The *_device
configuration string names the hardware device which will be opened and read. Typically, the device name will be similar to com1
, com2
, etc.
By default when GMM runs for the first time and creates a new .xml file, the following devices are setup:
com4
com5
com6
com7
The chart image is typically re-drawn every 1000 milliseconds for the active tab, as described by *_chart_redraw_ms
. In addition, the chart image can also be written to disk at the same time when *_export_image
is set to "true"
.
When enabled, the images are redrawn for all tabs, not only the active tab, and they are exported to %tmp%
after they've been generated, which typically will look like C:\Users\username\AppData\Local\Temp\
.
For example:
The *_name
configuration string provides a readable English-language name to each tab. Instead of refering to a device as "com4", it can then be refered to as "Planer #1" which is more meaningful.
The original mapping between *_device
and *_name
is as follows:
Device | Name |
---|---|
com4 | "Planer #1" |
com5 | "Planer #2" |
com6 | "Moulder" |
com7 | "Spare" |
The *_regex_pattern
configuration string contains a regular expression used to parse the data read from the communication port. Regular expressions are complex textual descriptions used to perform character matching. Do a Google search or refer to https://en.wikipedia.org/wiki/Regular_expression for details.
The default regex used is the following: "\s*([\d.]{4})\s([\d.]{4})\s*"
. This is broken down as follows:
Regex | Meaning |
---|---|
"\s*" | Skip over any number of leading whitespace characters. |
"([\d.]{4})" | Read exactly 4 characters and remember them. The characters must be either numerical digits or a period. For example: 14.3 . This value is interpreted as the moisture value for the current board. |
"\s" | Skip over a single whitespace character, such as space or tab . |
"([\d.]{4})" | Read exactly 4 characters and remember them. The characters must be either numerical digits or a period. For example: 14.3 . This value is interpreted as the average. |
"\s*" | Skip over any number of trailing whitespace characters. For example, the \r\n (carriage return + linefeed) at the end of the string. |
Adding a new device (a new tab) is very simple. There is only 1 required configuration string: *_device
.
When GMM starts, if it finds a new *_device
configuration string, it will then add all of the other necessary configuration strings, making it relatively easy to then customize by hand.
To add a new device (tab):
"C:\ProgramData\GormanMoistureMeter\GormanMoistureMeter.cfg"
. "test"
. *_device
line to the .cfg file using the new prefix. For this example: <VALUE name="test_device" val="com9"/>
At this point, a new tab should have been created. If the settings for this new tab need to be modified:
"C:\ProgramData\GormanMoistureMeter\GormanMoistureMeter.cfg"
. "test"
prefix, such as test_name
, test_comm_str
, test_regex_pattern
, etc.