-
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 3baddd2
Showing
19 changed files
with
153 additions
and
103 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 |
---|---|---|
|
@@ -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 + "}"; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
dz3r-model/src/main/java/net/sf/dz3r/signal/hvac/EconomizerStatus.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,29 @@ | ||
package net.sf.dz3r.signal.hvac; | ||
|
||
import net.sf.dz3r.device.actuator.economizer.EconomizerSettings; | ||
import net.sf.dz3r.signal.Signal; | ||
|
||
/** | ||
* Economiser status. | ||
* | ||
* @see net.sf.dz3r.device.actuator.economizer.AbstractEconomizer | ||
* @author Copyright © <a href="mailto:[email protected]">Vadim Tkachenko</a> 2001-2022 | ||
*/ | ||
public class EconomizerStatus { | ||
|
||
public final EconomizerSettings settings; | ||
public final CallingStatus callingStatus; | ||
public final Signal<Double, Void> ambient; | ||
|
||
public EconomizerStatus(EconomizerSettings settings, double demand, boolean calling, Signal<Double, Void> ambient) { | ||
|
||
this.settings = settings; | ||
this.callingStatus = new CallingStatus(demand, calling); | ||
this.ambient = ambient; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "{demand=" + callingStatus.demand + ", calling=" + callingStatus.calling + ", ambient=" + ambient + ", settings=" + settings + "}"; | ||
} | ||
} |
28 changes: 0 additions & 28 deletions
28
dz3r-model/src/main/java/net/sf/dz3r/signal/hvac/ThermostatStatus.java
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -9,20 +9,22 @@ | |
* | ||
* @see net.sf.dz3r.model.ZoneSettings | ||
* | ||
* @author Copyright © <a href="mailto:[email protected]">Vadim Tkachenko</a> 2001-2021 | ||
* @author Copyright © <a href="mailto:[email protected]">Vadim Tkachenko</a> 2001-2022 | ||
*/ | ||
public class ZoneStatus { | ||
|
||
public final ZoneSettings settings; | ||
public final ThermostatStatus thermostatStatus; | ||
public final CallingStatus callingStatus; | ||
public final EconomizerStatus economizerStatus; | ||
|
||
public ZoneStatus(ZoneSettings settings, ThermostatStatus thermostatStatus) { | ||
public ZoneStatus(ZoneSettings settings, CallingStatus callingStatus, EconomizerStatus economizerStatus) { | ||
this.settings = settings; | ||
this.thermostatStatus = thermostatStatus; | ||
this.callingStatus = callingStatus; | ||
this.economizerStatus = economizerStatus; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "{settings=" + settings + ", thermostat=" + thermostatStatus + "}"; | ||
return "{settings=" + settings + ", thermostat=" + callingStatus + ", economizer=" + economizerStatus + "}"; | ||
} | ||
} |
Oops, something went wrong.