<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[REXYGEN Community Forum / Node OPCUA]]></title>
	<link rel="self" href="https://www.rexygen.com/oldforum/extern.php?action=feed&amp;tid=81&amp;type=atom"/>
	<link href="http://www.rexygen.com/oldforum/viewtopic.php?id=81"/>
	<updated>2016-03-29T08:11:10Z</updated>
	<generator>FluxBB</generator>
	<id>http://www.rexygen.com/oldforum/viewtopic.php?id=81</id>
	<entry>
		<title type="html"><![CDATA[Re: Node OPCUA]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=355#p355"/>
		<content type="html"><![CDATA[<p>Thank you for your question. At the moment I cannot help with this one. </p><p>A native OPC UA server for the REX Control System is in development. As soon as we have it ready, I&#039;ll let you know. Thanks for your patience.</p>]]></content>
		<author>
			<name><![CDATA[jaroslav_sobota]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=3</uri>
		</author>
		<updated>2016-03-29T08:11:10Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=355#p355</id>
	</entry>
	<entry>
		<title type="html"><![CDATA[Node OPCUA]]></title>
		<link rel="alternate" href="http://www.rexygen.com/oldforum/viewtopic.php?pid=347#p347"/>
		<content type="html"><![CDATA[<p>Is there a way to pass rex variables to the node opcua server to fill in the stuff like is shown in MyVariable below.</p><p>/*global require,setInterval,console */<br />var opcua = require(&quot;node-opcua&quot;);</p><br /><p>// Let&#039;s create an instance of OPCUAServer<br />var server = new opcua.OPCUAServer({<br />&#160; &#160; port: 4334, // the port of the listening socket of the server<br />&#160; &#160; resourcePath: &quot;UA/MyLittleServer&quot;, // this path will be added to the endpoint resource name<br />&#160; &#160; &#160;buildInfo : {<br />&#160; &#160; &#160; &#160; productName: &quot;MySampleServer1&quot;,<br />&#160; &#160; &#160; &#160; buildNumber: &quot;7658&quot;,<br />&#160; &#160; &#160; &#160; buildDate: new Date(2014,5,2)<br />&#160; &#160; }<br />});</p><p>function post_initialize() {<br />&#160; &#160; console.log(&quot;initialized&quot;);<br />&#160; &#160; function construct_my_address_space(server) {<br />&#160; &#160; <br />&#160; &#160; &#160; &#160; var addressSpace = server.engine.addressSpace;<br />&#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; // declare a new object<br />&#160; &#160; &#160; &#160; var device = addressSpace.addObject({<br />&#160; &#160; &#160; &#160; &#160; &#160; organizedBy: addressSpace.rootFolder.objects,<br />&#160; &#160; &#160; &#160; &#160; &#160; browseName: &quot;MyDevice&quot;<br />&#160; &#160; &#160; &#160; });<br />&#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; // add some variables <br />&#160; &#160; &#160; &#160; // add a variable named MyVariable1 to the newly created folder &quot;MyDevice&quot;<br />&#160; &#160; &#160; &#160; var variable1 = 1;<br />&#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; // emulate variable1 changing every 500 ms<br />&#160; &#160; &#160; &#160; setInterval(function(){&#160; variable1+=1; }, 500);<br />&#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; addressSpace.addVariable({<br />&#160; &#160; &#160; &#160; &#160; &#160; componentOf: device,<br />&#160; &#160; &#160; &#160; &#160; &#160; browseName: &quot;MyVariable1&quot;,<br />&#160; &#160; &#160; &#160; &#160; &#160; dataType: &quot;Double&quot;,<br />&#160; &#160; &#160; &#160; &#160; &#160; value: {<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; get: function () {<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; return new opcua.Variant({dataType: opcua.DataType.Double, value: variable1 });<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }<br />&#160; &#160; &#160; &#160; &#160; &#160; }<br />&#160; &#160; &#160; &#160; });<br />&#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; // add a variable named MyVariable2 to the newly created folder &quot;MyDevice&quot;<br />&#160; &#160; &#160; &#160; var variable2 = 10.0;<br />&#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; server.engine.addressSpace.addVariable({<br />&#160; &#160; &#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; &#160; &#160; componentOf: device,<br />&#160; &#160; &#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; &#160; &#160; nodeId: &quot;ns=1;b=1020FFAA&quot;, // some opaque NodeId in namespace 4<br />&#160; &#160; &#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; &#160; &#160; browseName: &quot;MyVariable2&quot;,<br />&#160; &#160; &#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; &#160; &#160; dataType: &quot;Double&quot;,&#160; &#160; <br />&#160; &#160; &#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; &#160; &#160; value: {<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; get: function () {<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; return new opcua.Variant({dataType: opcua.DataType.Double, value: variable2 });<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; },<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; set: function (variant) {<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; variable2 = parseFloat(variant.value);<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; return opcua.StatusCodes.Good;<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; }<br />&#160; &#160; &#160; &#160; &#160; &#160; }<br />&#160; &#160; &#160; &#160; });<br />&#160; &#160; &#160; &#160; var os = require(&quot;os&quot;);<br />&#160; &#160; &#160; &#160; /**<br />&#160; &#160; &#160; &#160; &#160;* returns the percentage of free memory on the running machine<br />&#160; &#160; &#160; &#160; &#160;* @return {double}<br />&#160; &#160; &#160; &#160; &#160;*/<br />&#160; &#160; &#160; &#160; function available_memory() {<br />&#160; &#160; &#160; &#160; &#160; &#160; // var value = process.memoryUsage().heapUsed / 1000000;<br />&#160; &#160; &#160; &#160; &#160; &#160; var percentageMemUsed = os.freemem() / os.totalmem() * 100.0;<br />&#160; &#160; &#160; &#160; &#160; &#160; return percentageMemUsed;<br />&#160; &#160; &#160; &#160; }<br />&#160; &#160; &#160; &#160; server.engine.addressSpace.addVariable({<br />&#160; &#160; &#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; &#160; &#160; componentOf: device,<br />&#160; &#160; &#160; &#160; &#160; &#160; <br />&#160; &#160; &#160; &#160; &#160; &#160; nodeId: &quot;ns=1;s=free_memory&quot;, // a string nodeID<br />&#160; &#160; &#160; &#160; &#160; &#160; browseName: &quot;FreeMemory&quot;,<br />&#160; &#160; &#160; &#160; &#160; &#160; dataType: &quot;Double&quot;,&#160; &#160; <br />&#160; &#160; &#160; &#160; &#160; &#160; value: {<br />&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; get: function () {return new opcua.Variant({dataType: opcua.DataType.Double, value: available_memory() });}<br />&#160; &#160; &#160; &#160; &#160; &#160; }<br />&#160; &#160; &#160; &#160; });<br />&#160; &#160; }<br />&#160; &#160; construct_my_address_space(server);<br />&#160; &#160; server.start(function() {<br />&#160; &#160; &#160; &#160; console.log(&quot;Server is now listening ... ( press CTRL+C to stop)&quot;);<br />&#160; &#160; &#160; &#160; console.log(&quot;port &quot;, server.endpoints[0].port);<br />&#160; &#160; &#160; &#160; var endpointUrl = server.endpoints[0].endpointDescriptions()[0].endpointUrl;<br />&#160; &#160; &#160; &#160; console.log(&quot; the primary server endpoint url is &quot;, endpointUrl );<br />&#160; &#160; });<br />}<br />server.initialize(post_initialize);</p>]]></content>
		<author>
			<name><![CDATA[fish19]]></name>
			<uri>http://www.rexygen.com/oldforum/profile.php?id=47</uri>
		</author>
		<updated>2016-03-24T17:55:20Z</updated>
		<id>http://www.rexygen.com/oldforum/viewtopic.php?pid=347#p347</id>
	</entry>
</feed>
