2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-13 05:06:35 +00:00

- bugfix: correct correction factors for EMEM in 15_CUL_EM.pm

git-svn-id: https://svn.fhem.de/fhem/trunk@269 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
borisneubert 2008-11-15 20:20:45 +00:00
parent e32f7a428c
commit a7069a2bb6
3 changed files with 26 additions and 14 deletions

View File

@ -440,3 +440,4 @@
devices in fhem (Boris 2008-11-02)
- feature: X10 support for pgm3 (Boris 2008-11-02)
- bugfix: FHT short message warning
- bugfix: correct correction factors for EMEM in 15_CUL_EM.pm

View File

@ -29,8 +29,8 @@ CUL_EM_Define($$)
my ($hash, $def) = @_;
my @a = split("[ \t][ \t]*", $def);
return "wrong syntax: define <name> CUL_EM <code> [corr]"
if(int(@a) < 3 || int(@a) > 4);
return "wrong syntax: define <name> CUL_EM <code> [corr1 corr2]"
if(int(@a) != 3 && int(@a) != 5);
return "Define $a[0]: wrong CODE format: valid is 1-12"
if($a[2] !~ m/^\d$/ || $a[2] < 1 || $a[2] > 12);
@ -38,16 +38,22 @@ CUL_EM_Define($$)
if($a[2] >= 1 && $a[2] <= 4) { # EMWZ: nRotation in 5 minutes
my $c = (int(@a) > 3 ? $a[3] : 150);
$hash->{corr} = (12/$c);
$hash->{corr1} = (12/$c);
$hash->{corr2} = (12/$c);
} elsif($a[2] >= 5 && $a[2] <= 8) { # EMEM: 0.01
$hash->{corr} = (int(@a) > 3 ? $a[3] : 0.01);
} elsif($a[2] >= 5 && $a[2] <= 8) { # EMEM
# corr1 is the correction factor for power
$hash->{corr1} = (int(@a) > 3 ? $a[3] : 0.01);
# corr2 is the correction factor for energy
$hash->{corr2} = (int(@a) > 3 ? $a[4] : 0.001);
} elsif($a[2] >= 9 && $a[2] <= 12) { # EMGZ: 0.01
$hash->{corr} = (int(@a) > 3 ? $a[3] : 0.01);
$hash->{corr1} = (int(@a) > 3 ? $a[3] : 0.01);
$hash->{corr2} = (int(@a) > 3 ? $a[4] : 0.01);
} else {
$hash->{corr} = 1;
$hash->{corr1} = 1;
$hash->{corr2} = 1;
}
$defptr{$a[2]} = $hash;
return undef;
@ -78,16 +84,17 @@ CUL_EM_Parse($$)
my $cum = hex($a[ 9].$a[10].$a[ 7].$a[ 8]);
my $lst = hex($a[13].$a[14].$a[11].$a[12]);
my $top = hex($a[17].$a[18].$a[15].$a[16]);
my $val = sprintf("CNT %d CUM: %d 5MIN: %d TOP: %d",
my $val = sprintf("CNT: %d CUM: %d 5MIN: %d TOP: %d",
$cnt, $cum, $lst, $top);
if($defptr{$cde}) {
$hash = $defptr{$cde};
my $corr = $hash->{corr};
$cum *= $corr;
$lst *= $corr;
$top *= $corr;
$val = sprintf("CNT %d CUM: %0.3f 5MIN: %0.3f TOP: %0.3f",
my $corr1 = $hash->{corr1}; # EMEM power correction factor
my $corr2 = $hash->{corr2}; # EMEM energy correction factor
$cum *= $corr2;
$lst *= $corr1;
$top *= $corr1;
$val = sprintf("CNT: %d CUM: %0.3f 5MIN: %0.3f TOP: %0.3f",
$cnt, $cum, $lst, $top);
my $n = $hash->{NAME};
Log GetLogLevel($n,1), "CUL_EM $n: $val";

View File

@ -322,3 +322,7 @@ Fri Jul 25 18:14:26 MEST 2008
- feature: new modules 00_CM11.pm and 20_X10.pm for integration of X10
devices in fhem
- feature: X10 support for pgm3
- Boris Sat Nov 15 CET 2008
- bugfix: correct correction factors for EMEM in 15_CUL_EM.pm