How to use the node-opcua.standardUnits function in node-opcua

To help you get started, we’ve selected a few node-opcua examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-opcua / node-opcua / packages / node-opcua-end2end-test / test_helpers / build_server_with_temperature_device.js View on Github external
//xx    assert(parentNode instanceof opcua.BaseNode);

    const addressSpace = parentNode.addressSpace;
    const namespace = addressSpace.getOwnNamespace();

    // add a UAAnalogItem
    namespace.addAnalogDataItem({
        componentOf: parentNode,
        nodeId: "s=TemperatureAnalogItem",
        browseName: "TemperatureAnalogItem",
        definition: "(tempA -25) + tempB",
        valuePrecision: 0.5,
        engineeringUnitsRange: {low: 100, high: 200},
        instrumentRange: {low: -100, high: +200},
        engineeringUnits: opcua.standardUnits.degree_celsius,
        dataType: "Double",
        value: {
            get: function () {
                return new Variant({dataType: DataType.Double, value: Math.random() + 19.0});
            }
        }
    });

}
github node-opcua / node-opcua / packages / node-opcua-samples / bin / simple_server.js View on Github external
}
  });

  // UAAnalogItem
  // add a UAAnalogItem
  const node = namespace.addAnalogDataItem({

    organizedBy: myDevices,

    nodeId: "s=TemperatureAnalogItem",
    browseName: "TemperatureAnalogItem",
    definition: "(tempA -25) + tempB",
    valuePrecision: 0.5,
    engineeringUnitsRange: { low: 100, high: 200 },
    instrumentRange: { low: -100, high: +200 },
    engineeringUnits: opcua.standardUnits.degree_celsius,
    dataType: "Double",
    value: {
      get: function() {
        return new Variant({ dataType: DataType.Double, value: Math.random() + 19.0 });
      }
    }
  });


  const m3x3 = namespace.addVariable({
    organizedBy: addressSpace.rootFolder.objects,
    nodeId: "s=Matrix",
    browseName: "Matrix",
    dataType: "Double",
    valueRank: 2,
    arrayDimensions: [3, 3],
github node-opcua / node-opcua / documentation / sample_server_with_historizing_variable.js View on Github external
function construct_address_space(server) {
  const addressSpace = server.engine.addressSpace;
  const namespace = addressSpace.getOwnNamespace();
  const vessel = namespace.addObject({
      browseName: "Vessel",
      organizedBy: addressSpace.rootFolder.objects
  });
  
  const vesselPressure = namespace.addAnalogDataItem({
      browseName: "Pressure",
      engineeringUnitsRange: {
          low:  0,
          high: 10.0
      },
      engineeringUnits: opcua.standardUnits.bar,
      componentOf: vessel
  });
  addressSpace.installHistoricalDataNode(vesselPressure);
  // simulate pressure change
  let t = 0;
  setInterval(function() {
    let value = (Math.sin(t/50)*0.70+Math.random()*0.20)*5.0+5.0;
    vesselPressure.setValueFromSource({dataType:"Double",value:value});
    t=t+1;
  }, 200);
  
};
github node-opcua / node-opcua / packages / node-opcua-end2end-test / test_helpers / hvac_system.js View on Github external
"use strict";

const chalk = require("chalk");
const _ = require("underscore");
const assert = require("node-opcua-assert").assert;
const opcua = require("node-opcua");
const StatusCodes = opcua.StatusCodes;
const DataType = opcua.DataType;
const standardUnits = opcua.standardUnits;

const doDebug = false;

/**
 * @method createHVACSystem
 *
 * @startuml
 *
 * class HVACModuleType {
 * }
 * HVACModuleType -up-> ObjectType
 * HVACModuleType o-down-> ExteriorTemperatureSensor     << (P,#F0F0FF)TemperatureSensorType >>
 * HVACModuleType o-down-> InteriorTemperatureSensor     << (P,#F0F0FF)TemperatureSensorType >>
 * HVACModuleType o-down-> TargetTemperature     << (P,#F0F0FF)TemperatureSensorType >>
 * HVACModuleType o-down-> HVACEnabledEventType  << (E,#00F0FF)BaseEventType >>
 * HVACModuleType o-down-> HVACDisabledEventType << (E,#00F0FF)BaseEventType >>
github node-opcua / node-opcua / documentation / server_with_da_variables.js View on Github external
});
    
    
    const fakeValue = 1;

    const analogItem = namespace.addAnalogDataItem({
    
          componentOf: myDevice,
    
          browseName: "TemperatureSensor",
    
          definition: "(tempA -25) + tempB",
          valuePrecision: 0.5,
          engineeringUnitsRange: { low: 100 , high: 200},
          instrumentRange: { low: -100 , high: +200},
          engineeringUnits: opcua.standardUnits.degree_celsius,
          dataType: "Double",
    
          value: { get: function(){return new opcua.Variant({dataType: opcua.DataType.Double , value: fakeValue}); } }
    });

}