Documentation Home Page HYPERSIM Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

Modbus Slave | Configuration

Accessing the I/O Interface Configuration

The Modbus slave communication protocol can be configured through the I/O Interface Configuration tool available from the HYPERSIM ribbon.

For more information on the general use of the I/O Interface Configuration, see I/O Interface Configuration.

General Configuration

Use an RT core for asynchronous computation

  • If set to true, the driver reserves a real-time CPU core for its communication system and will be able to handle a bigger number of slaves.
  • If set to false, the communication system defaults to core 0 (running with the operating system).

Enable verbose mode

If enabled, additional information is displayed in the HYPERSIM log during the loading of the model.

Enable virtual modeIn virtual mode, the model can be executed even if this I/O interface is not compatible with the hardware configuration of the system. The connections between the model and the I/O interface will be done during the initialization, but the I/O interface will not do anything.






The virtual mode can be used to troubleshoot problems on a system without having the required hardware, or to prepare a model with different I/O interfaces even if the final hardware platform is not available.

Slave Configuration

General Parameters

Mode

Select TCP or RTU.

Slave ID

ID of the Modbus slave. Each slave must be configured with a unique identification number. This is due to the fact that:

  • In TCP mode, many slaves can use the same IP address and TCP port combination.

  • In RTU mode, many slaves can be connected on the same physical serial link.

Cycle output rate (ms)

Defines the rate (in milliseconds) at which the data from the model is written in the slave's outputs (coils and holding registers).

When the slave's outputs are controlled both from the model and from the master, this parameter must be set to a value greater than the time step of the model. Otherwise, the write operations made by the master are never reflected in the model.

Byte ordering

Defines how 32-bit data is encoded. Any of the byte ordering cases are possible (ABCD, BADC, CDAB, DCBA). ABCD refers to the network byte order.

Permit read/write requests with address gapsFrom the lowest address to the highest address configured, this option creates dynamically new coils, discrete inputs, holding registers and input registers at every address that is not defined by the user and assigns a value of 0.

TCP Specific Parameters

NIC name

The desired network interface name. The proper interface name should be selected based on the information given by the Linux command "ifconfig".

If a Modbus master is running on the same machine as the Modbus slave, the loopback network interface must be used ('lo'). If the driver is running on Windows this field will be ignored.

IP address

The IP address of the Modbus slave. If a Modbus master is running on the same machine as the Modbus slave, the loopback IP address must be used (127.0.0.1).

TCP port

Select the TCP port on which the slave will wait for a connection.

RTU Specific Parameters

Serial port

Path to the serial interface to be used. The default serial interface name of the first port on a SuperMicro motherboard (OPAL-RT chassis) is "/dev/ttyS0".

Serial baudrate

Speed at which Modbus RTU slave is configured to communicate.

Serial data bits

Number of data bits the Modbus RTU slave is configured to communicate.

Stop bits

Number of stop bits the Modbus RTU slave is configured to communicate.

Serial parity

Parity at which the Modbus RTU slave is configured to communicate.

If "Odd" or "Even" is selected, the number of "1" bits in the data section of each character frame is counted. As each character in RTU mode contains 8 bits, the parity bit will then be set to a 0 (even parity) or a 1 (odd parity) to reflect the total number of "1" bits.



For each slave instance, the inputs and outputs must be configured. The slave will reply to the master requests continuously as fast as possible.

Coils

Name

A specific name to recognize the coil.

Address

The address at which the slave holds that coil.

Initial value

If the coil is only controlled by the master, it will take this value (as a binary number) at the beginning of the simulation. Otherwise, the initial value comes from the model.

Control from

Master

The coil is a model input and can only be changed by a Modbus master.

Model

The coil is a model output and can only be changed by the model. A Modbus master can read this coil and if it writes a value to it, it is overwritten automatically by the model.

Both

The coil is directly connected to the model input and a "from model" data point is instantiated. This one overwrites the coil value at the interval specified by the cycle output rate (ms) parameter.

Discrete Inputs

Name

A specific name to recognize the discrete input.

Address

The address at which the slave holds that discrete input.

Holding Registers

Name

A specific name to recognize the holding register.

Address

The address at which the slave holds that holding register.

Initial value

If the holding register is only controlled by the master, it takes this value at the beginning of the simulation. Otherwise, the initial value comes from the model.

Control from

Master

The holding register is a model input and can only be changed by a Modbus master.

Model

The holding register is a model output and can only be changed by the model. A Modbus master can read this holding register and if it writes a value to it, it is overwritten automatically by the model.

Both

The holding register is directly connected to the model input and a "from model" data point is instantiated. This one will overwrite the holding register value at the interval specified by the cycle output rate (ms) parameter.

Register type

UINT16

This is the standard format of Modbus slave holding registers.

INT16

This is a non standard format of Modbus slave holding registers. The support for this type is added to improve usability.

UINT32

This is a non standard format of Modbus slave holding registers. The support for this type is added to improve usability. The driver supports multiple byte orderings as described above in the slave configuration. A UINT32 holding register will take two UINT16 registers. This means that there should be an offset of 2 after each UINT32 holding register, otherwise the driver initialization will fail.

INT32

This is a non standard format of Modbus slave holding registers. The support for this type is added to improve usability. The driver supports multiple byte orderings as described above in the slave configuration. An INT32 holding register will take two UINT16 registers. This means that there should be an offset of 2 after each INT32 holding register, otherwise the driver initialization will fail.

FLOAT32

This type is based on the single-precision floating-point IEEE 754 standard (32 bits). The Modbus slave driver supports multiple byte orderings as described above in the slave configuration.

A FLOAT32 holding register will take two UINT16 registers. This means that there should be an offset of 2 after each FLOAT32 holding register, otherwise the driver initialization will fail.

Input Registers

Name

A specific name to recognize the input register.

Address

The address at which the slave holds that input register.

Register type

UINT16

This is the standard format of Modbus slave input registers.

INT16

This is a non standard format of Modbus slave input registers. The support for this type is added to improve usability.

UINT32

This is a non standard format of Modbus slave input registers. The support for this type is added to improve usability. The driver supports multiple byte orderings as described above in the slave configuration. A UINT32 input register will take two UINT16 registers. This means that there should be an offset of 2 after each UINT32 input register, otherwise the driver initialization will fail.

INT32

This is a non standard format of Modbus slave input registers. The support for this type is added to improve usability. The driver supports multiple byte orderings as described above in the slave configuration. An INT32 input register will take two UINT16 registers. This means that there should be an offset of 2 after each INT32 input register, otherwise the driver initialization will fail.

FLOAT32

This type is based on the single-precision floating-point IEEE 754 standard. The Modbus slave driver supports multiple byte orderings as described above in the slave configuration. A FLOAT32 input register takes two UINT16 registers. This means that there should be an offset of 2 after each FLOAT32 input register, otherwise the driver initialization will fail.

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323
Follow OPAL-RT: LinkedIn | Facebook | YouTube | X/Twitter