Author Topic: Progress, status  (Read 3548 times)

zoneblue

  • Hero Member
  • *****
  • Posts: 964
Progress, status
« on: January 11, 2014, 06:13:39 PM »
As further work on the blackbox project UI was pending resolution of sample rate issues, and no improvement in the timeout issue materialised with the last firmware update, it was decided to work up a daemon version of RossW's newmodbus. This allows us to sample at smaller intervals continuously, utelising a single open modbus connection to the classic.

Im happy to say it works and at a 1s sample rate is stable. However as c is not my native language, hopefully others can give some feedback on it. Source code for both newmodbusd, and the original newmodbus (thanks to Ross) are now up at the blackbox project svn. (http://code.google.com/p/theblackboxproject/source/browse/trunk) in folder 'c'. There is a binary compile of newmodbusd for ARM there too, to get it click 'show details' then 'view raw file' in the right sidebar.

For those perservering with cron/newmodbus, it has been determined on three seperate systems that 3 minute intervals is the fastest sample rate that is stable on the ARM architecture. But short of a firmware miracle my focus will be moving on to this daemon methodology. The upside is that using ajax we will now be able to get near real time data into the UI. The downside is that to use the local app you will first need to unplug blackbox. Not ideal, but bearable i guess.
6x300W CSUN, ground mount, CL150Lite, 2V/400AhToyo AGM,  Outback VFX3024E, Steca Solarix PL1100
http://www.zoneblue.org/cms/page.php?view=off-grid-solar

Westbranch

  • Hero Member
  • *****
  • Posts: 2795
  • Building System (sort of) 1 weekend at a time
Re: Progress, status
« Reply #1 on: January 11, 2014, 06:43:48 PM »
The downside is that to use the local app you will first need to unplug blackbox. Not ideal, but bearable i guess.

Wouldn't a A/B switch be usable here?
KID FW1811 560W >C&D 24V 900Ah AGM
CL150 29032 FW V.2126-NW2097-GP2133 175A E-Panel WBjr, 3Px4s 140W > 24V 900Ah AGM,
2 Cisco WRT54GL i/c DD-WRT Rtr, NetGr DS104Hub
Cotek ST1500 Inv  want a 24V  ROSIE Inverter
OmniCharge3024  Eu1/2/3000iGens
West Chilcotin 1680+W to come

RossW

  • Sr. Member
  • ****
  • Posts: 368
Re: Progress, status
« Reply #2 on: January 11, 2014, 07:19:50 PM »
The downside is that to use the local app you will first need to unplug blackbox. Not ideal, but bearable i guess.

Wouldn't a A/B switch be usable here?

Since it's TCP/IP, no need to physically disconnect anything. All that's required would be to stop the process on the blackbox system to permit the local-app to connect (since the classic only allows one connection at a time)

The other possible fix for this would be to have a "mirror mode" in the daemon that will accept connections on the same port as the classic and to "pass through" from local app to the classic.

Degrees of cleverness could be added. The daemon could maintain a table that is a copy of the registers in the classic, and when the local app requests a register, the daemon could immediately reply with its local (cached) copy instantly. If it was a register that wasn't cached (perhaps the special purpose registers), or a command for something else (like to read log files etc), they could be passed through.

Where a passthrough is happening, the daemon should be smart enough to arbitrate and interleave the local-app requests with its own needs so both devices could operate transparently.

(Only possible fly in the ointment will be the mysterious udp broadcasts the classic does to announce itself. Either the daemon would need to do the same thing, or hopefully the local app has a mode to specify the IP address of the classic, so you can point it to the "mirror" rather than the actual classic)
3600W on 6 tracking arrays.
7200W on 2 fixed array.
Midnite Classic 150
Outback Flexmax FM80
16 x LiFePO4 600AH cells
16 x LiFePO4 300AH cells
Selectronics SP-PRO 481 5kW inverter
Fronius 6kW AC coupled inverter
Home-brew 4-cyl propane powered 14kVa genset
2kW wind turbine

laszlo

  • Full Member
  • ***
  • Posts: 177
Re: Progress, status
« Reply #3 on: April 16, 2014, 09:57:58 PM »
I see you have thought about coding up newmodbusd so it would act as a modbus proxy for the Classic.  (damon) Say, to keep things simple, for read-only requests? Then we could have diverse apps connect to it in parallel and monitor the Classic. I thinbk that would be a great projedct and we had some threads here about this a while back.
« Last Edit: April 16, 2014, 10:14:25 PM by laszlo »
4.6KW offgrid PV system, Classic 200, MX60, dual Magnum PAE 4448 inverters, Midnite combiner and disconnect boxes, e-panel,  WBJr, and 8 MN SPDs

zoneblue

  • Hero Member
  • *****
  • Posts: 964
Re: Progress, status
« Reply #4 on: April 17, 2014, 01:30:04 AM »
newmodbusd maintains a text file containing the entire register range, at near realtime. It would be realtively simple im sure to write a tiny server which handles modbus requests. However another route would be to factor it more as a http api, thus utelising the existing webserver.

- http://blackbox/api.php?readmodbusrange=4110-4130
- http://blackbox/api.php?readdatapts=vbat,icc,iwb,soc

etc, type of thing. Im not really sure what kinds of devices would be consuming such data to say which would be best.
6x300W CSUN, ground mount, CL150Lite, 2V/400AhToyo AGM,  Outback VFX3024E, Steca Solarix PL1100
http://www.zoneblue.org/cms/page.php?view=off-grid-solar

crunnells

  • Jr. Member
  • **
  • Posts: 85
    • chrisrunnells.com
Re: Progress, status
« Reply #5 on: May 31, 2014, 12:05:19 AM »
I like the approach of using an API as a go between. It seems like it would work for lower powered devices to just act as a go-between to a cloud server or something.

I've finally gotten a look at theblackbox code today, and trying to make it run on my iMac (instead of doing actual work). I think the Beagle can handle everything, but I'm thinking it'd be nice (long term) to be able to push the data to my web server so it's accessibly remotely, tons more storage and processing power, etc.

I really should have done some real work today, heh.