-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPID20_DeadZone.patch
44 lines (41 loc) · 2.05 KB
/
PID20_DeadZone.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Index: fhem/FHEM/98_PID20.pm
===================================================================
--- fhem/FHEM/98_PID20.pm (revision 11268)
+++ fhem/FHEM/98_PID20.pm (working copy)
@@ -102,6 +102,7 @@
. 'pidActorKeepAlive '
. 'pidActorLimitLower '
. 'pidActorLimitUpper '
+ . 'pidActorDeadZoneLower '
. 'pidActorCallBeforeSetting '
. 'pidIPortionCallBeforeSetting '
. 'pidCalcInterval '
@@ -316,7 +317,8 @@
$ret .= 'Factor I : ' . $hash->{helper}{factor_I} . "\n";
$ret .= 'Factor D : ' . $hash->{helper}{factor_D} . "\n\n";
$ret .= 'Actor lower limit: ' . $hash->{helper}{actorLimitLower} . "\n";
- $ret .= 'Actor upper limit: ' . $hash->{helper}{actorLimitUpper} . "\n";
+ $ret .= 'Actor upper limit: ' . $hash->{helper}{actorLimitUpper} . "\n\n";
+ $ret .= 'Actor lower dead zone: ' . $hash->{helper}{actorDeadZoneLower} . "\n";
return $ret;
}
default { return $usage; }
@@ -468,6 +470,8 @@
my $actorLimitLower = $hash->{helper}{actorLimitLower};
$hash->{helper}{actorLimitUpper} = ( AttrVal( $name, 'pidActorLimitUpper', 100 ) =~ m/$reFloat/ ) ? $1 : 100;
my $actorLimitUpper = $hash->{helper}{actorLimitUpper};
+ $hash->{helper}{actorDeadZoneLower} = ( AttrVal( $name, 'pidActorDeadZoneLower', 0 ) =~ m/$reFloat/ ) ? $1 : 0;
+ my $actorDeadZoneLower = $hash->{helper}{actorDeadZoneLower};
$hash->{helper}{factor_P} = ( AttrVal( $name, 'pidFactor_P', 25 ) =~ m/$reFloatpos/ ) ? $1 : 25;
$hash->{helper}{factor_I} = ( AttrVal( $name, 'pidFactor_I', 0.25 ) =~ m/$reFloatpos/ ) ? $1 : 0.25;
$hash->{helper}{factor_D} = ( AttrVal( $name, 'pidFactor_D', 0 ) =~ m/$reFloatpos/ ) ? $1 : 0;
@@ -574,6 +578,12 @@
# calc actuation
$actuationCalc = $pPortion + $iPortion + $dPortion;
+
+ # add dead zone offset
+ if ($actuationCalc > 0.1)
+ {
+ $actuationCalc = $actuationCalc + $actorDeadZoneLower;
+ }
PID20_Log $hash, 2, 'P1 delta:' . sprintf( "%.2f", $delta ) . " isWindup:$isWindup" if ($DEBUG_Calc);