Example #1
0
        public bool Open()
        {
            if (!plantDataCollector.Open())
            {
                logger.Debug("Connect to OPC Server Failure");
                return false;
            }
            else
            {
                 resultBuilder.OpcClient = plantDataCollector.OpcClient;
                 this.opcClient = plantDataCollector.OpcClient;
                 this.opcClient.OpcServer.ShutdownRequested += new OPCDA.NET.ShutdownRequestEventHandler(OpcServerShutdownRequested);
                 ReportAlive();
            }

            if (!modelExecutor.Open(this.caseFilePath))
                return false;

            if (!resultBuilder.Open())
                return false;

            return true;
        }
        public bool Open()
        {
            this.client4OPC = new Client4OPC();

            bool connectSuccess = false;
            connectSuccess = client4OPC.Connect("Intellution.OPCiFIX.1");

            if (connectSuccess)
            {
                logger.Debug("Connect to OPC Server Success");
                // register tags to OPC 
                foreach (KeyValuePair<string, double> kvp in this.rawData.ToArray())
                {
                    client4OPC.RegisterSyncIOGroup(kvp.Key);
                }



                //OPC.DataChange += new DataChangeHandler(OPC_DataChange);
               // client4OPC.OpcServer.ShutdownRequested += new OPCDA.NET.ShutdownRequestEventHandler(OpcServer_ShutdownRequested);
            }
            return connectSuccess;
        }