monthDataOffset

Topics: 4. Bugs
Sep 28, 2015 at 3:45 PM
With the new SBFspot 3.1.2 i receive an error using the 123Solar.
It returns a monthDataOffset=-86400 when asking data.
I try some options but i can find any solution.
This is the output:
[code]
/usr/local/bin/sbfspot.3/SBFspot -123s=DATA
SBFspot V3.1.2
Yet another tool to read power production of SMA solar inverters
(c) 2012-2015, SBF (https://sbfspot.codeplex.com)
Compiled for Linux (LE) 32 bit

Commandline Args: -123s=DATA
20150928-16:20:31 235.450 6.508 1532.000 0.000 0.000 0.000 0.000 0.000 0.000 49.990 98.966 60.000 0.000 26852.129 242.770 3.210 779.000 241.730 3.184 769.000 235.450 6.508 1532.000 >>>S123:OK
monthDataOffset=-86400
pi@raspberrypi ~ $[/code]

Can someone help me ?
Thanks.
Tony
Coordinator
Sep 28, 2015 at 7:10 PM
Are you sure you're using the correct command line?
Think you have to add -q
Sep 28, 2015 at 9:24 PM
Edited Sep 29, 2015 at 12:39 PM
SBF wrote:
Are you sure you're using the correct command line?
Think you have to add -q
I test adding the -q option and the -finq (because it's dark). This the result:

/usr/local/bin/sbfspot.3/SBFspot -q -finq -123s=DATA
20150928-23:23:06 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 26853.290 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 >>>S123:OK
monthDataOffset=-86400

Why ?

This problem was not present in the 3.1.1 version.
Sep 30, 2015 at 4:08 PM
Edited Sep 30, 2015 at 4:09 PM
I can confirm the problem Tony raises, here is my example and result showing that a "monthDataOffsett" line is now being written out, maybe a line left in the code for debug purposes?

./SBFspot -q -nocsv -nosql -sp0
monthDataOffset=-86400
Coordinator
Sep 30, 2015 at 5:06 PM
In SBFspot.cpp search for:
if (DEBUG_HIGHEST)
    std::cout << "monthDataOffset=" << inverters[inv]->monthDataOffset << std::endl;
Either erase these 2 lines or change it to :
if ((DEBUG_HIGHEST) && (!quiet))
    std::cout << "monthDataOffset=" << inverters[inv]->monthDataOffset << std::endl;
Oct 7, 2015 at 10:54 AM
SBF wrote:
In SBFspot.cpp search for:
if (DEBUG_HIGHEST)
    std::cout << "monthDataOffset=" << inverters[inv]->monthDataOffset << std::endl;
Either erase these 2 lines or change it to :
if ((DEBUG_HIGHEST) && (!quiet))
    std::cout << "monthDataOffset=" << inverters[inv]->monthDataOffset << std::endl;
I cannot find these lines in the SBFspot.cpp file and i cannot correct as you suggested.
I hope that a new version can correct this error.
Thanks.
Coordinator
Oct 7, 2015 at 3:08 PM
Sorry, it's in ArchData.cpp (near the end)
Oct 11, 2015 at 3:25 PM
Edited Oct 11, 2015 at 3:38 PM
Good morning,
Even in my installation 3.1.2
OS : Linux 4.1.7-v7+ GNU/Linux System : raspberrypi model name : ARMv7 Processor rev 5 (v7l)
/home/pi/sbfspot.3/SBFspot/ArcData.cpp 2015-09-22 21:18
I use the exact same problem
pi@raspberrypi ~ $ /usr/local/bin/sbfspot.3/SBFspot -finq -q -123s=DATA -cfg/var/www/123solar/config/SBFspot_1.cfg -nosql
20151011-16:56:05 242.420 2.162 524.000 0.000 0.000 0.000 0.000 0.000 0.000 49.960 89.573 34.940 0.000 15380.103 404.390 0.727 293.000 408.580 0.717 292.000 242.420 2.162 524.000 >>>S123:OK
monthDataOffset=-86400

but ArcData.cpp not find the lines indicated.
single line like the bottom is
//Issue 115
E_SBFSPOT getMonthDataOffset(InverterData *inverters[])
{
    time_t now = time(NULL);
    struct tm now_tm;
    memcpy(&now_tm, gmtime(&now), sizeof(now_tm));

    E_SBFSPOT rc = E_OK;

    rc = ArchiveMonthData(inverters, &now_tm);

    if (rc == E_OK)
    {
        for (int inv=0; inverters[inv]!=NULL && inv<MAX_INVERTERS; inv++)
        {
            inverters[inv]->monthDataOffset = 0;
            // Get last record of monthdata
            for(unsigned int i = sizeof(inverters[inv]->monthData)/sizeof(MonthData); i > 0; i--)
            {
                if (inverters[inv]->monthData[i].datetime != 0)
                {
                    if ((inverters[inv]->monthData[i].datetime - now) < 86400)
                        inverters[inv]->monthDataOffset = -86400;

                    break;
                }
            }

            std::cout << "monthDataOffset=" << inverters[inv]->monthDataOffset << std::endl;
        }
    }

    return rc;
}
Coordinator
Oct 11, 2015 at 6:40 PM
I uploaded V3.1.2 with the fixed file included. You can find it here
Oct 11, 2015 at 9:41 PM
Hello,
I saw that it was made a minor change to the file archdata.cpp .
123solar inverter sma passes the test
thank you
Oct 12, 2015 at 1:09 PM
SBF wrote:
I uploaded V3.1.2 with the fixed file included. You can find it here
Many Thanks Dear SBF.