Beispiel #1
0
        private byte NowAck = 0;                               //当前ACK应答值

        public MainWindow()
        {
            InitializeComponent();



            baseFrame = new RTUFrame(downComputeAddress, (byte)FunEnum.None);

            downComputeSampleData = new List <SampleDataBase>();
            sampleData            = new SampleDataBase(sampleLen, "原始采样数据");
            downComputeSampleData.Add(sampleData);

            realCalArray = new List <double>();
            realCalArray.Add(0);
            realCalArray.Add(1);
            realCalArray.Add(2);
            realCalArray.Add(3);
            realCalArray.Add(4);

            //曲线显示与转换
            setHezhaPhase.TextChanged += setHezhaPhase_TextChanged;
            PlotSineWave();
            jiaoDuRadio.IsChecked = true;

            NowAck = 0; //初始化为0
        }
Beispiel #2
0
        private void SaveDataToFile(SampleDataBase rawData, string path)
        {
            //此方法是每次获取后立刻写入磁盘文件,亦可以考虑先保存数据待全部接收完毕,一起写入磁盘文件。
            //文件名

            FileStream saveFileStream = new FileStream(path, FileMode.Create,
                                                       FileAccess.ReadWrite, FileShare.ReadWrite);
            StreamWriter charStream = new StreamWriter(saveFileStream);
            int          len        = rawData.RawData.Length;

            for (int i = 0; i < len; i += 2)
            {
                var str = (rawData.RawData[i] + rawData.RawData[i + 1] * 256).ToString();
                charStream.WriteLine(str);
            }
            if (realCalArray.Count > 0)
            {
                foreach (var ele in realCalArray)
                {
                    charStream.WriteLine(ele.ToString());
                }
            }

            charStream.Flush();
            charStream.Close();
        }
Beispiel #3
0
 private void zvdRaio_Checked(object sender, RoutedEventArgs e)
 {
     sampleLen = 128 * 10 * 2;
     if (downComputeSampleData != null)
     {
         downComputeSampleData.Remove(sampleData);
         sampleData = new SampleDataBase(sampleLen, "原始采样数据");
         downComputeSampleData.Add(sampleData);
     }
 }
Beispiel #4
0
 private void fftRadioButton_Click(object sender, RoutedEventArgs e)
 {
     sampleLen = 128 * 2;
     if (downComputeSampleData != null)
     {
         downComputeSampleData.Remove(sampleData);
         sampleData = new SampleDataBase(sampleLen, "原始采样数据");
         downComputeSampleData.Add(sampleData);
     }
 }
Beispiel #5
0
        public List <SampleDataBase> RawData; //集合
        public SampDataType(int len)
        {
            RawMainVolatageA = new SampleDataBase(len);        //主回路A相电压
            RawMainVolatageB = new SampleDataBase(len);        //主回路B相电压
            RawMainVolatageC = new SampleDataBase(len);        //主回路C相电压

            RawMainCurrentA = new SampleDataBase(len);         //主回路A相电流
            RawMainCurrentB = new SampleDataBase(len);         //主回路B相电流
            RawMainCurrentC = new SampleDataBase(len);         //主回路C相电流

            RawMainDuankouVolatageA = new SampleDataBase(len); //主回路A相断口电压
            RawMainDuankouVolatageB = new SampleDataBase(len); //主回路B相断口电压
            RawMainDuankouVolatageC = new SampleDataBase(len); //主回路C相断口电压

            RawXianquanCurrent = new SampleDataBase(len);      //线圈电流A

            RawJiasuduA = new SampleDataBase(len);             //A相 加速度
            RawJiasuduB = new SampleDataBase(len);             //B相 加速度
            RawJiasuduC = new SampleDataBase(len);             //C相 加速度

            RawLineA = new SampleDataBase(len);                //A相 位移
            RawLineB = new SampleDataBase(len);                //B相 位移
            RawLineC = new SampleDataBase(len);                //C相 位移



            RawData = new List <SampleDataBase>();

            RawData.Add(RawXianquanCurrent);

            RawData.Add(RawMainDuankouVolatageA);
            RawData.Add(RawMainDuankouVolatageB);
            RawData.Add(RawMainDuankouVolatageC);

            RawData.Add(RawMainCurrentA);
            RawData.Add(RawMainCurrentB);
            RawData.Add(RawMainCurrentC);


            //仅仅用到以上七组

            RawData.Add(RawMainVolatageA);
            RawData.Add(RawMainVolatageB);
            RawData.Add(RawMainVolatageC);

            RawData.Add(RawJiasuduA);
            RawData.Add(RawJiasuduB);
            RawData.Add(RawJiasuduC);

            RawData.Add(RawLineA);
            RawData.Add(RawLineB);
            RawData.Add(RawLineC);
        }