示例#1
0
 public void RemoveADBlock(int channel, ADBlock block)
 {
     lock (listChannelBlock)
     {
         List <ADBlock> list = listChannelBlock[channel];
         list.Remove(block);
     }
 }
示例#2
0
 public void AddADBlock(int channel, ADBlock block)
 {
     lock (listChannelBlock)
     {
         List <ADBlock> list = listChannelBlock[channel];
         list.Add(block);
     }
 }
示例#3
0
        private void ProcADSample(object obj)
        {
            int channel = (int)obj;

            ADBlock block=new ADBlock(8000,4000);
            this.device.AddADBlock(channel, block);

            try
            {

                while (true)
                {
                   short[] adData= block.GetAdData(-1);

                   if (adData == null) continue;

                   if (listEnable[channel] == false) continue;

                   int adMin = int.MaxValue;
                   int adMax = int.MinValue;

                   for (int i = 0; i < adData.Length; i++)
                   {
                       if (adData[i] > adMax)
                       {
                           adMax = adData[i];
                       }
                       if (adData[i] < adMin)
                       {
                           adMin = adData[i];
                       }
                   }

                   float adMaxf = adMax + (adMax - adMin) * 0.2f;

                   float adMinf = adMin - (adMax - adMin) * 0.2f;

                       this.Invoke((EventHandler)delegate
                       {

                           ChartGraph chart = listChart[channel];
                           UltraChart.CurveGroup grp = chart.GroupList[0];
                           grp.ClearChartObject();

                           LineArea area = new LineArea(chart, "AD曲线", true);
                           area.IsShowFoldFlag = false;
                           area.IsFold = false;
                           area.YAxes.Mode = YAxesMode.Manual;
                           area.YAxes.YAxesMin =adMinf ;
                           area.YAxes.YAxesMax = adMaxf;
                           area.YAxes.Precision = 3;
                           area.YAxes.UnitString = "";

                           LineCurve lcAmpl = new LineCurve(chart, "原始波形", 0);

                           lcAmpl.LineColor = Color.Lime;
                           area.AddLine(lcAmpl);

                           DateTime timeNow = DateTime.Now;
                           long startTm = ChartGraph.DateTime2ChartTime(timeNow);
                           for (int j = 0; j < adData.Length; j++)
                           {

                               long tm = startTm + j * 1000000L / 8000;
                               // var tm = timeQuery.AddMilliseconds(j / 8.0);
                               lcAmpl.AddPoint(new LinePoint(tm, adData[j]));
                           }

                           grp.AddChartObject(area);
                           grp.XAxes.SetOrgTime(ChartGraph.DateTime2ChartTime(timeNow), 0);
                           chart.AutoSetXScale();

                           chart.Draw();

                       });

                }

            }
            catch (Exception ex)
            {

            }
            finally {
                this.device.RemoveADBlock(channel,block);
            }
        }
示例#4
0
        private void ProcADSample(object obj)
        {
            int channel = (int)obj;

            ADBlock block = new ADBlock(8000, 4000);

            this.device.AddADBlock(channel, block);

            try
            {
                while (true)
                {
                    short[] adData = block.GetAdData(-1);

                    if (adData == null)
                    {
                        continue;
                    }

                    if (listEnable[channel] == false)
                    {
                        continue;
                    }

                    int adMin = int.MaxValue;
                    int adMax = int.MinValue;


                    for (int i = 0; i < adData.Length; i++)
                    {
                        if (adData[i] > adMax)
                        {
                            adMax = adData[i];
                        }
                        if (adData[i] < adMin)
                        {
                            adMin = adData[i];
                        }
                    }

                    float adMaxf = adMax + (adMax - adMin) * 0.2f;

                    float adMinf = adMin - (adMax - adMin) * 0.2f;

                    this.Invoke((EventHandler) delegate
                    {
                        ChartGraph chart          = listChart[channel];
                        UltraChart.CurveGroup grp = chart.GroupList[0];
                        grp.ClearChartObject();

                        LineArea area         = new LineArea(chart, "AD曲线", true);
                        area.IsShowFoldFlag   = false;
                        area.IsFold           = false;
                        area.YAxes.Mode       = YAxesMode.Manual;
                        area.YAxes.YAxesMin   = adMinf;
                        area.YAxes.YAxesMax   = adMaxf;
                        area.YAxes.Precision  = 3;
                        area.YAxes.UnitString = "";


                        LineCurve lcAmpl = new LineCurve(chart, "原始波形", 0);

                        lcAmpl.LineColor = Color.Lime;
                        area.AddLine(lcAmpl);

                        DateTime timeNow = DateTime.Now;
                        long startTm     = ChartGraph.DateTime2ChartTime(timeNow);
                        for (int j = 0; j < adData.Length; j++)
                        {
                            long tm = startTm + j * 1000000L / 8000;
                            // var tm = timeQuery.AddMilliseconds(j / 8.0);
                            lcAmpl.AddPoint(new LinePoint(tm, adData[j]));
                        }


                        grp.AddChartObject(area);
                        grp.XAxes.SetOrgTime(ChartGraph.DateTime2ChartTime(timeNow), 0);
                        chart.AutoSetXScale();


                        chart.Draw();
                    });
                }
            }
            catch (Exception ex)
            {
            }
            finally {
                this.device.RemoveADBlock(channel, block);
            }
        }
示例#5
0
 public void RemoveADBlock(int channel, ADBlock block)
 {
     lock (listChannelBlock)
     {
         List<ADBlock> list = listChannelBlock[channel];
         list.Remove(block);
     }
 }
示例#6
0
 public void AddADBlock(int channel,ADBlock block)
 {
     lock (listChannelBlock)
     {
         List<ADBlock> list = listChannelBlock[channel];
         list.Add(block);
     }
 }