![]() |
|
Modbus Goodwe - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10) +--- Thread: Modbus Goodwe (/showthread.php?tid=5032) Pages:
1
2
|
Modbus Goodwe - Amelie - 16.10.2023 I want to communicate through Modbus with my Goodwe inverter. I've found on the site of Goodwe how I can connect: Goodwe and the Modbus register here. The connection on the logic machine is shown in attachement. My json looks as follows: Code: {
"manufacturer": "Goodwe",
"timeout": 3,
"read_delay": 1,
"description": "GW8k-ET",
"mapping": [
{ "bus_address": "1/7/50",
"name": "Opbrengst PV - 1",
"bus_datatype": "9",
"datatype": "uint16",
"read_count":1,
"type": "inputregister",
"value_multiplier": 0.1,
"address": 0539 }
]
}But, I get the error: Operation timed out. What Am I doing wrong? Thank in advance! RE: Modbus Goodwe - Daniel - 16.10.2023 Use read test to find correct configuration, maybe you need to shift registry addresses by -1 RE: Modbus Goodwe - Amelie - 16.10.2023 When I do a ping test, there is no problem (4 packages send and 4 packages received). But, when I do a read test, I get connection time out. The parameters, I use for the read test are shown below. Can you help me to figure out what is wrong? RE: Modbus Goodwe - 1danny - 16.10.2023 Hello, do you have the Goodwe LAN adapter on the inverter? Modbus only works with the LAN adapter. Gruß Danny RE: Modbus Goodwe - Amelie - 16.10.2023 They are connected trough lan. (It took me one week to change from wifi to lan) RE: Modbus Goodwe - 1danny - 16.10.2023 Does the inverter really have Modbus address 1? You can check in SolarGo app. I would first try whether it works with Modbus test software. RE: Modbus Goodwe - Amelie - 16.10.2023 Can you recommend some good software for testing? RE: Modbus Goodwe - Amelie - 18.10.2023 I succeed in making connection with my inverter. I get no errors anymore and the read lest is going well. Maybe i shouldn't post it but this website helped me a lot. Maybe it can help other people too.... But, I still have some questions because I get value which aren't the same as in my semsportal or with an API call:
Thank in advance RE: Modbus Goodwe - admin - 19.10.2023 U32 (uint32) is 4 byte unsigned integer, U16 (uint16) is 2 byte unsigned integer. Default swap in LM is w (word). Use read test to check if you a different swap is needed. You might need to use a different datatype like 4 byte floating point on LM side if the register value is scaled (x10, x100 etc). Otherwise the fractional part will be lost when using an integer data type. RE: Modbus Goodwe - fleeceable - 19.10.2023 I have established successfully communication with Goodwe GW10K-ET and battery pack BYD 22kWh . Gonna post script here. Since it is taken from backup you maybe need to modify a bit but it should work... Code: ip = '192.168.1.179'
GroupAddresses = '32/1/'
require('luamodbus')
mb = luamodbus.tcp()
mb:open(ip, 502)
res, err = mb:connect()
mb:setslave(1) -- Inverter
Inverter_rated_power = mb:readregistervalue(35001,'uint16')
Grid_connection_status = mb:readregistervalue(35136,"uint16")
Total_INV_Power = mb:readregistervalue(35137,'int32')
AC_ActivePower = mb:readregistervalue(35139,'int32')
Total_Back_Up = mb:readregistervalue(35169,'int32')
Total_Load_power = mb:readregistervalue(35171,'int32')
Ups_Load_Percent = mb:readregistervalue(35173,'uint16')
Inverter_Internal_Temperature = mb:readregistervalue(35174,'int16')
Inverter_Unit_Temperature = mb:readregistervalue(35175,'int16')
Inverter_Heat_Sink_Temperature = mb:readregistervalue(35176,'int16')
Battery1_Mode = mb:readregistervalue(35184,'uint16')
Work_Mode = mb:readregistervalue(35187,'uint16')
Error_Message = mb:readregistervalue(35189,"uint32")
PV_E_Day = mb:readregistervalue(45224,'uint32')
E_Day_Sell = mb:readregistervalue(45230,'uint16')
E_Day_Buy = mb:readregistervalue(45231,'uint32')
Meter_L1_Active_Power = mb:readregistervalue(36019,'int32')
Meter_L2_Active_Power = mb:readregistervalue(36021,'int32')
Meter_L3_Active_Power = mb:readregistervalue(36023,'int32')
Meter_Total_Active_Power = mb:readregistervalue(36025,'int32')
E_Total_Sell = mb:readregistervalue(45226,'uint32')
E_Total_Buy = mb:readregistervalue(45231,'uint32')
Battery_Mode_PV_Charge_Enable = mb:readregistervalue(45278,'uint16')
App_Mode_Index = mb:readregistervalue(47000,'uint16')
Start_Charge_SOC = mb:readregistervalue(47531,'uint16')
Stop_Charge_SOC = mb:readregistervalue(47532,'uint16')
Fast_Charge_Enable = mb:readregistervalue(47545,'uint16')
Fast_Charge_Stop_SOC = mb:readregistervalue(47546,'uint16')
Battery_SOC = mb:readregistervalue(37007,'uint16')
EMSPowerMode = mb:readregistervalue(47511,'uint16')
EMSPowerSet = mb:readregistervalue(47512,'uint16')
--FeedPowerEnable = mb:readregistervalue(47509,'int16')
--log(FeedPowerEnable)
--FeedPowerPara = mb: readregistervalue(47510,'int16')
--log(FeedPowerPara)
--Model_Name = mb:readregistervalue(35182,'uint32')
--log(Model_Name)
--Model_Name2 = mb:readregisters(35012,1)
--log(Model_Name2)
--Model_Name3 = mb:readregisters(35013,1)
--log(Model_Name3)
--Model_Name4 = mb:readregisters(35014,1)
--log(Model_Name4)
--wBMSBatSOC = mb:readregistervalue(47908,'uint16')
BMS_Pack_Temperature = mb:readregistervalue(37003,'uint16')
mb:close()
grp.checkupdate(GroupAddresses .. '1', Inverter_rated_power)
grp.checkupdate(GroupAddresses .. '2', Grid_connection_status)
grp.checkupdate(GroupAddresses .. '3', Total_INV_Power/1000)
grp.checkupdate(GroupAddresses .. '4', AC_ActivePower/1000)
grp.checkupdate(GroupAddresses .. '5', Total_Back_Up/1000)
grp.checkupdate(GroupAddresses .. '6', Total_Load_power/1000)
grp.checkupdate(GroupAddresses .. '7', Ups_Load_Percent)
grp.checkupdate(GroupAddresses .. '8', Inverter_Internal_Temperature/10)
grp.checkupdate(GroupAddresses .. '9', Inverter_Unit_Temperature/10)
grp.checkupdate(GroupAddresses .. '10', Inverter_Heat_Sink_Temperature/10)
grp.checkupdate(GroupAddresses .. '11', Battery1_Mode)
grp.checkupdate(GroupAddresses .. '12', Work_Mode)
grp.checkupdate(GroupAddresses .. '13', Error_Message)
grp.checkupdate(GroupAddresses .. '14', PV_E_Day/10)
grp.checkupdate(GroupAddresses .. '15', E_Day_Sell/10)
grp.checkupdate(GroupAddresses .. '16', E_Day_Buy/10)
grp.checkupdate(GroupAddresses .. '17', Meter_Total_Active_Power/1000)
grp.checkupdate(GroupAddresses .. '18', E_Total_Sell/10)
grp.checkupdate(GroupAddresses .. '19', E_Total_Buy/10)
grp.checkupdate(GroupAddresses .. '20', Battery_Mode_PV_Charge_Enable)
grp.checkupdate(GroupAddresses .. '21', App_Mode_Index)
grp.checkupdate(GroupAddresses .. '22', Start_Charge_SOC)
grp.checkupdate(GroupAddresses .. '23', Stop_Charge_SOC)
grp.checkupdate(GroupAddresses .. '24', Fast_Charge_Enable)
grp.checkupdate(GroupAddresses .. '25', Fast_Charge_Stop_SOC)
grp.checkupdate(GroupAddresses .. '26', Battery_SOC)
grp.checkupdate(GroupAddresses .. '27', EMSPowerMode)
grp.checkupdate(GroupAddresses .. '28', EMSPowerSet)
grp.checkupdate(GroupAddresses .. '31', BMS_Pack_Temperature/10)
grp.checkupdate(GroupAddresses .. '32', Meter_L1_Active_Power/1000)
grp.checkupdate(GroupAddresses .. '33', Meter_L2_Active_Power/1000)
grp.checkupdate(GroupAddresses .. '34', Meter_L3_Active_Power/1000)Maybe it helps RE: Modbus Goodwe - Amelie - 19.10.2023 Thank you for the script. It works. What, I mean with that: I get no errors and I get values. But, with what I'm still struggeling: the values doesn't correspond with the values I get in Semsportal or the values I get with an API-call. What could be the cause of that? If I want to see the output of the inverter, at which variable should I look? The funny thing is, that when I look to 'PV_E_Dag', the value is the same for the Modbus, API and Semsportal. Thus, this is correct. RE: Modbus Goodwe - Amelie - 20.10.2023 Thank you for for all the help I received the past days. They were very helpful. I mailed to Goodwe for there last Modbus register, and after signing a NDA, I got it. It seems that the register didn't change. So, the problem must be found elsewhere. I know that there is always a delay on the API, so having matching values is practically impossible, but I noticed that if I log the values in the script, they change the whole time. But, the address aren't updated. So, the code Code: grp.checkupdate(GroupAddresses .. '3', Total_INV_Power/1000)What could be the cause of this? RE: Modbus Goodwe - Daniel - 20.10.2023 Are you sure the value is actually changing? grp.checkupdate will update value only on change. You can change it to grp.update to see if value is updated. RE: Modbus Goodwe - Amelie - 21.10.2023 I think that now everything works. The values of the Modbus differs a bit from those from the API. But on those received from the API, there is some delay and they are not always updated. (I think the server is China is sometimes slow )But, now and then, I get an error (see attachment). Not much, I got one error since yesterday evening. It is caused by an error in the way I have implemented it, or is it caused by the inverter? RE: Modbus Goodwe - Amelie - 22.10.2023 (19.10.2023, 10:00)fleeceable Wrote: I have established successfully communication with Goodwe GW10K-ET and battery pack BYD 22kWh . Gonna post script here. Since it is taken from backup you maybe need to modify a bit but it should work... Thank you, it helped a lot. Now, I can force the inverted to load the battery by writing a value to register 'Stop_Charge_SOC' (register 47532). But, when I write the same value to 'Start_Charge_SOC' (register 47531), I thought that he wouldn't discharge. But, my thoughts were wrong. Do you have an idea to what register I have to write, to stop discharging the battery? I want to load my battery, in winter when the electricity prices are low and discharge them when the prices are high. RE: Modbus Goodwe - 1danny - 23.10.2023 Hello Amelie, register 45353 should be the correct one. Here is a page where you might get help with the registers. Link: https://github.com/OpenEMS/openems/blob/develop/io.openems.edge.goodwe/src/io/openems/edge/goodwe/common/AbstractGoodWe.java Gruß Danny RE: Modbus Goodwe - fleeceable - 23.10.2023 (22.10.2023, 19:28)Amelie Wrote:(19.10.2023, 10:00)fleeceable Wrote: I have established successfully communication with Goodwe GW10K-ET and battery pack BYD 22kWh . Gonna post script here. Since it is taken from backup you maybe need to modify a bit but it should work... I'm using these registers to control battery: mb:writeregisters(47511, EMSPowerModeWrite) - 2 charge, 3 discharge, 1 auto/self use mode mb:writeregisters(47512, EMSPowerSetWrite) - charging/discharging power (in watts) Modes are described in attachment RE: Modbus Goodwe - Amelie - 23.10.2023 (23.10.2023, 09:54)fleeceable Wrote: I'm using these registers to control battery: So, during night, I have to set the register 47511 to 1 and at 6 o'clock (when the electricity prices are higher) I have to write 0 to register 47511. Will the battery automatically stop when it reaches 100% or, do I have to time it? RE: Modbus Goodwe - fleeceable - 23.10.2023 (23.10.2023, 16:04)Amelie Wrote:(23.10.2023, 09:54)fleeceable Wrote: I'm using these registers to control battery: It's basically in charging mode and if battery is full, system gonna hold battery on 100%. If no sun then only house usage is imported from grid. Short answer you don't need to time it. But double check values. These are on hex. If you try to write 0 in that register you probably get error... If electricity is cheap - write 2 - you gonna buy If price is high and you want to sell back to grid (in summer time) before sun - write 3 If you want to use electricity from battery to supply home usage - write 1 If you want to hold battery state then you can write 8 - so battery gonna be on standby RE: Modbus Goodwe - Amelie - 24.10.2023 (23.10.2023, 16:19)fleeceable Wrote: So, during night, I have to set the register 47511 to 1 and at 6 o'clock (when the electricity prices are higher) I have to write 0 to register 47511. Will the battery automatically stop when it reaches 100% or, do I have to time it? Thank you for your help. I appreciate it very much! But, I still have some question:
|