Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Limiter inverter with RS485 load setting
#21
This is my output at the moment (4 units - 1 x fixed at 180W because it does not have RS485 - 2 x 900W units - 1 x 800W unit)


The oldest unit without RS485 works, however periodically it will reset and not sure if it's a hardware issue or firmware issue (basically a fault) although it still runs after the reset without any unplugging, etc.

One of the other units seems to have a software issue which leaves the unit offline when the battery voltage drops too low and cuts out automatically. I have a suspision that it is to do with the reception of data over the RS485 port when the unit is on low voltage cut-off because when used just as constant output with min/max voltage levels it works fine.

If the units are kept within the normal battery voltage setting range they seem to run fine.


The controller is written in visual basc and cut-s out the three units if the minimum output wattage is less than 90% of the minimum setting and then waits until it's back above 110% to switch back again. This is because I don't have enough separate ports to control each one individually (they are not addressable when on a common RS485 bus).

I have the max set to 450W because I don't get enough sun at the moment and 450W level is at a reasonable efficiency level.

Bill for a month in summer for the house was $4.60 (energy) as I can only really net off around 2.5kW and no matter how much I say don't switch everything on at once.....
If you can't quantify how much they cost, it's a deal, I'll buy 5 of them for 3 lumps of rocking horse ......
Reply
#22
Hi completelycharged

would you share your code?
currently i'm writing an python-code that should set the limiter to the current used wattage, but it seems not to work


here is my code:

Code:
import bs4
import requests
import time
import serial

compensateserial = serial.Serial('/dev/ttyUSB0', 4800, timeout=1)


##############################
def setCompensationSerial(CompensationHex="0000", checksum="08"):
##############################
    preData = "24560021"
    middleData = "80"
    data = preData + CompensationHex + middleData + checksum
    compensateserial.write(data.encode())
   

while True:
    currentTime = int(time.time() * 1000)
    url = "json URL from my Meter"
    r = requests.get(url)
    content = r.json()
    for meter in content['result']:
        if meter['seriesKey'] == 'Bezug':
            bezug = meter['values'][0]['value'] * 0.001  
            if bezug > 20:
                bezugHex = "%0.4X" % int(meter['values'][0]['value'] * 0.001)
                calcchecksum = [(bezugHex[i:i+2]) for i in range(0, len(bezugHex), 2)] 
                checksum1 = int(calcchecksum[0],16)
                checksum2 = int(calcchecksum[1],16)
                intchecksum = int(264)-int(checksum1)-int(checksum2)
                checksum = "%0.2X" % intchecksum
            else:
                bezugHex = "%0.4X" % 0
                checksum = "08"
            setCompensationSerial(bezugHex,checksum)


Output that is sent through ttyusb is somethine like
b'2456002101E58022'
Reply
#23
Send a byte array :

Code:
invBytes(0) = 36
    invBytes(1) = 86
    invBytes(2) = 0
    invBytes(3) = 33
    invBytes(6) = 128


invBytes(4) = Int(lTargetW / 256)
    invBytes(5) = lTargetW - (invBytes(4) * 256)
    invBytes(7) = (264 - invBytes(4) - invBytes(5)) And 255
If you can't quantify how much they cost, it's a deal, I'll buy 5 of them for 3 lumps of rocking horse ......
Reply
#24
thank you. working perfect!!!

here is the python3 code


Code:
import bs4
import requests
import time
import serial

## CompenstationBytes
byte0 = 36
byte1 = 86
byte2 = 0
byte3 = 33
byte4 = 0
byte5 = 0
byte6 = 128
byte7 = 8
compensateserial = serial.Serial('/dev/ttyUSB0', 4800, timeout=1)

######################################################
def setCompensationSerial():
######################################################
    bytes = [byte0,byte1,byte2,byte3,byte4,byte5,byte6,byte7]
    try:
        compensateserial.write(bytearray(bytes))
    except ValueError:
        print(bytes)
    

while True:
    currentTime = int(time.time() * 1000)
    url = "json URL from my Meter"
    r = requests.get(url)
    content = r.json()
    for meter in content['result']:
        if meter['seriesKey'] == 'Bezug':
            bezug = meter['values'][0]['value'] * 0.001  
            if bezug > 20:
                byte4 = int(bezug / 256)
                if byte4 < 0 or byte4 > 256:
                    byte4 = 0
                byte5 = int(bezug) - (byte4 * 256)
                if byte5 < 0 or byte5 > 256:
                    byte5 = 0
                byte7 = (264 - byte4 - byte5)
                if byte7 > 256:
                    byte7 = 8
            setCompensationSerial(byte4,byte5,byte7)


i added for me a little loop to check the current wattage every minute and readjust it, but i think everybody can do this loop by himself.
completelycharged likes this post
Reply
#25
OK, when they said "all items from Soyosource are not available now as they don't work now" they meant the factory was temporarily closed  Big Grin

They resumed operations today.

Also sharing my code, I hope it helps!
Code:
import struct
import time
import serial

ser_in  = serial.Serial('/dev/ttyUSB0',4800)
ser_out = serial.Serial('/dev/ttyUSB1',4800)

def computeCRC(power):
    pu = power >> 8
    pl = power & 0xFF
    return (264 - pu - pl) & 0xFF

def read_consumed_power(ser):
    time.sleep(0.1) # Wait and clear input buffer to ensure proper packet synchronization
    ser.reset_input_buffer()
    try:
        raw = ser.read(8) # Read 8 bytes
    except: return -1
   
    (a,b,divider,c,consumed_power,d,crc) = struct.unpack('>BBBBHBB', raw)
    if computeCRC(consumed_power) != crc: return -2 # Checksum mismatch
   
    return consumed_power

def set_generated_power(ser, power):
    a = 0x24
    b = 0x56
    divider = 0x00
    c = 0x21
    d = 0x80
   
    crc = computeCRC(power)
    out = struct.pack('>BBBBHBB', a,b,divider,c,power,d,crc)
    ser.write(out)
    ser.flush() # Wait for data to be written out

while True:
    consumed_power = read_consumed_power(ser_in)
    if consumed_power < 0: continue
    print(consumed_power)
   
    desired_power = consumed_power + 6 # Add 6 extra watts, for example to compensate and completely null out the utility meter
   
    set_generated_power(ser_out, desired_power)

ser_in.close()
ser_out.close()
completelycharged likes this post
Reply
#26
Hi @completelycharged I hope you are ok!

I'm wondering if with the constant voltage mode it would be possible to feed the grid stand-alone. What were your findings?
Reply
#27
(04-03-2020, 08:32 AM)CarlosGS Wrote: I'm wondering if with the constant voltage mode it would be possible to feed the grid stand-alone. What were your findings?

Not quite sure what you mean specifically so I will list a number of different scenario's which I have actually tried out...

Single unit + grid tied : Controls, works fine.

Multiple units + grid tied : Work in parallel without any issues. I'm now controlling 1 on it's own and 2 together (2 RS485 adapters, 1 into 1, 1 into 2). This allows me to effectively switch one off or two off and then switch them off around 70W level.

Single unit + Off grid inverter : This is with the battery feeding a stand alone inverter and then plugging the single unit into the inverter. If the single unit is pushig out too much then the power flows back through the off-grid inverter into the battery (circular loop effectively). I tried this out as a way of increasing off-grid inverter capacity (off-grid inverter 5000W + 3 x 800W) while retaining a high start surge capability. i.e. they can be used off-grid as long as your inverter is designed/capable of reverse power flow (i.e. not a high frequency inverter !!!)

If the supply voltage is constant it would be like the ideal battery and work forever.


This is my control setup now (the max inverter watts does not get used and is instead limited by the other values entered). The 1600W is actually the aggregate of 2 units so in this case I'm limiting the 900W units to 800W and the 800W unit to 700W.  This is to keep them cooler to prolong the working life and keep them in a better efficiency zone.



The issues I was having with the units apparently locking up turned out to be the RS485 adapters I'm using and still figuring out the exact electrical reasoning.

Just noticed the 4th unit watts is showing 0 - actually the code does not update that value on screen as it's just the offset watts I enter...

Also noticed the max watts in the table is not updated.... lol. the min watts in the table is divide by 2. Reason for the random 2x values is I wrote the code on the basis I'm going to add another RS485 adapter to the control each of the 3 units separately.

The reason is that every (random number of seconds) the unit will return a stuatus update of the supply volts and amps, which is used to update the Wh remaining.... BUT each unit has a slightly different calibration and so consistent readings are lacking AND when 2 units send at the same time you get nothing..
If you can't quantify how much they cost, it's a deal, I'll buy 5 of them for 3 lumps of rocking horse ......
Reply
#28
Ah - good to know we cannot do that with HF inverters Smile

Thanks for the update, it really is an awesome setup!!
Reply
#29
The inverter still draws some power from the battery when commanding power=0W. It would be nice to be able to shut it off completely. Do you think this is possible using the RS485 protocol?
Reply
#30
Hi completelycharged

I see you are in the UK! I am looking to buy one of these inverters and was wondering if you had any problems with the utility company? i.e. if the inverters ever produced too much power and sent it to the grid....would the utility company care?

Also, do you know if these inverters have islanding protection? I'm guessing if the mains went down the limiting sensor would say the desired is 0 and and the inverter shouldn't produce......but what happens if say you disconnected the mains connection whilst there was still demand? Does it disable the inverter to prevent it producing power on potentially bare connections?

Thanks in advance! Your work on the RS485 is amazing
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)