Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Understanding the data/code
#1
I've been reading the code, trying to understand how/why everything works.  Mostly I've been going over main/reader.go and smartpi/ade7878.go.

I'm wondering if there is some additional documentation on all of the inputs and outputs.

I'm considering refactoring this code to make it easier to follow.  The big one is smartpi.ReadoutValues(), which returns a completely unformated slice of floats.  This should really be a struct, or broken up into several smaller sub-functions.

For example, in the main for{} loop of readout.go, there is a sub-loop that updates all of the current/voltage gauges (I think), but it ignores the cumulative counters every 5 seconds.

Then every 12 iterations (1min) it updates the database storage and two persistent cumulative counters.

Then it resets the value state for everything and starts the temporary cumulative counters over again.

Does this all sound correct?

I'm also wondering what unit these values are:

EB1: 1.116625  EB2: 0.0341316  EB3: 0.033458143  EL1: 0  EL2: 0  EL3: 0

One more question, it looks like there is no way to ignore disconnected phases, my apartment only has one phase, I can turn off voltage readings, but it appears to be counting some current against the cumulative counter on phases that are disconnected.
Reply
#2
You could start with the documentation on the ADE7878 chip.
I got my copy from: http://www.analog.com/en/products/analog...e7878.html

It's a long document, but seems to fit most of the stuff I found in the source code.

I am in a similar position/phase as you seem to be, so maybe we can join forces.

BTW, thanks for your pull request related to the formatting of the golang source.
Reply
#3
Thanks for the link to the datasheet, very useful.

I'm trying to decide on a good struct layout for the return values of ReadoutValues().  If you have any suggestions, I'm game.
Reply
#4
Hello SuperQ,

you are right.
Every 5 seconds the smartpi.ReadoutValues() reads the values from the SmartPi and updates the actual values in the file. Every 12 iterations the average of the values are written in the database and cumultative counters.
EB ist energy consumption and EL is the energy production (sorry for the german words Bezug (consumption) and Lieferung (production)).
Reply
#5
Hi,

what's the format of the returned data of a REST API call ? 

I've to verify if I can get the data into an application running on Rpi .

Other question : what's included in the cost of a SmartPi (sorry but I don't speak german) ?  

tnks

donato
Reply
#6
(28.04.2017, 07:25)jens Wrote: Hello SuperQ,

you are right.
Every 5 seconds the smartpi.ReadoutValues() reads the values from the SmartPi and updates the actual values in the file. Every 12 iterations the average of the values are written in the database and cumultative counters.
EB ist energy consumption and EL is the energy production (sorry for the german words Bezug (consumption) and Lieferung (production)).

Ahh, Deutsch, ganz gut.

My German isn't so great, but it makes more sense now.  Mostly I was wondering what the unit was, but I've traced the code enough that I see it's coming from the "Total active power" in watts.  I was confused if it was watt-hours, amp-hours, etc.

The code is quite confusing, as all of the data is being sent around in an un-named slice of floats.  I will likely refactor this code to use a struct so that the complicated loops and case statements can be eliminated.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)