Skip to content

Commit 88a3f07

Browse files
committed
fix dehumidification bug
1 parent d09b676 commit 88a3f07

File tree

6 files changed

+36
-6
lines changed

6 files changed

+36
-6
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Refer to the [Commissioning Scripts](https://github.com/automatic-controls/commi
2525
- **Airflow Damper** - Creates and analyzes a graph of airflow (*cfm*) vs damper position (*%*). Intended for use with dampers controlled by an airflow microblock (e.g, the integrated dampers on [ZN141A](https://www.automatedlogic.com/en/products/webctrl-building-automation-system/building-controllers/zn141a/), [ZN341A](https://www.automatedlogic.com/en/products/webctrl-building-automation-system/building-controllers/zn341a/), [OF141-E2](https://www.automatedlogic.com/en/products/webctrl-building-automation-system/building-controllers/OF141-E2/), and [OF342-E2](https://www.automatedlogic.com/en/products/webctrl-building-automation-system/building-controllers/OF342-E2/). When heating/cooling elements are tested, the airflow setpoint is set to the heating/cooling maximum.
2626
- **Fans** - Performs start/stop tests on any number of fans. Requires a binary/analog output to command each fan on or off. Optionally may include a second output which controls VFD speed. The script expects a binary input for monitoring fan status. When testing airflow dampers and heating/cooling elements, all fans are commanded on to ensure adequate airflow.
2727
- **Heating / Cooling Elements** - Creates and analyzes a graph of temperature (*°F*) vs time (*minutes*). Requires an output for turning each element on/off. Also requires a leaving air temperature sensor, but an entering air temperature sensor is optional. An optional status input and reversing output may be included. The reversing output control is designed to switch the mode of an element from heating to cooling or vice versa.
28-
- **Dehumidification** - Creates and analyzes a graph of humidity (*%*) vs time (*minutes*). Requires a binary/analog output for commanding dehumidification to turn on/off. Temperature is also monitored for the duration of this test to verify that dehumidification mode does not significantly alter temperature.
28+
- **Dehumidification** - Creates and analyzes a graph of humidity (*%*) vs time (*minutes*). Requires a binary/analog output for commanding dehumidification to turn on/off. A binary input is optional for monitoring status. Temperature is also monitored for the duration of this test to verify that dehumidification mode does not significantly alter temperature.
2929
- **OA / RA Dampers** - For the duration of all tests, the OA damper is fully closed, and the RA damper is fully opened. In the future, I may implement logic to test economizing capabilities of OA / RA dampers.
3030

3131
If your control program does not match these specifications exactly, there are workarounds which can be implemented in the logic. For example, if a supply fan uses an analog input to monitor status by measuing amp draw, then you could throw an *BACnet Binary Value Status* microblock into the logic which turns on when the amp draw is above a certain threshold. Then you would map the status tag to this microblock instead.
@@ -108,8 +108,9 @@ For mapping multiple *on* and *off* points, occurences of `#` should be replaced
108108
| `dehum_lock_min` | `dehum/min_pres_value` | Minimum DEHU lock value |
109109
| `dehum_lock_max` | `dehum/max_pres_value` | Maximum DEHU lock value |
110110
| `dehum_fault` | `dehum/status_flags/fault` | Whether DEHU has a fault |
111+
| `dehum_status` | `dehum_status/present_value` | Whether the DEHU component has status |
111112

112-
These mappings are meant to control a single analog/binary output. Before testing dehumidification mode, all elements with a reversing command are switched to cooling mode. It is expected that locking this output on is sufficient to simulate/trigger dehumidification mode. The `dehum_lock_flag` and `dehum_lock_value` tags are required, but the others are optional.
113+
These mappings are meant to control a single analog/binary output. Before testing dehumidification mode, all elements with a reversing command are switched to cooling mode. It is expected that locking this output on is sufficient to simulate/trigger dehumidification mode. The `dehum_lock_flag` and `dehum_lock_value` tags are required, but the others are optional. `dehum_status` might be mapped to a particular compressor's status in a heat pump, for example.
113114

114115
### Airflow Dampers
115116
| Semantic Tag | Sample Expression | Description |

resources/tags_generic.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"dehum_lock_min": "dehum/min_pres_value",
2323
"dehum_lock_max": "dehum/max_pres_value",
2424
"dehum_fault": "dehum/status_flags/fault",
25+
"dehum_status":"dehum_status/present_value",
2526

2627
"off#_lock_flag": "off#/locked",
2728
"off#_lock_value": "off#/locked_value",

src/aces/webctrl/scripts/terminalunits/Data.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@ public class Data implements Comparable<Data> {
2121
private volatile PrimaryTemp temp;
2222
private volatile Humidity hum;
2323
private volatile Output dehum;
24+
private volatile BinaryInput dehumStatus;
2425
private volatile OATemp oat;
2526
private volatile OADamper oad;
2627
private volatile Airflow air;
2728
private volatile Fan fans[];
2829
private volatile boolean hasFans = false;
2930
private volatile Element elements[];
3031
private volatile int numElements = 0;
32+
private volatile boolean dehumStartTest = false;
33+
private volatile boolean dehumStopTest = false;
3134
private volatile boolean alarmTriggered = false;
3235
private volatile boolean lossOfAirflow = false;
3336
private volatile Trend tempTrend = null;
@@ -49,13 +52,15 @@ public Data(ResolvedTestingUnit x, Params p) throws Throwable {
4952
temp = new PrimaryTemp(this);
5053
hum = new Humidity(this);
5154
dehum = new Output(this, "dehum");
55+
dehumStatus = new BinaryInput(this, "dehum_status");
5256
oat = new OATemp(this);
5357
oad = new OADamper(this);
5458
air = new Airflow(this);
5559
if (!alarm.isDefined()){ alarm = null; }
5660
if (!temp.isDefined()){ temp = null; }
5761
if (!hum.isDefined()){ hum = null; }
5862
if (!dehum.isDefined()){ dehum = null; }
63+
if (!dehumStatus.isDefined()){ dehumStatus = null; }
5964
if (!oat.isDefined()){ oat = null; }
6065
if (!oad.isDefined()){ oad = null; }
6166
if (!air.isDefined()){ air = null; }
@@ -451,8 +456,12 @@ public int compare(Element a, Element b){
451456
if ((t=hum.get(5, 2000))==null){
452457
break testing;
453458
}
459+
if (dehumStatus!=null && !dehumStatus.get(true)){
460+
dehumStopTest = true;
461+
}
454462
if (dehum.set(true)){
455463
humTrend = new Trend(64);
464+
humTrend.offset = 45;
456465
humTrend.add(t);
457466
while (true){
458467
Thread.sleep(10000L);
@@ -478,6 +487,9 @@ public int compare(Element a, Element b){
478487
seg.highDanger = temp.highLimitPass;
479488
break;
480489
}
490+
if (dehumStatus!=null && !dehumStartTest && !dehumStatus.hasFault() && dehumStatus.get(false)){
491+
dehumStartTest = true;
492+
}
481493
}
482494
}
483495
}
@@ -501,6 +513,9 @@ public int compare(Element a, Element b){
501513
}
502514
if (dehum!=null){
503515
sb.append("<br>Dehumidification&nbsp;Command");
516+
if (dehumStatus!=null){
517+
sb.append("&nbsp;+&nbsp;Status");
518+
}
504519
}
505520
if (oad!=null){
506521
sb.append("<br>Outdoor&nbsp;Air&nbsp;Damper");
@@ -600,6 +615,7 @@ public void print(final StringBuilder sb, final boolean JSON){
600615
prefix|=addProblem(sb, temp, "Primary Temperature Sensor", prefix);
601616
prefix|=addProblem(sb, hum, "Humidity Sensor", prefix);
602617
prefix|=addProblem(sb, dehum, "Dehumidification Command", prefix);
618+
prefix|=addProblem(sb, dehumStatus, "Dehumidification Status", prefix);
603619
prefix|=addProblem(sb, oat, "OAT Sensor", prefix);
604620
prefix|=addProblem(sb, oad, "OAD Command", prefix);
605621
prefix|=addProblem(sb, air, "Airflow Microblock", prefix);
@@ -620,6 +636,7 @@ public void print(final StringBuilder sb, final boolean JSON){
620636
prefix|=addFault(sb, temp, "Primary Temperature Sensor", prefix);
621637
prefix|=addFault(sb, hum, "Humidity Sensor", prefix);
622638
prefix|=addFault(sb, dehum, "Dehumidification Command", prefix);
639+
prefix|=addFault(sb, dehumStatus, "Dehumidification Status", prefix);
623640
prefix|=addFault(sb, oat, "OAT Sensor", prefix);
624641
prefix|=addFault(sb, oad, "OAD Command", prefix);
625642
prefix|=addFault(sb, air, "Airflow Microblock", prefix);
@@ -717,6 +734,16 @@ public void print(final StringBuilder sb, final boolean JSON){
717734
}
718735
sb.append(",\n\"commandTests\":[\n");
719736
prefix = false;
737+
if (humTrend!=null && dehumStatus!=null){
738+
if (prefix){
739+
sb.append(",\n");
740+
}else{
741+
prefix = true;
742+
}
743+
sb.append("{\n\"name\":\"Dehum\",\n");
744+
sb.append("\"start\":").append(dehumStartTest).append(",\n");
745+
sb.append("\"stop\":").append(dehumStopTest).append("\n}");
746+
}
720747
if (hasFans && p.ctrlFans){
721748
for (i=0;i<fans.length;++i){
722749
if (fans[i]!=null && fans[i].status().isDefined()){

src/aces/webctrl/scripts/terminalunits/Output.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@
393393
let xPrev = 0;
394394
let yPrev = 0;
395395
for (const z of trend){
396-
addTest("Dehumidification", !z["increasing"] && z["max"]-z["min"]>=Number(humMargin.value));
396+
addTest("Dehumidification", !z["increasing"] && z["max"]-z["min"]>=Number(humMargin.value), tdGeneralTests);
397397
const xData = z["x"];
398398
const yData = z["y"];
399399
for (var i = 0; i < yData.length; ++i) {
@@ -411,7 +411,7 @@
411411
}
412412
addTest("Erratic Humidistat", success, tdGeneralTests);
413413
const tHum = y["tempTrend"][y["tempTrend"].length-1];
414-
addTest("Dehumidification Temperature Constant", tHum["max"]-tHum["min"]<Number(humTMargin.value));
414+
addTest("Dehumidification Temperature Constant", tHum["max"]-tHum["min"]<Number(humTMargin.value), tdGeneralTests);
415415
}
416416
}
417417
};

src/aces/webctrl/scripts/terminalunits/TerminalUnitTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class TerminalUnitTest extends Script {
1212
private volatile String outputString = null;
1313
private volatile Params p = null;
1414
@Override public String getDescription(){
15-
return "<a href=\"https://github.com/automatic-controls/commissioning-scripts/tree/main/samples/TerminalUnitTest\" target=\"_blank\" style=\"border:none;\">Terminal Unit Commissioning Script</a> v0.2.0<br>Evaluates performance of fans, dampers, heating, cooling, and dehumidification components.";
15+
return "<a href=\"https://github.com/automatic-controls/commissioning-scripts/tree/main/samples/TerminalUnitTest\" target=\"_blank\" style=\"border:none;\">Terminal Unit Commissioning Script</a> v0.2.1<br>Evaluates performance of fans, dampers, heating, cooling, and dehumidification components.";
1616
}
1717
@Override public String[] getParamNames(){
1818
return new String[]{"Dampers", "Fans", "Heating / Cooling"};

src/aces/webctrl/scripts/terminalunits/Trend.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public class Trend {
88
public volatile double OFFSET_FACTOR = 0.018;
99
public volatile int TRAILING_AVG = 5;
1010
public volatile int MIDDLE_AVG = 10;
11+
public volatile int offset = 15;
1112
public volatile long[] x;
1213
public volatile double[] y;
1314
public volatile int len = 0;
@@ -91,7 +92,7 @@ public boolean isIncreasing(){
9192
* @return whether this trend appears to have stabalized.
9293
*/
9394
public boolean hasStabilized(){
94-
if (len<start+MIDDLE_AVG+TRAILING_AVG+15){
95+
if (len<start+MIDDLE_AVG+TRAILING_AVG+offset){
9596
return false;
9697
}
9798
int i;

0 commit comments

Comments
 (0)