Table of Contents

Configuration file for the ibvunit program

The ibvunit program operates based on a configuration file. The file is of xml type.

Sample configuration file

Below is the content of a sample configuration file for the ibvunit program. This example also includes comments, which serve as a brief documentation, hints, or an example of alternative configuration, making it possible to edit the sample ibvunit configuration file intuitively.

ibvunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<Config xmlns="http://www.insbud.net/ibvunit" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="1.11" xsi:schemaLocation="http://www.insbud.net/ibvunit ibvunit.xsd">
   <Modbus>
      <Gateways>
 
         <SerialPort Id="0" PortName="/dev/ttyS1" SleepMS="20" Parameters="9600/8-N-1"/>
         <SerialPort Id="1" PortName="/dev/ttyS2" SleepMS="20" Parameters="9600/8-N-1"/>
 
         <!-- 
              optional attribute serial port Parameters looks like "XXXX/D-P-S". default value "9600/8-N-1"
              XXXX - baud rate (300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400)
              D - data bits - only 8 is supported
              P - parity flag (N - none, E - even, O - odd, M - mark, S - space)
              S - stop bits (1, 1.5, 2) 
         -->
         <!-- <SerialPort Id="0" PortName="COM4" SleepMS="0" Parameters="9600/8-N-1.5"/> -->
         <!-- <SerialPort Id="1" PortName="/dev/ttyS1" SleepMS="0" Parameters="19200/8-E-2"/> -->
         <!-- <SerialPort Id="1" PortName="/dev/ttyUSB0" SleepMS="0"/> -->
         <!-- <TcpRsConverter Id="0" IPAddress="192.168.200.50" Port="20108" SleepMS="35" /> -->
         <!-- <TlsPskListener Id="0" Port="50001" SleepMS="0" Psk="0102030405" PskIdentity="client" TimeoutMS="3000" CheckPeriodMS="10000"/> -->
      </Gateways>
 
      <!-- ConfigDir - path to the local directory that contains device configuration files -->
      <!-- RemoteConfigDir - url to the remote http directory from which ibvunit downloads configuration files if 
                           not found in local directory. if this attribute is not present or present and is empty
                           then ibvunit not handles downloading file (remember about terminating "/" and trailing "http://")-->
      <Devices ConfigDir="/ibsystem/ibvunit/devcfg" RemoteConfigDir="http://update.ibsystem.org/devcfg/1.2/">
 
         <Device GatewayId="0" Address="0" TimeoutMS="3000" />
 
         <!-- MaxDataWordsInFrame - 1 data word equals 1 modbus register or 8 modbus coils-->
         <!-- MaxRetransmissions - maximum number of retransmission in single transaction, default no retransmissions-->
         <Device GatewayId="1" Address="1" HardwareId="1000" FirmwareId="1" FirmwareVersion="0" MaxDataWordsInFrame="2" MaxRetransmissions="3"/>
      </Devices>
 
   </Modbus>
 
   <License Path="/ibsystem/license/license.dat" SignaturePublicKeyPath="" />
 
   <IbProtocol TcpPort="2001" SecureConnection="false" />
 
   <!-- Levels: TraceLo, Trace, TraceHi, DebugLo, Debug, DebugHi, Info, Notice, Warning, Error, Critical -->
   <!-- Types: Console, File, None -->
   <Log Type="File" Level="Info" Params="/ibsystem/ibvunit/ibvunit.log" MaxLogFileSize="10000000" MaxLogArchives="10" />
 
   <MWT Value="70"/>
   <EDT Value="IyMjIz4jIz4jIzMjIykjIykjIxMT" />
</Config>

The main element of the configuration file is Config, which among other things, has the Version attribute, which is the version of the configuration file. The correct version of the configuration file is version 1.11 (for the ibvunit program in version 2.3.5).

If this version does not match the version number currently handled by the program, an error will be reported and the program will stop running. The error will be reported in the terminal, as the program's log parameters are contained in the configuration file, which is not supported.

The other elements of the configuration file have been described in separate chapters of the documentation.

<Modbus>

A mandatory element. It contains other elements that define all devices and gateways with the MODBUS RTU protocol.

<Gateways>

A mandatory element located in the <Modbus> element. The element is responsible for defining all gateways through which the ibvunit program will communicate with target devices using the MODBUS RTU protocol.

The ibvunit program supports the following types of gateways:

Each defined gateway has an Id attribute, it is a unique identifier for a given gateway. It must be unique within the entire Gateways element. It is not allowed to assign the same identifier, for example, for one gateway being a TCP/RS converter and another being a local serial port.

Each gateway must be correlated with at least one device. If a gateway is defined and no device from the <Devices> element is connected with it, an error will be reported and the program will stop running.

Local serial port (SerialPort)

<SerialPort Id="1" PortName="COM6" Parameters="115200/8-N-1" SleepMS="0"/>

The above element defines a gateway being a serial port in the Windows system with the identifier “1”, and refers to the physical port “COM6”.

The element contains attributes:

TCP/RS Converter (TcpRsConverter)

<TcpRsConverter Id="2" IPAddress="192.168.1.223" Port="20108" SleepMS="0"/>

The above example defines an RS485-ETHERNET converter with the identifier 2, which has the IP address 192.168.1.223, and listens on TCP port 20108. The serial transmission parameters are defined directly in the RS485-ETHERNET converter configuration.

The element contains the following attributes:

TLS Server (TlsPskListener)

<TlsPskListener Id="2" Port="2003" SleepMS="0" Psk="0102030405" PskIdentity="client" TimeoutMS="3000" CheckPeriodMS="10000"/>

The above example defines a TLS server type gateway. In this case, the ibvunit program runs a TLS server on the indicated port.

The element contains the following attributes:

The values of the Psk, PskIdentity, Port, and the IP/DNS address of the machine on which the ibvunit program is running must be entered in the appropriate places in the M1F1 device, as they are the ones that establish and maintain communication with the given TLS gateway of ibvunit.

<Devices>

<Devices ConfigDir="/ibsystem/ibvunit/devcfg" RemoteConfigDir="http://update.ibsystem.org/devcfg/1.2/">
   <!-- multiple <Device/> elements -->
</Devices>

This is a mandatory element found within the <Modbus> element. This element is responsible for defining all devices with MODBUS RTU communication that are connected to previously defined gateways.

The element can contain multiple <Device> elements.

This element contains the attributes:

With all devices listed in the Devices element that have not explicitly been assigned the HardwareId, FirmwareId and FirmwareVersion attributes, communication is established during the ibvunit program startup in order to identify them (device id and version number). Based on this, ibvunit assigns a configuration to each device, selecting it from the appropriate xml file. If a given file is not found in the local directory, then the application tries to download it from the remote location specified in the RemoteConfigDir attribute of the Devices element.

<Device>

This is a mandatory element located in the <Devices> element. This element is responsible for defining a single device with MODBUS RTU communication.

<Device GatewayId="0" Address="255" HardwareId="3" FirmwareId="1" FirmwareVersion="6" TimeoutMS="5000" MaxDataWordsInFrame="2" MaxRetransmissions="2"/>

The element contains the following attributes:

<License>

<License Path="/ibsystem/license/license.dat" SignaturePublicKeyPath="" />

Mandatory element pointing to the provided license file. Without a valid license file, the program will not start.

The element contains the attributes:

<IbProtocol>

<IbProtocol TcpPort="2001" SecureConnection="false" />

The IbProtocol element describes the parameters of the protocol, with which, external programs can communicate with the ibvunit program.

The element contains attributes:

<Log>

<Log Type="File" Level="Info" Params="/ibsystem/ibvunit/ibvunit.log" MaxLogFileSize="40000000" MaxLogArchives="20" />

Element responsible for configuring the logging system of the ibvunit program.

The element contains the attributes:

In the sample definition of the <Log> element, the log rotation mechanism assumes the existence of up to 20 archival files. Both archival and current can be up to about 40MB in size.

<MWT>

<MWT Value="70"/>

The Value attribute represents the maximum number of days the ibvunit program can run. After this period, the program will be blocked, closed, and it will be impossible to restart it.

This feature has been introduced for individuals and companies using IB-System for commercial reselling purposes and is designed to disable some functionalities in case, for example, the trial period is exceeded.

This is a relatively primitive feature and familiarity with IB-System in terms of functionalities and configurations will allow for the removal of such a blockade, nevertheless, it can be useful when selling ready-made systems with a ready and configured IB-System as a trial product.

The MWT element is optional. If it does not appear in the configuration file, it means that the ibvunit program's operating time limit does not exist.

If the element has been defined, a *.bin file is created in the directory with the ibvunit executable file, which is updated as the appropriate time period elapses. When the ibvunit program is launched, this time is read from the aforementioned file.

To remove the operating time limit of the ibvunit program, you need to remove the MWT element from the program's configuration file, stop the ibvunit program, delete the *.bin file, and then restart the ibvunit program.

<EDT>

<EDT Value="IyMjIz4jIz4jIzMjIykjIykjIxMT" />

This element configures similar functionality to the MWT element, however, the Value attribute represents the encoded date after which the ibvunit program is to be blocked.

The current date is the system date, therefore changing the system date or running the ibvunit program on systems without a real-time clock (RTC) can bypass this security measure.

This element is mandatory, however, if the Value attribute takes the value “IyMjIz4jIz4jIzMjIykjIykjIxMT” it means the deactivation of the EDT security feature.