Compare commits
1 Commits
a97326af08
...
c4f16fb36d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4f16fb36d |
7
dependencies/measurement/measurement.js
vendored
7
dependencies/measurement/measurement.js
vendored
@@ -39,19 +39,18 @@
|
||||
*/
|
||||
|
||||
const EventEmitter = require('events');
|
||||
const Logger = require('../../../generalFunctions/helper/logger');
|
||||
const {logger,configUtils} = require('generalFunctions');
|
||||
const defaultConfig = require('./measurementConfig.json');
|
||||
const ConfigUtils = require('../../../generalFunctions/helper/configUtils');
|
||||
|
||||
class Measurement {
|
||||
constructor(config={}) {
|
||||
|
||||
this.emitter = new EventEmitter(); // Own EventEmitter
|
||||
this.configUtils = new ConfigUtils(defaultConfig);
|
||||
this.configUtils = new configUtils(defaultConfig);
|
||||
this.config = this.configUtils.initConfig(config);
|
||||
|
||||
// Init after config is set
|
||||
this.logger = new Logger(this.config.general.logging.enabled,this.config.general.logging.logLevel, this.config.general.name);
|
||||
this.logger = new logger(this.config.general.logging.enabled,this.config.general.logging.logLevel, this.config.general.name);
|
||||
|
||||
// Smoothing
|
||||
this.storedValues = [];
|
||||
|
||||
BIN
measurement-1.0.0.tgz
Normal file
BIN
measurement-1.0.0.tgz
Normal file
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
<script type="module">
|
||||
import * as menuUtils from "/generalFunctions/helper/menuUtils.js";
|
||||
|
||||
<script src="measurement/resources/menuUtils.js"></script>
|
||||
<script>
|
||||
RED.nodes.registerType("measurement", {
|
||||
|
||||
category: "digital twin",
|
||||
@@ -48,6 +48,12 @@
|
||||
|
||||
const node = this;
|
||||
|
||||
// Use the namespaced version instead of global
|
||||
const menuUtils = window.EVOLV.nodes.measurement.utils.menuUtils;
|
||||
const helpers = window.EVOLV.nodes.measurement.utils.helpers;
|
||||
//this needs to live somewhere and for now we add it to every node file for simplicity
|
||||
const projecSettingstURL = "http://localhost:1880/generalFunctions/settings/projectSettings.json";
|
||||
|
||||
// Define UI html elements
|
||||
const elements = {
|
||||
// Basic fields
|
||||
@@ -72,8 +78,7 @@
|
||||
unit: document.getElementById("node-input-unit"),
|
||||
};
|
||||
|
||||
//this needs to live somewhere and for now we add it to every node file for simplicity
|
||||
const projecSettingstURL = "http://localhost:1880/generalFunctions/settings/projectSettings.json";
|
||||
|
||||
|
||||
try{
|
||||
|
||||
|
||||
@@ -1,3 +1,12 @@
|
||||
console.log('Loading measurement.js module...');
|
||||
// load helper modules from the generalFunctions folder
|
||||
const { outputUtils } = require('generalFunctions');
|
||||
//internal node-red node dependencies this is the class that will handle the measurement
|
||||
const Measurement = require("./dependencies/measurement/measurement");
|
||||
const { menuUtils } = require('generalFunctions');
|
||||
console.log('All dependencies loaded successfully');
|
||||
console.log(menuUtils);
|
||||
|
||||
module.exports = function (RED) {
|
||||
function measurement(config) {
|
||||
//create node
|
||||
@@ -6,11 +15,6 @@ module.exports = function (RED) {
|
||||
var node = this;
|
||||
|
||||
try{
|
||||
|
||||
//fetch measurement object from source.js
|
||||
const Measurement = require("./dependencies/measurement/measurement");
|
||||
const OutputUtils = require("../generalFunctions/helper/outputUtils");
|
||||
|
||||
//load user defined config in the node-red UI
|
||||
const mConfig={
|
||||
general: {
|
||||
@@ -52,7 +56,7 @@ module.exports = function (RED) {
|
||||
node.source = m;
|
||||
|
||||
//load output utils
|
||||
const output = new OutputUtils();
|
||||
const output = new outputUtils();
|
||||
|
||||
function updateNodeStatus(val) {
|
||||
//display status
|
||||
@@ -144,5 +148,12 @@ module.exports = function (RED) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
RED.nodes.registerType("measurement", measurement);
|
||||
|
||||
// Create a new instance of MenuUtils for use in the html browser
|
||||
let menuUtil = new menuUtils();
|
||||
// Create the endpoint with one line!
|
||||
menuUtil.createMenuUtilsEndpoint(RED, 'measurement', menuUtils);
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user