Пример #1
0
        public static void Main(string[] args)
        {
            m_definedMeasurements = new ConcurrentDictionary<string, IMeasurement>();
            m_definedDevices = new ConcurrentDictionary<ushort, ConfigurationCell>();

            if (WriteLogs)
                m_exportFile = new StreamWriter(FilePath.GetAbsolutePath("InputTimestamps.csv"));

            if (TestConcentrator)
            {
                // Create a new concentrator
                concentrator = new Concentrator(WriteLogs, FilePath.GetAbsolutePath("OutputTimestamps.csv"));
                concentrator.TimeResolution = 333000;
                concentrator.FramesPerSecond = 30;
                concentrator.LagTime = 3.0D;
                concentrator.LeadTime = 9.0D;
                concentrator.PerformTimestampReasonabilityCheck = false;
                concentrator.ProcessByReceivedTimestamp = true;
                concentrator.Start();
            }

            // Create a new protocol parser
            parser = new MultiProtocolFrameParser();
            parser.AllowedParsingExceptions = 500;
            parser.ParsingExceptionWindow = 5;

            // Attach to desired events
            parser.ConnectionAttempt += parser_ConnectionAttempt;
            parser.ConnectionEstablished += parser_ConnectionEstablished;
            parser.ConnectionException += parser_ConnectionException;
            parser.ParsingException += parser_ParsingException;
            parser.ReceivedConfigurationFrame += parser_ReceivedConfigurationFrame;
            parser.ReceivedDataFrame += parser_ReceivedDataFrame;
            parser.ReceivedFrameBufferImage += parser_ReceivedFrameBufferImage;
            parser.ConnectionTerminated += parser_ConnectionTerminated;

            // Define the connection string
            //parser.ConnectionString = @"phasorProtocol=IeeeC37_118V1; transportProtocol=UDP; localport=5000; server=233.123.123.123:5000; interface=0.0.0.0";
            //parser.ConnectionString = @"phasorProtocol=Ieee1344; transportProtocol=File; file=D:\Projects\Applications\openPDC\Synchrophasor\Current Version\Build\Output\Debug\Applications\openPDC\Sample1344.PmuCapture";
            //parser.ConnectionString = @"phasorProtocol=Macrodyne; accessID=1; transportProtocol=File; skipDisableRealTimeData = true; file=C:\Users\Ritchie\Desktop\Development\Macrodyne\ING.out; iniFileName=C:\Users\Ritchie\Desktop\Development\Macrodyne\BCH18Aug2011.ini; deviceLabel=ING1; protocolVersion=G";
            //parser.ConnectionString = @"phasorProtocol=Iec61850_90_5; accessID=1; transportProtocol=UDP; skipDisableRealTimeData = true; localPort=102; interface=0.0.0.0; commandChannel={transportProtocol=TCP; server=172.21.1.201:4712; interface=0.0.0.0}";
            //parser.ConnectionString = @"phasorProtocol=FNET; transportProtocol=TCP; server=172.21.4.100:4001; interface=0.0.0.0; isListener=false";
            //parser.ConnectionString = @"phasorProtocol=Macrodyne; transportProtocol=Serial; port=COM6; baudrate=38400; parity=None; stopbits=One; databits=8; dtrenable=False; rtsenable=False;";
            //parser.ConnectionString = @"phasorProtocol=SelFastMessage; transportProtocol=Serial; port=COM5; baudrate=57600; parity=None; stopbits=One; databits=8; dtrenable=False; rtsenable=False;";            
            //parser.ConnectionString = @"phasorProtocol=IEEEC37_118v1; transportProtocol=File; file=C:\Users\Ritchie\Desktop\MTI_Test_3phase.PmuCapture; checkSumValidationFrameTypes=DataFrame,HeaderFrame,CommandFrame";
            parser.ConnectionString = @"phasorProtocol=IEEEC37_118V1; transportProtocol=tcp; accessID=105; server=172.31.105.135:4712; interface=0.0.0.0; isListener=false";

            Dictionary<string, string> settings = parser.ConnectionString.ParseKeyValuePairs();
            string setting;

            // TODO: These should be optional picked up from connection string inside of MPFP
            // Apply other settings as needed
            if (settings.TryGetValue("accessID", out setting))
                parser.DeviceID = ushort.Parse(setting);

            if (settings.TryGetValue("simulateTimestamp", out setting))
                parser.InjectSimulatedTimestamp = setting.ParseBoolean();

            if (settings.TryGetValue("allowedParsingExceptions", out setting))
                parser.AllowedParsingExceptions = int.Parse(setting);

            if (settings.TryGetValue("parsingExceptionWindow", out setting))
                parser.ParsingExceptionWindow = Ticks.FromSeconds(double.Parse(setting));

            if (settings.TryGetValue("autoStartDataParsingSequence", out setting))
                parser.AutoStartDataParsingSequence = setting.ParseBoolean();

            if (settings.TryGetValue("skipDisableRealTimeData", out setting))
                parser.SkipDisableRealTimeData = setting.ParseBoolean();

            // When connecting to a file based resource you may want to loop the data
            parser.AutoRepeatCapturedPlayback = true;

            // Start frame parser
            parser.AutoStartDataParsingSequence = true;

            Console.WriteLine("ConnectionString: {0}", parser.ConnectionString);

            parser.Start();

            // To keep the console open while receiving live data with AutoRepeatCapturedPlayback = false, uncomment the following line of code:

            Console.WriteLine("Press <enter> to terminate application...");

            Console.ReadLine();

            parser.Stop();

            // Stop concentrator
            if (TestConcentrator)
                concentrator.Stop();

            if (WriteLogs)
                m_exportFile.Close();
        }
Пример #2
0
        public static void Main(string[] args)
        {
            m_definedMeasurements = new ConcurrentDictionary <string, MeasurementMetadata>();
            m_definedDevices      = new ConcurrentDictionary <ushort, ConfigurationCell>();

            if (WriteLogs)
            {
                m_exportFile = new StreamWriter(FilePath.GetAbsolutePath("InputTimestamps.csv"));
            }

            if (TestConcentrator)
            {
                // Create a new concentrator
                concentrator = new Concentrator(WriteLogs, FilePath.GetAbsolutePath("OutputTimestamps.csv"));
                concentrator.TimeResolution  = 333000;
                concentrator.FramesPerSecond = 30;
                concentrator.LagTime         = 3.0D;
                concentrator.LeadTime        = 9.0D;
                concentrator.PerformTimestampReasonabilityCheck = false;
                concentrator.ProcessByReceivedTimestamp         = true;
                concentrator.Start();
            }

            // Create a new protocol parser
            parser = new MultiProtocolFrameParser();
            parser.AllowedParsingExceptions = 500;
            parser.ParsingExceptionWindow   = 5;

            // Attach to desired events
            parser.ConnectionAttempt          += parser_ConnectionAttempt;
            parser.ConnectionEstablished      += parser_ConnectionEstablished;
            parser.ConnectionException        += parser_ConnectionException;
            parser.ParsingException           += parser_ParsingException;
            parser.ReceivedConfigurationFrame += parser_ReceivedConfigurationFrame;
            parser.ReceivedDataFrame          += parser_ReceivedDataFrame;
            parser.ReceivedFrameBufferImage   += parser_ReceivedFrameBufferImage;
            parser.ConnectionTerminated       += parser_ConnectionTerminated;

            // Define the connection string
            //parser.ConnectionString = @"phasorProtocol=IeeeC37_118V1; transportProtocol=UDP; localport=5000; server=233.123.123.123:5000; interface=0.0.0.0";
            //parser.ConnectionString = @"phasorProtocol=Ieee1344; transportProtocol=File; file=D:\Projects\Applications\openPDC\Synchrophasor\Current Version\Build\Output\Debug\Applications\openPDC\Sample1344.PmuCapture";
            //parser.ConnectionString = @"phasorProtocol=Macrodyne; accessID=1; transportProtocol=File; skipDisableRealTimeData = true; file=C:\Users\Ritchie\Desktop\Development\Macrodyne\ING.out; iniFileName=C:\Users\Ritchie\Desktop\Development\Macrodyne\BCH18Aug2011.ini; deviceLabel=ING1; protocolVersion=G";
            //parser.ConnectionString = @"phasorProtocol=Iec61850_90_5; accessID=1; transportProtocol=UDP; skipDisableRealTimeData = true; localPort=102; interface=0.0.0.0; commandChannel={transportProtocol=TCP; server=172.21.1.201:4712; interface=0.0.0.0}";
            //parser.ConnectionString = @"phasorProtocol=FNET; transportProtocol=TCP; server=172.21.4.100:4001; interface=0.0.0.0; isListener=false";
            //parser.ConnectionString = @"phasorProtocol=Macrodyne; transportProtocol=Serial; port=COM6; baudrate=38400; parity=None; stopbits=One; databits=8; dtrenable=False; rtsenable=False;";
            //parser.ConnectionString = @"phasorProtocol=SelFastMessage; transportProtocol=Serial; port=COM5; baudrate=57600; parity=None; stopbits=One; databits=8; dtrenable=False; rtsenable=False;";
            //parser.ConnectionString = @"phasorProtocol=IEEEC37_118v1; transportProtocol=File; file=C:\Users\Ritchie\Desktop\MTI_Test_3phase.PmuCapture; checkSumValidationFrameTypes=DataFrame,HeaderFrame,CommandFrame";
            //parser.ConnectionString = @"phasorProtocol=IEEEC37_118V1; transportProtocol=tcp; accessID=105; server=172.31.105.135:4712; interface=0.0.0.0; isListener=false";
            parser.ConnectionString = @"phasorProtocol=IEEEC37_118V1; transportProtocol=Serial; port=COM6; baudRate=115200; dataBits=8; stopBits=One; parity=None; dtrEnable=false; rtsEnable=false; autoStartDataParsingSequence=false; disableRealTimeDataOnStop=false";

            Dictionary <string, string> settings = parser.ConnectionString.ParseKeyValuePairs();
            string setting;

            // TODO: These should be optional picked up from connection string inside of MPFP
            // Apply other settings as needed
            if (settings.TryGetValue("accessID", out setting))
            {
                parser.DeviceID = ushort.Parse(setting);
            }

            if (settings.TryGetValue("simulateTimestamp", out setting))
            {
                parser.InjectSimulatedTimestamp = setting.ParseBoolean();
            }

            if (settings.TryGetValue("allowedParsingExceptions", out setting))
            {
                parser.AllowedParsingExceptions = int.Parse(setting);
            }

            if (settings.TryGetValue("parsingExceptionWindow", out setting))
            {
                parser.ParsingExceptionWindow = Ticks.FromSeconds(double.Parse(setting));
            }

            if (settings.TryGetValue("autoStartDataParsingSequence", out setting))
            {
                parser.AutoStartDataParsingSequence = setting.ParseBoolean();
            }

            if (settings.TryGetValue("skipDisableRealTimeData", out setting))
            {
                parser.SkipDisableRealTimeData = setting.ParseBoolean();
            }

            if (settings.TryGetValue("disableRealTimeDataOnStop", out setting))
            {
                parser.DisableRealTimeDataOnStop = setting.ParseBoolean();
            }

            // When connecting to a file based resource you may want to loop the data
            //parser.AutoRepeatCapturedPlayback = true;

            Console.WriteLine("ConnectionString: {0}", parser.ConnectionString);

            parser.Start();

            Console.WriteLine("Press <enter> to terminate application...");
            Console.ReadLine();

            parser.Stop();

            // Stop concentrator
            if (TestConcentrator)
            {
                concentrator.Stop();
            }

            if (WriteLogs)
            {
                m_exportFile.Close();
            }
        }
Пример #3
0
        public static void Main(string[] args)
        {
            m_definedMeasurements = new ConcurrentDictionary <string, IMeasurement>();
            m_definedDevices      = new ConcurrentDictionary <ushort, ConfigurationCell>();

            if (WriteLogs)
            {
                m_exportFile = new StreamWriter(FilePath.GetAbsolutePath("InputTimestamps.csv"));
            }

            if (TestConcentrator)
            {
                // Create a new concentrator
                concentrator = new Concentrator(WriteLogs, FilePath.GetAbsolutePath("OutputTimestamps.csv"));
                concentrator.TimeResolution  = 333000;
                concentrator.FramesPerSecond = 30;
                concentrator.LagTime         = 3.0D;
                concentrator.LeadTime        = 9.0D;
                concentrator.PerformTimestampReasonabilityCheck = false;
                concentrator.ProcessByReceivedTimestamp         = true;
                concentrator.Start();
            }

            // Create a new protocol parser
            parser = new MultiProtocolFrameParser();
            parser.AllowedParsingExceptions = 500;
            parser.ParsingExceptionWindow   = 5;

            // Attach to desired events
            parser.ConnectionAttempt          += parser_ConnectionAttempt;
            parser.ConnectionEstablished      += parser_ConnectionEstablished;
            parser.ConnectionException        += parser_ConnectionException;
            parser.ParsingException           += parser_ParsingException;
            parser.ReceivedConfigurationFrame += parser_ReceivedConfigurationFrame;
            parser.ReceivedDataFrame          += parser_ReceivedDataFrame;

            // Define the connection string
            //parser.ConnectionString = @"phasorProtocol=IeeeC37_118V1; transportProtocol=UDP; localport=5000; server=233.123.123.123:5000; interface=0.0.0.0";
            //parser.ConnectionString = @"phasorProtocol=Ieee1344; transportProtocol=File; file=D:\Projects\Applications\openPDC\Synchrophasor\Current Version\Build\Output\Debug\Applications\openPDC\Sample1344.PmuCapture";
            //parser.ConnectionString = @"phasorProtocol=Macrodyne; accessID=1; transportProtocol=File; skipDisableRealTimeData = true; file=C:\Users\Ritchie\Desktop\Development\Macrodyne\ING.out; iniFileName=C:\Users\Ritchie\Desktop\Development\Macrodyne\BCH18Aug2011.ini; deviceLabel=ING1; protocolVersion=G";
            //parser.ConnectionString = @"phasorProtocol=Iec61850_90_5; accessID=1; transportProtocol=UDP; skipDisableRealTimeData = true; localPort=102; interface=0.0.0.0; commandChannel={transportProtocol=TCP; server=172.21.1.201:4712; interface=0.0.0.0}";
            //parser.ConnectionString = @"phasorProtocol=FNET; transportProtocol=TCP; server=172.21.4.100:4001; interface=0.0.0.0; isListener=false";
            //parser.ConnectionString = @"phasorProtocol=Macrodyne; transportProtocol=Serial; port=COM6; baudrate=38400; parity=None; stopbits=One; databits=8; dtrenable=False; rtsenable=False;";
            //parser.ConnectionString = @"phasorProtocol=SelFastMessage; transportProtocol=Serial; port=COM5; baudrate=57600; parity=None; stopbits=One; databits=8; dtrenable=False; rtsenable=False;";
            //parser.ConnectionString = @"phasorProtocol=IEEEC37_118v1; transportProtocol=File; file=C:\Users\Ritchie\Desktop\MTI_Test_3phase.PmuCapture; checkSumValidationFrameTypes=DataFrame,HeaderFrame,CommandFrame";
            parser.ConnectionString = @"phasorProtocol=IEEEC37_118V1; transportProtocol=tcp; server=172.21.4.100:4001; interface=0.0.0.0; isListener=false";

            // When connecting to a file based resource you may want to loop the data
            parser.AutoRepeatCapturedPlayback = true;

            // Start frame parser
            parser.AutoStartDataParsingSequence = true;
            parser.Start();

            // To keep the console open while receiving live data with AutoRepeatCapturedPlayback = false, uncomment the following line of code:
            Console.ReadLine();

            // Stop concentrator
            if (TestConcentrator)
            {
                concentrator.Stop();
            }

            if (WriteLogs)
            {
                m_exportFile.Close();
            }
        }