-
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.
Augmented ZoneStatus with EconomizerStatus (#239)
- Loading branch information
1 parent
442f780
commit 59167b4
Showing
21 changed files
with
197 additions
and
117 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
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 |
---|---|---|
|
@@ -2,7 +2,12 @@ | |
|
||
import net.sf.dz3r.model.HvacMode; | ||
|
||
public class EconomizerSettings { | ||
/** | ||
* Full set of economizer settings. | ||
* | ||
* @author Copyright © <a href="mailto:[email protected]">Vadim Tkachenko</a> 2001-2022 | ||
*/ | ||
public class EconomizerSettings extends EconomizerTransientSettings { | ||
|
||
public final String name; | ||
|
||
|
@@ -11,16 +16,6 @@ public class EconomizerSettings { | |
*/ | ||
public final HvacMode mode; | ||
|
||
/** | ||
* Temperature difference between indoor and outdoor temperature necessary to turn the device on. | ||
*/ | ||
public final double changeoverDelta; | ||
|
||
/** | ||
* When this temperature is reached, the device is shut off. | ||
*/ | ||
public final double targetTemperature; | ||
|
||
/** | ||
* {@code true} means that turning on the device will NOT turn the HVAC off. | ||
* You probably want to keep this at {@code false}, unless the indoor temperature is measured at HVAC return | ||
|
@@ -38,7 +33,7 @@ public class EconomizerSettings { | |
* Primary constructor with just the {@link #mode}, {@link #changeoverDelta}, and {@link #targetTemperature} values provided, | ||
* {@link #keepHvacOn} set to {@code false}, and PI controller with default settings. | ||
*/ | ||
public EconomizerSettings( String name, HvacMode mode, double changeoverDelta, double targetTemperature) { | ||
public EconomizerSettings(String name, HvacMode mode, double changeoverDelta, double targetTemperature) { | ||
// VT: FIXME: I and saturationLimit of 0 are bad defaults, will need to be adjusted when deployed to production | ||
this(name, mode, changeoverDelta, targetTemperature, false, 1, 0, 0); | ||
} | ||
|
@@ -55,11 +50,10 @@ public EconomizerSettings(String name, | |
HvacMode mode, double changeoverDelta, double targetTemperature, | ||
boolean keepHvacOn, | ||
double P, double I, double saturationLimit) { | ||
super(changeoverDelta, targetTemperature); | ||
this.name = name; | ||
|
||
this.mode = mode; | ||
this.changeoverDelta = changeoverDelta; | ||
this.targetTemperature = targetTemperature; | ||
this.keepHvacOn = keepHvacOn; | ||
|
||
this.P = P; | ||
|
36 changes: 36 additions & 0 deletions
36
...del/src/main/java/net/sf/dz3r/device/actuator/economizer/EconomizerTransientSettings.java
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package net.sf.dz3r.device.actuator.economizer; | ||
|
||
/** | ||
* Set of economizer settings that can change over time by the user. | ||
* | ||
* @author Copyright © <a href="mailto:[email protected]">Vadim Tkachenko</a> 2001-2022 | ||
*/ | ||
public class EconomizerTransientSettings { | ||
|
||
/** | ||
* Temperature difference between indoor and outdoor temperature necessary to turn the device on. | ||
*/ | ||
public final double changeoverDelta; | ||
|
||
/** | ||
* When this temperature is reached, the device is shut off. | ||
*/ | ||
public final double targetTemperature; | ||
|
||
public EconomizerTransientSettings(double changeoverDelta, double targetTemperature) { | ||
this.changeoverDelta = changeoverDelta; | ||
this.targetTemperature = targetTemperature; | ||
} | ||
|
||
public EconomizerTransientSettings(EconomizerSettings source) { | ||
this.changeoverDelta = source.changeoverDelta; | ||
this.targetTemperature = source.targetTemperature; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "{changeoverDelta=" + changeoverDelta | ||
+ ", targetTemperature=" + targetTemperature | ||
+ "}"; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
import net.sf.dz3r.controller.pid.SimplePidController; | ||
import net.sf.dz3r.device.Addressable; | ||
import net.sf.dz3r.signal.Signal; | ||
import net.sf.dz3r.signal.hvac.ThermostatStatus; | ||
import net.sf.dz3r.signal.hvac.CallingStatus; | ||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import reactor.core.publisher.Flux; | ||
|
@@ -28,7 +28,7 @@ | |
* | ||
* @author Copyright © <a href="mailto:[email protected]">Vadim Tkachenko</a> 2001-2021 | ||
*/ | ||
public class Thermostat implements ProcessController<Double, ThermostatStatus, Void>, Addressable<String> { | ||
public class Thermostat implements ProcessController<Double, CallingStatus, Void>, Addressable<String> { | ||
|
||
private final Logger logger = LogManager.getLogger(); | ||
|
||
|
@@ -147,7 +147,7 @@ public double getError() { | |
* @see net.sf.dz3r.device.actuator.economizer.v2.PidEconomizer#computeDeviceState(Flux) | ||
*/ | ||
@Override | ||
public Flux<Signal<Status<ThermostatStatus>, Void>> compute(Flux<Signal<Double, Void>> pv) { | ||
public Flux<Signal<Status<CallingStatus>, Void>> compute(Flux<Signal<Double, Void>> pv) { | ||
|
||
logger.debug("compute()"); | ||
|
||
|
@@ -171,14 +171,14 @@ public Flux<Signal<Status<ThermostatStatus>, Void>> compute(Flux<Signal<Double, | |
.map(this::mapOutput); | ||
} | ||
|
||
private Signal<Status<ThermostatStatus>, Void> mapOutput(Signal<Status<Double>, Status<Double>> source) { | ||
private Signal<Status<CallingStatus>, Void> mapOutput(Signal<Status<Double>, Status<Double>> source) { | ||
|
||
var demand = source.payload.signal - signalRenderer.getThresholdLow(); | ||
var calling = Double.compare(source.getValue().signal, 1.0) == 0; | ||
|
||
return new Signal<>( | ||
source.timestamp, | ||
new Status<>(source.payload.setpoint, source.payload.error, new ThermostatStatus(demand, calling)), | ||
new Status<>(source.payload.setpoint, source.payload.error, new CallingStatus(demand, calling)), | ||
null, | ||
source.status, | ||
source.error); | ||
|
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
24 changes: 24 additions & 0 deletions
24
dz3r-model/src/main/java/net/sf/dz3r/signal/hvac/CallingStatus.java
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package net.sf.dz3r.signal.hvac; | ||
|
||
/** | ||
* Calling status. | ||
* | ||
* This object defines the actual thermostat or economizer status in real time. | ||
* | ||
* @author Copyright © <a href="mailto:[email protected]">Vadim Tkachenko</a> 2001-2022 | ||
*/ | ||
public class CallingStatus { | ||
|
||
public final double demand; | ||
public final boolean calling; | ||
|
||
public CallingStatus(double demand, boolean calling) { | ||
this.demand = demand; | ||
this.calling = calling; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "{demand=" + demand + ", calling=" + calling + "}"; | ||
} | ||
} |
Oops, something went wrong.