diff --git a/loadvars.sh b/loadvars.sh index 9d3666ca6..a7feccb98 100755 --- a/loadvars.sh +++ b/loadvars.sh @@ -1189,7 +1189,15 @@ loadvars(){ pvallwh=$(echo "$pvkwh + $pv2kwh" |bc) echo $pvallwh > /var/www/html/openWB/ramdisk/pvallwh fi - + # monthly / yearly fuer status rechnen (csv aus cronnight und laufend) + pvdaily=$( /var/www/html/openWB/ramdisk/yearly_pvkwhk + echo $pvmonthly > /var/www/html/openWB/ramdisk/monthly_pvkwhk + # rechnen ende if [[ $speichermodul == "speicher_e3dc" ]] || [[ $speichermodul == "speicher_tesvoltsma" ]] || [[ $speichermodul == "speicher_solarwatt" ]] || [[ $speichermodul == "speicher_rct" ]]|| [[ $speichermodul == "speicher_lgessv1" ]] || [[ $speichermodul == "speicher_bydhv" ]] || [[ $speichermodul == "speicher_kostalplenticore" ]] || [[ $speichermodul == "speicher_powerwall" ]] || [[ $speichermodul == "speicher_sbs25" ]] || [[ $speichermodul == "speicher_solaredge" ]] || [[ $speichermodul == "speicher_sonneneco" ]] || [[ $speichermodul == "speicher_varta" ]] ; then ra='^-?[0-9]+$' watt2=$( int(startspalten/2)) and (i < startspalten): + sumcsvtj [i - int(startspalten/2)] = float (sumcsvtj [i - int(startspalten/2)] ) + float( sumrow [i] ) + #print ('I %s %s ' % (str(i),str(sumrow [i]))) sumline=sumline+ str(sumrow [i-1]) if i < (startspalten+1): sumline=sumline+ ',' @@ -378,6 +394,13 @@ def reyeardet(calcyear): f1.write(str(headerline)) f1.close() os.chmod(file_stringos, 0o777) + #hier aktuelle pv Leistung fuer diesen jahr schreiben + if (akt_year == 1): + f1 = open('/var/www/html/openWB/ramdisk/yearly_pvkwhk_csv', 'w') + # pv pos 3 + f1.write(str(float("%.3f" % sumcsvtj [3]))) + f1.close() + os.chmod('/var/www/html/openWB/ramdisk/yearly_pvkwhk_csv', 0o777) print ('%s %s written' % (getTime(),file_stringos)) return def remonth(jjjjmm): @@ -397,7 +420,7 @@ def remonth(jjjjmm): dds = '0' + str (dd) datestring = str(jjjjmm) + dds[-2:] file_stringi = inputp + datestring + '.csv' - (file_stringo,file_stringos) = outfiledef(jjjjmm) + (file_stringo,file_stringos,akt_month) = outfiledef(jjjjmm) if os.path.isfile(file_stringi): ifile=1 else: @@ -464,7 +487,7 @@ def remonth(jjjjmm): except Exception as e: print ('%s error1 %s inhalt %s' % (getTime(),datestring, str(e) )) #summenfile schreiben - fillcounts(monhtrow,file_stringos,lastdate,lastzeit) + fillcounts(monhtrow,file_stringos,lastdate,lastzeit,akt_month) return def checkyear(calcyear): #lesen summenfile year @@ -476,7 +499,7 @@ def checkyear(calcyear): lastspalten = 0 dfile=0 ifile=0 - (file_stringo,file_stringos) = outfiledefyear(calcyear) + (file_stringo,file_stringos,akt_year) = outfiledefyear(calcyear) try: if os.path.isfile(file_stringos): ifile=1 @@ -493,7 +516,7 @@ def checkyear(calcyear): dds = '0' + str (dd) datestring = int(str(calcyear) + dds[-2:]) #letzses summenfile montssuchen - (file_stringi,file_stringis) = outfiledef(datestring) + (file_stringi,file_stringis,akt_month) = outfiledef(datestring) if os.path.isfile(file_stringis): dfile=1 f = open( file_stringis, 'r') @@ -527,7 +550,7 @@ def checkmonth(jjjjmm): compspalten = 0 dfile=0 ifile=0 - (file_stringo,file_stringos) = outfiledef(jjjjmm) + (file_stringo,file_stringos,akt_month) = outfiledef(jjjjmm) try: if os.path.isfile(file_stringos): ifile=1 @@ -648,11 +671,12 @@ def reyear(): countercsv = [] sumcsv = [] sumcsvt = [] + sumcsvtj = [] for i in range (1,SUMCOLUMNSTART+1): countercsv.append("0") sumcsv.append("0") sumcsvt.append(float(0)) - + sumcsvtj.append(float(0)) prep() print ('%s csvcalc.py processing mode %s date jjjjmm %6d' % (getTime(),mode,jjjjmm)) if (mode == 'M'): diff --git a/runs/initRamdisk.sh b/runs/initRamdisk.sh index adbcd2a62..1ad27e06e 100644 --- a/runs/initRamdisk.sh +++ b/runs/initRamdisk.sh @@ -245,6 +245,7 @@ initRamdisk(){ echo 0 > $RamdiskPath/daily_pvkwhk1 echo 0 > $RamdiskPath/daily_pvkwhk2 echo 0 > $RamdiskPath/monthly_pvkwhk + echo 0 > $RamdiskPath/monthly_pvkwhk_csv echo 0 > $RamdiskPath/monthly_pvkwhk1 echo 0 > $RamdiskPath/monthly_pvkwhk2 echo 0 > $RamdiskPath/nurpv70dynstatus @@ -268,6 +269,7 @@ initRamdisk(){ echo 0 > $RamdiskPath/pvwatt1 echo 0 > $RamdiskPath/pvwatt2 echo 0 > $RamdiskPath/yearly_pvkwhk + echo 0 > $RamdiskPath/yearly_pvkwhk_csv echo 0 > $RamdiskPath/yearly_pvkwhk1 echo 0 > $RamdiskPath/yearly_pvkwhk2