Skip to content

Commit

Permalink
v0.2.0-beta complete rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
cvogt729 committed Dec 20, 2022
1 parent 340a873 commit 48cb059
Show file tree
Hide file tree
Showing 26 changed files with 3,121 additions and 1,008 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
**/*.jar
test.html
**/*.jar
4 changes: 2 additions & 2 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
file:tomcat-embed-core:webserver\lib
url:CommissioningScripts-0.1.2.jar:https://github.com/automatic-controls/commissioning-scripts/releases/download/v0.1.2-beta/CommissioningScripts-0.1.2.jar
url:CommissioningScripts-0.1.2-sources.jar:https://github.com/automatic-controls/commissioning-scripts/releases/download/v0.1.2-beta/CommissioningScripts-0.1.2-sources.jar
url:CommissioningScripts-0.1.3.jar:https://github.com/automatic-controls/commissioning-scripts/releases/download/v0.1.3-beta/CommissioningScripts-0.1.3.jar
url:CommissioningScripts-0.1.3-sources.jar:https://github.com/automatic-controls/commissioning-scripts/releases/download/v0.1.3-beta/CommissioningScripts-0.1.3-sources.jar
328 changes: 232 additions & 96 deletions README.md

Large diffs are not rendered by default.

Binary file modified resources/report1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/report2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 0 additions & 23 deletions resources/tags.json

This file was deleted.

108 changes: 108 additions & 0 deletions resources/tags_ex1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
"eat": "ahu_sat/present_value",
"eat_status": "ahu_sat/output2",
"eat_fault": "ahu_sat/status_flags/fault",

"lat": "dat/present_value",
"lat_status": "dat/output2",
"lat_fault": "dat/status_flags/fault",

"oat": "oat/present_value",
"oat_status": "oat/output2",
"oat_fault": "oat/status_flags/fault",

"humidity": "zone_hum/present_value",
"humidity_status": "zone_hum/output2",
"humidity_fault": "zone_hum/status_flags/fault",

"airflow_measured": "air_flow/flow_tab/actual_flow",
"airflow_setp_lock_flag": "air_flow/flow_tab/lock_flags/flowsetp",
"airflow_setp_lock_value": "air_flow/flow_tab/flowsetp_lock",
"airflow_for_max_cool": "air_flow/flow_tab/max_cool",
"airflow_for_max_heat": "air_flow/flow_tab/max_heat",
"airflow_damper_lock_flag": "air_flow/flow_tab/lock_flags/damper",
"airflow_damper_lock_value": "air_flow/flow_tab/damper_lock",
"airflow_damper_position": "air_flow/flow_tab/damper_position",
"airflow_fault": "air_flow/flow_tab/status_flags/fault",

"oa_damper_lock_flag": "oad/locked",
"oa_damper_lock_value": "oad/locked_value",
"oa_damper_lock_min": "oad/min_pres_value",
"oa_damper_lock_max": "oad/max_pres_value",
"oa_damper_fault": "oad/status_flags/fault",
"oa_damper_min_position": "oad_min_pos/present_value",

"fan1_lock_flag": "sfss/locked",
"fan1_lock_value": "sfss/locked_value",
"fan1_lock_min": "sfss/min_pres_value",
"fan1_lock_max": "sfss/max_pres_value",
"fan1_fault": "sfss/status_flags/fault",
"fan1_status": "sfst/present_value",

"fan2_lock_flag": "efss/locked",
"fan2_lock_value": "efss/locked_value",
"fan2_lock_min": "efss/min_pres_value",
"fan2_lock_max": "efss/max_pres_value",
"fan2_fault": "efss/status_flags/fault",
"fan2_status": "efst/present_value",

"fan3_vfd_lock_flag": "baf1_vfd/locked",
"fan3_vfd_lock_value": "baf1_vfd/locked_value",
"fan3_vfd_lock_min": "baf1_vfd/min_pres_value",
"fan3_vfd_lock_max": "baf1_vfd/max_pres_value",
"fan3_vfd_fault": "baf1_vfd/status_flags/fault",
"fan3_status": "baf1st/present_value",

"fan4_vfd_lock_flag": "baf2_vfd/locked",
"fan4_vfd_lock_value": "baf2_vfd/locked_value",
"fan4_vfd_lock_min": "baf2_vfd/min_pres_value",
"fan4_vfd_lock_max": "baf2_vfd/max_pres_value",
"fan4_vfd_fault": "baf2_vfd/status_flags/fault",
"fan4_status": "baf2st/present_value",

"fan5_vfd_lock_flag": "baf3_vfd/locked",
"fan5_vfd_lock_value": "baf3_vfd/locked_value",
"fan5_vfd_lock_min": "baf3_vfd/min_pres_value",
"fan5_vfd_lock_max": "baf3_vfd/max_pres_value",
"fan5_vfd_fault": "baf3_vfd/status_flags/fault",
"fan5_status": "baf3st/present_value",

"h1_name": "@HW Valve",
"h1_lock_flag": "hwv/locked",
"h1_lock_value": "hwv/locked_value",
"h1_lock_min": "hwv/min_pres_value",
"h1_lock_max": "hwv/max_pres_value",
"h1_fault": "hwv/status_flags/fault",

"h2_1_name": "@Stage 1",
"h2_1_lock_flag": "htg_stg1/locked",
"h2_1_lock_value": "htg_stg1/locked_value",
"h2_1_lock_min": "htg_stg1/min_pres_value",
"h2_1_lock_max": "htg_stg1/max_pres_value",
"h2_1_fault": "htg_stg1/status_flags/fault",

"h2_2_name": "@Stage 2",
"h2_2_lock_flag": "htg_stg2/locked",
"h2_2_lock_value": "htg_stg2/locked_value",
"h2_2_lock_min": "htg_stg2/min_pres_value",
"h2_2_lock_max": "htg_stg2/max_pres_value",
"h2_2_fault": "htg_stg2/status_flags/fault",

"h3_name": "@Unit Heater",
"h3_lock_flag": "unit_run/locked",
"h3_lock_value": "unit_run/locked_value",
"h3_lock_min": "unit_run/min_pres_value",
"h3_lock_max": "unit_run/max_pres_value",
"h3_fault": "unit_run/status_flags/fault",
"h3_status": "sfst/present_value",

"off1_lock_flag": "dx1ss/locked",
"off1_lock_value": "dx1ss/locked_value",
"off1_lock_min": "dx1ss/min_pres_value",
"off1_lock_max": "dx1ss/max_pres_value",

"off2_lock_flag": "dx2ss/locked",
"off2_lock_value": "dx2ss/locked_value",
"off2_lock_min": "dx2ss/min_pres_value",
"off2_lock_max": "dx2ss/max_pres_value"
}
98 changes: 98 additions & 0 deletions resources/tags_generic.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"alarm": "alarm/present_value",

"eat": "eat/present_value",
"eat_status": "eat/output2",
"eat_fault": "eat/status_flags/fault",

"lat": "lat/present_value",
"lat_status": "lat/output2",
"lat_fault": "lat/status_flags/fault",

"oat": "oat/present_value",
"oat_status": "oat/output2",
"oat_fault": "oat/status_flags/fault",

"humidity": "humidity/present_value",
"humidity_status": "humidity/output2",
"humidity_fault": "humidity/status_flags/fault",

"dehum_lock_flag": "dehum/locked",
"dehum_lock_value": "dehum/locked_value",
"dehum_lock_min": "dehum/min_pres_value",
"dehum_lock_max": "dehum/max_pres_value",
"dehum_fault": "dehum/status_flags/fault",

"off#_lock_flag": "off#/locked",
"off#_lock_value": "off#/locked_value",
"off#_lock_min": "off#/min_pres_value",
"off#_lock_max": "off#/max_pres_value",

"on#_lock_flag": "on#/locked",
"on#_lock_value": "on#/locked_value",
"on#_lock_min": "on#/min_pres_value",
"on#_lock_max": "on#/max_pres_value",

"airflow_measured": "airflow/flow_tab/actual_flow",
"airflow_setp_lock_flag": "airflow/flow_tab/lock_flags/flowsetp",
"airflow_setp_lock_value": "airflow/flow_tab/flowsetp_lock",
"airflow_for_max_cool": "airflow/flow_tab/max_cool",
"airflow_for_max_heat": "airflow/flow_tab/max_heat",
"airflow_damper_lock_flag": "airflow/flow_tab/lock_flags/damper",
"airflow_damper_lock_value": "airflow/flow_tab/damper_lock",
"airflow_damper_position": "airflow/flow_tab/damper_position",
"airflow_fault": "airflow/flow_tab/status_flags/fault",

"oa_damper_lock_flag": "oa_damper/locked",
"oa_damper_lock_value": "oa_damper/locked_value",
"oa_damper_lock_min": "oa_damper/min_pres_value",
"oa_damper_lock_max": "oa_damper/max_pres_value",
"oa_damper_fault": "oa_damper/status_flags/fault",
"oa_damper_min_position": "oa_damper_min/present_value",
"ra_damper_lock_flag": "ra_damper/locked",
"ra_damper_lock_value": "ra_damper/locked_value",
"ra_damper_lock_min": "ra_damper/min_pres_value",
"ra_damper_lock_max": "ra_damper/max_pres_value",
"ra_damper_fault": "ra_damper/status_flags/fault",

"fan#_lock_flag": "fan#/locked",
"fan#_lock_value": "fan#/locked_value",
"fan#_lock_min": "fan#/min_pres_value",
"fan#_lock_max": "fan#/max_pres_value",
"fan#_fault": "fan#/status_flags/fault",
"fan#_status": "fan#_status/present_value",
"fan#_vfd_lock_flag": "fan#_vfd/locked",
"fan#_vfd_lock_value": "fan#_vfd/locked_value",
"fan#_vfd_lock_min": "fan#_vfd/min_pres_value",
"fan#_vfd_lock_max": "fan#_vfd/max_pres_value",
"fan#_vfd_fault": "fan#_vfd/status_flags/fault",

"e#_name": "@e",
"e#_lock_flag": "e/locked",
"e#_lock_value": "e/locked_value",
"e#_lock_min": "e/min_pres_value",
"e#_lock_max": "e/max_pres_value",
"e#_fault": "e/status_flags/fault",
"e#_status": "e_status/present_value",
"e#_rv_lock_flag": "e_rv/locked",
"e#_rv_lock_value": "e_rv/locked_value",
"e#_rv_lock_min": "e_rv/min_pres_value",
"e#_rv_lock_max": "e_rv/max_pres_value",
"e#_rv_fault": "e_rv/status_flags/fault",

"h#_#_name": "@h",
"h#_#_lock_flag": "h/locked",
"h#_#_lock_value": "h/locked_value",
"h#_#_lock_min": "h/min_pres_value",
"h#_#_lock_max": "h/max_pres_value",
"h#_#_fault": "h/status_flags/fault",
"h#_#_status": "h_status/present_value",

"c#_#_name": "@c",
"c#_#_lock_flag": "c/locked",
"c#_#_lock_value": "c/locked_value",
"c#_#_lock_min": "c/min_pres_value",
"c#_#_lock_max": "c/max_pres_value",
"c#_#_fault": "c/status_flags/fault",
"c#_#_status": "c_status/present_value"
}
123 changes: 123 additions & 0 deletions src/aces/webctrl/scripts/terminalunits/Airflow.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
package aces.webctrl.scripts.terminalunits;
/**
* Encapsulates an airflow microblock.
*/
public class Airflow extends Component {
public volatile double[] readings = null;
private final static String measured = "airflow_measured";
private final static String setp_lock_flag = "airflow_setp_lock_flag";
private final static String setp_lock_value = "airflow_setp_lock_value";
private final static String max_cool = "airflow_for_max_cool";
private final static String max_heat = "airflow_for_max_heat";
private final static String damper_lock_flag = "airflow_damper_lock_flag";
private final static String damper_lock_value = "airflow_damper_lock_value";
private final static String damper_position = "airflow_damper_position";
private final static String fault = "airflow_fault";
private volatile AnalogInput airflowActual;
private volatile Output airflowSetpoint;
private volatile AnalogInput damperActual;
private volatile Output damperSetpoint;
private volatile boolean defined;
private volatile int maxCool = -1;
private volatile int maxHeat = -1;
public Airflow(Data d) throws InterruptedException {
super(d);
defined = d.x.hasMapping(measured)
&& d.x.hasMapping(setp_lock_flag)
&& d.x.hasMapping(setp_lock_value)
&& d.x.hasMapping(max_cool)
&& d.x.hasMapping(max_heat)
&& d.x.hasMapping(damper_lock_flag)
&& d.x.hasMapping(damper_lock_value)
&& d.x.hasMapping(damper_position)
&& d.x.hasMapping(fault);
if (defined){
try{
String s;
if ((s=d.x.getValue(max_heat))==null){
maxHeat = 150;
problem = true;
}else{
maxHeat = Math.max((int)Double.parseDouble(s),150);
}
if ((s=d.x.getValue(max_cool))==null){
maxCool = maxHeat;
problem = true;
}else{
maxCool = Math.max((int)Double.parseDouble(s),150);
}
}catch(NumberFormatException e){
if (maxHeat==-1){
maxHeat = 150;
}
maxCool = maxHeat;
}
airflowActual = new AnalogInput(d, measured);
damperActual = new AnalogInput(d, damper_position);
airflowSetpoint = new Output(d, "airflow_setp", 0, 0);
damperSetpoint = new Output(d, "airflow_damper", 0, 0);
}
}
/**
* Controls the airflow setpoint.
* @return whether the airflow setpoint was successfully set.
*/
public boolean setAirflow(int x) throws InterruptedException {
return x>=0 && damperSetpoint.unlock() && airflowSetpoint.set(x);
}
/**
* Controls the damper position setpoint.
* @param x should be between 0 and 100.
* @return whether the damper position setpoint was successfully set.
*/
public boolean setDamperPosition(double x) throws InterruptedException {
return x>=0 && x<=100 && airflowSetpoint.unlock() && damperSetpoint.set(x);
}
/**
* @return the ideal airflow for when cooling elements are cranked to 100%.
*/
public int getCoolingAirflow(){
return maxCool;
}
/**
* @return the ideal airflow for when heating elements are cranked to 100%.
*/
public int getHeatingAirflow(){
return maxHeat;
}
/**
* @return the {@code AnalogInput} corresponding to measured airflow.
*/
public AnalogInput getAirflow(){
return airflowActual;
}
/**
* @return the {@code AnalogInput} corresponding to the actual damper position.
*/
public AnalogInput getDamperPosition(){
return damperActual;
}
/**
* @return whether or not sufficient tag mappings exist to set the output value for this component.
*/
@Override public boolean isDefined(){
return defined;
}
/**
* {@inheritDoc}
*/
@Override protected boolean fault() throws InterruptedException {
if (!defined){
return true;
}
String s = d.x.getValue(fault);
if (s==null){ problem = true; }
return parseBoolean(s,true);
}
/**
* {@inheritDoc}
*/
@Override public boolean hasProblem(){
return problem || airflowActual.hasProblem() || airflowSetpoint.hasProblem() || damperActual.hasProblem() || damperSetpoint.hasProblem();
}
}
Loading

0 comments on commit 48cb059

Please sign in to comment.