コード例 #1
0
ファイル: RelayManagment2.cs プロジェクト: benvert/pfe
        //Configuration du rapport à lire
        private void Get_reports_Click(object sender, EventArgs e)
        {
            if (!IEDConnected)
            {
                toolStatus.Text = "IED NOT CONNECTED";
                return;
            }

            try
            {
                foreach (var item in DbReport)
                {
                    ReportControlBlock x;
                    rcb_ref = Device_name + "/LLN0" + item.Key;
                    x       = ConnectToIED.GetReportControlBlock(rcb_ref);
                    RCBS.Add(x);
                }
                foreach (var item in RCBS)
                {
                    item.GetRCBValues();
                    item.InstallReportHandler(ReportHandler, item);
                    item.SetTrgOps(TriggerOptions.DATA_CHANGED | TriggerOptions.INTEGRITY);
                    item.SetIntgPd(5000);
                    item.SetRptEna(true);
                    item.SetRCBValues();
                }
            }
            catch (IedConnectionException ev)
            {
                toolStatus.Text = ev.Message;
            }
            StopReporting.Enabled = true;
        }
コード例 #2
0
        public static void Main(string[] args)
        {
            IedConnection con = new IedConnection();

            string hostname;

            if (args.Length > 0)
            {
                hostname = args [0];
            }
            else
            {
                //hostname = "localhost";
                hostname = "172.23.44.10";
            }

            Console.WriteLine("Connect to " + hostname);

            try {
                con.Connect(hostname, 102);

                string rcbReference = "simpleIOGenericIO/LLN0.RP.EventsRCB01";

                ReportControlBlock rcb = con.GetReportControlBlock(rcbReference);

                rcb.GetRCBValues();

                // note: the second parameter is not required!
                rcb.InstallReportHandler(reportHandler, rcb);

                if (rcb.IsBuffered())
                {
                    Console.WriteLine("RCB: " + rcbReference + " is buffered");
                }

                Console.WriteLine(rcb.GetDataSetReference());

                rcb.SetTrgOps(TriggerOptions.DATA_CHANGED | TriggerOptions.INTEGRITY);
                rcb.SetIntgPd(5000);
                rcb.SetRptEna(true);

                rcb.SetRCBValues();

                /* run until Ctrl-C is pressed */
                Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e) {
                    e.Cancel = true;
                    ReportingExample.running = false;
                };

                while (running)
                {
                    Thread.Sleep(10);
                }

                con.Abort();
            } catch (IedConnectionException e) {
                Console.WriteLine(e.Message);
            }
        }
コード例 #3
0
ファイル: Main.cs プロジェクト: feuvan/libiec61850
        public static void Main(string[] args)
        {
            IedConnection con = new IedConnection ();

            string hostname;

            if (args.Length > 0)
                hostname = args[0];
            else
                hostname = "localhost";

            Console.WriteLine("Connect to " + hostname);

            try
            {
                con.Connect(hostname, 102);

                // create a new data set

                List<string> dataSetElements = new List<string>();

                dataSetElements.Add("simpleIOGenericIO/GGIO1.AnIn1.mag.f[MX]");
                dataSetElements.Add("simpleIOGenericIO/GGIO1.AnIn2.mag.f[MX]");
                dataSetElements.Add("simpleIOGenericIO/GGIO1.AnIn3.mag.f[MX]");
                dataSetElements.Add("simpleIOGenericIO/GGIO1.AnIn4.mag.f[MX]");

                // permanent (domain specific) data set
                //string dataSetReference = "simpleIOGenericIO/LLN0.ds1";

                // temporary (association specific) data set
                string dataSetReference = "@newds";

                // Note: this function will throw an exception when a data set with the same name already exists
                con.CreateDataSet(dataSetReference, dataSetElements);

                // reconfigure existing RCB with new data set

                string rcbReference = "simpleIOGenericIO/LLN0.RP.EventsRCB01";

                ReportControlBlock rcb = con.GetReportControlBlock(rcbReference);

                rcb.GetRCBValues();

                // note: the second parameter is not required!
                rcb.InstallReportHandler(reportHandler, rcb);

                string rcbDataSetReference = dataSetReference.Replace('.', '$');

                rcb.SetDataSetReference(rcbDataSetReference);
                rcb.SetTrgOps(TriggerOptions.DATA_CHANGED | TriggerOptions.INTEGRITY);
                rcb.SetIntgPd(5000);
                rcb.SetRptEna(true);

                rcb.SetRCBValues();

                /* run until Ctrl-C is pressed */
                Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e) {
                    e.Cancel = true;
                    running = false;
                };

                while (running) {
                    Thread.Sleep(1000);
                }

                // delete the data set
                con.DeleteDataSet(dataSetReference);

                con.Abort();
            }
            catch (IedConnectionException e)
            {
                Console.WriteLine(e.Message + " reason: " + e.GetIedClientError().ToString());
            }
        }
コード例 #4
0
ファイル: Main.cs プロジェクト: mlazic95/iec61850-client
        public static void Main(string[] args)
        {
            IedConnection con = new IedConnection();

            string hostname;

            if (args.Length > 0)
            {
                hostname = args[0];
            }
            else
            {
                hostname = "localhost";
            }

            Console.WriteLine("Connect to " + hostname);

            try
            {
                con.Connect(hostname, 102);

                // create a new data set

                List <string> dataSetElements = new List <string>();

                dataSetElements.Add("simpleIOGenericIO/GGIO1.AnIn1.mag.f[MX]");
                dataSetElements.Add("simpleIOGenericIO/GGIO1.AnIn2.mag.f[MX]");
                dataSetElements.Add("simpleIOGenericIO/GGIO1.AnIn3.mag.f[MX]");
                dataSetElements.Add("simpleIOGenericIO/GGIO1.AnIn4.mag.f[MX]");

                // permanent (domain specific) data set
                //string dataSetReference = "simpleIOGenericIO/LLN0.ds1";

                // temporary (association specific) data set
                string dataSetReference = "@newds";

                // Note: this function will throw an exception when a data set with the same name already exists
                con.CreateDataSet(dataSetReference, dataSetElements);

                // reconfigure existing RCB with new data set

                string rcbReference = "simpleIOGenericIO/LLN0.RP.EventsRCB01";

                ReportControlBlock rcb = con.GetReportControlBlock(rcbReference);

                rcb.GetRCBValues();

                // note: the second parameter is not required!
                rcb.InstallReportHandler(reportHandler, rcb);

                string rcbDataSetReference = dataSetReference.Replace('.', '$');

                rcb.SetDataSetReference(rcbDataSetReference);
                rcb.SetTrgOps(TriggerOptions.DATA_CHANGED | TriggerOptions.INTEGRITY);
                rcb.SetIntgPd(5000);
                rcb.SetRptEna(true);

                rcb.SetRCBValues();

                /* run until Ctrl-C is pressed */
                Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e) {
                    e.Cancel = true;
                    running  = false;
                };

                while (running)
                {
                    Thread.Sleep(1000);
                }

                // delete the data set
                con.DeleteDataSet(dataSetReference);

                con.Abort();
            }
            catch (IedConnectionException e)
            {
                Console.WriteLine(e.Message + " reason: " + e.GetIedClientError().ToString());
            }

            // release all resources - do NOT use the object after this call!!
            con.Dispose();
        }
コード例 #5
0
        public static void Main(string[] args)
        {
            IedConnection con = new IedConnection();

            string hostname;

            if (args.Length > 0)
            {
                hostname = args [0];
            }
            else
            {
                hostname = "localhost";
            }

            Console.WriteLine("Connect to " + hostname);

            try {
                con.Connect(hostname, 102);

                string rcbReference1 = "simpleIOGenericIO/LLN0.RP.EventsRCB01";
                string rcbReference2 = "simpleIOGenericIO/LLN0.RP.EventsIndexed01";
                string rcbReference3 = "simpleIOGenericIO/LLN0.BR.Measurements01";

                ReportControlBlock rcb1 = con.GetReportControlBlock(rcbReference1);
                ReportControlBlock rcb2 = con.GetReportControlBlock(rcbReference2);
                ReportControlBlock rcb3 = con.GetReportControlBlock(rcbReference3);

                rcb1.GetRCBValues();

                // note: the second parameter is not required!
                rcb1.InstallReportHandler(reportHandler, rcb1);

                if (rcb1.IsBuffered())
                {
                    Console.WriteLine("RCB: " + rcbReference1 + " is buffered");
                }

                rcb1.SetTrgOps(TriggerOptions.DATA_CHANGED | TriggerOptions.INTEGRITY);
                rcb1.SetIntgPd(5000);
                rcb1.SetRptEna(true);

                rcb2.GetRCBValues();

                if (rcb2.IsBuffered())
                {
                    Console.WriteLine("RCB: " + rcbReference2 + " is buffered");
                }

                rcb2.InstallReportHandler(reportHandler, rcb2);

                rcb2.SetOptFlds(ReportOptions.REASON_FOR_INCLUSION | ReportOptions.SEQ_NUM | ReportOptions.TIME_STAMP |
                                ReportOptions.CONF_REV | ReportOptions.ENTRY_ID | ReportOptions.DATA_REFERENCE | ReportOptions.DATA_SET);
                rcb2.SetTrgOps(TriggerOptions.DATA_CHANGED | TriggerOptions.INTEGRITY);
                rcb2.SetIntgPd(2000);
                rcb2.SetRptEna(true);

                rcb2.SetRCBValues();

                rcb3.GetRCBValues();

                if (rcb3.IsBuffered())
                {
                    Console.WriteLine("RCB: " + rcbReference3 + " is buffered");
                }

                rcb3.InstallReportHandler(reportHandler, rcb2);

                rcb3.SetOptFlds(ReportOptions.REASON_FOR_INCLUSION | ReportOptions.SEQ_NUM | ReportOptions.TIME_STAMP |
                                ReportOptions.CONF_REV | ReportOptions.ENTRY_ID | ReportOptions.DATA_REFERENCE | ReportOptions.DATA_SET);
                rcb3.SetTrgOps(TriggerOptions.DATA_CHANGED | TriggerOptions.INTEGRITY);
                rcb3.SetIntgPd(2000);
                rcb3.SetRptEna(true);

                rcb3.SetRCBValues();


                /* run until Ctrl-C is pressed */
                Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e) {
                    e.Cancel = true;
                    ReportingExample.running = false;
                };

                /* stop main loop when connection is lost */
                con.InstallConnectionClosedHandler(delegate(IedConnection connection) {
                    Console.WriteLine("Connection closed");
                    ReportingExample.running = false;
                });

                while (running)
                {
                    Thread.Sleep(10);
                }

                /* Dispose the RCBs when you no longer need them */
                rcb1.Dispose();
                rcb2.Dispose();
                rcb3.Dispose();

                con.Abort();

                con.Dispose();
            } catch (IedConnectionException e) {
                Console.WriteLine("Error: " + e.Message);

                con.Dispose();
            }
        }
コード例 #6
0
        public ResultDatasetModel ReadRCB(string hostip, Int32 port, string dataaddress)
        {   //instance
            IedConnection con = new IedConnection();

            try
            {   //connection
                con.Connect(hostip, port);
                //read data set
                // create a new data set

                List <string> dataSetElements = new List <string>();

                dataSetElements.Add("simpleIOGenericIO/GGIO1.AnIn1.mag.f[MX]");
                dataSetElements.Add("simpleIOGenericIO/GGIO1.AnIn2.mag.f[MX]");
                dataSetElements.Add("simpleIOGenericIO/GGIO1.AnIn3.mag.f[MX]");
                dataSetElements.Add("simpleIOGenericIO/GGIO1.AnIn4.mag.f[MX]");

                // permanent (domain specific) data set
                //string dataSetReference = "simpleIOGenericIO/LLN0.ds1";

                // temporary (association specific) data set
                string dataSetReference = "@ss";

                // Note: this function will throw an exception when a data set with the same name already exists
                con.CreateDataSet(dataSetReference, dataSetElements);

                // reconfigure existing RCB with new data set

                string rcbReference = "simpleIOGenericIO/LLN0.RP.EventsRCB01";

                ReportControlBlock rcb = con.GetReportControlBlock(rcbReference);

                rcb.GetRCBValues();

                // note: the second parameter is not required!
                rcb.InstallReportHandler(reportHandler, rcb);

                string rcbDataSetReference = dataSetReference.Replace('.', '$');

                rcb.SetDataSetReference(rcbDataSetReference);
                rcb.SetTrgOps(TriggerOptions.DATA_CHANGED | TriggerOptions.INTEGRITY);
                rcb.SetIntgPd(5000);
                rcb.SetRptEna(true);

                rcb.SetRCBValues();

                // Console.WriteLine(mmsresult.GetRCBValues());
                List <Dataset_Result> valuelist   = new List <Dataset_Result>();
                data_extract          dataExtract = new data_extract();

                //con close
                con.Abort();

                ResultDatasetModel result = new ResultDatasetModel
                {
                    data         = valuelist,
                    error        = false,
                    errormessage = null
                };
                //destroy instance
                con.Dispose();
                //result
                return(result);
            }
            catch (IedConnectionException e)
            {
                ResultDatasetModel result = new ResultDatasetModel()
                {
                    data         = null,
                    error        = true,
                    errormessage = e.Message.ToString()
                };
                //insert logs into db
                Submission dbinsert = new Submission
                {
                    CreatedAt = DateTime.Now,
                    Content   = e.Message.ToString()
                };
                _subSvc.Create(dbinsert);
                //destroy result
                con.Dispose();
                //result
                return(result);
            }
        }
コード例 #7
0
        public static void Main(string[] args)
        {
            IedConnection con = new IedConnection ();

            string hostname;

            if (args.Length > 0)
                hostname = args [0];
            else
                hostname = "localhost";

            Console.WriteLine ("Connect to " + hostname);

            try {
                con.Connect (hostname, 102);

                string rcbReference1 = "simpleIOGenericIO/LLN0.RP.EventsRCB01";
                string rcbReference2 = "simpleIOGenericIO/LLN0.RP.EventsIndexed01";
                string rcbReference3 = "simpleIOGenericIO/LLN0.BR.Measurements01";

                ReportControlBlock rcb1 = con.GetReportControlBlock(rcbReference1);
                ReportControlBlock rcb2 = con.GetReportControlBlock(rcbReference2);
                ReportControlBlock rcb3 = con.GetReportControlBlock(rcbReference3);

                rcb1.GetRCBValues();

                // note: the second parameter is not required!
                rcb1.InstallReportHandler(reportHandler, rcb1);

                if (rcb1.IsBuffered())
                    Console.WriteLine ("RCB: " + rcbReference1 + " is buffered");

                rcb1.SetTrgOps(TriggerOptions.DATA_CHANGED | TriggerOptions.INTEGRITY);
                rcb1.SetIntgPd(5000);
                rcb1.SetRptEna(true);

                rcb1.SetRCBValues();

                rcb2.GetRCBValues();

                if (rcb2.IsBuffered())
                    Console.WriteLine ("RCB: " + rcbReference2 + " is buffered");

                rcb2.InstallReportHandler(reportHandler, rcb2);

                rcb2.SetOptFlds(ReportOptions.REASON_FOR_INCLUSION | ReportOptions.SEQ_NUM | ReportOptions.TIME_STAMP |
                    ReportOptions.CONF_REV | ReportOptions.ENTRY_ID | ReportOptions.DATA_REFERENCE | ReportOptions.DATA_SET);
                rcb2.SetTrgOps(TriggerOptions.DATA_CHANGED | TriggerOptions.INTEGRITY);
                rcb2.SetIntgPd(2000);
                rcb2.SetRptEna(true);

                rcb2.SetRCBValues();

                rcb3.GetRCBValues();

                if (rcb3.IsBuffered())
                    Console.WriteLine ("RCB: " + rcbReference3 + " is buffered");

                rcb3.InstallReportHandler(reportHandler, rcb2);

                rcb3.SetOptFlds(ReportOptions.REASON_FOR_INCLUSION | ReportOptions.SEQ_NUM | ReportOptions.TIME_STAMP |
                                ReportOptions.CONF_REV | ReportOptions.ENTRY_ID | ReportOptions.DATA_REFERENCE | ReportOptions.DATA_SET);
                rcb3.SetTrgOps(TriggerOptions.DATA_CHANGED | TriggerOptions.INTEGRITY);
                rcb3.SetIntgPd(2000);
                rcb3.SetRptEna(true);

                rcb3.SetRCBValues();

                /* run until Ctrl-C is pressed */
                Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e) {
                    e.Cancel = true;
                    ReportingExample.running = false;
                };

                while (running) {
                    Thread.Sleep(10);
                }

                con.Abort ();
            } catch (IedConnectionException e) {
                Console.WriteLine (e.Message);
            }
        }
コード例 #8
0
        public void OnGet()
        {
            IndexModel viewdata = new IndexModel();

            IedConnection con = new IedConnection();

            string hostname;

            hostname = "100.100.100.100";

            Console.WriteLine("Connect to " + hostname);

            try {
                con.Connect(hostname, 102);

                string rcbReference3 = "TEMPLATEMEAS/LLN0.RP.urcbAinA01";
                // string rcbReference3 = "TEMPLATECTRL/LLN0.BR.brcbDinD01";
                ReportControlBlock rcb3 = con.GetReportControlBlock(rcbReference3);

                rcb3.GetRCBValues();

                if (rcb3.IsBuffered())
                {
                    Console.WriteLine("RCB: " + rcbReference3 + " is buffered");
                }

                rcb3.InstallReportHandler(reportHandler, rcb3);

                rcb3.SetOptFlds(ReportOptions.REASON_FOR_INCLUSION | ReportOptions.SEQ_NUM | ReportOptions.TIME_STAMP |
                                ReportOptions.CONF_REV | ReportOptions.ENTRY_ID | ReportOptions.DATA_REFERENCE | ReportOptions.DATA_SET);
                rcb3.SetTrgOps(TriggerOptions.DATA_CHANGED | TriggerOptions.INTEGRITY);
                rcb3.SetIntgPd(2000);
                rcb3.SetRptEna(true);

                rcb3.SetRCBValues();


                /* run until Ctrl-C is pressed */
                Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e) {
                    e.Cancel           = true;
                    IndexModel.running = false;
                };

                /* stop main loop when connection is lost */
                con.InstallConnectionClosedHandler(delegate(IedConnection connection) {
                    Console.WriteLine("Connection closed");
                    IndexModel.running = false;
                });

                while (running)
                {
                    Thread.Sleep(10);
                }

                /* Dispose the RCBs when you no longer need them */
                rcb3.Dispose();

                con.Abort();

                con.Dispose();
            } catch (IedConnectionException e) {
                Console.WriteLine("Error: " + e.Message);

                con.Dispose();
            }
        }