RalfJL / S10history

Read historical data from a S10/E3DC solar power station
6 stars 2 forks source link

S10 values inaccurate / S10 Werte sind nicht korrekt #1

Open nischram opened 7 years ago

nischram commented 7 years ago

A lot of values, reported by the S10 solar power station are off by some percent. If you find a flaw in my calculations please report. I am more than happy to correct that.

nischram commented 7 years ago

Das Problem mit den Daten liegt daran, dass das System alle Daten umgerechnet auf UTC abspeichert. Wenn ich nun die Daten für einen Tag ohne zurückrechnen hole, dann bekomme ich die Daten von 22:00 - 21:59. Am Hausverbrauch merkt man dies zum Teil gar nicht, da dieser meist jede Nacht gleich ist. Aber je nach Batterie Füllstand ist die Entladung jede Nacht unterschiedlich und somit fehlen ggf. 2 Stunden am Zählerstand.

Um diesen Fehler zu beheben muss die Abfrage mit dem Offset von der Lokalen Zeit zu UTC (Aktuell 2 Stunden) erfolgen. Eine Möglichkeit ist 7200 Sekunden in die RscpReader.cpp einzubauen. start.seconds = mktime(l)+7200; Bei den diversen Ausgaben müssen die 2 Std. wieder abgezogen werden time_t d = start.seconds-7200; const char * sum_prefix = db_sum_prefix(); printf("%s start: %d - %s", sum_prefix, (int) d, ctime(&d)); d = start.seconds-7200 + span.seconds;

Sinnvoller wäre eine automatische Korrektur von UTC zur Lokalen Uhrzeit. Hierfür fehlt mir aber noch der richtige Ansatz.

RalfJL commented 7 years ago

Hi, in the meantime I added a switch "-U" or "--utc" so that the time to the S10 is not depending on your local timezone. Never the less it is still unclear to me what the WUI reports. (Does the browsers timezone has any influence on the reported values?)

And this still does not help with the problem that the sum of all days of a month does not add up to what is reported for the month itself.

nischram commented 7 years ago

Hey, jetzt muss ich mich Entschuldigen. Dein Ansatz mit dem UTC-Schalter war doch richtig. Ich hatte die Zeilen falsch kopiert und beim Abfragen gar nicht bemerkt, dass die Software mir einen Fehler ausgeworfen hat und trotzdem die Daten geholt hat.

./S10history -u "Schrameyer.Nico" -P PW -A AES -i "192.168.178.33" -y 2017 -m 7 -d 26 -b -U
./S10history: option requires an argument — 'U'
Reporting one dayReport starts: Wed Jul 26 00:00:00 2017

Die mir dann ausgegebenen Daten waren dann natürlich immer noch Zeitversetzt und ich hatte einen anderen Ansatz getestet. Also kann man meinen "commented 3" ignorieren!

Deine Vermutung mit der Zeitzone des Browsers ist korrekt, ich habe mich mal auf Australien umgestellt und siehe da die Sonne geht mitten in der Nacht auf.

Zu den Differenzen in den Tageswerten kann ich noch nichts sagen, dass muss ich erst Testen.

Gruß Nico

hismastersvoice commented 7 years ago

@nischram Was mir auch aufgefallen ist... Wenn ich zB den Juni 2017 abrufe wird trotzdem Juli angezeigt. Bei Feb. wird Mrz. angezeigt Bei Jan Mrz usw wird der richte Monat angezeigt. Es werden quasi gerade falsch und ungerade richtig angezeigt.

Ist das bei dir auch so?

-y 2017 -m 2 --brief -utc Start time: Wed Mar 1 00:00:00 2017 End time: Fri Mar 31 23:59:59 2017

-y 2017 -m 6 --brief --utc Start time: Sat Jul 1 00:00:00 2017 End time: Mon Jul 31 23:59:59 2017

-y 2017 -m 1 --brief --utc Start time: Sun Jan 1 00:00:00 2017 End time: Tue Jan 31 23:59:59 2017

@RalfJL If I call June 2017 is still displayed July. With Feb. it displays Mar. For Jan Mar, etc., the correct month are displayed. Looks like that odd month are displayed corract the others not. Is the maybe somthing wrong with the time-calcualtion?

nischram commented 7 years ago

@hismastersvoice Hey, ich habe es gerade getestet und kann es nicht bestätigen:

/home/pi/E3dcGui/S10history/S10history -y 2017 -m 3 -b Month start: 1488326400 - Wed Mar 1 00:00:00 2017 Month end: 1491004799 - Fri Mar 31 23:59:59 2017

/home/pi/E3dcGui/S10history/S10history -y 2017 -m 2 -b Month start: 1485907200 - Wed Feb 1 00:00:00 2017 Month end: 1488326399 - Tue Feb 28 23:59:59 2017

/home/pi/E3dcGui/S10history/S10history -y 2017 -m 1 -b Month start: 1483228800 - Sun Jan 1 00:00:00 2017 Month end: 1485907199 - Tue Jan 31 23:59:59 2017

Die Ergebnisse stimmen auch mit dem Portal überein. Gruß Nico

hismastersvoice commented 7 years ago

War anscheinend nur gestern... Evtl ein Systemfehler. Heute funktioniert es auch bei mir wie es soll.

@RalfJL Works again...

I write a Plug-in for the Loxberry System (Raspberry for Loxone Smartphone). www.loxberry.de

Is it OK if I use your Code to implement the E3DC requests in the background of the system?

RalfJL commented 7 years ago

Yes, please go ahead

RalfJL commented 7 years ago

By the way it works correct for me too. The program makes heavily use of functions like mktime, localtime, ... and they heavily depend on the environment. e.g. to switch the program to UTC you simply have to set an environment variable export TZ=UTC the switch -U does nothing but putting the TZ=UTC in the environment of the program which is lost when the program ends