Examples
  • 10 Oct 2022
  • 1 Minute to read
  • PDF

Examples

  • PDF

Article summary

Connecting to an Inverter using Modbus Client

In this example, the Modbus Client module is used to connect to an inverter acting as a slave over TCP. The inverter has the following memory map:

Template: PV inverter
Communication protocol: Modbus TCP
Tag same ModbusModbus AddressData typeAccessUnitsScalingDescription
ALARMS/FAN_ERROR400108.2booleanR
1Alarm: Fan diagnostics error
ALARMS/IGBT_HIGH_TEMP400108.3booleanR
1Alarm: High temperature in drive
ENERGY_TODAY_VAL400101Int32RW/h0.1Energy generated on current day
ERROR_CODE400103Int16RW
1Error Code: 0 - No error, 1 - AC error, 2-DC error
FREQUENCY_VAL400104Int16RHz0.01Grid Frequency
POWER_SP400105Int16RWkW1Active power setpoint
POWER_VAL400106Int16RkW0.1Active power generated
STATUS_CODE400107Int16R
1Status code


Follow the below steps to set up the connection correctly:

  • Step 1: After creating a Modbus Client module instance, a connection with the device needs to be configured, as depicted in the below image:

Figure 7. TCP connection configuration


For this example, the following fields have been configured:

    • Host:10.101.9.42, which is the device's IP address.
    • TCP port: By default, port 502 is used.
  • Step 2: Once the connection has been set up, the device must be created and configured. In this example,a device has been created named Device01.

Figure 8. Creating and configuring a new device


The other parameters have been left as their default values.

At this point, the connection is ready and we can move on to create new tags according to the memory map shown above.

  • Step 3: In the Explorer panel, select Tags. In the Model panel, create a new group and name it INV01.

Figure 9. Creating a new group of tags


  • Step 4: Create a tag inside the group and name it POWER_VAL.

Figure 10. Create a new tag


  • Step 5: Set the configuration parameters properly: 
    • Type: Number.
    • Format: Integer.
    • Client Access: R.
    • Details:
      • Description: Active power generated.
    • Scaling:
      • Enabled: Yes.
      • Raw Range:
        • Minimum: 0.
        • Maximum: 1.
    • Source:
      • Enabled: Yes.
      • Module type: ModbusClient.
      • Module name: ModbusClient.
      • Config:
        • Device: This option must follow the format Channel_name/Device_name. In this case, Channel01/Device_01.
        • Modbus Address: The Modbus Address for the POWER_VAL is 400106, as shown in the memory map table.
        • Data type: Int16.

Figure 11a. Tag configuration


Figure 11b. Tag configuration


To create the rest of the tags associated with the inverter, follow the same procedure as described above.

Now, go to the Data/Real-Time section in the Navigation panel, where you should be able to see the data read from the device.

Figure 12. Data visualization



Was this article helpful?