Modbus Communication with Inch products

For some of our customers there is a need for manual manipulating charging settings via modbus. Bellow you can find attached python script, that should be a good start what can you do with modbus on our Inch products. Script is written, with both Duo and Inch, in mind.

List of supported registers can be found here - Modbus TCP Registers

 

Prerequsites:

PC with Windows/Linux, MacOS or other device capable running Python

Python 3.(x) and above installed - Python 3.9

Modbus module - https://github.com/riptideio/pymodbus

Python editor - we suggest https://code.visualstudio.com/

 

Installation:

First you need to install Python and add it to you path. On Windows, path is found in Enviroment variables settings.

Then, using pip, you must install pymodbus library. Once your python was added to path you can use command

1 pip install -U pymodbus

In script there is a line that sets charger IP address. (Line 27), and it looks like following

1 clientIP="192.168.1.250" #Charger's IP address

Change IP address accordingly to your charger.

 

Running script:

Script can be easily run using python executable from command prompt.

For reading Modbus registers use

1 python INCH_modbus_read.py

And for writing Modbus registers use

1 python INCH_modbus_write.py

When writing modbus, scripts asks for which connector on Inch Duo

 

Limitations:

During first 45 seconds is impossible to set current point, due to station figuring out minimal and maximum target current.

 

Running example:

Reading on modbus:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 ******************************************************************************** Reading data from INCH or DUO, IP address and port: 172.25.2.250:502 -------------------------------------------------------------------------------- >>> REAL-TIME VALUES <<< ******************************************************************************** CONNECTOR 1 (22 registers) -------------------------------------------------------------------------------- [0]Connector 1 status: Charging [1]Connector 1 measured vehicle number of phases: Single phase (L1) [2]Connector 1 EV max phase current: 8.44A [4]Connector 1 Target current from power mgm or modbus: 9.00A [6]Connector 1 Frequency: 50.01Hz [8]Connector 1 L-N voltage (L1): 230.60V [10]Connector 1 L-N voltage (L2): 230.50V [12]Connector 1 L-N voltage (L3): 230.60V [14]Connector 1 Current (L1): 8.32A [16]Connector 1 Current (L2): 0.02A [18]Connector 1 Current (L3): 0.00A [20]Connector 1 Active power (L1): 1.92kW [22]Connector 1 Active power (L2): 0.00kW [24]Connector 1 Active power (L3): 0.00kW [26]Connector 1 Active power (Total): 1.92kW [28]Connector 1 Power factor: 0.998 [30]Connector 1 Total imported active energy in running session: 0.10kWh [32]Connector 1 Running session duration (h:mm:ss): 0:02:50 [36]Connector 1 Running session departure time: 19-03-2021 11:30 [40]Connector 1 Running session ID: 17 [44]Connector 1 EV max power: 1.946 [46]Connector 1 EV required energy: 60.000 -------------------------------------------------------------------------------- CONNECTOR 2 (22 registers) -------------------------------------------------------------------------------- [100]Connector 2 status: Unknown status! [101]Connector 2 measured vehicle number of phases: Unknown number of phases [102]Connector 2 EV max phase current: 0.00A [104]Connector 2 Target current from power mgm or modbus: 0.00A [106]Connector 2 Connector 1 Frequency: 0.00Hz [108]Connector 2 L-N voltage (L1): 0.00V [110]Connector 2 L-N voltage (L2): 0.00V [112]Connector 2 L-N voltage (L3): 0.00V [114]Connector 2 Current (L1): 0.00A [116]Connector 2 Current (L2): 0.00A [118]Connector 2 Current (L3): 0.00A [120]Connector 2 Active power (L1): 0.00kW [122]Connector 2 Active power (L2): 0.00kW [124]Connector 2 Active power (L3): 0.00kW [126]Connector 2 Active power (Total): 0.00kW [128]Connector 2 Power factor: 0.000 [130]Connector 2 Total imported active energy in running session: 0.00kWh [132]Connector 2 Running session duration (h:mm:ss): 0:00:00 [136]Connector 2 Running session departure time: 01-01-1970 01:00 [140]Connector 2 Running session ID: 0 [144]Connector 2 EV max power: 0.000 [146]Connector 2 EV required energy: 0.000 ******************************************************************************** >>> CHARGER SETTINGS (5 registers) <<< ******************************************************************************** [990]Serial number: 15122020 [1000]Model: G-PC1VDBY20 [1010]HW version: 1.2 [1015]SW version: 3.0.901-6- [1020]Number of connectors: 1 -------------------------------------------------------------------------------- CONNECTOR 1 (6 registers) -------------------------------------------------------------------------------- [1022]Connector 1 Connector type: SocketType2 [1023]Connector 1 Number of phases: 3 [1024]Connector 1 L1 connected to phase: 1 [1025]Connector 1 L2 connected to phase: 2 [1026]Connector 1 L3 connected to phase: 3 [1028]Connector 1 Custom max current: 32A -------------------------------------------------------------------------------- CONNECTOR 2 (6 registers) -------------------------------------------------------------------------------- [1122]Connector 2 Connector type: Unknown connector type! [1123]Connector 2 Number of phases: 0 [1124]Connector 2 L1 connected to phase: 0 [1125]Connector 2 L2 connected to phase: 0 [1126]Connector 2 L3 connected to phase: 0 [1128]Connector 2 Custom max current: 0A ******************************************************************************** Reading cluster data from INCH or DUO, IP address and port: 172.25.2.250:503 -------------------------------------------------------------------------------- >>> CLUSTER DATA (20 registers) <<< ******************************************************************************** [2000]LoadGuard status: Not connected [2002]Load Guard frequency: 0.00Hz [2004]Load Guard L-N voltage (L1): 0.00V [2006]Load Guard L-N voltage (L2): 0.00V [2008]Load Guard L-N voltage (L3): 0.00V [2010]Load Guard current (L1): 0.00A [2012]Load Guard current (L2): 0.00A [2014]Load Guard current (L3): 0.00A [2016]Load Guard active power (L1): 0.00kW [2018]Load Guard active power (L2): 0.00kW [2020]Load Guard active power (L3): 0.00kW [2022]Load Guard active power (Total): 0.00kW [2024]Load Guard Power factor: 0.000 [2100]Power cluster current (L1): 8.32A [2102]Power cluster current (L2): 0.02A [2104]Power cluster current (L3): 0.00A [2106]Power cluster active power (L1): 1.92kW [2108]Power cluster active power (L2): 0.00kW [2110]Power cluster active power (L3): 0.00kW [2112]Power cluster active power (Total): 1.92kW ******************************************************************************** >>> CLUSTER SETTINGS (1 register) <<< ******************************************************************************** [3000]LoadGuard installation status: Not installed

 

Writing on modbus, set current point was changed:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 ----------------------------------------------------------------- Please enter connector number 1 or 2 for 172.25.2.250 (e to exit): 1 ----------------------------------------------------------------- AVAILABLE WRITING OPTIONS for 172.25.2.250 ----------------------------------------------------------------- >>> CONNECTOR 1 COMMANDS <<< 1. Stop charging 2. Pause charging 3. Set departure time 4. Set current setpoint 5. Cancel current setpoint 6. Set power setpoint 7. Cancel power setpoint >>> CHARGER COMMANDS <<< 8. Set time 9. Restart charger >>> CLUSTER COMMANDS <<< 10. Cluster - set limit L1 11. Cluster - set limit L2 12. Cluster - set limit L3 ----------------------------------------------------------------- Please enter option number (1 to 12 or e to exit): 4 ----------------------------------------------------------------- Connection: ModbusTcpClient(172.25.2.250:502) ----------------------------------------------------------------- >>> CONNECTOR COMMANDS <<< ----------------------------------------------------------------- Please enter current setpoint in A (e.g. 6.6): 8 [8]Set current setpoint to: 8A ----------------------------------------------------------------- AVAILABLE WRITING OPTIONS for 172.25.2.250 ----------------------------------------------------------------- >>> CONNECTOR 1 COMMANDS <<< 1. Stop charging 2. Pause charging 3. Set departure time 4. Set current setpoint 5. Cancel current setpoint 6. Set power setpoint 7. Cancel power setpoint >>> CHARGER COMMANDS <<< 8. Set time 9. Restart charger >>> CLUSTER COMMANDS <<< 10. Cluster - set limit L1 11. Cluster - set limit L2 12. Cluster - set limit L3 ----------------------------------------------------------------- Please enter option number (1 to 12 or e to exit):