examples after rename

This commit is contained in:
Paul Warren 2024-10-14 20:26:50 +11:00
parent 65b84d1503
commit 8769240b93
3 changed files with 37 additions and 37 deletions

View file

@ -1,40 +1,40 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from pyfroniusreg import gen24_registers as froniusreg from pyfroniusreg import gen24_registers
from pymodbus.client.tcp import ModbusTcpClient 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 = froniusreg.scaledStateOfCharge.getValue(fronius1) soc = gen24_registers.scaledStateOfCharge.get(fronius1)
print(" SOC: %s%%" % soc) print(" SOC: %s%%" % soc)
discharge = froniusreg.scaledOutWRte.getValue(fronius1) discharge = gen24_registers.scaledOutWRte.get(fronius1)
print("Pre DRate: %d%%" % discharge) print("Pre DRate: %d%%" % discharge)
charge = froniusreg.scaledInWRte.getValue(fronius1) charge = gen24_registers.scaledInWRte.get(fronius1)
print("Pre CRate: %d%%" % charge) print("Pre CRate: %d%%" % charge)
mode = froniusreg.StorCtl_Mode.getValue(fronius1) mode = gen24_registers.StorCtl_Mode.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 = froniusreg.StorCtl_Mode.setValue(fronius1, 2) err = gen24_registers.StorCtl_Mode.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
print("Setting discharge rate to -10%") print("Setting discharge rate to -10%")
err = froniusreg.scaledOutWRte.setValue(fronius1, int(-10)) err = gen24_registers.scaledOutWRte.set(fronius1, int(-10))
print("Setting charge rate to 100%") print("Setting charge rate to 100%")
err = froniusreg.scaledInWRte.setValue(fronius1, int(100)) err = gen24_registers.scaledInWRte.set(fronius1, int(100))
discharge = froniusreg.scaledOutWRte.getValue(fronius1) discharge = gen24_registers.scaledOutWRte.get(fronius1)
print("Post DRate: %d%%" % discharge) print("Post DRate: %d%%" % discharge)
charge = froniusreg.scaledInWRte.getValue(fronius1) charge = gen24_registers.scaledInWRte.get(fronius1)
print("Post CRate: %d%%" % charge) print("Post CRate: %d%%" % charge)
mode = froniusreg.StorCtl_Mode.getValue(fronius1) mode = gen24_registers.StorCtl_Mode.get(fronius1)
print("Post Mode: %d" % mode) print("Post Mode: %d" % mode)

View file

@ -1,20 +1,20 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from pyfroniusreg import gen24_registers as froniusreg from pyfroniusreg import gen24_registers
from pyfroniusreg.froniusreg import registerReadError from pyfroniusreg.froniusreg import RegisterReadError
from pymodbus.client.tcp import ModbusTcpClient 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()
print(" Manufacturer: %s" % froniusreg.Mn.getValue(fronius1)) print(" Manufacturer: %s" % gen24_registers.Mn.get(fronius1))
print(" Model: %s" % froniusreg.Md.getValue(fronius1)) print(" Model: %s" % gen24_registers.Md.get(fronius1))
print(" Version: %s" % froniusreg.Vr.getValue(fronius1)) print(" Version: %s" % gen24_registers.Vr.get(fronius1))
print(" SOC: %s%%" % froniusreg.scaledStateOfCharge.getValue(fronius1)) print(" SOC: %s%%" % gen24_registers.scaledStateOfCharge.get(fronius1))
print("Max DCharg Rate: %d%%" % froniusreg.scaledOutWRte.getValue(fronius1)) print("Max DCharg Rate: %d%%" % gen24_registers.scaledOutWRte.get(fronius1))
print("Max Charge Rate: %d%%" % froniusreg.scaledInWRte.getValue(fronius1)) print("Max Charge Rate: %d%%" % gen24_registers.scaledInWRte.get(fronius1))
print(" Reserve: %d%%" % froniusreg.scaledReserve.getValue(fronius1)) print(" Reserve: %d%%" % gen24_registers.scaledReserve.get(fronius1))
print("Max Charge rate: %dW" % froniusreg.scaledMaxChaRte.getValue(fronius1)) print("Max Charge rate: %dW" % gen24_registers.scaledMaxChaRte.get(fronius1))
print(" Current charge: %dW" % froniusreg.scaledToBattery.getValue(fronius1)) print(" Current charge: %dW" % gen24_registers.scaledToBattery.get(fronius1))
print(" Current dCharg: %dW" % froniusreg.scaledFromBattery.getValue(fronius1)) print(" Current dCharg: %dW" % gen24_registers.scaledFromBattery.get(fronius1))

View file

@ -1,44 +1,44 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from pyfroniusreg import gen24_registers as froniusreg from pyfroniusreg import gen24_registers
from pymodbus.client.tcp import ModbusTcpClient 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 = froniusreg.scaledStateOfCharge.getValue(fronius1) soc = gen24_registers.scaledStateOfCharge.get(fronius1)
print(" SOC: %s%%" % soc) print(" SOC: %s%%" % soc)
discharge = froniusreg.scaledOutWRte.getValue(fronius1) discharge = gen24_registers.scaledOutWRte.get(fronius1)
print("Pre DRate: %d%%" % discharge) print("Pre DRate: %d%%" % discharge)
charge = froniusreg.scaledInWRte.getValue(fronius1) charge = gen24_registers.scaledInWRte.get(fronius1)
print("Pre CRate: %d%%" % charge) print("Pre CRate: %d%%" % charge)
mode = froniusreg.StorCtl_Mode.getValue(fronius1) mode = gen24_registers.StorCtl_Mode.get(fronius1)
print("Pre Mode: %d" % mode) print("Pre Mode: %d" % mode)
reserve = froniusreg.scaledReserve.getValue(fronius1) reserve = gen24_registers.scaledReserve.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 = froniusreg.StorCtl_Mode.setValue(fronius1, 0) err = gen24_registers.StorCtl_Mode.set(fronius1, 0)
# discharge at 100% allowed charge rate # discharge at 100% allowed charge rate
err = froniusreg.scaledOutWRte.setValue(fronius1, 100) err = gen24_registers.scaledOutWRte.set(fronius1, 100)
err = froniusreg.scaledInWRte.setValue(fronius1, 100) err = gen24_registers.scaledInWRte.set(fronius1, 100)
# charge to 7% # charge to 7%
err = froniusreg.scaledReserve.setValue(fronius1, 7) err = gen24_registers.scaledReserve.set(fronius1, 7)
discharge = froniusreg.scaledOutWRte.getValue(fronius1) discharge = gen24_registers.scaledOutWRte.get(fronius1)
print("Post DRate: %d%%" % discharge) print("Post DRate: %d%%" % discharge)
charge = froniusreg.scaledInWRte.getValue(fronius1) charge = gen24_registers.scaledInWRte.get(fronius1)
print("Post CRate: %d%%" % charge) print("Post CRate: %d%%" % charge)
mode = froniusreg.StorCtl_Mode.getValue(fronius1) mode = gen24_registers.StorCtl_Mode.get(fronius1)
print("Post Mode: %d" % mode) print("Post Mode: %d" % mode)
reserve = froniusreg.scaledReserve.getValue(fronius1) reserve = gen24_registers.scaledReserve.get(fronius1)
print("Post Res: %d" % reserve) print("Post Res: %d" % reserve)