Fun and games with industrial control software

I initially planned to write my own software to monitor, log and control our off-grid system, including optional loads like the well pump. But recently I came across a free-for-non-commercial use industrial control software that does exactly what I want, without having to write too much code :D

Using my existing Sunny Island data logger and PHP interface to the Midnite classic as well as weather forecast data from Weather Underground, I could write a simple script to turn the well pump on:

Attachment not found.

Basically it says: Turn on the pump between 12 and 3pm if one of the following is true:
- The battery SoC is above 85% and the charge controller is in Float or Absorb
- The battery SoC is above 75% and the weather forecast for tomorrow is "clear"

Although I don't have the relays to actually turn the pump on yet, I've got the system sending me an email when it thinks it should turn the pump on. Apart from this, the software lets you define custom alerts and events based on the data it's monitoring, I've got the following setup just as examples:
- Send me an email if the battery SoC dips below 50%
- Send an email if the charging current is greater than C/20 and the battery voltage is higher than gassing voltage

Attachment not found.

It's very promising software that can be applied to a wide range of applications, all you need is the data to monitor and potentially sensors and actuators to do something about the data. More details and screenshots on my blog here: http://www.casanogaldelasbrujas.com/blog/2013/01/03/scada-control-software-for-off-grid-system/

Comments

  • Eric L
    Eric L Solar Expert Posts: 262 ✭✭
    Re: Fun and games with industrial control software

    That is cool Stephen.

    It looks like you could further program it to progressively add more opportunity loads based on battery voltage and SoC; e.g., heating air or water after the pump was on as long as the system could hold absorb voltage, say (this would assume the system had the capacity for the extra loads, obviously).
  • stephendv
    stephendv Solar Expert Posts: 1,571 ✭✭
    Re: Fun and games with industrial control software

    Eric, yes that's the idea as more opportunity loads come on line it can make some sort of semi-intelligent decisions about what to turn on when.
    Just been toying more with the software and it supports Modbus TCP natively, so it can talk directly to the midnite classic without needing any intermediate software in between.

    It also has a built in pachube (cosm) module, so you just select which data points you want to upload and it takes care of the rest: https://cosm.com/feeds/75889
  • mtdoc
    mtdoc Solar Expert Posts: 600 ✭✭
    Re: Fun and games with industrial control software
    stephendv wrote: »
    I initially planned to write my own software to monitor, log and control our off-grid system, including optional loads like the well pump. But recently I came across a free-for-non-commercial use industrial control software that does exactly what I want, without having to write too much code :D

    That IS cool Stephen.;)

    I'm just starting to play with using an arduino and also a small national intruments usb daq board with the idea of eventually doing some monitoring and control of my home energy use and solar system. I've done some programming with LabView in the past but this Mango may be simpler way to do things - I'll have to investigate. Are you running Mango on your Raspberry Pi?

    For now using a combination of Midnite's local app, Wattplot and a VNC server I can already monitor my system on line pretty closely - but I'm greedy and am looking for more control. Primarily this is just a hobby/fun project that may or may not accomplish something useful....:roll:

    I don't have a Sunny Island system. Depending on what Midnite comes up with for their yet to be released battery monitor - I may want to develop a way to end absorb on my Classic CCs based on shunt measured end amps. I thought I had seen a post where you had developed a program to do this - but don't recall where I saw that. Am I right? Any insight or details?
  • stephendv
    stephendv Solar Expert Posts: 1,571 ✭✭
    Re: Fun and games with industrial control software

    Yep, I loaded it onto the rPI and it works, but the web UI is a bit sluggish. So while I'm testing, it's running on a more powerful linux pc. Once the config has settled down I'll load it back onto the PI. I have one of the early pi version with only 256Mb RAM, so with Mango and the mysql db for the sunny island logger running, there's only 20Mb free. The newer ones have 512Mb which should be much better.

    I was ending amps by reading the current shunt on the SI. If you have an FNDC, can you read the charging current through the Mate3? If the mate3 has an HTTP interface then you could potentially use that with Mango.
  • mtdoc
    mtdoc Solar Expert Posts: 600 ✭✭
    Re: Fun and games with industrial control software
    stephendv wrote: »
    I was ending amps by reading the current shunt on the SI. If you have an FNDC, can you read the charging current through the Mate3? If the mate3 has an HTTP interface then you could potentially use that with Mango.

    Thanks - yep - I can read end amps from my shunt but have a traditional Mate. I'm planning on directly reading end amps from the shunt and using the arduino or NI daq board to do the A/D. Labview can do all sorts of fun things with that data programming wise - graphical displays, controls with digital or analog outputs, etc. But Labview will not run on a low cost, low power platform like the rPI.

    Were you able to end absorb on a Classic CC with the end amp info or only end absorb on the Sunny Island?

    If you've been able to do it on the Classic I'd be interested in hearing how? Per boB they will be implementing a way to end absorb through Aux 2 input but that is not yet implemented in the production firmware.
  • stephendv
    stephendv Solar Expert Posts: 1,571 ✭✭
    Re: Fun and games with industrial control software

    I was ending absorb on the classic by writing 0x20 to register 4159 (or 4160 depending on how the software addresses it). This is the "force float" command, similarly you can force bulk or force EQ through modbus, in fact you can get the classic to do almost anything by writing to it's modbus registers.

    The caveat is that to write to the classic you have to first write the serial number to a specific register and then the command you actually want to write. Since the modbus library I was using was a bit limited, I couldn't get this right, so bob pointed out that you can set a jumper on the classic that would remove this requirement. With this jumper set you can write directly to any register without first writing the serial number.

    I'm working on writing a little program with an improved library that will write to the classic without having to change jumpers around. Will keep you posted :)
  • stephendv
    stephendv Solar Expert Posts: 1,571 ✭✭
    Re: Fun and games with industrial control software

    ...if you could use the arduino to read the shunt, then you could install a modbus library onto the arduino and have mango talk to it that way.
  • mtdoc
    mtdoc Solar Expert Posts: 600 ✭✭
    Re: Fun and games with industrial control software

    OK thanks!. Yes - modbus- that is something I have not played with yet. One more thing to learn! There is a modbus library for Labview as well.

    It will be easier I think - once they have an input function on Aux 2 that allows one to end absorb with a logic signal.

    Then again if they get their low cost shunt based battery monitor on the market it will probably do this anyways.. Still fun to play with this stuff and DIY.

    Thanks for the ideas....
  • stephendv
    stephendv Solar Expert Posts: 1,571 ✭✭
    Re: Fun and games with industrial control software

    Got the modbus write working, code is here: https://github.com/stephendv/IslandManager/blob/master/scripts/classic.py
    Using that script you can do: python classic.py forcefloat
    Which will end absorb.
  • stephendv
    stephendv Solar Expert Posts: 1,571 ✭✭
    Re: Fun and games with industrial control software

    Got end amps configured in Mango, so it reads the actually amps going into the battery from the Sunny Island and then does a forcefloat on the Classic based on a trigger value.

    Attachment not found.

    Attachment not found.

    ...will see if it works today :)
  • stephendv
    stephendv Solar Expert Posts: 1,571 ✭✭
    Re: Fun and games with industrial control software

    End amps is working well, so I've gone and added in some more rules:

    Avoid daily absorb on a charged battery
    The idea of this was cribbed from the way the Sunny Island does its charging: Floats most days and only Absorbs every 3-4 days depending on the battery SoC. Since I’ve configured Mango to pull in the weather forecast, I can make it a bit more intelligent, the rule goes something like:

    If it’s been less than 3 days since the last absorb charge and the battery SoC is greater than 85% and the prediction is for clear skies tomorrow, then skip absorb and go straight to float for the whole day.

    Do a regular short EQ charge
    If it's been longer than 14 days since the battery has hit the EQ voltage, and the classic is in Float mode, then do a 10 minute EQ. The purpose of this is just to fully charge the batt, not do actually equalise the cells. A full and proper EQ will still be done perhaps every 3 months?

    Notify my wife when it's OK to do the laundry
    If it's 8am and the battery is more than 80% charged and the forecast is for clear skies or partly cloudy skies tomorrow then send my lovely wife an email saying it's ok to do the washing. If not, send a different mail asking politely whether the laundry can wait a day.
  • mtdoc
    mtdoc Solar Expert Posts: 600 ✭✭
    Re: Fun and games with industrial control software

    Super cool stephen. How are you getting end amps and SOC info into your computer? Serial port input from Sunny Island?

    Fun stuff with Mango! I'm not off grid but maybe I can put a pressure transducer on my laundry hamper and have Mango send my wife an email when it is full?? ...;)

    On second thought that might lead to some other problems...:blush:
  • stephendv
    stephendv Solar Expert Posts: 1,571 ✭✭
    Re: Fun and games with industrial control software
    mtdoc wrote: »
    Super cool stephen. How are you getting end amps and SOC info into your computer? Serial port input from Sunny Island?

    RS-485 piggy back in the sunny island (all SMA inverters use the same one), and then USB-RS-485 converter in the computer.
    mtdoc wrote: »
    Fun stuff with Mango! I'm not off grid but maybe I can put a pressure transducer on my laundry hamper and have Mango send my wife an email when it is full?? ...;)

    Hehe, it's all possible :)

    I've got a pair of the XRF modules on order: http://shop.ciseco.co.uk/rf-module-range/ to control the well pump which is about 200m away from the house. Those same modules also have a generic ADC interface so could potentially communicate with a whole range of different sensors.
  • Eric L
    Eric L Solar Expert Posts: 262 ✭✭
    Re: Fun and games with industrial control software
    Fun stuff with Mango! I'm not off grid but maybe I can put a pressure transducer on my laundry hamper and have Mango send my wife an email when it is full??

    I was thinking of using it to monitor battery SoC and weather forecasts to send my wife an email indicating when she could next use her hair maintenance equipment ("Based on current forecasts, you might be able to use your blow dryer on THURSDAY of next week").


    I bet that would work out well.
  • stephendv
    stephendv Solar Expert Posts: 1,571 ✭✭
    Re: Fun and games with industrial control software
    Eric L wrote: »
    I was thinking of using it to monitor battery SoC and weather forecasts to send my wife an email indicating when she could next use her hair maintenance equipment ("Based on current forecasts, you might be able to use your blow dryer on THURSDAY of next week").

    Hey, there's nothing you can do about it, computer says no.

    http://www.youtube.com/watch?v=0n_Ty_72Qds
  • techntrek
    techntrek Solar Expert Posts: 1,372 ✭✭✭
    Re: Fun and games with industrial control software

    I'm sorry Dave, I can not comply with your request to use a hair dryer.

    Wouldn't you prefer a nice game of chess?



    < yeah, I mixed two movies together, but it worked here... >
    4.5 kw APC UPS powered by a Prius, 12 kw Generac, Honda EU3000is
  • stephendv
    stephendv Solar Expert Posts: 1,571 ✭✭
    Re: Fun and games with industrial control software

    The wireless relay modules arrived last week and I've installed them today and have just seen Mango turning the well pump on and off :D The wireless signal is quite good using the built in wire-whip antennas, it covers the 200m, half a pine forest and brick wall without problems. The modules are these: http://shop.ciseco.co.uk/xrf-relaybase-also-for-xbee-wireless-dual-relay-module-for-switching-kit/, cheap, easy to use and with a decent range, couldn't ask for more.

    Attachment not found.Attachment not found.