This project has moved and is read-only. For the latest updates, please go here.

Power and Average are identical in PVO since v3.0.0

Topics: 1. General
Sep 16, 2014 at 4:45 PM
Thanks for all the good work with SBFspot.

I'm using it since 2.06 and applied most updates. My current version is 3.01.
However since version 3.0.0 the uploaded shown in PVOutput changed the Power and Average figures in "live" in PVOutput are identical. I'm using the SMA SB2500 inverter.

Is this normal?
Sep 16, 2014 at 9:49 PM
This is normal.
According to PVO help pages:

Average Power

The average power, represented by a orange line on the graph, is a calculated value based on the change in energy divided by the change in time. The average power is used to smooth out fluctuations in the instantaneous power readings. Measured in watts (W)
SBFspot prior V3.0 was sending instantaneous (=spot) power, whereas V3.0 sends the historic data kept by the inverter (=average)

Example (pre 3.0)
Time   Energy     Power  Average    
16:15  2.662kWh   189W   204W
16:10  2.645kWh   205W
Change in time: 5mins
Change in energy: 2662-2645=17kWh
Avg Power: 17 * 60 / 5 = 204W
Marked as answer by SBF on 9/16/2014 at 1:49 PM
Nov 1, 2014 at 6:18 AM
I would prefer to upload the "true" instantaneous power value to PVO (as per previous versions). The average power in the historic data is a bit useless because it is just calculated using the energy values which is what PVO does anyway. So why send data to PVO that PVO can calculate for itself?

Would you consider adding a switch to the cfg file to upload the data in the SpotData table rather than the DayData table?
Nov 1, 2014 at 9:44 AM
I agree with brunofabre.
Nov 1, 2014 at 9:28 PM
The SQL DB feature makes SBFspot very flexible:
As described in the docs (tweaking part), modify the V2 field in vwPvoData to spot.Pac1 + spot.Pac2 + spot.Pac3 AS V2
SELECT dd.Timestamp,
    dd.TotalYield AS V1,
    spot.Pac1 + spot.Pac2 + spot.Pac3 AS V2,
    cons.EnergyUsed AS V3,
    cons.PowerUsed AS V4,
    spot.Temperature AS V5,
    spot.Uac1 AS V6,
    NULL AS V7,
    NULL AS V8,
    NULL AS V9,
    NULL AS V10,
    NULL AS V11,
    NULL AS V12,
FROM vwDayData AS dd
LEFT JOIN vwAvgSpotData AS spot
    ON dd.Serial = spot.Serial AND dd.Timestamp = spot.Nearest5min
LEFT JOIN vwAvgConsumption AS cons
    ON dd.Timestamp = cons.Nearest5min
ORDER BY dd.Timestamp DESC
Marked as answer by SBF on 11/1/2014 at 1:29 PM
Nov 2, 2014 at 3:36 AM
Thanks for the reply pointing me to the right place to fix this. Only problem I found is that if SpotData has NULL for Pac1, Pac2 and Pac3 then vwPvoData.V2 is set to NULL which causes errors for the ServiceUpload Daemon.

A better replacement is for V2 is:

IFNULL(spot.Pac1 + spot.Pac2 + spot.Pac3, dd.Power) AS V2

which avoids NULL values for V2.

That keeps ServiceUploadDaemon happy!
Nov 3, 2014 at 8:40 AM
@SBF: thanks for the advice and that you made SBFspot so flexible!

@brunofabre: Thanks for continuing this discussion.
When I put the IFNULL option in the database I get a warning (something like) "to many arguments". To me it looks to work great without IFNULL.
Nov 3, 2014 at 11:41 PM
Maybe there are differences between MySQL implementations! I am running on Ubuntu.

MySQL IFNULL function is one of the MySQL control flow functions that accepts two arguments and returns the first argument if the argument is not NULL; otherwise it returns the second argument. Arguments can be literal values or expressions.

If you start SBFspot in the middle of the day, it will upload DatData for the whole day from the inverter but there will only be SpotData from that point. So the vwPvoData view will have NULL values. I got errors when ServiceUploadDaemon tried to upload NULL values to PVOutput.
Nov 4, 2014 at 10:08 AM
IFNULL is indeed needed. SQLite uses the same syntax, so I guess you made a typo in the SQL query
Nov 4, 2014 at 2:22 PM
SBF was wright. I forgot the ", dd.Power" in the IFNULL line... :-(

(I'm using the sqlite3-database on a Raspberry Pi. I did not found an error when I used "(spot.Pac1 + spot.Pac2 + spot.Pac3) AS V2" instead of "IFNULL(spot.Pac1 + spot.Pac2 + spot.Pac3, dd.Power) AS V2")