@@ -22,21 +22,63 @@ var server = new opcua.OPCUAServer({
2222 * @param server
2323 */
2424function construct_my_address_space ( server ) {
25+ // Mi5-Tag
2526 server . engine . addFolder ( "RootFolder" , { browseName : "Mi5" } ) ;
27+
28+ // Module-Interface
2629 server . engine . addFolder ( "Mi5" , { browseName : "Module2501" } ) ;
30+
31+ // Module-Interface Input
2732 server . engine . addFolder ( "Module2501" , { browseName : "Input" } ) ;
33+ createOpcuaVariable ( 'Input' , 'MI5.Module2501.Input.PositionInput' , 'Double' , 0 ) ;
2834 server . engine . addFolder ( "Input" , { browseName : "SkillInput" } ) ;
29- server . engine . addFolder ( "SkillInput" , { browseName : "SkillInput0" } ) ;
30-
31- createOpcuaVariable ( 'SkillInput0' , 'MI5.Module2501.Input.PositionInput' , 'Double' , 0 ) ;
35+ server . engine . addFolder ( "SkillInput" , { browseName : "SkillInput0" } ) ; // old Array structure
3236 createOpcuaVariable ( 'SkillInput0' , 'MI5.Module2501.Input.SkillInput.SkillInput0.Execute' , 'Boolean' , false ) ;
3337
34-
38+ // Module-Interface Output
39+ server . engine . addFolder ( "Module2501" , { browseName : "Output" } ) ;
40+ server . engine . addFolder ( "Output" , { browseName : "SkillOutput" } ) ;
41+ server . engine . addFolder ( "SkillOutput" , { browseName : "SkillOutput0" } ) ;
42+ createOpcuaVariable ( 'SkillOutput0' , 'MI5.Module2501.Output.SkillOutput.SkillOutput0.ID' , 'Int16' , 8765 ) ;
43+ createOpcuaVariable ( 'SkillOutput0' , 'MI5.Module2501.Output.SkillOutput.SkillOutput0.Name' , 'String' , 'SkillOutput0 / Description' ) ;
44+ createOpcuaVariable ( 'SkillOutput0' , 'MI5.Module2501.Output.SkillOutput.SkillOutput0.Ready' , 'Boolean' , true ) ;
45+ createOpcuaVariable ( 'SkillOutput0' , 'MI5.Module2501.Output.SkillOutput.SkillOutput0.Busy' , 'Boolean' , false ) ;
46+ createOpcuaVariable ( 'SkillOutput0' , 'MI5.Module2501.Output.SkillOutput.SkillOutput0.Done' , 'Boolean' , false ) ;
47+ createOpcuaVariable ( 'SkillOutput0' , 'MI5.Module2501.Output.SkillOutput.SkillOutput0.Error' , 'Boolean' , false ) ;
48+ server . engine . addFolder ( "SkillOutput0" , { browseName : "ParameterSO0" } ) ; // Folder needs unique name, therfore deviation from module-interface
49+ server . engine . addFolder ( "ParameterSO0" , { browseName : "ParameterSO00" } ) ; // temp convention: SOx for SkillOutputx, Parameter Count, SOxy
50+ createOpcuaVariable ( 'ParameterSO00' , 'MI5.Module2501.Output.SkillOutput.SkillOutput0.Parameter.Parameter0.ID' , 'Int16' , 8765 ) ;
51+ createOpcuaVariable ( 'ParameterSO00' , 'MI5.Module2501.Output.SkillOutput.SkillOutput0.Parameter.Parameter0.Name' , 'String' , 'Parameter0 Desription - Marmelade' ) ;
52+ createOpcuaVariable ( 'ParameterSO00' , 'MI5.Module2501.Output.SkillOutput.SkillOutput0.Parameter.Parameter0.Unit' , 'String' , 'ml' ) ;
53+ createOpcuaVariable ( 'ParameterSO00' , 'MI5.Module2501.Output.SkillOutput.SkillOutput0.Parameter.Parameter0.Value' , 'Int16' , 0 ) ;
54+ createOpcuaVariable ( 'ParameterSO00' , 'MI5.Module2501.Output.SkillOutput.SkillOutput0.Parameter.Parameter0.Default' , 'Int16' , 50 ) ;
55+ createOpcuaVariable ( 'ParameterSO00' , 'MI5.Module2501.Output.SkillOutput.SkillOutput0.Parameter.Parameter0.MinValue' , 'Int16' , 10 ) ;
56+ createOpcuaVariable ( 'ParameterSO00' , 'MI5.Module2501.Output.SkillOutput.SkillOutput0.Parameter.Parameter0.MaxValue' , 'Int16' , 100 ) ;
57+ createOpcuaVariable ( 'ParameterSO00' , 'MI5.Module2501.Output.SkillOutput.SkillOutput0.Parameter.Parameter0.Required' , 'Boolean' , true ) ;
58+
59+ // StateValues
60+ server . engine . addFolder ( "Mi5" , { browseName : "StateValue" } ) ;
61+ server . engine . addFolder ( "StateValue" , { browseName : "StateValue0" } ) ;
62+ createOpcuaVariable ( 'StateValue0' , 'MI5.Module2501.StateValue.StateValue0.Value' , 'Int16' , 40 ) ;
63+ createOpcuaVariable ( 'StateValue0' , 'MI5.Module2501.StateValue.StateValue0.Name' , 'String' , 'Percentage Done' ) ;
64+ createOpcuaVariable ( 'StateValue0' , 'MI5.Module2501.StateValue.StateValue0.Description' , 'String' , 'Percentage of done - Long Description' ) ; // max-size=200
65+ createOpcuaVariable ( 'StateValue0' , 'MI5.Module2501.StateValue.StateValue0.Unit' , 'String' , '%' ) ;
66+ server . engine . addFolder ( "StateValue" , { browseName : "StateValue1" } ) ;
67+ createOpcuaVariable ( 'StateValue1' , 'MI5.Module2501.StateValue.StateValue1.StringValue' , 'String' , 'http://xyz.de/id=123453' ) ;
68+ createOpcuaVariable ( 'StateValue1' , 'MI5.Module2501.StateValue.StateValue1.Name' , 'String' , 'Last Scan' ) ;
69+ createOpcuaVariable ( 'StateValue1' , 'MI5.Module2501.StateValue.StateValue1.Description' , 'String' , 'URL to the .ojb/.stl file of the last object that has been scanned' ) ; // max-size=200
70+ createOpcuaVariable ( 'StateValue1' , 'MI5.Module2501.StateValue.StateValue1.Unit' , 'String' , 'string' ) ;
71+
72+ // Recipe Mock
3573 server . engine . addFolder ( "Mi5" , { browseName : "Recipe" } ) ;
36- server . engine . addFolder ( "Recipe" , { browseName : "Recipe[0]" } ) ;
74+ server . engine . addFolder ( "Recipe" , { browseName : "Recipe[0]" } ) ; // newer Array Structure
3775 createOpcuaVariable ( 'Recipe[0]' , 'MI5.Recipe[0].Description' , 'String' , 'Recipe 0 description' ) ;
3876 createOpcuaVariable ( 'Recipe[0]' , 'MI5.Recipe[0].Name' , 'String' , 'XTS one Round' ) ;
3977 createOpcuaVariable ( 'Recipe[0]' , 'MI5.Recipe[0].RecipeID' , 'Int16' , 10001 ) ;
78+ server . engine . addFolder ( "Recipe" , { browseName : "Recipe[1]" } ) ; // newer Array Structure
79+ createOpcuaVariable ( 'Recipe[1]' , 'MI5.Recipe[1].Description' , 'String' , 'Recipe 1 description' ) ;
80+ createOpcuaVariable ( 'Recipe[1]' , 'MI5.Recipe[1].Name' , 'String' , 'XTS two Round' ) ;
81+ createOpcuaVariable ( 'Recipe[1]' , 'MI5.Recipe[1].RecipeID' , 'Int16' , 10002 ) ;
4082}
4183
4284/**
@@ -51,7 +93,7 @@ var serverQ = function(){
5193 return Q . Promise ( function ( resolve ) {
5294 server . initialize ( resolve ) ;
5395 } ) ;
54- }
96+ } ;
5597// exports a promise, so that the sole require does not start a server.
5698exports . instance = function ( ) {
5799 return Q . promise ( function ( resolve ) {
@@ -60,16 +102,19 @@ exports.instance = function(){
60102 . then ( start_server )
61103 . then ( resolve ) ;
62104 } ) ;
63- }
105+ } ;
64106
65107/**
66108 * Create a console interface
67109 *
68110 * start the server directly using:
69- * // $..PassiveModule\test\mock>node opcua-server.js --startServer
111+ * // $..PassiveModule\test\mock>node opcua-server.js --start
70112 */
71113if ( process . argv . pop ( ) == '--start' ) {
72- serverQ ( ) . then ( post_initialize ) . then ( start_server ) ;
114+ serverQ ( )
115+ . then ( post_initialize )
116+ . then ( start_server )
117+ . catch ( console . log ) ;
73118}
74119
75120/**
0 commit comments