-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replaced inheritance with ownership, handled ripples (#311)
- Loading branch information
1 parent
cc0cff5
commit 6befbc1
Showing
7 changed files
with
100 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
* | ||
* @author Copyright © <a href="mailto:[email protected]">Vadim Tkachenko</a> 2001-2024 | ||
*/ | ||
public class EconomizerConfig extends EconomizerSettings { | ||
public class EconomizerConfig { | ||
|
||
/** | ||
* Which mode this device is active in. This mode may be different from the zone mode; it is the user's | ||
|
@@ -21,54 +21,31 @@ public class EconomizerConfig extends EconomizerSettings { | |
|
||
public final Double saturationLimit; | ||
|
||
/** | ||
* All except {@code enabled} argument constructor (defaults to {@code true}, for common sense. | ||
* | ||
* @param keepHvacOn See {@link #keepHvacOn}. Think twice before setting this to {@code true}. | ||
* @param P Internal {@link net.sf.dz3r.controller.pid.PidController} P component. | ||
* @param I Internal {@link net.sf.dz3r.controller.pid.PidController} I component. | ||
* @param saturationLimit Internal {@link net.sf.dz3r.controller.pid.PidController} saturation limit. | ||
*/ | ||
public EconomizerConfig(HvacMode mode, | ||
Double changeoverDelta, Double targetTemperature, | ||
Boolean keepHvacOn, | ||
Double P, Double I, Double saturationLimit) { | ||
this(mode, true, changeoverDelta, targetTemperature, keepHvacOn, P, I, saturationLimit); | ||
} | ||
public final EconomizerSettings settings; | ||
|
||
/** | ||
* All argument constructor. | ||
* | ||
* @param keepHvacOn See {@link #keepHvacOn}. Think twice before setting this to {@code true}. | ||
* @param P Internal {@link net.sf.dz3r.controller.pid.PidController} P component. | ||
* @param I Internal {@link net.sf.dz3r.controller.pid.PidController} I component. | ||
* @param saturationLimit Internal {@link net.sf.dz3r.controller.pid.PidController} saturation limit. | ||
* @param settings User changeable settings. | ||
*/ | ||
public EconomizerConfig(HvacMode mode, | ||
Boolean enabled, | ||
Double changeoverDelta, Double targetTemperature, | ||
Boolean keepHvacOn, | ||
Double P, Double I, Double saturationLimit) { | ||
super(enabled, changeoverDelta, targetTemperature, keepHvacOn); | ||
Double P, Double I, Double saturationLimit, | ||
EconomizerSettings settings) { | ||
|
||
if (mode == null) { | ||
throw new IllegalArgumentException("mode can't be null"); | ||
} | ||
|
||
this.mode = mode; | ||
|
||
this.P = P; | ||
this.I = I; | ||
this.saturationLimit = saturationLimit; | ||
|
||
checkArgs(); | ||
} | ||
|
||
protected void checkArgs() { | ||
|
||
if (mode == null) { | ||
throw new IllegalArgumentException("mode can't be null"); | ||
} | ||
|
||
if (changeoverDelta < 0) { | ||
throw new IllegalArgumentException("changeoverDelta must be non-negative"); | ||
} | ||
this.settings = settings; | ||
} | ||
|
||
/** | ||
|
@@ -79,26 +56,25 @@ protected void checkArgs() { | |
public EconomizerConfig merge(EconomizerConfig from) { | ||
|
||
return new EconomizerConfig( | ||
from.mode != null ? from.mode : mode, | ||
from.enabled != null ? from.enabled : enabled, | ||
from.changeoverDelta != null ? from.changeoverDelta : changeoverDelta, | ||
from.targetTemperature != null ? from.targetTemperature : targetTemperature, | ||
from.keepHvacOn != null ? from.keepHvacOn : keepHvacOn, | ||
from.mode, | ||
from.P != null ? from.P : P, | ||
from.I != null ? from.I : I, | ||
from.saturationLimit != null ? from.saturationLimit : saturationLimit); | ||
from.saturationLimit != null ? from.saturationLimit : saturationLimit, | ||
from.settings != null ? from.settings : settings); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "{mode=" + mode | ||
+ ", enabled=" + enabled | ||
+ ", changeoverDelta=" + changeoverDelta | ||
+ ", targetTemperature=" + targetTemperature | ||
+ ", keepHvacOn=" + keepHvacOn | ||
+ ", enabled=" + isEnabled() | ||
+ ", P=" + P | ||
+ ", I=" + I | ||
+ ", saturationLimit=" + saturationLimit | ||
+ ", settings=" + settings | ||
+ "}"; | ||
} | ||
|
||
public boolean isEnabled() { | ||
return settings != null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.