Limiter inverter with RS485 load setting

Announcement - Help us fight the BOTS! Please report all spam including stuff in your inbox!

completelycharged

Well-known member
Joined
Mar 7, 2018
Messages
1,054
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)

image_mtwfam.jpg


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.....
 

MasterTH

New member
Joined
Feb 28, 2020
Messages
3
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'
 

completelycharged

Well-known member
Joined
Mar 7, 2018
Messages
1,054
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
 

MasterTH

New member
Joined
Feb 28, 2020
Messages
3
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.
 

CarlosGS

New member
Joined
Nov 17, 2019
Messages
10
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 :D

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()
 

CarlosGS

New member
Joined
Nov 17, 2019
Messages
10
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?
 

completelycharged

Well-known member
Joined
Mar 7, 2018
Messages
1,054
CarlosGS said:
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.


image_vntzfs.jpg


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..
 

CarlosGS

New member
Joined
Nov 17, 2019
Messages
10
Ah - good to know we cannot do that with HF inverters :)

Thanks for the update, it really is an awesome setup!!
 

CarlosGS

New member
Joined
Nov 17, 2019
Messages
10
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?
 

rtdm

New member
Joined
Apr 20, 2020
Messages
1
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
 

MasterTH

New member
Joined
Feb 28, 2020
Messages
3
CarlosGS said:
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?


no it is not. but you can control a smart powersocket via bluetooth or, if you are an avm fritzbox owner, via lan
 

completelycharged

Well-known member
Joined
Mar 7, 2018
Messages
1,054
rtdm said:
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

This is a bit long and a bit of a varied answer, to a seemingly simple question..... you need to know what your doing and fully understand what your doing. It's not just plug and play. Safety for ALL.

The inverters are only 900W (0.9kW) each and a typical house is fused at 100A (UK standard) which is 25kW BUT and here is the reality, if you were to run your house at 25kW for any significant length of time you would find that the cable or junction or joint potentially melts and breaks. I have seen this happen first hand quite a few years back when (under duress, close to getting fired) we connected a house up with about 18kW of overnight heating (Economy 7), which resulted in all of the jointing compound out of the cable/fuse housing to melt and run out onto the floor the first night. Fortunately it did not set on fire. The mains supply was 10mm2 if I remember.

Single inverters can export upto around 3.8kW without "additional" registration steps, etc.

Harmonics, the units are quiet and well within spec. The most horrendous harmonics I have are generated by a 2kW solar grid tie unit which (very amazingly) actually passed the UK testing standards and is fully approved. Just because it has or does not have a "bit of official paper" it does not mean that it is actually ideal or should be used. The specifics depend on how the output is fed in relation to the syncronised waveform as some inverter will try to push out as much as possible early and therefore end up ootentially distorting the waveform. This is way more evident when you are using the units off grid with a single master inverter that provides the "off-grid" mains syncronisation.

If the inverters send power to the grid, then the energy at the moment is not metered (in my case) an therefore effectively goes towards offsetting distribution losses (as that is where the actual metering difference is accounted for in my case) so I am effectively then subsidising the distribution company. So, technically they should care in thoery because it is an accounting issue, in reality it is not in thier interest to actually resolve the issue because their proffits would be impacted directly.

Safety. The inverter circuit is powered from the mains side (as with a lot of grid tie units, if not the vast majority) and islanding protection is actually provided for due to the loss of a stable frequency to syncronise to and the typical case of more load attached, which would also overload the unit and cause it to trip offline anyway. There are multiple ways that islanding is provided and these units do island without problem and the re-sync time can be changes so that it fits within the grid code timings.

The most difficult islanding scenario to deal with is where the inverter is supplying a resonant (of sorts) load where the inverter could potentially provide the balancing power to keep the resonance ongoing. No domestic property would have appliances or equipment that would provide this capability as you would need something like a few hp motor with a very large flywheel or a large ferroresonant transformer attached. Think of it as if your powering a flywheel the energy to keep the flywheel running is relatively little, which is where the lower output could be enough to keep things running. The critical flaw to this scenario is that induction motors have slip (they loose sync with the mains every few cycles due to the losses) and this slip cuases the frequency to go out of range and the inverter trips. The only equipment I can think of which would be an issue is a large ferroresonant transformer, which again would not be seen in a domestic property.

Multiple inverters could potentially create a resonant "cluster" if the output load is perfectly matched and no changes occur. The islanding standard specifies a maximum time for islanding, google "Experimental Evaluation of PV Inverter Anti-Islanding with Grid Support Functions in Multi-Inverter Island Scenarios" and have a read. Page 9, Figure 3. Notice the inverter(s) can still run for a few cycles before instability/excess/under voltage trips the unit off. This is a really good read as to why typically only a single inverter is connected because it can extend the islanding time long enough to cause issues with automatic breaker reset's that occur on the grid, which could result in out of phase reconnects. Chart on page 27, Figure 12.

The real safety issue is isolating your house from the grid when powering from an isolated battery powered inverter because it MUST (absolutely MUST) be double pole isolated from the grid supply cable. There is a particular scenario whereby the neutral line can back feed a live mains equivalent voltage and gets even more complicated with residual current trip breakers involved. This is where you could electrocute the cable repair guy.

"potentially bare connections" - I'm guessing this is either a scenario of the cable guy outtside repairing a fault on the grid or someone inside the house doing some work on the electrics.. Either case, isolate the inverter. NEVER rely on an inverter to not provide any output voltage that could be lethal. These units need the mains to power the switching of the battery supply to get an output, sort of like the chicken and egg, no mains, no output. That is not to say that you could still asume that you don't even get 48V out. Think of a case where the unit has shorted out in some strange way where you have the 48V passing through.

Really basic sense check, think of the scenatio and then think would I be happy/comfortable/confident if I put the bare wire in my mouth. (DONT DO IT !!!!!!)
 

barry

Member
Joined
Oct 19, 2019
Messages
66
this is a very little brave inverter i have one on the wall for over a year now and it made almost 1000 kwh and still going strong!! and that for 150 euro :D last week i had a little DUCK up (my fault)and had some exploding capacitors (bleu ones) and 4 euro later and 10 min of soldering it hums again happy on the wall :D
the only downside is....it makes a lot off noise and can not run 48 volts it uses 96 volts :-/
 

barry

Member
Joined
Oct 19, 2019
Messages
66
CarlosGS said:
Oh you even managed to service it? :D Did you take any pictures of the process?

yeah i did it was so easy that a guy with 2 left hands could do it

20200413-145242.jpg
" />
 

barry

Member
Joined
Oct 19, 2019
Messages
66
well..... i think it died this time for good :-/ this morning there was a thunder storm 5 kilometers a way there was one big flash and my main braker tripped i reset the braker and the power was back in the house and the inverters powerd on but one inverter says AC input high and won't turn on i think the lightning killed my inverter :cry:
 

pevzhangli

New member
Joined
May 13, 2020
Messages
2
Really interesting stuff.

I am looking for grid-tie inverter/charger that I can use a gateway to control the charge/discharge power in realtime. Would your setup do so? Any recommendations?

Thank you.
 
Top