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