示例#1
0
        /// <summary>
        /// Здесь отсчеты идут эквидистантно с шагом x_step
        /// </summary>
        /// <param name="inputs">Количество входов</param>
        /// <param name="x_step">шаг по х</param>
        public ChartApplet(GraphBuilder gb, int inputs, double x_step)
            : base(gb)
        {
            m_XStep = x_step;
            Chart = new ChartPanel();
            Chart.Dock = DockStyle.Fill;
            Chart.Location = new Point(0, 0);

            Random rnd_clr = new Random((int)DateTime.Now.Ticks);
            for (int i = 0; i < inputs; i++)
            {
                Chart.Chart.SeriesList.Add(new LineSeries(Chart.Chart, "series" + i.ToString(),
                    Color.FromArgb(rnd_clr.Next(255), rnd_clr.Next(255), rnd_clr.Next(255)), 2.0f));

                int index = i;
                double x = 0.0;
                InPin<double> pin = RegisterInputPin<double>("ChartInput" + i.ToString(), 1, 1);
                pin.OnNewDataEnabled += new NewDataEnabled<double>(
                    delegate(IEnumerable<double> data)
                    {
                        LineSeries ls = (Chart.Chart.SeriesList[index] as LineSeries);
                        foreach (double y in data)
                        {
                            ls.AddPoint(x, y);
                            x += m_XStep;
                        }

                        Chart.Chart.AutoFit();
                    });
            }
        }
示例#2
0
        public DefectoscopeApplet(GraphBuilder gb, ChartPanel mainPanel, ChartPanel dipolePanel, ListBox dipoleList, Form defectoscopeForm)
            : base(gb)
        {
            m_defectoscopeForm = defectoscopeForm;
            m_mainChartPanel = mainPanel;
            m_dipoleChartPanel = dipolePanel;
            m_mainChartSeriesCh1 = new LineSeries(m_mainChartPanel.Chart, "1", Color.Red, 2.0f);
            m_mainChartSeriesCh2 = new LineSeries(m_mainChartPanel.Chart, "2", Color.Green, 2.0f);
            m_mainChartSeriesCh3 = new LineSeries(m_mainChartPanel.Chart, "3", Color.Blue, 2.0f);

            m_dipoleChartSeriesCh1 = new LineSeries(m_dipoleChartPanel.Chart, "1", Color.Red, 2.0f);
            m_dipoleChartSeriesCh2 = new LineSeries(m_dipoleChartPanel.Chart, "2", Color.Green, 2.0f);
            m_dipoleChartSeriesCh3 = new LineSeries(m_dipoleChartPanel.Chart, "3", Color.Blue, 2.0f);

            m_mainChartPanel.Chart.SeriesList.Add(m_mainChartSeriesCh1);
            m_mainChartPanel.Chart.SeriesList.Add(m_mainChartSeriesCh2);
            m_mainChartPanel.Chart.SeriesList.Add(m_mainChartSeriesCh3);
            m_dipoleChartPanel.Chart.SeriesList.Add(m_dipoleChartSeriesCh1);
            m_dipoleChartPanel.Chart.SeriesList.Add(m_dipoleChartSeriesCh2);
            m_dipoleChartPanel.Chart.SeriesList.Add(m_dipoleChartSeriesCh3);

            InPin<CHDSample> mainIn = RegisterInputPin<CHDSample>(1, kVisiblePoints);
            mainIn.OnNewDataEnabled += new NewDataEnabled<CHDSample>(mainIn_OnNewDataEnabled);

            InPin<CHDSample[]> subIn = RegisterInputPin<CHDSample[]>("SubInPin", 1, 1);
            subIn.OnNewDataEnabled += new NewDataEnabled<CHDSample[]>(subIn_OnNewDataEnabled);

            m_dipoleListBox = dipoleList;
            m_dipoleListBox.SelectedIndexChanged += new EventHandler(dipoleList_SelectedIndexChanged);
        }
示例#3
0
        public AdnsReader(GraphBuilder gb)
            : base(gb)
        {
            InPin<byte[]> inputPin = RegisterInputPin<byte[]>(1, 1);
            m_outPin = RegisterOutputPin<Bitmap>();

            inputPin.OnNewDataEnabled += new NewDataEnabled<byte[]>(AppletEngine);
        }
示例#4
0
        public mainForm(FTDI dev)
        {
            InitializeComponent();
            m_graphBuilder = new GraphBuilder();
            m_defectoscope = new CHDDriver(m_graphBuilder, dev, kDevice_Descriptor, 9600u);
            m_defectoscopeCharts = new DefectoscopeApplet(m_graphBuilder, mainChartPanel, dipoleChartPanel, dipoleListBox, this);

            m_graphBuilder.ConnectApplets(m_defectoscope, m_defectoscopeCharts);
        }
示例#5
0
 public FTDIBulkDriver(GraphBuilder gb, FTDI device, string deviceDescriptor, uint baudRate)
     : base(gb)
 {
     FTDI.FT_STATUS fs;
     if (device != null)
     {
         m_device = device;
         if ((fs = device.OpenBySerialNumber(deviceDescriptor)) != FTDI.FT_STATUS.FT_OK)
             throw new Exception(string.Format("Невозможно открыть устройство. Устройство не готово. ({0})", fs));
         if ((fs = device.SetBaudRate(baudRate)) != FTDI.FT_STATUS.FT_OK)
             throw new Exception(string.Format("Устройство не поддерживает заданную скорость ({0})", fs));
         m_outputPin = RegisterOutputPin<byte[]>("MainOutPin");
     }
 }
示例#6
0
        public mainForm(FTDI dev)
        {
            InitializeComponent();

            m_graphBuilder = new GraphBuilder();

            m_bulk = new FTDIBulkDriver(m_graphBuilder, dev, kDevice_Descriptor, 9600u);
            m_reader = new AdnsReader(m_graphBuilder);
            m_printer = new Printer(m_graphBuilder, Graphics.FromHwnd(Handle));

            m_graphBuilder.ConnectApplets(m_bulk, m_reader);
            m_graphBuilder.ConnectApplets(m_reader, m_printer);

            m_bulk.start(900);
        }
示例#7
0
 public AllanDetectorApplet(GraphBuilder gb, int windowLength, int subWindowLength, double threshold)
     : base(gb)
 {
     m_threshold = threshold;
     m_windowLength = windowLength;
     m_subWindowLength = subWindowLength;
     m_averageRange = m_windowLength - 2 * m_subWindowLength + 1;
     if (m_averageRange < 0)
         throw new Exception("Длина окна меньше двух интервалов усреднения");
     c1 = new double[m_subWindowLength + m_averageRange + 1];
     c2 = new double[m_subWindowLength + m_averageRange + 1];
     c3 = new double[m_subWindowLength + m_averageRange + 1];
     f1 = new double[m_subWindowLength + 1];
     f2 = new double[m_subWindowLength + 1];
     f3 = new double[m_subWindowLength + 1];
     m_samples = new CHDSample[(m_windowLength - 1) / 2 + 1];
     m_current = new List<CHDSample>();
     InPin<CHDSample> inPin = RegisterInputPin<CHDSample>(1, windowLength);
     inPin.OnNewDataEnabled += new NewDataEnabled<CHDSample>(inPin_OnNewDataEnabled);
     m_outputPin = RegisterOutputPin<CHDSample[]>();
 }
示例#8
0
        private int m_windowLength; //L

        #endregion Fields

        #region Constructors

        //TODO: подобрать оптимальные начальные параметры!
        public AllanDetectorApplet(GraphBuilder gb, double threshold)
            : this(gb, 49, 3, threshold)
        {
        }