Modbus

The Modbus I/O plugin allows the connection of a G-Core system with external I/O modules that communicate via the Modbus standard.

Creation of the Hardware Plugin in G-Set

For each Modbus device you want to connect to G-Core, you need to create a Modbus hardware plugin. There are three different types of Modbus plugins. You can choose between 32 inputs or 32 outputs or 16 inputs and 16 outputs.

If you have a Modbus device with more inputs and outputs, you must use more than one plugin. See the following sections for more information.

Description of the Configuration Parameters

The following parameters can be configured in the settings of the plugin:

General Settings

Name

Description

Modbus device IP or Hostname

IP address of the respective Modbus module.

Modus device port

Port of the Modbus module (default: 502).

Polling time refresh rate

Interval at which the current inputs of the module are polled (setting in milliseconds).

Keepalive action interval

Configuration of the interval at which the Keepalive action is sent.

The current connection status of the Modbus module is displayed here.

Input Settings

Name

Description

Start address of inputs

Start address of the inputs of the Modbus module.

Number of inputs

Number of inputs that the Modbus module has.

Depending on the selected plugin type, a maximum of up to 32 inputs are supported.

Explicitly poll read only inputs instead of read/write inputs

This setting is disabled by default.

  • The inputs are polled by default with the Modbus functions 0x01 READ_COILS or 0x03 READ_REGS.

  • Activating this setting changes this to the Modbus functions 0x02 READ_INPUT_BITS or 0x04 READ_INPUT_REGS.

Whether this function is required depends on the Modbus module used.

Retrigger inputs on startup

When this setting is enabled, the plugin retriggers inputs that were already set when the G-Core server was started.

This is useful for scenarios where events should be triggered immediately at server startup.

Use analog Inputs instead of digital (enables cut line detection)

This setting is disabled by default.

  • The inputs are polled by default with the Modbus functions 0x01 READ_COILS or 0x02 READ_INPUT_BITS.

  • Activating this settings changes this to the Modbus functions 0x03 READ_REGS or 0x04 READ_INPUT_REGS.

Whether this function is required depends on the Modbus module used. If a Modbus module with analogue inputs is used, this function activates the cut line detection.

Voltage threshold 1 /

Voltage threshold 2

When activating the analog query and thus the cut line detection, the voltage state can be defined with these two parameters. This defines when analog inputs are detected as closed, open or terminated.

The values can vary depending on the used Modbus module and resistor.

Output Settings

Name

Description

Start address of outputs

Start address of the outputs of the Modbus module.

Number of outputs

Number of outputs that the Modbus module has.

Depending on the selected plugin type, a maximum of up to 32 outputs are supported.

Use analog Outputs instead of digital

This setting is disabled by default.

  • By default, outputs are set with function 0x05 WRITE_COIL.

  • If the setting is enabled, function 0x06 WRITE_REG is used.

Whether this function is required depends on the Modbus module used.

Reconnect Behaviour

This setting determines how the plugin behaves when it is reconnected to the Modbus device after a connection loss.

  • Buffer outputs: During the connection loss, all outputs are buffered and as soon as the connection is re-established, the latest output states will be sent to the Modbus device.

  • Query outputs: After the connection is re-established, the plugin ignores the outputs that have been set in the meantime and queries the Modbus device for its current output states and uses them.

  • Do nothing: The outputs are neither buffered nor polled, but simply ignored and normal operation continues. May cause a temporary inconsistency between the initial state of the G-Core server and the actual output states of the Modbus devices. This only lasts until the outputs are set again.

Do nothing: May cause a temporary inconsistency between the initial state of the G-Core server and the actual output states of the Modbus devices. This only lasts until the outputs are set again.

Mapping of the G-Set I/O’s with the Modbus I/O‘s

Additionally you have to map the inputs and outputs that the Modbus plugin provides to the G-Core server to the virtual inputs and outputs of the server. You can do this in G-Set in the General Settings via the I/O Settings.

Serving a Large Modbus Device with Multiple Plugins

You can set up Modbus devices with more inputs and outputs than a plugin supports due to its existing limitations. For example, the input addresses of your Modbus device start at 1000 and go to 1063.

In the first plugin you can now set the input address to 1000 and the number of inputs to 32. In the second plugin you can set the input address to 1032 and the number of inputs to 32 as well. However, in both plugins the IP address and the port must be the same.

Important is the compatibility of the respective Modbus module, it must support multiple server connections, because each plugin is equivalent to its own server.

Manufacturer Specific Notes

I/O modules of the manufacturer Phoenix Contact:

The watchdog on the module is activated by default, this means that the module goes into an error mode after 200 ms to 65000 ms as soon as no more outputs are set.

In the error mode no more outputs can be set and the mode can only be canceled by restarting the device. This problem can only be avoided if outputs are set in this time frame or if the watchdog is switched off.