Beispiel #1
0
        static void TestASCII()
        {
            Console.WriteLine("TestASCIIContent-TestStart");
            string testStr = "2, 167, -943, 1231 , 94, 37, -137 , -275, 0, 0, 0, 0, 0, 0";

            // var row = new ASCIIContent(testStr,6,6);
            byte[] data      = new byte[] { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0xFC, 0xB5, 0x04, 0x64, 0x00, 0x1D, 0x00, 0x79, 0xFF, 0x3B, 0xFF, 0x00, 0x00 };
            var    rowBinary = new BinaryContent(data, 6, 6);

            var row = new ASCIIContent(rowBinary);

            Console.Write(row.RowToString());
            testStr = "2, 45, -943, 2322 , 94, 37, -137 , -275, 1, 1, 0, 0, 0, 0";;

            row.StringToRow(testStr, 6, 6);

            Console.Write(row.RowToString());
            Console.WriteLine("TestASCIIContent-TestEnd");

            while (true)
            {
                try
                {
                    Console.WriteLine();
                    Console.Write("Input:");
                    var instr = Console.ReadLine();
                    if (instr == "q")
                    {
                        return;
                    }
                    else
                    {
                        row.StringToRow(instr, 6, 6);

                        Console.WriteLine(row.RowToString());

                        Console.WriteLine("TestEnd");
                        Console.WriteLine();
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Exception:");
                    Console.WriteLine(ex.Message);
                }
            }
        }
Beispiel #2
0
        void TestComtrade()
        {
            Console.WriteLine("TestComtradeManager-TestStart");
            string path     = @"E:\WorkProject\04-FTU终端\Comtrade\ComtradeFile";
            string cfgPath  = System.IO.Path.Combine(path, "binary.cfg");
            string dataPath = System.IO.Path.Combine(path, "binary.dat");

            Console.WriteLine("In:");
            Console.WriteLine(path);
            Console.WriteLine(cfgPath);
            Console.WriteLine(dataPath);

            var comtradeManager = new ComtradeFileManager();

            comtradeManager.ReadFile(cfgPath, dataPath);


            Console.WriteLine("Out:");
            Console.WriteLine("配置文件内容:");
            string[] cfgRow;
            comtradeManager.ConfigFile.MakeConfigFile(out cfgRow);

            for (int index = 0; index < cfgRow.Length; index++)
            {
                Console.Write(string.Format("{0}:" + cfgRow[index], index + 1));
            }
            Console.WriteLine("数据文件内容:");
            for (int i = 0; i < comtradeManager.DataFile.AsciiData.Count; i++)
            {
                var ascii = new ASCIIContent(comtradeManager.DataFile.AsciiData[i],
                                             comtradeManager.ConfigFile.RowChannelNumType.AnalogChannelCount,
                                             comtradeManager.ConfigFile.RowChannelNumType.DigitalChannelCount);

                Console.Write(ascii.RowToString());
            }
            for (int j = 0; j < comtradeManager.DataFile.BinaryData.Count; j++)
            {
                var binanry = new BinaryContent(comtradeManager.DataFile.BinaryData[j],
                                                comtradeManager.ConfigFile.RowChannelNumType.AnalogChannelCount,
                                                comtradeManager.ConfigFile.RowChannelNumType.DigitalChannelCount);
                var assii = new ASCIIContent(binanry);
                Console.Write(assii.RowToString());
            }


            Console.WriteLine("TestComtradeManager-TestEnd");

            //gridRowStationRev.ItemsSource

            //var rowStationRev = new ObservableCollection<StationRev>();
            //rowStationRev.Add(comtradeManager.ConfigFile.RowStationRev);
            //gridRowStationRev.ItemsSource = rowStationRev;
        }
Beispiel #3
0
        static void TestComtradeManager()
        {
            while (true)
            {
                try
                {
                    Console.WriteLine("回车开始");
                    Console.ReadLine();

                    Console.WriteLine("TestComtradeManager-TestStart");
                    string path     = @"E:\WorkProject\04-FTU终端\Comtrade\ComtradeFile";
                    string cfgPath  = Path.Combine(path, "binary.cfg");
                    string dataPath = Path.Combine(path, "binary.dat");
                    Console.WriteLine("In:");
                    Console.WriteLine(path);
                    Console.WriteLine(cfgPath);
                    Console.WriteLine(dataPath);

                    var comtradeManager = new ComtradeFileManager();
                    comtradeManager.ReadFile(cfgPath, dataPath);


                    Console.WriteLine("Out:");
                    Console.WriteLine("配置文件内容:");
                    string[] cfgRow;
                    comtradeManager.ConfigFile.MakeConfigFile(out cfgRow);



                    for (int index = 0; index < cfgRow.Length; index++)
                    {
                        Console.Write(string.Format("{0}:" + cfgRow[index], index + 1));
                    }
                    Console.WriteLine("数据文件内容:");
                    for (int i = 0; i < comtradeManager.DataFile.AsciiData.Count; i++)
                    {
                        var ascii = new ASCIIContent(comtradeManager.DataFile.AsciiData[i],
                                                     comtradeManager.ConfigFile.RowChannelNumType.AnalogChannelCount,
                                                     comtradeManager.ConfigFile.RowChannelNumType.DigitalChannelCount);

                        Console.Write(ascii.RowToString());
                    }
                    for (int j = 0; j < comtradeManager.DataFile.BinaryData.Count; j++)
                    {
                        var binanry = new BinaryContent(comtradeManager.DataFile.BinaryData[j],
                                                        comtradeManager.ConfigFile.RowChannelNumType.AnalogChannelCount,
                                                        comtradeManager.ConfigFile.RowChannelNumType.DigitalChannelCount);
                        var assii = new ASCIIContent(binanry);
                        Console.Write(assii.RowToString());
                    }


                    Console.WriteLine("TestComtradeManager-TestEnd");
                    var instr = Console.ReadLine();
                    if (instr == "q")
                    {
                        return;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine();
                    Console.WriteLine("Exception:");
                    Console.WriteLine(ex.Message);

                    var instr = Console.ReadLine();
                    if (instr == "q")
                    {
                        return;
                    }
                }
            }
        }