2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

git-svn-id: https://svn.fhem.de/fhem/trunk@4627 2b470e98-0d58-463d-a4d8-8e2adae1ed80

This commit is contained in:
pahenning 2014-01-12 06:42:22 +00:00
parent db4c522528
commit a0d2b9d4dc

View File

@ -436,9 +436,9 @@ sub OWCOUNT_FormatValues($) {
}else{
#-- only if attribute value mode=daily, take the midnight value from memory
if( $daily == 1){
$vval = int( (($owg_val[$i] + $offset)*$factor - $owg_midnight[$i])*100)/100;
$vval = int( (($owg_val[$i] + $offset)*$factor - $owg_midnight[$i])*10000+0.5)/10000;
} else {
$vval = int( ($owg_val[$i] + $offset)*$factor*100)/100;
$vval = int( ($owg_val[$i] + $offset)*$factor*10000+0.5)/10000;
}
#-- rate calculation: get the old values
@ -450,7 +450,7 @@ sub OWCOUNT_FormatValues($) {
if( length($oldtim) > 0 ){
#-- correct counter wraparound since last reading
if( $vval < $oldval) {
$oldval -= 65536*(65536*$factor);
$oldval -= (65536*$factor);
}
#-- previous measurement time
@ -465,6 +465,7 @@ sub OWCOUNT_FormatValues($) {
#-- rate
if( ($delt > 0.0) && $present ){
$vrate = ($vval-$oldval)/$delt;
Log 1, "Caluclating rate from oldval=$oldval, vval=$vval, delt=$delt as $vrate";
} else {
$vrate = 0.0;
}
@ -474,13 +475,13 @@ sub OWCOUNT_FormatValues($) {
}elsif( $period eq "minute" ){
$vrate*=60;
}
$vrate = int($vrate * 100)/100;
$vrate = int($vrate * 10000+0.5)/10000;
#--midnight extrapolation only possible if previous measurement
if( $daybreak==1 ){
#-- linear extrapolation
$dt = -$delf/$delt;
$dval = int(($vval+($vval-$oldval)*$dt)*100)/100;
$dval = int(($vval+($vval-$oldval)*$dt)*10000+0.5)/10000;
if( $daily == 1 ){
$dval2 = $dval+$owg_midnight[$i];