@strato-automation/node-red-contrib-strato-automation
Version:
Strato Automation Official Node Red Library
179 lines (165 loc) • 6.7 kB
HTML
<script type="text/javascript">
RED.nodes.registerType('psychrometric-calculator', {
category: 'Strato Automation',
color: '#f3b567',
defaults: {
name: { value: "", label: "name" },
option: { value: "Imperial", required: true, label: "option" },
initialized: { value: false }
},
inputs: 1,
outputs: 5,
icon: "font-awesome/fa-thermometer-quarter",
paletteLabel: function () {
return "Psychrometric Calculator";
},
label: function () {
return "Psychrometric Calculator: " + this.option
},
labelStyle: function () {
return this.name ? "node_label_italic" : "";
},
outputLabels: function (index) {
const outLabels = [
"Dew Point",
"Enthalpy",
"Saturation Pressure",
"Vapor Pressure",
"Wet Bulb Temperature"
]
return outLabels[index];
},
inputLabels: function (index) {
return "Input 1: Temperature\nInput 2: Humidity";
},
oneditprepare: function () {
var node = this;
$("#node-input-option").typedInput({
types: [
{
value: "",
options: [ {value: "Metric", label: "Metric"}, {value: "Imperial", label: "Imperial"} ]
}
]
})
}
});
RED.events.on("nodes:add", function (node) {
if (node.type == "psychrometric-calculator" && !node.initialized) {
// Get node
var node = RED.nodes.node(node.id);
// Timeout to make sure the node is initialized and ready
setTimeout(() => {
in1_node = addNode(RED, node, {
type: 'input-topic',
name: "Temperature",
topic: "in1"
}, -300, -40)
in2_node = addNode(RED, node, {
type: 'input-topic',
name: "Humidity",
topic: "in2"
}, -300, 40)
groupNodes([node, in1_node, in2_node])
}, 200);
node.initialized = true;
}
});
</script>
<script type="text/html" data-template-name="psychrometric-calculator">
<!-- Basic Settings -->
<div class="form-tips" style="margin-bottom: 20px;">
<b>Basic Settings</b>
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-bookmark"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Optional name for this calculator">
</div>
<div class="form-row">
<label for="node-input-option"><i class="fa fa-thermometer-half"></i> Units</label>
<input type="text" id="node-input-option">
</div>
<div class="form-tips" style="margin-top: 20px;">
<p><i class="fa fa-info-circle"></i> Tip: Input 1 expects temperature and Input 2 expects relative humidity percentage.</p>
</div>
</script>
<script type="text/html" data-help-name="psychrometric-calculator">
<p>A node that calculates various psychrometric properties based on temperature and relative humidity inputs.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>Input 1 (Temperature) <span class="property-type">number</span></dt>
<dd>
Temperature value in selected units:
<ul>
<li>Metric: degrees Celsius (°C)</li>
<li>Imperial: degrees Fahrenheit (°F)</li>
</ul>
</dd>
<dt>Input 2 (Humidity) <span class="property-type">number</span></dt>
<dd>Relative humidity percentage (0-100%)</dd>
</dl>
<h3>Outputs</h3>
<ol class="node-ports">
<li>Dew Point
<dl class="message-properties">
<dt>payload <span class="property-type">number</span></dt>
<dd>Temperature at which water vapor begins to condense (°C or °F)</dd>
</dl>
</li>
<li>Enthalpy
<dl class="message-properties">
<dt>payload <span class="property-type">number</span></dt>
<dd>Total heat content of the air (kJ/kg or BTU/lb)</dd>
</dl>
</li>
<li>Saturation Pressure
<dl class="message-properties">
<dt>payload <span class="property-type">number</span></dt>
<dd>Vapor pressure at saturation (kPa or PSI)</dd>
</dl>
</li>
<li>Vapor Pressure
<dl class="message-properties">
<dt>payload <span class="property-type">number</span></dt>
<dd>Actual vapor pressure (kPa or PSI)</dd>
</dl>
</li>
<li>Wet Bulb Temperature
<dl class="message-properties">
<dt>payload <span class="property-type">number</span></dt>
<dd>Temperature indicated by a moistened thermometer (°C or °F)</dd>
</dl>
</li>
</ol>
<h3>Configuration</h3>
<dl class="message-properties">
<dt>Name <span class="property-type">string</span></dt>
<dd>Optional name to identify the node in the flow</dd>
<dt>Units <span class="property-type">string</span></dt>
<dd>
Select unit system:
<ul>
<li><code>Metric</code> - Uses °C, kPa, kJ/kg</li>
<li><code>Imperial</code> - Uses °F, PSI, BTU/lb</li>
</ul>
</dd>
</dl>
<h3>Details</h3>
<p>This node calculates psychrometric properties using standard ASHRAE formulas. The calculations include:</p>
<ul>
<li><b>Dew Point</b> - Temperature at which condensation begins</li>
<li><b>Enthalpy</b> - Total heat content per unit mass of air</li>
<li><b>Saturation Pressure</b> - Maximum possible vapor pressure at given temperature</li>
<li><b>Vapor Pressure</b> - Actual partial pressure of water vapor</li>
<li><b>Wet Bulb Temperature</b> - Temperature reading of a moistened thermometer</li>
</ul>
<h3>Status</h3>
<dl class="message-properties">
<dt>Grey dot</dt>
<dd>All calculations completed successfully</dd>
<dt>Yellow dot</dt>
<dd>Waiting for both temperature and humidity inputs</dd>
</dl>
<h3>References</h3>
<p>Calculations based on ASHRAE Handbook - Fundamentals (2021) Chapter 1 equations and Clausius-Clapeyron relationship.</p>
</script>