/// <summary> /// Initialise the sub devices of this tank. This methode overrides the parent class methode. /// </summary> /// <param name="istIds">Mapping actual values opc ua node id's.</param> /// <param name="sollIds">Mapping set values opc ua node id's.</param> /// <param name="rest">RestAPI object.</param> public override void InitOPCUAData(IstOPCUANodeIds istIds, SollOPCUANodeIds sollIds, RestAPIRequest rest) { // Load mapping -> TODO: Has to be fixed ... subDevicesTopologie = plantTopo.ModuleSubmodels(linkedData_data.ModuleDiscription) [linkedData_data.PlantTag]; Device local; // Safepoint // loop through dictionary foreach (KeyValuePair <string, TopologyObject> entry in subDevicesTopologie) { // Get the class of the subdevice local = devVali.Validator(entry.Key, linkedData_data.ModuleDiscription, istIds); // A sub device with set and actual value. if (sollIds.SollNodeId [linkedData_data.ModuleDiscription].ContainsKey(entry.Key)) { // init this device. local.InitOPCUAData(rest.getNode(istIds.TagToNodeId [linkedData_data.ModuleDiscription] [entry.Key].Core), rest.getNode(sollIds.SollNodeId [linkedData_data.ModuleDiscription] [entry.Key])); } else { // A sub device with only actual value. TODO: Neue Variable wirklich notwendig? Sensor locSensor = (Sensor)local; // Until now: Only sensors. In further software versions you need maybe more cases. // Fix it. Looks bad! Problem1: LinkedData doesen't know the position. Problem2: the validation can't see if binary sensor or something else. if (subDevicesTopologie [locSensor.Tag].Position == "ontop" && locSensor.GetType().ToString() == "BinarySensor") { locSensor = new LinearFluidLevelSensor(locSensor.Tag); } // init the new sensor locSensor.InitOPCUAData(rest.getNode(istIds.TagToNodeId [linkedData_data.ModuleDiscription] [entry.Key].Core)); local = locSensor; } // Add the sub device to dictionary subDevices.Add(local.Tag, local); } }
/// <summary> /// Awake this instance. /// </summary> void Awake() { //get referecences to communicator scripts for restAPI and linkedData request linkedData = GameObject.Find("Communicator").GetComponent <linkedDataRequest>(); restAPI = GameObject.Find("Communicator").GetComponent <RestAPIRequest>(); // invoke static nodeid lists istNodeIds = new IstOPCUANodeIds(restAPI); sollNodeIds = new SollOPCUANodeIds(istNodeIds.NodeIdCrawlerResult); //initialise dictionary try { moduleDatabase = new Dictionary <string, Dictionary <string, DeviceGUI> >(); } catch (Exception e) { Debug.Log("exception at new dataDictionary occurd: " + e.Message); } }
/// <summary> /// Awake this instance. /// </summary> void Awake() { zyklusRest = Time.time; zyklusOPC = Time.time; zyklusMatching = 0; GameObject go = GameObject.Find("SocketIO"); socket = go.GetComponent <SocketIOComponent>(); // Test OPC UA Server connection // connect to database database = GameObject.Find("Database").GetComponent <Database>(); istNodeIds = database.IstNodeIds; sollNodeIds = database.SollNodeIds; // Test serverstatus for the first time testRest(); //socket.On ("message", testSocket); socket.On("message", socketMessage); }
/// <summary> /// For submodules. /// </summary> public virtual void InitOPCUAData(IstOPCUANodeIds istIds, SollOPCUANodeIds sollIds, RestAPIRequest rest) { }