--- title: "Calculating a Minimum of a Modbus Value and a 104 Protocol Value - icom Data Suite" slug: "calculating-a-minimum-of-a-modbus-value-and-a-104-protocol-value-en" updated: 2024-10-01T11:41:35Z published: 2024-10-01T11:41:35Z canonical: "docs.insys-icom.com/calculating-a-minimum-of-a-modbus-value-and-a-104-protocol-value-en" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.insys-icom.com/llms.txt > Use this file to discover all available pages before exploring further. # Calculating a Minimum of a Modbus Value and a 104 Protocol Value - icom Data Suite ## Situation A renewable energy plant gets two feed power requests, one from the grid operator and one from the direct marketer. The lower of each values must be used as feed power since the grid operator cannot transport a higher power or the direct marketer cannot sell a higher power. The grid operator issues a 104 protocol signal containing it’s feed power request. The direct marketer issues a Modbus signal containing it’s feed power request. The control of the renewable energy plant requests the feed power input as a Modbus signal. The two values need to be compared and the lower value (minimum) need to be transmitted to the renewable energy plant control via Modbus. Data transmission and computation takes place using an INSYS router located in the renewable energy plant using a secure VPN connection. ![cg ids modbus 104 comparison](https://docs.insys-icom.de/assets/cg_ids_modbus_104_comparison.png) ## Solution The icom Data Suite running on the INSYS router will act as a comparator of the Modbus and the 104 value and transmit the minimum of both values via Modbus. The icom Data Suite acts as a 104 server and enables the grid operator that acts as a 104 client to write the feed power request to a 104 protocol item. The icom Data Suite acts as a Modbus slave and enables the direct marketer that acts as a Modbus master to write the feed power request to a Modbus register. The two values will then be mapped to flags that can be compared by the icom Data Suite. The icom Data Suite will then compare both values and write the minimum of both values as a Modbus master into a Modbus register of the control of the renewable energy plant that acts as a Modbus slave. It is prerequisite that you have access to the web interface of the icom Data Suite. It is also prerequisite that the INSYS router is properly configured to establish the VPN connection to the grid operator and direct marketer as well as the Modbus connection to the control of the renewable energy plant. ### Configuring the 104 Connection to the Grid Operator 1. In the *Data points* → *Flags* menu, add a new flag that will be used to compare the values () and configure it: - *Description*: Feed power request - grid operator - *Type*: *Unsigned integer* 2. Click on *Save settings*. 3. In the *Gateway* → *104 server* menu, add a new device () and edit it (): - *Description*: 104 gateway to grid operator - *Port*: 2404 - *Station address*: 1 4. Click on *Save settings*. 5. In the *Gateway* → *104 server* menu in the *Items* section, add a new item, which can be written with the feed power request by the grid operator and will be mapped to a flag, () and edit it (): - *Description*: Feed power request from grid operator - *Type*: *Mapping* - *Data point*: Select above added flag - *104 type*: *Scaled value* - *IOA*: Enter the Information object address for the feed power request value > [!NOTE] > Where do I find this information? > > *104 type* and *IOA* can be taken from the protocol description that should be provided by the grid operator. 6. Click on *Save settings*. ### Configuring the Modbus Connection to the Direct Marketer 1. In the *Data points* → *Flags* menu, add a new flag that will be used to compare the values () and configure it: - *Description*: Feed power request - direct marketer - *Type*: *Unsigned integer* 2. Click on *Save settings*. 3. In the *Gateway* → *Modbus* menu, add a new device () and edit it (): - *Description*: Modbus gateway to direct marketer - *Type*: *TCP* - *Port*: 502 - *Slave address*: enter the slave address of the direct marketer (request this address from the direct marketer) - *Byte order*: select as requested by the protocol 4. Click on *Save settings*. 5. In the *Gateway* → *Modbus* menu in the *Mappings* section, add a new mapping, which can be written with the feed power request by the direct marketer and will be mapped to a flag, () and edit it (): - *Data point*: Select above added flag - *Type*: *Holding register* - *Register*: Enter the register address for the feed power request value - *Format*: *Unsigned integer 16* > [!NOTE] > Where do I find this information? > > *Type*, *Register* and *Format* can be taken from the protocol description that should be provided by the direct marketer. 6. Click on *Save settings*. ### Configuring the Modbus Connection to the Renewable Energy Plant 1. In the *Data points* → *Modbus* menu, add a new device () and edit it (): - *Description*: Modbus connection to renewable energy plant - *Type*: select the connection type *TCP* (TCP/IP) or *RTU* (serial) depending on the Modbus connection - Enter address and port for TCP or the serial parameters for RTU (serial parameters, addresses and protocol parameters are available from the manufacturer of the renewable energy plant) - *Polling interval*: 5 - *Slave address*: enter the Modbus slave address of the control of the renewable energy plant - *Byte order*: select as requested by the protocol 2. Click on *Save settings*. 3. In the *Data points* → *Modbus* menu in the *Data points* section, add a new data point, which transmits the minimum feed power request to the control of the renewable energy plant, () and edit it (): - *Description*: Minimum feed power request - *Type*: *Holding register* - *Register*: 1 - *Format*: *Unsigned integer 16* > [!NOTE] > Where do I find this information? > > *Type*, *Register* and *Format* can be taken from the protocol description that should be provided by the manufacturer of the renewable energy plant. 4. Click on *Save settings*. ### Configuring the Value Comparison 1. In the *ALU* → *Functions* menu, add a new function that computes the minimum of the two values () and edit it (): - *Description*: Minimum feed power request - *Type*: *Minimum* - *Capture value over time*: - *Input data points*: Check the two flags added above containing the feed power requests - *Additionally assign output value to*: Check the Modbus data point added above (this assigns the minimum feed power request to the Modbus data point that will be written into the Modbus register of the control of the renewable energy plant) 2. Click on *Save settings*. 3. Activate the profile (). ## Troubleshooting - View the *Status* → *Current values* page to check whether the flags receive the feed power request values. If the values are missing/incorrect there, check the configuration of the gateways in the icom Data Suite. If the correct values are displayed there, check the Modbus slave connection in the icom Data Suite. - View the appropriate logs in the *Status* → *Log view* page (also of the router) to locate possible problems. ## Resources The following ASCII configuration can be taken over using copy & paste. It must be observed that the individual parameters need to be adapted to the own application. Correct numbering must be observed for numbered parameters. Moreover, it must be observed that no existing parameters with the same number will be overwritten. A proper functionality can only be ensured if the opened profile has been created from default settings before. ASCII configuration ```plaintext datapoints.flags.flag.add datapoints.flags.flag[1].active=1 datapoints.flags.flag[1].description=Feed power request - grid operator datapoints.flags.flag[1].type=unsigned_int gateway.104server.gateway.add gateway.104server.gateway[1].active=1 gateway.104server.gateway[1].description=104 gateway to grid operator gateway.104server.gateway[1].tcp_port=2404 gateway.104server.gateway[1].station_address=1 gateway.104server.gateway[1].item.add gateway.104server.gateway[1].item[1].item_description=Feed power request from grid operator gateway.104server.gateway[1].item[1].item_active=1 gateway.104server.gateway[1].item[1].item_type=mapping gateway.104server.gateway[1].item[1].map_datapoint=flag1 gateway.104server.gateway[1].item[1].map_104type=mscaled gateway.104server.gateway[1].item[1].map_104ioa=1 datapoints.flags.flag.add datapoints.flags.flag[2].active=1 datapoints.flags.flag[2].description=Feed power request - direct marketer datapoints.flags.flag[2].type=unsigned_int gateway.modbus.gateway.add gateway.modbus.gateway[1].active=1 gateway.modbus.gateway[1].description=Modbus gateway to direct marketer gateway.modbus.gateway[1].type=tcp gateway.modbus.gateway[1].tcp_port=502 gateway.modbus.gateway[1].serial_port=--- gateway.modbus.gateway[1].serial_speed=115200 gateway.modbus.gateway[1].serial_databits=8 gateway.modbus.gateway[1].serial_parity=par_none gateway.modbus.gateway[1].serial_stopbits=1 gateway.modbus.gateway[1].slave_address=1 gateway.modbus.gateway[1].endianess=big_abcd gateway.modbus.gateway[1].mapping.add gateway.modbus.gateway[1].mapping[1].map_active=1 gateway.modbus.gateway[1].mapping[1].map_datapoint=flag2 gateway.modbus.gateway[1].mapping[1].map_type=holding_register gateway.modbus.gateway[1].mapping[1].map_register=1 gateway.modbus.gateway[1].mapping[1].map_bit= gateway.modbus.gateway[1].mapping[1].map_format=uint16 datapoints.modbus.device.add datapoints.modbus.device[1].active=1 datapoints.modbus.device[1].description=Modbus connection to renewable energy plant datapoints.modbus.device[1].type=tcp datapoints.modbus.device[1].ip_address=192.168.101.13 datapoints.modbus.device[1].tcp_port=502 datapoints.modbus.device[1].serial_port=--- datapoints.modbus.device[1].serial_speed=115200 datapoints.modbus.device[1].serial_databits=8 datapoints.modbus.device[1].serial_parity=par_none datapoints.modbus.device[1].serial_stopbits=1 datapoints.modbus.device[1].polling_interval=5 datapoints.modbus.device[1].slave_address=1 datapoints.modbus.device[1].endianess=big_abcd datapoints.modbus.device[1].response_timeout=500 datapoints.modbus.device[1].byte_timeout=500 datapoints.modbus.device[1].read_delay=0 datapoints.modbus.device[1].datapoint.add datapoints.modbus.device[1].datapoint[1].datapoint_active=1 datapoints.modbus.device[1].datapoint[1].datapoint_description=Minimum feed power request datapoints.modbus.device[1].datapoint[1].datapoint_type=holding_register datapoints.modbus.device[1].datapoint[1].datapoint_register=1 datapoints.modbus.device[1].datapoint[1].datapoint_bit= datapoints.modbus.device[1].datapoint[1].datapoint_format=uint16 alu.functions.function.add alu.functions.function[1].active=1 alu.functions.function[1].description=Minimum feed power request alu.functions.function[1].type=min alu.functions.function[1].datapoint=flag1,flag2 alu.functions.function[1].output_datapoints=mdbDp1 alu.functions.function[1].time_based=0 ``` [ASCII configuration download (right-click and save as)](https://docs.insys-icom.de/assets/configs/cg_ids_modbus_104_comparison.txt)