Compare commits
1 Commits
96430d3592
...
b09d9e8327
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b09d9e8327 |
@@ -1,70 +1,55 @@
|
|||||||
<script type="module">
|
<script type="module">
|
||||||
|
|
||||||
import * as menuUtils from "/generalFunctions/helper/menuUtils.js";
|
import * as menuUtils from "/generalFunctions/helper/menuUtils.js";
|
||||||
|
import nodeTemplates from "/generalFunctions/helper/nodeTemplates.js";
|
||||||
|
|
||||||
|
// Grab the asset template from nodeTemplates
|
||||||
|
const tm = nodeTemplates.asset;
|
||||||
|
|
||||||
RED.nodes.registerType("rotatingMachine", {
|
RED.nodes.registerType("rotatingMachine", {
|
||||||
category: "digital twin",
|
category: tm.category,
|
||||||
color: "#4f8582",
|
color: tm.color,
|
||||||
|
|
||||||
defaults: {
|
defaults: {
|
||||||
// Define default properties
|
...tm.defaults,
|
||||||
name: { value: "", required: true },
|
machineCurve: { value: {} }, // used to interpolate values
|
||||||
enableLog: { value: false },
|
speed: { value: 1, required: true },
|
||||||
logLevel: { value: "error" },
|
startup: { value: 0, required: false },
|
||||||
|
warmup: { value: 0, required: false },
|
||||||
// Define specific properties
|
shutdown:{ value: 0, required: false },
|
||||||
speed: { value: 1, required: true },
|
cooldown:{ value: 0, required: false },
|
||||||
startup: { value: 0 },
|
|
||||||
warmup: { value: 0 },
|
|
||||||
shutdown: { value: 0 },
|
|
||||||
cooldown: { value: 0 },
|
|
||||||
|
|
||||||
//define general asset properties
|
|
||||||
supplier: { value: "" },
|
|
||||||
subType: { value: "" },
|
|
||||||
model: { value: "" },
|
|
||||||
unit: { value: "" },
|
|
||||||
|
|
||||||
//define specific asset properties
|
|
||||||
machineCurve : { value: {}},
|
|
||||||
},
|
},
|
||||||
|
inputs: tm.inputs,
|
||||||
inputs: 1,
|
outputs: tm.outputs,
|
||||||
outputs: 4,
|
inputLabels: tm.inputLabels,
|
||||||
inputLabels: ["Machine Input"],
|
outputLabels: tm.outputLabels,
|
||||||
outputLabels: ["process", "dbase", "upstreamParent", "downstreamParent"],
|
icon: tm.icon,
|
||||||
icon: "font-awesome/fa-cogs",
|
|
||||||
|
|
||||||
label: function () {
|
label: function () {
|
||||||
return this.name || "Rotating Machine";
|
return this.name || "asset";
|
||||||
},
|
},
|
||||||
|
|
||||||
oneditprepare: function () {
|
oneditprepare: function () {
|
||||||
const node = this;
|
const node = this;
|
||||||
|
console.log("------------ Edit Prepare for Rotating Machine Node ------------");
|
||||||
|
|
||||||
console.log("Rotating Machine Node: Edit Prepare");
|
// specific fields of node
|
||||||
|
|
||||||
const elements = {
|
const elements = {
|
||||||
// Basic fields
|
|
||||||
name: document.getElementById("node-input-name"),
|
|
||||||
// specific fields
|
|
||||||
speed: document.getElementById("node-input-speed"),
|
speed: document.getElementById("node-input-speed"),
|
||||||
startup: document.getElementById("node-input-startup"),
|
startup: document.getElementById("node-input-startup"),
|
||||||
warmup: document.getElementById("node-input-warmup"),
|
warmup: document.getElementById("node-input-warmup"),
|
||||||
shutdown: document.getElementById("node-input-shutdown"),
|
shutdown: document.getElementById("node-input-shutdown"),
|
||||||
cooldown: document.getElementById("node-input-cooldown"),
|
cooldown: document.getElementById("node-input-cooldown"),
|
||||||
// Logging fields
|
|
||||||
logCheckbox: document.getElementById("node-input-enableLog"),
|
|
||||||
logLevelSelect: document.getElementById("node-input-logLevel"),
|
|
||||||
rowLogLevel: document.getElementById("row-logLevel"),
|
|
||||||
// Asset fields
|
|
||||||
supplier: document.getElementById("node-input-supplier"),
|
|
||||||
subType: document.getElementById("node-input-subType"),
|
|
||||||
model: document.getElementById("node-input-model"),
|
|
||||||
unit: document.getElementById("node-input-unit"),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const projecSettingstURL = "http://localhost:1880/generalFunctions/settings/projectSettings.json";
|
// Loop through tm.elements to add non-specific elements
|
||||||
|
Object.keys(tm.elements).forEach(key => {
|
||||||
|
elements[key] = document.getElementById(tm.elements[key]);
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("Elements:", elements);
|
||||||
|
|
||||||
|
const projecSettingstURL = tm.projectSettingsURL;
|
||||||
|
console.log("Project settings URL:", projecSettingstURL);
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user