Adjust examples to generated registers
This commit is contained in:
parent
24022a04ea
commit
a2a6b9c4e9
4 changed files with 18 additions and 18 deletions
|
@ -14,15 +14,15 @@ fronius1.connect()
|
||||||
|
|
||||||
current_time = datetime.now()
|
current_time = datetime.now()
|
||||||
|
|
||||||
soc = gen24_registers.scaledStateOfCharge.get(fronius1)
|
soc = gen24_registers.scaledChaState.get(fronius1)
|
||||||
|
|
||||||
charge_data = []
|
charge_data = []
|
||||||
discharge_data = []
|
discharge_data = []
|
||||||
|
|
||||||
print("Gathering 20 second average of battery Charge")
|
print("Gathering 20 second average of battery Charge")
|
||||||
while( (datetime.now() - current_time).seconds < 20):
|
while( (datetime.now() - current_time).seconds < 20):
|
||||||
charge_data.append(gen24_registers.scaledToBattery.get(fronius1))
|
charge_data.append(gen24_registers.scaledmodule_3_DCW.get(fronius1))
|
||||||
discharge_data.append(gen24_registers.scaledFromBattery.get(fronius1))
|
discharge_data.append(gen24_registers.scaledmodule_4_DCW.get(fronius1))
|
||||||
|
|
||||||
avg_charge = statistics.mean(charge_data)
|
avg_charge = statistics.mean(charge_data)
|
||||||
avg_discharge = statistics.mean(discharge_data)
|
avg_discharge = statistics.mean(discharge_data)
|
||||||
|
|
|
@ -7,7 +7,7 @@ from pymodbus.client.tcp import ModbusTcpClient
|
||||||
fronius1 = ModbusTcpClient("172.19.107.211", port=502, timeout=10)
|
fronius1 = ModbusTcpClient("172.19.107.211", port=502, timeout=10)
|
||||||
fronius1.connect()
|
fronius1.connect()
|
||||||
|
|
||||||
soc = gen24_registers.scaledStateOfCharge.get(fronius1)
|
soc = gen24_registers.scaledChaState.get(fronius1)
|
||||||
print(" SOC: %s%%" % soc)
|
print(" SOC: %s%%" % soc)
|
||||||
|
|
||||||
discharge = gen24_registers.scaledOutWRte.get(fronius1)
|
discharge = gen24_registers.scaledOutWRte.get(fronius1)
|
||||||
|
@ -16,12 +16,12 @@ print("Pre DRate: %d%%" % discharge)
|
||||||
charge = gen24_registers.scaledInWRte.get(fronius1)
|
charge = gen24_registers.scaledInWRte.get(fronius1)
|
||||||
print("Pre CRate: %d%%" % charge)
|
print("Pre CRate: %d%%" % charge)
|
||||||
|
|
||||||
mode = gen24_registers.StorCtl_Mode.get(fronius1)
|
mode = gen24_registers.StorCtl_Mod.get(fronius1)
|
||||||
print("Pre Mode: %d" % mode)
|
print("Pre Mode: %d" % mode)
|
||||||
|
|
||||||
# This should be 'limit discharge' mode
|
# This should be 'limit discharge' mode
|
||||||
print("Setting control mode to limit discharge")
|
print("Setting control mode to limit discharge")
|
||||||
err = gen24_registers.StorCtl_Mode.set(fronius1, 2)
|
err = gen24_registers.StorCtl_Mod.set(fronius1, 2)
|
||||||
|
|
||||||
# Charge battery at a rate from -2% discharge to 100% charge
|
# Charge battery at a rate from -2% discharge to 100% charge
|
||||||
# as a percentage of the MaxChaRte, which in our case is 25600W
|
# as a percentage of the MaxChaRte, which in our case is 25600W
|
||||||
|
@ -36,5 +36,5 @@ print("Post DRate: %d%%" % discharge)
|
||||||
charge = gen24_registers.scaledInWRte.get(fronius1)
|
charge = gen24_registers.scaledInWRte.get(fronius1)
|
||||||
print("Post CRate: %d%%" % charge)
|
print("Post CRate: %d%%" % charge)
|
||||||
|
|
||||||
mode = gen24_registers.StorCtl_Mode.get(fronius1)
|
mode = gen24_registers.StorCtl_Mod.get(fronius1)
|
||||||
print("Post Mode: %d" % mode)
|
print("Post Mode: %d" % mode)
|
||||||
|
|
|
@ -11,10 +11,10 @@ fronius1.connect()
|
||||||
print(" Manufacturer: %s" % gen24_registers.Mn.get(fronius1))
|
print(" Manufacturer: %s" % gen24_registers.Mn.get(fronius1))
|
||||||
print(" Model: %s" % gen24_registers.Md.get(fronius1))
|
print(" Model: %s" % gen24_registers.Md.get(fronius1))
|
||||||
print(" Version: %s" % gen24_registers.Vr.get(fronius1))
|
print(" Version: %s" % gen24_registers.Vr.get(fronius1))
|
||||||
print(" SOC: %s%%" % gen24_registers.scaledStateOfCharge.get(fronius1))
|
print(" SOC: %s%%" % gen24_registers.scaledChaState.get(fronius1))
|
||||||
print("Max DCharg Rate: %d%%" % gen24_registers.scaledOutWRte.get(fronius1))
|
print("Max DCharg Rate: %d%%" % gen24_registers.scaledOutWRte.get(fronius1))
|
||||||
print("Max Charge Rate: %d%%" % gen24_registers.scaledInWRte.get(fronius1))
|
print("Max Charge Rate: %d%%" % gen24_registers.scaledInWRte.get(fronius1))
|
||||||
print(" Reserve: %d%%" % gen24_registers.scaledReserve.get(fronius1))
|
print(" Reserve: %d%%" % gen24_registers.scaledMinRsvPct.get(fronius1))
|
||||||
print("Max Charge rate: %dW" % gen24_registers.scaledMaxChaRte.get(fronius1))
|
print("Max Charge rate: %dW" % gen24_registers.scaledMaxChaRte.get(fronius1))
|
||||||
print(" Current charge: %dW" % gen24_registers.scaledToBattery.get(fronius1))
|
print(" Current charge: %dW" % gen24_registers.scaledmodule_3_DCW.get(fronius1))
|
||||||
print(" Current dCharg: %dW" % gen24_registers.scaledFromBattery.get(fronius1))
|
print(" Current dCharg: %dW" % gen24_registers.scaledmodule_4_DCW.get(fronius1))
|
||||||
|
|
|
@ -7,7 +7,7 @@ from pymodbus.client.tcp import ModbusTcpClient
|
||||||
fronius1 = ModbusTcpClient("172.19.107.211", port=502, timeout=10)
|
fronius1 = ModbusTcpClient("172.19.107.211", port=502, timeout=10)
|
||||||
fronius1.connect()
|
fronius1.connect()
|
||||||
|
|
||||||
soc = gen24_registers.scaledStateOfCharge.get(fronius1)
|
soc = gen24_registers.scaledChaState.get(fronius1)
|
||||||
print(" SOC: %s%%" % soc)
|
print(" SOC: %s%%" % soc)
|
||||||
|
|
||||||
discharge = gen24_registers.scaledOutWRte.get(fronius1)
|
discharge = gen24_registers.scaledOutWRte.get(fronius1)
|
||||||
|
@ -16,20 +16,20 @@ print("Pre DRate: %d%%" % discharge)
|
||||||
charge = gen24_registers.scaledInWRte.get(fronius1)
|
charge = gen24_registers.scaledInWRte.get(fronius1)
|
||||||
print("Pre CRate: %d%%" % charge)
|
print("Pre CRate: %d%%" % charge)
|
||||||
|
|
||||||
mode = gen24_registers.StorCtl_Mode.get(fronius1)
|
mode = gen24_registers.StorCtl_Mod.get(fronius1)
|
||||||
print("Pre Mode: %d" % mode)
|
print("Pre Mode: %d" % mode)
|
||||||
|
|
||||||
reserve = gen24_registers.scaledReserve.get(fronius1)
|
reserve = gen24_registers.scaledMinRsvPct.get(fronius1)
|
||||||
print("Pre Res: %d" % reserve)
|
print("Pre Res: %d" % reserve)
|
||||||
|
|
||||||
|
|
||||||
# This should be 'no limits' mode
|
# This should be 'no limits' mode
|
||||||
err = gen24_registers.StorCtl_Mode.set(fronius1, 0)
|
err = gen24_registers.StorCtl_Mod.set(fronius1, 0)
|
||||||
# discharge at 100% allowed charge rate
|
# discharge at 100% allowed charge rate
|
||||||
err = gen24_registers.scaledOutWRte.set(fronius1, 100)
|
err = gen24_registers.scaledOutWRte.set(fronius1, 100)
|
||||||
err = gen24_registers.scaledInWRte.set(fronius1, 100)
|
err = gen24_registers.scaledInWRte.set(fronius1, 100)
|
||||||
# charge to 7%
|
# charge to 7%
|
||||||
err = gen24_registers.scaledReserve.set(fronius1, 7)
|
err = gen24_registers.scaledMinRsvPct.set(fronius1, 7)
|
||||||
|
|
||||||
discharge = gen24_registers.scaledOutWRte.get(fronius1)
|
discharge = gen24_registers.scaledOutWRte.get(fronius1)
|
||||||
print("Post DRate: %d%%" % discharge)
|
print("Post DRate: %d%%" % discharge)
|
||||||
|
@ -37,8 +37,8 @@ print("Post DRate: %d%%" % discharge)
|
||||||
charge = gen24_registers.scaledInWRte.get(fronius1)
|
charge = gen24_registers.scaledInWRte.get(fronius1)
|
||||||
print("Post CRate: %d%%" % charge)
|
print("Post CRate: %d%%" % charge)
|
||||||
|
|
||||||
mode = gen24_registers.StorCtl_Mode.get(fronius1)
|
mode = gen24_registers.StorCtl_Mod.get(fronius1)
|
||||||
print("Post Mode: %d" % mode)
|
print("Post Mode: %d" % mode)
|
||||||
|
|
||||||
reserve = gen24_registers.scaledReserve.get(fronius1)
|
reserve = gen24_registers.scaledMinRsvPct.get(fronius1)
|
||||||
print("Post Res: %d" % reserve)
|
print("Post Res: %d" % reserve)
|
||||||
|
|
Loading…
Reference in a new issue