diff --git a/static/js/ASHRAE/ashrae.js b/static/js/ASHRAE/ashrae.js index 28b66b3..e4f6a44 100644 --- a/static/js/ASHRAE/ashrae.js +++ b/static/js/ASHRAE/ashrae.js @@ -15,8 +15,10 @@ const vRelativeValue = $("#relative-air-speed-value"); const vRelativeDiv = $("#relative-air-speed-div"); const dynamicCloValue = $("#dynamic-clo-value"); const dynamicCloDiv = $("#dynamic-clo-div"); +const useRelativeAirSpeedCheckbox = $("#use-relative-air-speed"); $(document).ready(function () { + comf.useSelfGeneratedAirSpeed = useRelativeAirSpeedCheckbox.is(":checked"); highlightNabBarItem("#nav_a_ashrae"); dropdownsCloMet(); @@ -69,10 +71,31 @@ $(document).ready(function () { handleClickToCheckBox(); }); + useRelativeAirSpeedCheckbox.change(function () { + comf.useSelfGeneratedAirSpeed = $(this).prop("checked"); + update(); + }); + $("#chartSelect").val("psychtop").change(); }); $(function () { + $("#airSpeedDialog").dialog({ + autoOpen: false, + width: 380, + modal: true, + resizable: false, + buttons: { + Close: function () { + $(this).dialog("close"); + }, + }, + }); + + $("#airSpeedSettings").click(function () { + $("#airSpeedDialog").dialog("open"); + }); + $("#globedialog").dialog({ autoOpen: false, height: 350, @@ -524,7 +547,7 @@ function update() { d.rh = psy.convert(d.rh, d.ta, window.humUnit, "rh"); // calculate and display relative air speed - if (d.met > 1) { + if (d.met > 1 && comf.useSelfGeneratedAirSpeed) { vRelativeDiv.show(); if (isCelsius) { vRelativeValue.html(comf.relativeAirSpeed(d.vel, d.met).toFixed(2)); diff --git a/static/js/EN/en.js b/static/js/EN/en.js index 22551e1..959c703 100644 --- a/static/js/EN/en.js +++ b/static/js/EN/en.js @@ -2,8 +2,10 @@ keys = ["ta", "tr", "vel", "rh", "met", "clo", "trm", "vel_a"]; const vRelativeValue = $("#relative-air-speed-value"); const vRelativeDiv = $("#relative-air-speed-div"); +const useRelativeAirSpeedCheckbox = $("#use-relative-air-speed"); $(document).ready(function () { + comf.useSelfGeneratedAirSpeed = useRelativeAirSpeedCheckbox.is(":checked"); highlightNabBarItem("#nav_a_en"); dropdownsCloMet(); @@ -50,6 +52,22 @@ $(document).ready(function () { }); $(function () { + $("#airSpeedDialog").dialog({ + autoOpen: false, + width: 380, + modal: true, + resizable: false, + buttons: { + Close: function () { + $(this).dialog("close"); + }, + }, + }); + + $("#airSpeedSettings").click(function () { + $("#airSpeedDialog").dialog("open"); + }); + $("#globedialog").dialog({ autoOpen: false, height: 350, @@ -140,6 +158,11 @@ $("#vel-a-box").click(function () { update(); }); +$("#use-relative-air-speed").change(function () { + comf.useSelfGeneratedAirSpeed = $(this).prop("checked"); + update(); +}); + $("#unitsToggle").click(function () { toggleUnits(); update(); @@ -320,7 +343,7 @@ function update() { } // calculate and display relative air speed - if (d.met > 1) { + if (d.met > 1 && comf.useSelfGeneratedAirSpeed) { vRelativeDiv.show(); if (isCelsius) { vRelativeValue.html(comf.relativeAirSpeed(d.vel, d.met).toFixed(2)); diff --git a/static/js/comfort-models.js b/static/js/comfort-models.js index e1fb69b..190e482 100644 --- a/static/js/comfort-models.js +++ b/static/js/comfort-models.js @@ -6,8 +6,10 @@ if (typeof module !== "undefined" && module.exports) { module.exports.comf = comf; } +comf.useSelfGeneratedAirSpeed = true; + comf.relativeAirSpeed = function (v, met) { - if (met > 1) { + if (comf.useSelfGeneratedAirSpeed && met > 1) { return v + 0.3 * (met - 1); } else { return v; diff --git a/static/js/compare/compare.js b/static/js/compare/compare.js index f2600f5..1630cbc 100644 --- a/static/js/compare/compare.js +++ b/static/js/compare/compare.js @@ -12,6 +12,7 @@ $(document).ready(function () { }); $("#temphumchart-div").hide(); + comf.useSelfGeneratedAirSpeed = $("#use-relative-air-speed").is(":checked"); window.isCelsius = true; window.humUnit = "rh"; @@ -68,6 +69,7 @@ $(function () { d3.selectAll("path.comfortzone1").remove(); d3.selectAll("circle.point1").remove(); } + updateVrRowVisibility(); }); $("#inputs2") .button({}) @@ -89,11 +91,20 @@ $(function () { r = comf.pmvElevatedAirspeed(d.ta, d.tr, d.vel, d.rh, d.met, d.clo, 0); renderPmvElevResults(r, "2"); calcPmvElevCompliance(d, r, "2"); + if (comf.useSelfGeneratedAirSpeed && d.met > 1) { + const vr2 = comf.relativeAirSpeed(d.vel, d.met); + $("#vr-res2").html(isCelsius ? vr2.toFixed(2) : (vr2 * 196.9).toFixed(1)); + $("#vr-unit2").html(isCelsius ? " m/s" : " fpm"); + } else { + $("#vr-res2").html(""); + $("#vr-unit2").html(""); + } } else { $(".inputbox2, .unit2, .tempunit2, .result2").hide(); d3.selectAll("path.comfortzone2").remove(); d3.selectAll("circle.point2").remove(); } + updateVrRowVisibility(); }); $("#inputs3") .button({}) @@ -115,11 +126,20 @@ $(function () { r = comf.pmvElevatedAirspeed(d.ta, d.tr, d.vel, d.rh, d.met, d.clo, 0); renderPmvElevResults(r, "3"); calcPmvElevCompliance(d, r, "3"); + if (comf.useSelfGeneratedAirSpeed && d.met > 1) { + const vr3 = comf.relativeAirSpeed(d.vel, d.met); + $("#vr-res3").html(isCelsius ? vr3.toFixed(2) : (vr3 * 196.9).toFixed(1)); + $("#vr-unit3").html(isCelsius ? " m/s" : " fpm"); + } else { + $("#vr-res3").html(""); + $("#vr-unit3").html(""); + } } else { $(".inputbox3, .unit3, .tempunit3, .result3").hide(); d3.selectAll("path.comfortzone3").remove(); d3.selectAll("circle.point3").remove(); } + updateVrRowVisibility(); }); $("#link").click(function () { @@ -414,6 +434,29 @@ $("#unitsToggle").click(function () { update("3"); }); +$("#airSpeedDialog").dialog({ + autoOpen: false, + width: 380, + modal: true, + resizable: false, + buttons: { + Close: function () { + $(this).dialog("close"); + }, + }, +}); + +$("#airSpeedSettings").click(function () { + $("#airSpeedDialog").dialog("open"); +}); + +$("#use-relative-air-speed").change(function () { + comf.useSelfGeneratedAirSpeed = $(this).prop("checked"); + update("1"); + update("2"); + update("3"); +}); + $("#restart").click(function () { setDefaults1(); setDefaults2(); @@ -450,6 +493,23 @@ $("#specPressure").click(function () { } }); +function updateVrRowVisibility() { + if (!comf.useSelfGeneratedAirSpeed) { + $("#vr-row").hide(); + return; + } + for (let j = 1; j <= 3; j++) { + if ($("#inputs" + j).is(":checked")) { + const met = parseFloat(document.getElementById("met" + j).value) || 0; + if (met > 1) { + $("#vr-row").show(); + return; + } + } + } + $("#vr-row").hide(); +} + function update(i) { if ($("#tr-input").is(":hidden")) { $("#tr" + i).val($("#ta" + i).val()); @@ -476,6 +536,21 @@ function update(i) { renderPmvElevResults(r, i); calcPmvElevCompliance(d, r, i); + if (comf.useSelfGeneratedAirSpeed && d.met > 1) { + const vr = comf.relativeAirSpeed(d.vel, d.met); + if (isCelsius) { + $("#vr-res" + i).html(vr.toFixed(2)); + $("#vr-unit" + i).html(" m/s"); + } else { + $("#vr-res" + i).html((vr * 196.9).toFixed(1)); + $("#vr-unit" + i).html(" fpm"); + } + } else { + $("#vr-res" + i).html(""); + $("#vr-unit" + i).html(""); + } + updateVrRowVisibility(); + let b; if ($("#chart-div").is(":visible")) { b = pc.findComfortBoundary(d, 0.5); diff --git a/static/js/ranges/ranges.js b/static/js/ranges/ranges.js index 663898c..3af09ca 100644 --- a/static/js/ranges/ranges.js +++ b/static/js/ranges/ranges.js @@ -36,6 +36,7 @@ $(document).ready(function () { window.humUnit = "rh"; rangeYes = false; + comf.useSelfGeneratedAirSpeed = $("#use-relative-air-speed").is(":checked"); resetDefaultValues(); update(); pc.drawChart(d); @@ -379,6 +380,33 @@ $("#unitsToggle").click(function () { update(); }); +$("#airSpeedDialog").dialog({ + autoOpen: false, + width: 380, + modal: true, + resizable: false, + buttons: { + Close: function () { + $(this).dialog("close"); + }, + }, +}); + +$("#airSpeedSettings").click(function () { + $("#airSpeedDialog").dialog("open"); +}); + +$("#use-relative-air-speed").change(function () { + comf.useSelfGeneratedAirSpeed = $(this).prop("checked"); + if (rangeYes) { + if (rangefactor === "tr") drawTRrange(); + else if (rangefactor === "vel") drawVELrange(); + else if (rangefactor === "met") drawMETrange(); + else if (rangefactor === "clo") drawCLOrange(); + } + update(); +}); + $("#restart").click(function () { rangeYes = false; d3.selectAll("path.comfortzone-range").remove(); @@ -626,6 +654,7 @@ function drawRange(factor, incr) { $(".factor-name").html(factor_names[rangefactor]); $("#factor-name").html(factor_names[rangefactor]); // $("#inputfield-" + factor).css('background-color', '#CECEE3'); + update(); } else { alert("insert the min and max values of the range"); } @@ -757,6 +786,18 @@ function update() { bc.redrawComfortRegion(b); bc.redrawPoint(); } + + if (d.met > 1 && comf.useSelfGeneratedAirSpeed) { + const vr = comf.relativeAirSpeed(d.vel, d.met); + if (isCelsius) { + $("#relative-air-speed-value").html(vr.toFixed(2)); + } else { + $("#relative-air-speed-value").html((vr * 196.9).toFixed(1)); + } + $("#relative-air-speed-div").show(); + } else { + $("#relative-air-speed-div").hide(); + } } function parameter_selection_change() { diff --git a/templates/ashrae.html b/templates/ashrae.html index c441324..b9a431f 100644 --- a/templates/ashrae.html +++ b/templates/ashrae.html @@ -357,6 +357,15 @@ /> SI/IP +
+ When metabolic rate is above 1 met, the tool automatically adds the + air speed generated by physical activity (e.g. walking) to the + measured air speed, following ASHRAE 55. +
++ Disable this if occupants are at elevated metabolic rates without + generating air movement (e.g. exercising on stationary equipment). +
++ When metabolic rate is above 1 met, the tool automatically adds the + air speed generated by physical activity (e.g. walking) to the + measured air speed, following ASHRAE 55. +
++ Disable this if occupants are at elevated metabolic rates without + generating air movement (e.g. exercising on stationary equipment). +
++ When metabolic rate is above 1 met, the tool automatically adds the + air speed generated by physical activity (e.g. walking) to the + measured air speed, following EN 16798. +
++ Disable this if occupants are at elevated metabolic rates without + generating air movement (e.g. exercising on stationary equipment). +
++ When metabolic rate is above 1 met, the tool automatically adds the + air speed generated by physical activity (e.g. walking) to the + measured air speed, following ASHRAE 55. +
++ Disable this if occupants are at elevated metabolic rates without + generating air movement (e.g. exercising on stationary equipment). +
+