private void Model_evtPCRReadingsTaken(double[,] readings)
        {
            //logger.Debug("Readings taken got the values; {0}", string.Join(",",readings));

            HelixGenModel theModel = ((HelixGen.App)(App.Current)).Model;

            Model_PCRReadingTaken((-readings[1, 0] - 0));
            Model_PCRReadingTaken2((-readings[1, 1] - 0));
            Model_PCRReadingTaken3((-readings[1, 2] - 0));
            Model_PCRReadingTaken4((-readings[1, 3] - 0));

            /*
             * Model_PCRReadingTaken((readings[3,3]-0));
             * Model_PCRReadingTaken2((readings[4, 0] - 0));
             * Model_PCRReadingTaken3((readings[4, 1] - 0));
             * Model_PCRReadingTaken4((readings[4, 2] - 0));
             */
            /*
             * Model_PCRReadingTaken((readings[2, 0] - 0));
             * Model_PCRReadingTaken2((readings[2, 1] - 0));
             * Model_PCRReadingTaken3((readings[2, 2] - 0));
             * Model_PCRReadingTaken4((readings[2, 3] - 0));
             */
            /*
             * Model_PCRReadingTaken(10 * (readings[2, 0] - theModel.optic_zero[0]));
             * Model_PCRReadingTaken2(10 * (readings[2, 1] - theModel.optic_zero[1]));
             * Model_PCRReadingTaken3(10 * (readings[2, 2] - theModel.optic_zero[2]));
             * Model_PCRReadingTaken4(10 * (readings[2, 3] - theModel.optic_zero[3]));
             */
            //Model_PCRReadingTaken2
        }
Exemple #2
0
        public devicePCRCycler(tecBoardModel modelIn, Configuration.CTEC_Channel_Configuration tecConfig)
        {
            _setPoint        = new double[6];
            _prev_setPoint   = new double[6];
            _rampingLowTemp  = new double[6];
            _rampingHighTemp = new double[6];
            _bAtTemp         = new bool[6];

            _theModel = ((HelixGen.App)(App.Current)).Model;

            _tecBoard = modelIn.theBoard;
            for (int ndx = 0; ndx < 6; ndx++)
            {
                _setPoint[ndx]      = _tecBoard.GetTemperature(ndx, 0);
                _prev_setPoint[ndx] = 0;
                //_prev_setPoint[ndx] = _tecBoard.GetTemperature(ndx, 0);
                _rampingLowTemp[ndx]          = NO_SETPOINT;
                _rampingHighTemp[ndx]         = NO_SETPOINT;
                _bAtTemp[ndx]                 = false;
                _theModel.bUnderTempPlan[ndx] = true;
            }

            _nChannel  = (int)(tecConfig.m_uiTECAddress) - 1;
            _tecConfig = tecConfig;

            // Stash a reference to the model while we're at it.
        }
Exemple #3
0
        private void Button_Click_SelectData(object sender, RoutedEventArgs e)
        {
            HelixGenModel theModel = ((HelixGen.App)(App.Current)).Model;
            /*
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.InitialDirectory = "c:\\";//注意这里写路径时要用c:\\而不是c:\
            openFileDialog.Filter = "文本文件|*.*|C#文件|*.cs|所有文件|*.*";
            openFileDialog.RestoreDirectory = true;
            openFileDialog.FilterIndex = 1;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                string  fName = openFileDialog.FileName;
                //File fileOpen = new File(fName);
                //isFileHaveName = true;
                //richTextBox1.Text = fileOpen.ReadFile();
                //richTextBox1.AppendText("");
            }*/

            FolderBrowserDialog dialog = new FolderBrowserDialog();
            dialog.Description = "请选择文件路径";
            dialog.SelectedPath = "C:\\HelixGen\\logs\\measurement";//注意这里写路径时要用c:\\而不是c:\
            //dialog.InitialDirectory = "c:\\";//注意这里写路径时要用c:\\而不是c:\

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                theModel.anaFilePath = dialog.SelectedPath;
                //string savePath = dialog.SelectedPath;
                //textBox2.Text = savePath;
            }
        }
Exemple #4
0
        void ICommand.Execute(object parameter)
        {
            HelixGenModel model = ((HelixGen.App)App.Current).Model;

            model.DeviceHeater.Temperature = double.Parse((string)parameter);
            //model.DevicePCRCycler.Temperature = double.Parse((string)parameter);
        }
Exemple #5
0
        public StartupPage(HelixGenModel modelIn)
        {
            _model = modelIn;

            this.Loaded += StartupPage_Loaded;

            InitializeComponent();
        }
Exemple #6
0
        void ICommand.Execute(object parameter)
        {
            logger.Debug("Running the SetPCRTemperature command.  Temperature is {0}", (string)parameter);

            HelixGenModel model = ((HelixGen.App)App.Current).Model;

            model.DevicePCRCycler.Temperature = double.Parse((string)parameter);
            //model.DevicePCRCycler.Temperature2 = double.Parse((string)parameter);
        }
Exemple #7
0
        void ICommand.Execute(object parameter)
        {
            HelixGenModel model = ((HelixGen.App)App.Current).Model;

            Task.Run(() =>
            {
                model.StopScript();
            });
        }
Exemple #8
0
        public deviceHeater(tecBoardModel modelIn, int nChannelIn)
        {
            _tecBoard = modelIn.theBoard;
            _nChannel = nChannelIn;

            // Stash a reference to the model while we're at it.

            _theModel = ((HelixGen.App)(App.Current)).Model;
        }
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            HelixGenModel theModel = ((HelixGen.App)(App.Current)).Model;

            theModel.initializationProgress += TheModel_initializationProgress;

            // Show the version.

            Version thisVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            tbVersion.Text = string.Format("CopyRight To Helixgen,Version: {0}.{1}",
                                           thisVersion.Major.ToString(),
                                           thisVersion.Minor.ToString());

            // showMainPage();
            //AnalysPage = new AnalysePage(this);

            startupPage = new StartupPage(theModel);

            setUpPage   = new setUp(this);
            idInputPage = new IDInput(this);

            Loginpage = new loginPage(this);

            AnalysPage    = new AnalysePage(this);
            runResultPage = new RunResultPage(this);
            //_mainPage = new MainPage(this);

            NavFrame.Navigate(Loginpage);

            /*
             * StartupPage startupPage = new StartupPage(theModel);
             *
             * NavFrame.Navigate(startupPage);
             * Thread.Sleep(0);
             *
             * NavFrame.LoadCompleted += NavFrame_Startup_Navigated;
             */

#if false
            OpticsControlPage opticsPage = new OpticsControlPage();
            NavFrame.Navigate(opticsPage);

            opticsPage.Initialize();
#endif
#if false
            Thread.Sleep(10000);

            Task.Factory.StartNew(() => {
                Application.Current.Dispatcher.Invoke(
                    delegate { showMainPage(); }
                    );
            }
                                  );
#endif
        }
        public int initialize()
        {
            int nRetVal = 0;

            try
            {
                string strChannel = _channel.ToString("00");

                // Set the motor parameters.

                HelixGenModel theModel = ((HelixGen.App)(App.Current)).Model;

                int nResult = initializeMotorParams(_channel, theModel.Config.m_R2Piston_Configuration);
                if (nResult != 0)
                {
                    // Initialization failed.

                    logger.Debug("deviceR2Piston::initialize failed.");
                }
                else
                {
                    HelixGenModel _theModel  = ((HelixGen.App)(App.Current)).Model;
                    clsAMB        controller = _theModel.getMotorBoard(_controllerId);

                    // Move the pump to the initial position.
                    //RNNosition = 89000;

                    controller.SetDirectionPolarity(strChannel, "0");
                    controller.MoveHome(strChannel);
                    controller.WaitForCompletion(strChannel);

                    /*
                     * controller.SetDirectionPolarity(strChannel, "0");
                     * controller.MoveRelativePositive(strChannel, "2580");
                     * controller.WaitForCompletion(strChannel);*/
                    /*
                     * controller.SetDirectionPolarity(strChannel, "0");
                     * controller.MoveRelativePositive(strChannel, "50064");
                     * controller.WaitForCompletion(strChannel);*/


                    controller.SetResolution(theModel.Config.m_R2Piston_Configuration.m_nMotorChannel.ToString("00"),
                                             theModel.Config.m_R2Piston_Configuration.m_uiMotorResolution.ToString());

                    // Position = 3;
                    // RNPosition = 50000;//9.9mm
                    // RNNosition = 89000;
                }
            }
            catch (Exception)
            {
                nRetVal = 1;
            }

            return(nRetVal);
        }
        public void Startup()
        {
            HelixGenModel theModel = ((HelixGen.App)(App.Current)).Model;

            theModel.initializationProgress += TheModel_initializationProgress;
            NavFrame.Navigate(startupPage);
            Thread.Sleep(0);

            NavFrame.LoadCompleted += NavFrame_Startup_Navigated;
        }
Exemple #12
0
        public vmOptics()
        {
            // Get the model.

            model        = ((HelixGen.App)App.Current).Model;
            _opticsModel = model.OpticsModel;

            // Subscribe to property notifications from the model.

            _opticsModel.PropertyChanged += _opticsModel_PropertyChanged;
        }
        private void Close_Button_Click(object sender, RoutedEventArgs e)
        {
            HelixGenModel theModel = ((HelixGen.App)(App.Current)).Model;

            theModel.ShutDown();

            Close();

            theModel.Dispose();
            theModel = null;
        }
Exemple #14
0
        public int initialize()
        {
            int nRetVal = 0;

            try
            {
                string strChannel = _channel.ToString("00");

                // Set the motor parameters.

                HelixGenModel theModel = ((HelixGen.App)(App.Current)).Model;

                int nResult = initializeMotorParams(_channel, theModel.Config.m_ChassisPiston_Configuration);
                if (nResult != 0)
                {
                    // Initialization failed.

                    logger.Debug("deviceChassisPiston::initialize failed.");
                }
                else
                {
                    clsAMB controller = theModel.getMotorBoard(theModel.Config.m_ChassisPiston_Configuration.m_strControllerName);

                    // Move the pump to the initial position.

                    /*
                     * controller.SetDirectionPolarity(strChannel, "0");
                     * controller.MoveRelativePositive(strChannel, "2700");
                     * controller.WaitForCompletion(strChannel);*/

                    // controller.SetDirectionPolarity(strChannel, "0");
                    controller.MoveHome(strChannel);
                    controller.WaitForCompletion(strChannel);

                    /*
                     * controller.SetDirectionPolarity(strChannel, "0");
                     * controller.MoveRelativePositive(strChannel, "5000");
                     * controller.WaitForCompletion(strChannel);
                     */
                    controller.SetResolution(theModel.Config.m_ChassisPiston_Configuration.m_nMotorChannel.ToString("00"),
                                             theModel.Config.m_ChassisPiston_Configuration.m_uiMotorResolution.ToString());

                    //Position = 1;
                }
            }
            catch (Exception ex)
            {
                logger.Debug("deviceChassisPiston::initialize() Caught an exception: {0}", ex.Message);

                nRetVal = 1;
            }

            return(nRetVal);
        }
Exemple #15
0
        void ICommand.Execute(object parameter)
        {
            HelixGenModel model = ((HelixGen.App)App.Current).Model;

            string protocolFile = Path.Combine(HelixGen.CSystem_Defns.strDefaultProtocolPath,
                                               _theVm.ProtocolFile + ".xml");

            Task.Run(() =>
            {
                model.RunScript(protocolFile);
            });
        }
Exemple #16
0
        public vmMain()
        {
            _setHeaterTemperatureCmd = new SetHeaterTemperature();
            _setPCRTemperatureCmd    = new SetPCRTemperature();
            _runScriptCmd            = new RunScriptCmd(this);
            _stopScriptCmd           = new StopScriptCmd(this);
            _pumpOn = new PumpOn();

            // Get the model.

            _model = ((HelixGen.App)App.Current).Model;

            // Start a process to update the list of the protocol files.

            Task.Run(() =>
            {
                // Form the directory name.

                string protocolsDir = Path.Combine(HelixGen.CSystem_Defns.strDefaultProtocolPath);
                string[] filenames  = Directory.GetFiles(protocolsDir, "*.xml");

                // Raffle through the list and reform the names to only include the actual file names.

                _protocolFiles = new List <string>();

                foreach (string fn in filenames)
                {
                    _protocolFiles.Add(Path.GetFileNameWithoutExtension(fn));
                }
            }

                     );

            // Subscribe to temperature updates

            _model.HeaterTempChanged               += _model_HeaterTempChanged;
            _model.PCRCyclerTempChanged            += _model_PCRCyclerTempChanged;
            _model.PCRCyclerTempChanged2           += _model_PCRCyclerTempChanged2;
            _model.evtPCRCyclerSetPointTemperature += _model_evtPCRCyclerSetPointTemperature;

            // Subscribe to position updates from the various piston pumps.

            _model.DeviceChassisPiston.PumpPositionChanged += DeviceChassisPiston_PumpPositionChanged;
            _model.DeviceHeaterPiston.PumpPositionChanged  += DeviceHeaterPiston_PumpPositionChanged;
            _model.DeviceOpticsMotor.PumpPositionChanged   += DeviceOpticsMotor_PumpPositionChanged;
            _model.DeviceR1Piston.PumpPositionChanged      += DeviceR1Piston_PumpPositionChanged;
            _model.DeviceR2Piston.PumpPositionChanged      += DeviceR2Piston_PumpPositionChanged;
            _model.DeviceSlider.PumpPositionChanged        += DeviceSlider_PumpPositionChanged;

            // Subscribe to protocol execution updates.

            _model.ProtocolExecutionStepped += _model_ProtocolExecutionStepped;
        }
Exemple #17
0
        public void runAnalysis()
        {
            HelixGenModel theModel = ((HelixGen.App)(App.Current)).Model;
            theModel.Analysis();
            //RadioButton_Checked_1(rongjie, new RoutedEventArgs());
            DisplayCurve(2);
            // rongjie. = true;
            Model_evtTempingsStarted();
            for (int i = 0; i < theModel.m_pcr_t.Count; i++)
            {
                Model_PCRCyclerTempChanged(theModel.m_pcr_t.ElementAt(i));

            }
        }
        private async void NavFrame_Startup_Navigated(object sender, NavigationEventArgs e)
        {
            HelixGenModel theModel = ((HelixGen.App)(App.Current)).Model;

            Task.Run(() =>
            {
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                theModel.Initialize();
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            });
            //inited = theModel.Initialize();

            //bool binited = await inited;
        }
Exemple #19
0
        public void ZeroOptic()
        {
            HelixGenModel theModel = ((HelixGen.App)(App.Current)).Model;

            clsAMB controller = theModel.getMotorBoard(_controllerId);
            string strChannel = _channel.ToString("00");

            /*
             * for (int nLED = 0; nLED < 6; nLED++)
             * {
             *  theModel.OpticsModel.SetLedCurrent(nLED + 1, 0.75);
             *  //theModel.OpticsModel.SetLedCurrent(nLED + 1, 0);
             * }*/

            // theModel.DeviceOpticsMotor.Position = 5;
            controller.MoveHome(strChannel);
            controller.WaitForCompletion(strChannel);

            // double[,] allReadings = new double[6, 4];
            // double[] baselines = new double[4];
            for (int i = 0; i < 15; i++)
            {
                for (int Position = 2; Position < 6; Position++)
                {
                    theModel.DeviceOpticsMotor.Position = Position;
                    double[] readings = theModel.opticsBoard.ReadPhotodetector();
                    if (i == 14)
                    {
                        theModel.optic_zero[Position - 2] = readings[2];
                    }

                    // for (int nCartridge = 0; nCartridge < 6; nCartridge++)
                    // allReadings[nCartridge, Position - 2] = readings[nCartridge];

                    //Thread.Sleep(3000);
                }
                controller.MoveHome(strChannel);
                controller.WaitForCompletion(strChannel);
            }

            /*
             * for (int nLED = 0; nLED < 6; nLED++)
             * {
             *  theModel.OpticsModel.SetLedCurrent(nLED + 1, 0);
             *  //theModel.OpticsModel.SetLedCurrent(nLED + 1, 0);
             * }*/
            controller.MoveHome(strChannel);
            controller.WaitForCompletion(strChannel);
        }
        public int initialize1()
        {
            int nRetVal = 0;

            try
            {
                string strChannel = _channel.ToString("00");

                // Set the motor parameters.

                HelixGenModel theModel = ((HelixGen.App)(App.Current)).Model;


                HelixGenModel _theModel  = ((HelixGen.App)(App.Current)).Model;
                clsAMB        controller = _theModel.getMotorBoard(_controllerId);

                // Move the pump to the initial position.
                //RNNosition = 89000;



                controller.SetDirectionPolarity(strChannel, "0");
                controller.MoveRelativePositive(strChannel, "12080");
                controller.WaitForCompletion(strChannel);

                /*
                 * controller.SetDirectionPolarity(strChannel, "0");
                 * controller.MoveRelativePositive(strChannel, "68100");
                 * controller.WaitForCompletion(strChannel);*/


                controller.SetResolution(theModel.Config.m_R2Piston_Configuration.m_nMotorChannel.ToString("00"),
                                         theModel.Config.m_R2Piston_Configuration.m_uiMotorResolution.ToString());

                // Position = 3;
                // RNPosition = 50000;//9.9mm
                // RNNosition = 89000;
            }
            catch (Exception)
            {
                nRetVal = 1;
            }

            return(nRetVal);
        }
Exemple #21
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            HelixGenModel theModel = ((HelixGen.App)(App.Current)).Model;

            Model_evtPCRReadingsStarted();
            theModel.Analysis();
            for (int i = 0; i < theModel._slope.Count / 4; i++)
            {
                //Model_PCRCyclerTempChanged(theModel._slope.ElementAt(i),0,false,false);
                Model_PCRReadingTaken1(10000 * (theModel._slope.ElementAt(i * 4 + 0)), theModel.m_data_t.ElementAt(i));
                Model_PCRReadingTaken21(10000 * (theModel._slope.ElementAt(i * 4 + 1)), theModel.m_data_t.ElementAt(i));
                Model_PCRReadingTaken31(10000 * (theModel._slope.ElementAt(i * 4 + 2)), theModel.m_data_t.ElementAt(i));
                Model_PCRReadingTaken41(10000 * (theModel._slope.ElementAt(i * 4 + 3)), theModel.m_data_t.ElementAt(i));
            }
            //theModel.m_data_r1.Add(temp_data);
            //for (uint ui = 5; ui <theModel.m_data_t.Count-5 ; ui++)
            //{

            //}
        }
Exemple #22
0
        protected int initializeMotorParams(int axis, Configuration.CSystem_MotorBoardConfigurationItem configIn)
        {
            HelixGenModel _theModel = ((HelixGen.App)(App.Current)).Model;

            clsAMB controller = _theModel.getMotorBoard(_controllerId);

            int nRetVal = 0;

            // Set the parameters for the board on this axis.

            int iaxis = axis - 1;

            controller.axisparams_current[iaxis].strStartSpeed                         = configIn.m_uiMotorStartSpeed.ToString();
            controller.axisparams_current[iaxis].strMaxSpeed                           = configIn.m_uiMotorMaxSpeed.ToString();
            controller.axisparams_current[iaxis].strAcceleration                       = configIn.m_uiMotorAccel.ToString();
            controller.axisparams_current[iaxis].strDeceleration                       = configIn.m_uiMotorDecel.ToString();
            controller.axisparams_current[iaxis].strJerk                               = configIn.m_uiMotorJerk.ToString();
            controller.axisparams_current[iaxis].strMoveCurrent                        = configIn.m_uiMotorMoveCurrent.ToString();
            controller.axisparams_current[iaxis].strHoldCurrent                        = configIn.m_uiMotorHoldCurrent.ToString();
            controller.axisparams_current[iaxis].strResolution                         = configIn.m_uiMotorResolution.ToString();
            controller.axisparams_current[iaxis].strDirectionPolarity                  = configIn.m_uiMotorDirection.ToString();
            controller.axisparams_current[iaxis].strHomeTimeout                        = configIn.m_uiMotorHomeTimeout.ToString();
            controller.axisparams_current[iaxis].strProfileMode                        = configIn.m_uiMotorProfileMode.ToString();
            controller.axisparams_current[iaxis].strEncoderPresent                     = configIn.m_bEncoderEnabled ? "1" : "0";
            controller.axisparams_current[iaxis].strEncoderEncoderMonitorTimer_ms      = configIn.m_uiEncoderMonitorTimer_ms.ToString();
            controller.axisparams_current[iaxis].strEncoderMonitorPulseChangeThreshold = configIn.m_uiEncoderMonitorPulseChangeThreshold.ToString();
            controller.axisparams_current[iaxis].strEncoderMonitorErrorCountThreshold  = configIn.m_uiEncoderMonitorErrorCountThreshold.ToString();
            controller.axisparams_current[iaxis].strEncoderDirectionPolarity           = configIn.m_uiEncoderDirectionPolarity.ToString();
            controller.axisparams_current[iaxis].strLostStepsLimit                     = configIn.m_uiMotorMaxNumLostSteps.ToString();
            controller.axisparams_current[iaxis].strEncoderStartOffset                 = configIn.m_iEncoderStartOffset.ToString();
            controller.axisparams_current[iaxis].strEncoderControllerConversionFactor  = configIn.m_fEncoderScalingFactor.ToString();

            // Kick the parameters in.

            controller.LoadParametersIntoController(axis.ToString("00"));

            return(nRetVal);
        }
Exemple #23
0
        public int initialize()
        {
            int nRetVal = 0;

            try
            {
                string strChannel = _channel.ToString("00");


                // Set the motor parameters.

                HelixGenModel theModel = ((HelixGen.App)(App.Current)).Model;

                int nResult = initializeMotorParams(_channel, theModel.Config.m_Slider_Configuration);
                if (nResult != 0)
                {
                    // Initialization failed.

                    logger.Debug("deviceSlider::initialize failed.");
                }
                else
                {
                    clsAMB controller = theModel.getMotorBoard(_controllerId);

                    // Move the pump to the initial position.
                    controller.SetDirectionPolarity(strChannel, "0");
                    controller.MoveHome(strChannel);
                    controller.WaitForCompletion(strChannel);



                    controller.MoveRelativePositive(strChannel, "4510");

                    controller.WaitForCompletion(strChannel);

                    /*
                     * //controller.SetDirectionPolarity(strChannel, "0");
                     * controller.MoveRelativePositive(strChannel, "9500");
                     * controller.WaitForCompletion(strChannel);
                     *
                     *
                     * controller.SetDirectionPolarity(strChannel, "1");
                     * //controller.MoveRelativePositive(strChannel, "6156");
                     * controller.MoveRelativePositive(strChannel, "5800");
                     * controller.WaitForCompletion(strChannel);
                     *
                     *       controller.MoveRelativePositive(strChannel, "4300");
                     * controller.WaitForCompletion(strChannel);
                     *
                     * controller.SetDirectionPolarity(strChannel, "0");
                     */
                    /* controller.MoveToAbsolutePosition(strChannel,
                     *       "11114");
                     * controller.WaitForCompletion(strChannel);*/
                    //controller.SetDirectionPolarity(strChannel, "1");

                    controller.SetResolution(theModel.Config.m_Slider_Configuration.m_nMotorChannel.ToString("00"),
                                             theModel.Config.m_Slider_Configuration.m_uiMotorResolution.ToString());

                    //Position = 2;
                    // Position = 1;
                    //RNPosition = 9614;
                    //RNNosition = 6307;
                    //RNNosition = 3307;
                }
            }
            catch (Exception ex)
            {
                logger.Debug("deviceSlider::initialize() Caught an exception: {0}", ex.Message);
                nRetVal = 1;
            }

            return(nRetVal);
        }
Exemple #24
0
        public AnalysePage(MainWindow parentWnd)
        {
            _parentWnd = parentWnd;
            InitializeComponent();

            // Initialize the temperature graph.

            graphTemps = new TemperaturePointCollection();
            graphTempsCount = 0;

            var ds = new EnumerableDataSource<TemperaturePoint>(graphTemps);
            ds.SetXMapping(x => (double)x.Count);
            ds.SetYMapping(y => y.Pressure);

            //plotter.AddLineGraph(ds, Colors.Green, 1, "T1");
            //plotter.LegendVisible = false;
            /*
            graphTemps2 = new TemperaturePointCollection();
            graphTempsCount = 0;

            var ds2 = new EnumerableDataSource<TemperaturePoint>(graphTemps2);
            ds2.SetXMapping(x => (double)x.Count);
            ds2.SetYMapping(y => y.Pressure);

            plotter.AddLineGraph(ds2, Colors.Red, 1, "T2");
            // plotter.LegendVisible = false;*/

            // Initialize the PCR graph.

            graphPCR = new PCRPointCollection();
            graphPCRCycle = 0;

            var dsPCR = new EnumerableDataSource<PCRPoint>(graphPCR);
            dsPCR.SetXMapping(x => (double)x.Cycle);
            dsPCR.SetYMapping(y => y.Reading);

            pcrplotter.AddLineGraph(dsPCR, Colors.Green, 1, " ");
            pcrplotter.LegendVisible = false;

            graphPCR2 = new PCRPointCollection();
            // graphPCRCycle = 0;

            var dsPCR2 = new EnumerableDataSource<PCRPoint>(graphPCR2);
            dsPCR2.SetXMapping(x => (double)x.Cycle);
            dsPCR2.SetYMapping(y => y.Reading);

            pcrplotter.AddLineGraph(dsPCR2, Colors.Red, 1, " ");
            //pcrplotter.LegendVisible = false;

            graphPCR3 = new PCRPointCollection();
            // graphPCRCycle = 0;

            var dsPCR3 = new EnumerableDataSource<PCRPoint>(graphPCR3);
            dsPCR3.SetXMapping(x => (double)x.Cycle);
            dsPCR3.SetYMapping(y => y.Reading);

            pcrplotter.AddLineGraph(dsPCR3, Colors.Blue, 1, " ");

            graphPCR4 = new PCRPointCollection();
            // graphPCRCycle = 0;

            var dsPCR4 = new EnumerableDataSource<PCRPoint>(graphPCR4);
            dsPCR4.SetXMapping(x => (double)x.Cycle);
            dsPCR4.SetYMapping(y => y.Reading);

            pcrplotter.AddLineGraph(dsPCR4, Colors.Brown, 1, " ");


            graphPCR5 = new PCRPointCollection();
            graphPCRCycle = 0;

            var dsPCR5 = new EnumerableDataSource<PCRPoint>(graphPCR5);
            dsPCR5.SetXMapping(x => (double)x.Cycle);
            dsPCR5.SetYMapping(y => y.Reading);

            pcrplotter3.AddLineGraph(dsPCR5, Colors.Green, 1, " ");
            pcrplotter3.LegendVisible = false;

            graphPCR6 = new PCRPointCollection();
            // graphPCRCycle = 0;

            var dsPCR6 = new EnumerableDataSource<PCRPoint>(graphPCR6);
            dsPCR6.SetXMapping(x => (double)x.Cycle);
            dsPCR6.SetYMapping(y => y.Reading);

            pcrplotter3.AddLineGraph(dsPCR6, Colors.Red, 1, " ");
            //pcrplotter.LegendVisible = false;

            graphPCR7 = new PCRPointCollection();
            // graphPCRCycle = 0;

            var dsPCR7 = new EnumerableDataSource<PCRPoint>(graphPCR7);
            dsPCR7.SetXMapping(x => (double)x.Cycle);
            dsPCR7.SetYMapping(y => y.Reading);

            pcrplotter3.AddLineGraph(dsPCR7, Colors.Blue, 1, " ");

            graphPCR8 = new PCRPointCollection();
            // graphPCRCycle = 0;

            var dsPCR8 = new EnumerableDataSource<PCRPoint>(graphPCR8);
            dsPCR8.SetXMapping(x => (double)x.Cycle);
            dsPCR8.SetYMapping(y => y.Reading);

            pcrplotter3.AddLineGraph(dsPCR8, Colors.Brown, 1, " ");

            graphPCR = new PCRPointCollection();
            graphPCRCycle = 0;

            var dsPCR9 = new EnumerableDataSource<PCRPoint>(graphPCR);
            dsPCR.SetXMapping(x => (double)x.Cycle);
            dsPCR.SetYMapping(y => y.Reading);

            pcrplotter1.AddLineGraph(dsPCR, Colors.Green, 1, " ");
            pcrplotter1.LegendVisible = false;

            graphPCR2 = new PCRPointCollection();
            // graphPCRCycle = 0;

            var dsPCR10 = new EnumerableDataSource<PCRPoint>(graphPCR2);
            dsPCR2.SetXMapping(x => (double)x.Cycle);
            dsPCR2.SetYMapping(y => y.Reading);

            pcrplotter1.AddLineGraph(dsPCR2, Colors.Red, 1, " ");
            //pcrplotter.LegendVisible = false;

            graphPCR3 = new PCRPointCollection();
            // graphPCRCycle = 0;

            var dsPCR11 = new EnumerableDataSource<PCRPoint>(graphPCR3);
            dsPCR3.SetXMapping(x => (double)x.Cycle);
            dsPCR3.SetYMapping(y => y.Reading);

            pcrplotter1.AddLineGraph(dsPCR3, Colors.Blue, 1, " ");

            graphPCR4 = new PCRPointCollection();
            // graphPCRCycle = 0;

            var dsPCR12 = new EnumerableDataSource<PCRPoint>(graphPCR4);
            dsPCR4.SetXMapping(x => (double)x.Cycle);
            dsPCR4.SetYMapping(y => y.Reading);

            pcrplotter1.AddLineGraph(dsPCR4, Colors.Brown, 1, " ");


            graphPCR = new PCRPointCollection();
            graphPCRCycle = 0;

            var dsPCR13 = new EnumerableDataSource<PCRPoint>(graphPCR);
            dsPCR.SetXMapping(x => (double)x.Cycle);
            dsPCR.SetYMapping(y => y.Reading);

            pcrplotter0.AddLineGraph(dsPCR, Colors.Green, 1, " ");
            pcrplotter0.LegendVisible = false;

            graphPCR2 = new PCRPointCollection();
            // graphPCRCycle = 0;

            var dsPCR14 = new EnumerableDataSource<PCRPoint>(graphPCR2);
            dsPCR2.SetXMapping(x => (double)x.Cycle);
            dsPCR2.SetYMapping(y => y.Reading);

            pcrplotter0.AddLineGraph(dsPCR2, Colors.Red, 1, " ");
            //pcrplotter.LegendVisible = false;

            graphPCR3 = new PCRPointCollection();
            // graphPCRCycle = 0;

            var dsPCR15 = new EnumerableDataSource<PCRPoint>(graphPCR3);
            dsPCR3.SetXMapping(x => (double)x.Cycle);
            dsPCR3.SetYMapping(y => y.Reading);

            pcrplotter0.AddLineGraph(dsPCR3, Colors.Blue, 1, " ");

            graphPCR4 = new PCRPointCollection();
            // graphPCRCycle = 0;

            var dsPCR16 = new EnumerableDataSource<PCRPoint>(graphPCR4);
            dsPCR4.SetXMapping(x => (double)x.Cycle);
            dsPCR4.SetYMapping(y => y.Reading);

            pcrplotter0.AddLineGraph(dsPCR4, Colors.Brown, 1, " ");


            graphPCR = new PCRPointCollection();
            graphPCRCycle = 0;

            var dsPCR17 = new EnumerableDataSource<PCRPoint>(graphPCR);
            dsPCR.SetXMapping(x => (double)x.Cycle);
            dsPCR.SetYMapping(y => y.Reading);

            pcrplotter4.AddLineGraph(dsPCR, Colors.Green, 1, " ");
            pcrplotter4.LegendVisible = false;

            graphPCR2 = new PCRPointCollection();
            // graphPCRCycle = 0;

            var dsPCR18 = new EnumerableDataSource<PCRPoint>(graphPCR2);
            dsPCR2.SetXMapping(x => (double)x.Cycle);
            dsPCR2.SetYMapping(y => y.Reading);

            pcrplotter4.AddLineGraph(dsPCR2, Colors.Red, 1, " ");
            //pcrplotter.LegendVisible = false;

            graphPCR3 = new PCRPointCollection();
            // graphPCRCycle = 0;

            var dsPCR19 = new EnumerableDataSource<PCRPoint>(graphPCR3);
            dsPCR3.SetXMapping(x => (double)x.Cycle);
            dsPCR3.SetYMapping(y => y.Reading);

            pcrplotter4.AddLineGraph(dsPCR3, Colors.Blue, 1, " ");

            graphPCR4 = new PCRPointCollection();
            // graphPCRCycle = 0;

            var dsPCR20 = new EnumerableDataSource<PCRPoint>(graphPCR4);
            dsPCR4.SetXMapping(x => (double)x.Cycle);
            dsPCR4.SetYMapping(y => y.Reading);

            pcrplotter4.AddLineGraph(dsPCR4, Colors.Brown, 1, " ");

            graphPCR = new PCRPointCollection();
            graphPCRCycle = 0;

            var dsPCR21 = new EnumerableDataSource<PCRPoint>(graphPCR);
            dsPCR.SetXMapping(x => (double)x.Cycle);
            dsPCR.SetYMapping(y => y.Reading);

            pcrplotter5.AddLineGraph(dsPCR, Colors.Green, 1, " ");
            pcrplotter5.LegendVisible = false;

            graphPCR2 = new PCRPointCollection();
            // graphPCRCycle = 0;

            var dsPCR22 = new EnumerableDataSource<PCRPoint>(graphPCR2);
            dsPCR2.SetXMapping(x => (double)x.Cycle);
            dsPCR2.SetYMapping(y => y.Reading);

            pcrplotter5.AddLineGraph(dsPCR2, Colors.Red, 1, " ");
            //pcrplotter.LegendVisible = false;

            graphPCR3 = new PCRPointCollection();
            // graphPCRCycle = 0;

            var dsPCR23 = new EnumerableDataSource<PCRPoint>(graphPCR3);
            dsPCR3.SetXMapping(x => (double)x.Cycle);
            dsPCR3.SetYMapping(y => y.Reading);

            pcrplotter5.AddLineGraph(dsPCR3, Colors.Blue, 1, " ");

            graphPCR4 = new PCRPointCollection();
            // graphPCRCycle = 0;

            var dsPCR24 = new EnumerableDataSource<PCRPoint>(graphPCR4);
            dsPCR4.SetXMapping(x => (double)x.Cycle);
            dsPCR4.SetYMapping(y => y.Reading);

            pcrplotter5.AddLineGraph(dsPCR4, Colors.Brown, 1, " ");

            
            //plotter.HorizontalAxisNavigation.Remove();
            //plotter.VerticalAxisNavigation.Remove();
            //plotter.Children.Remove(plotter.MouseNavigation);
            //pcrplotter.Children.Remove(pcrplotter.MouseNavigation); 

            theModel = ((HelixGen.App)(App.Current)).Model;
            
            Button_Click1(null, null);
        }
Exemple #25
0
        private void DisplayCurve(int selmode)
        {
            HelixGenModel theModel = ((HelixGen.App)(App.Current)).Model;

           

            switch (selmode)
            {
                case 0://扩增
                    
                    if (theModel.catrigeSelect == 0)
                    { 
                        for (int i = 0; i < theModel.m_data_pcr1.Count / 4; i++)
                        {
                            //Model_PCRCyclerTempChanged(theModel._slope.ElementAt(i),0,false,false);
                            Model_PCRReadingTaken1((theModel.m_data_pcr1.ElementAt(i * 4 + 0))*1, i + 2);
                            Model_PCRReadingTaken21((theModel.m_data_pcr1.ElementAt(i * 4 + 1))*1, i + 2);
                            Model_PCRReadingTaken31((theModel.m_data_pcr1.ElementAt(i * 4 + 2)) * 1, i + 2);
                            Model_PCRReadingTaken41((theModel.m_data_pcr1.ElementAt(i * 4 + 3)) * 1, i + 2);

                        }
                        /*
                        for (int i = theModel.m_data_pcr1.Count / 4; i < theModel.m_data_pcr1.Count / 1; i++)
                        {
                            //Model_PCRCyclerTempChanged(theModel._slope.ElementAt(i),0,false,false);
                            Model_PCRReadingTaken1((theModel.m_data_pcr1.ElementAt((theModel.m_data_pcr1.Count/4-1)*4 + 0)) * 1+0*i, i + 2);
                            Model_PCRReadingTaken21((theModel.m_data_pcr1.ElementAt((theModel.m_data_pcr1.Count / 4 - 1) * 4 + 1)) * 1 + 0 * i, i + 2);
                            Model_PCRReadingTaken31((theModel.m_data_pcr1.ElementAt((theModel.m_data_pcr1.Count / 4 - 1) * 4 + 2)) * 1 + 0 * i, i + 2);
                            Model_PCRReadingTaken41((theModel.m_data_pcr1.ElementAt((theModel.m_data_pcr1.Count / 4 - 1) * 4 + 3)) * 1 + 0 * i, i + 2);

                        }*/
                    }
                    else
                    { 
                        for (int i = 0; i < theModel.m_data_pcr1.Count / 4; i++)
                        {
                            //Model_PCRCyclerTempChanged(theModel._slope.ElementAt(i),0,false,false);
                            Model_PCRReadingTaken12((theModel.m_data_pcr1.ElementAt(i * 4 + 0)) * 1, i + 2);
                            Model_PCRReadingTaken22((theModel.m_data_pcr1.ElementAt(i * 4 + 1)) * 1, i + 2);
                            Model_PCRReadingTaken32((theModel.m_data_pcr1.ElementAt(i * 4 + 2)) * 1, i + 2);
                            Model_PCRReadingTaken42((theModel.m_data_pcr1.ElementAt(i * 4 + 3)) * 1, i + 2);

                        }
                        /*
                        for (int i = theModel.m_data_pcr1.Count / 4; i < theModel.m_data_pcr1.Count / 1; i++)
                        {
                            //Model_PCRCyclerTempChanged(theModel._slope.ElementAt(i),0,false,false);
                            Model_PCRReadingTaken12((theModel.m_data_pcr1.ElementAt((theModel.m_data_pcr1.Count / 4 - 1) * 4 + 0)) * 1 + 500 * (i- theModel.m_data_pcr1.Count / 4), i + 2);
                            Model_PCRReadingTaken22((theModel.m_data_pcr1.ElementAt((theModel.m_data_pcr1.Count / 4 - 1) * 4 + 1)) * 1 + 500 * (i - theModel.m_data_pcr1.Count / 4), i + 2);
                            Model_PCRReadingTaken32((theModel.m_data_pcr1.ElementAt((theModel.m_data_pcr1.Count / 4 - 1) * 4 + 2)) * 1 + 500 * (i - theModel.m_data_pcr1.Count / 4), i + 2);
                            Model_PCRReadingTaken42((theModel.m_data_pcr1.ElementAt((theModel.m_data_pcr1.Count / 4 - 1) * 4 + 3)) * 1 + 500 * (i - theModel.m_data_pcr1.Count / 4), i + 2);

                        }*/
                    }

                    break;

                case 1://溶解
                    if (theModel.catrigeSelect == 0)
                        for (int i = 0; i < theModel.m_data_r2.Count / 4; i++)
                    {
                        //Model_PCRReadingTaken1( (theModel.m_data_r2.ElementAt(i * 4 + 0)), 50 + 0.3125 * i);
                        Model_PCRReadingTaken1((theModel.m_data_r2.ElementAt(i * 4 + 0)), 45 + 0.195 * i);
                        Model_PCRReadingTaken21((theModel.m_data_r2.ElementAt(i * 4 + 1)), 45 + 0.195 * i);
                        Model_PCRReadingTaken31((theModel.m_data_r2.ElementAt(i * 4 + 2)), 45 + 0.195 * i);
                        Model_PCRReadingTaken41((theModel.m_data_r2.ElementAt(i * 4 + 3)), 45 + 0.195 * i);

                    }
                    else
                        for (int i = 0; i < theModel.m_data_r2.Count / 4; i++)
                        {
                            //Model_PCRReadingTaken1( (theModel.m_data_r2.ElementAt(i * 4 + 0)), 50 + 0.3125 * i);
                            Model_PCRReadingTaken12((theModel.m_data_r2.ElementAt(i * 4 + 0)), 45 + 0.195 * i);
                            Model_PCRReadingTaken22((theModel.m_data_r2.ElementAt(i * 4 + 1)), 45 + 0.195 * i);
                            Model_PCRReadingTaken32((theModel.m_data_r2.ElementAt(i * 4 + 2)), 45 + 0.195 * i);
                            Model_PCRReadingTaken42((theModel.m_data_r2.ElementAt(i * 4 + 3)), 45 + 0.195 * i);

                        }

                    /*
                    for (int i = 0; i < theModel.m_data_r1.Count / 4; i++)
                    {
                        //Model_PCRCyclerTempChanged(theModel._slope.ElementAt(i),0,false,false);
                        Model_PCRReadingTaken1((theModel.m_data_r1.ElementAt(i * 4 + 0)), 50 + 0.3125 * i);
                        Model_PCRReadingTaken21((theModel.m_data_r1.ElementAt(i * 4 + 1)), 50 + 0.3125 * i);
                        Model_PCRReadingTaken31((theModel.m_data_r1.ElementAt(i * 4 + 2)), 50 + 0.3125 * i);
                        Model_PCRReadingTaken41((theModel.m_data_r1.ElementAt(i * 4 + 3)), 50 + 0.3125 * i);

                    }*/
                    break;

                case 2://峰值
                    if(theModel.catrigeSelect == 0)
                    for (int i = 0; i < theModel._slope1.Count / 4; i++)
                    {
                            /*
                            Model_PCRReadingTaken1(10000 * (theModel._slope1.ElementAt(i * 4 + 0)), theModel.m_data_t.ElementAt(i));
                            Model_PCRReadingTaken21(10000 * (theModel._slope1.ElementAt(i * 4 + 1)), theModel.m_data_t.ElementAt(i));
                            Model_PCRReadingTaken31(10000 * (theModel._slope1.ElementAt(i * 4 + 2)), theModel.m_data_t.ElementAt(i));
                            Model_PCRReadingTaken41(10000 * (theModel._slope1.ElementAt(i * 4 + 3)), theModel.m_data_t.ElementAt(i));
                            */
                            /*
                            Model_PCRReadingTaken1((theModel._slope1.ElementAt(i * 4 + 0)), 41.5 + 0.17964 * i);
                            Model_PCRReadingTaken21((theModel._slope1.ElementAt(i * 4 + 1)), 41.5 + 0.17964 * i);
                            Model_PCRReadingTaken31((theModel._slope1.ElementAt(i * 4 + 2)), 41.5 + 0.17964 * i);
                            Model_PCRReadingTaken41((theModel._slope1.ElementAt(i * 4 + 3)), 41.5 + 0.17964 * i);
                            */
                            Model_PCRReadingTaken1((theModel._slope1.ElementAt(i * 4 + 0)), 50.4 + 0.15 * i);
                            Model_PCRReadingTaken21((theModel._slope1.ElementAt(i * 4 + 1)), 50.4 + 0.15 * i);
                            Model_PCRReadingTaken31((theModel._slope1.ElementAt(i * 4 + 2)), 50.4 + 0.15 * i);
                            Model_PCRReadingTaken41((theModel._slope1.ElementAt(i * 4 + 3)), 50.4 + 0.15 * i);

                        }
                    else
                        for (int i = 0; i < theModel._slope1.Count / 4; i++)
                        {
                            /*
                            Model_PCRReadingTaken1(10000 * (theModel._slope1.ElementAt(i * 4 + 0)), theModel.m_data_t.ElementAt(i));
                            Model_PCRReadingTaken21(10000 * (theModel._slope1.ElementAt(i * 4 + 1)), theModel.m_data_t.ElementAt(i));
                            Model_PCRReadingTaken31(10000 * (theModel._slope1.ElementAt(i * 4 + 2)), theModel.m_data_t.ElementAt(i));
                            Model_PCRReadingTaken41(10000 * (theModel._slope1.ElementAt(i * 4 + 3)), theModel.m_data_t.ElementAt(i));
                            */
                            /*
                            Model_PCRReadingTaken12((theModel._slope1.ElementAt(i * 4 + 0)), 41.5 + 0.17964 * i);
                            Model_PCRReadingTaken22((theModel._slope1.ElementAt(i * 4 + 1)), 41.5 + 0.17964 * i);
                            Model_PCRReadingTaken32((theModel._slope1.ElementAt(i * 4 + 2)), 41.5 + 0.17964 * i);
                            Model_PCRReadingTaken42((theModel._slope1.ElementAt(i * 4 + 3)), 41.5 + 0.17964 * i);*/
                            Model_PCRReadingTaken12((theModel._slope1.ElementAt(i * 4 + 0)), 48.5 + 0.15 * i);
                            Model_PCRReadingTaken22((theModel._slope1.ElementAt(i * 4 + 1)), 48.5 + 0.15 * i);
                            Model_PCRReadingTaken32((theModel._slope1.ElementAt(i * 4 + 2)), 48.5 + 0.15 * i);
                            Model_PCRReadingTaken42((theModel._slope1.ElementAt(i * 4 + 3)), 48.5 + 0.15 * i);

                        }


                    break;


                default:
                    break;
            }

        }
Exemple #26
0
        //
        public bool UnpackFrame()
        {
            char currChar;

            int data       = 0;
            int dataNumber = 0;

            bool sResult = false;

            HelixGenModel theModel = ((HelixGen.App)(App.Current)).Model;

            //data = DataBuf;



            try
            {
                dataNumber = objSerialPort.Read(DataBuf, 0, 20);
            }
            catch (Exception ex)
            {
                logger.Debug("opticReadCmd, got an exception: {0}", ex.Message);
            }

            //dataNumber = Uart0ReadString(BUFFER_LEN, data);

            //	buffer = (UCHAR*)sCurrPacket.data;
            // buffer = (UCHAR*)&sCurrPacket;

            // repeat untill no data in receive buffer
            while (0 < dataNumber)
            {
                currChar = DataBuf[data];

                // packet ID has been received
                if (sPacketIdGot)
                {
                    // current byte is a valid packet data,
                    // a packet data must greater than or equal to 0x80
                    //if (0x80 <= currChar )
                    //{
                    // be careful: data stored begin from the second byte
                    if (!sPacketEnd0aGot)
                    {
                        if (currChar == 0x0a)
                        {
                            sPacketEnd0aGot = true;
                        }
                        else
                        {
                            buffer[sCurrPacketLen] = currChar;
                            sCurrPacketLen++;
                            if (sCurrPacketLen >= 1900)
                            {
                                gCommErr        = true;
                                sPacketIdGot    = false;
                                sPacketEnd0aGot = false;
                                sCurrPacketLen  = 0;
                                //send err msg
                            }
                        }
                    }
                    else if (currChar == 0x0d)
                    {
                        gCommErr = false;
                        string stri = new string( buffer);

                        // public double[,] allReadings = new double[6, 4];
                        // public double[] readings = new double[24];
                        theModel.readings = UnpackWithCheckSum(stri, sCurrPacketLen);
                        sResult           = true;

                        /*
                         * switch ( result )
                         * {
                         * case 0: // Ok
                         *  ProcessPack(&sCurrPacket);
                         *  break;
                         * case 1: // packet length error
                         * //						gSysStatus.mCommStatus |= COMM_CMD_LEN_ERR;
                         *  break;
                         * case 2: // packet check sum error
                         * //						gSysStatus.mCommStatus |= COMM_CHECKSUM_ERR;
                         *  break;
                         *
                         * default:
                         *  break;
                         * }
                         */

                        sPacketIdGot    = false;
                        sPacketEnd0aGot = false;
                        //sPacketEnd0aGot =0;
                    }
                    else
                    {
                        gCommErr        = true;
                        sPacketIdGot    = false;
                        sPacketEnd0aGot = false;
                        sCurrPacketLen  = 0;
                    }
                    //}
                    // current byte is not a valid packet data, maybe is a packet ID,
                    // unget it for further analysis
                }
                // packet ID has not been received
                else if (currChar == '<')//">"
                {
                    sPacketIdGot   = true;
                    sCurrPacketLen = 0;
                }
                // point to the next byte
                data++;

                // the rest byte number decreasing
                dataNumber--;
            } // while

            return(sResult);
        }
Exemple #27
0
 public App()
 {
     _theModel = new HelixGenModel();
 }
Exemple #28
0
        void ICommand.Execute(object parameter)
        {
            HelixGenModel model = ((HelixGen.App)App.Current).Model;

            model.PumpOn();
        }
Exemple #29
0
        public int initialize()
        {
            int nRetVal = 0;

            try
            {
                string strChannel = _channel.ToString("00");

                // Set the motor parameters.

                HelixGenModel theModel = ((HelixGen.App)(App.Current)).Model;

                int nResult = initializeMotorParams(_channel, theModel.Config.m_OpticsMotor_Configuration);
                if (nResult != 0)
                {
                    // Initialization failed.

                    logger.Debug("deviceOpticsMotor::initialize failed.");
                }
                else
                {
                    clsAMB controller = theModel.getMotorBoard(_controllerId);

                    // Move the pump to the initial position.
                    string value;
                    controller.GetHomeSwitchStatus(strChannel, out value);

                    if (Int32.Parse(value) == 0)
                    {
                        controller.MoveHome(strChannel);
                        controller.WaitForCompletion(strChannel);
                    }

                    // theModel.DeviceOpticsMotor.Position = 4;

                    /*
                     * for (int nLED = 0; nLED < 6; nLED++)
                     * {
                     *   theModel.OpticsModel.SetLedCurrent(nLED + 1, 0.75);
                     *   //theModel.OpticsModel.SetLedCurrent(nLED + 1, 0);
                     * }
                     */
                    // controller.SetStartSpeed(strChannel, "400");//200,400
                    // controller.SetMaxSpeed(strChannel, "1200");//200,1600

                    /*
                     * controller.SetDirectionPolarity(strChannel, "0");
                     * controller.MoveRelativePositive(strChannel, "100000000");
                     * controller.WaitForCompletion(strChannel);
                     * controller.MoveRelativeNegative(strChannel, "0");
                     * controller.WaitForCompletion(strChannel);
                     */
                    controller.SetResolution(theModel.Config.m_OpticsMotor_Configuration.m_nMotorChannel.ToString("00"),
                                             theModel.Config.m_OpticsMotor_Configuration.m_uiMotorResolution.ToString());



                    //if(isFirstIn)
                    //ZeroOptic();
                    isFirstIn = false;
                    // theModel.OpticsModel.TriggerPhotodetector();
                    // Position = 1;

                    /*
                     * controller.MoveToAbsolutePosition(strChannel,
                     *       "132");
                     * controller.WaitForCompletion(strChannel);*/
                }
            }
            catch (Exception)
            {
                nRetVal = 1;
            }

            return(nRetVal);
        }
Exemple #30
0
        //m_data_x = new List<double>();
        //protected List<double> m_data_r2;
        //m_data_x = new List<double>();
        //protected List<double> m_data_r3;
        //m_data_x = new List<double>();
        //protected List<double> m_data_r4;
        //m_data_x = new List<double>();

        public MainPage(MainWindow parentWnd)
        {
            _parentWnd  = parentWnd;
            _vmMain     = new vmMain();
            DataContext = _vmMain;
            InitializeComponent();

            HelixGenModel model = ((HelixGen.App)App.Current).Model;

            // Initialize the temperature graph.

            graphTemps      = new TemperaturePointCollection();
            graphTempsCount = 0;

            var ds = new EnumerableDataSource <TemperaturePoint>(graphTemps);

            ds.SetXMapping(x => (double)x.Count);
            ds.SetYMapping(y => y.Pressure);

            plotter.AddLineGraph(ds, Colors.Green, 1, "T1");
            plotter.LegendVisible = false;

            graphTemps2     = new TemperaturePointCollection();
            graphTempsCount = 0;

            var ds2 = new EnumerableDataSource <TemperaturePoint>(graphTemps2);

            ds2.SetXMapping(x => (double)x.Count);
            ds2.SetYMapping(y => y.Pressure);

            plotter.AddLineGraph(ds2, Colors.Red, 1, "T2");
            // plotter.LegendVisible = false;

            // Initialize the PCR graph.

            graphPCR      = new PCRPointCollection();
            graphPCRCycle = 0;

            var dsPCR = new EnumerableDataSource <PCRPoint>(graphPCR);

            dsPCR.SetXMapping(x => (double)x.Cycle);
            dsPCR.SetYMapping(y => y.Reading);

            pcrplotter.AddLineGraph(dsPCR, Colors.Green, 1, "R1");
            pcrplotter.LegendVisible = false;

            graphPCR2 = new PCRPointCollection();
            // graphPCRCycle = 0;

            var dsPCR2 = new EnumerableDataSource <PCRPoint>(graphPCR2);

            dsPCR2.SetXMapping(x => (double)x.Cycle);
            dsPCR2.SetYMapping(y => y.Reading);

            pcrplotter.AddLineGraph(dsPCR2, Colors.Red, 1, "R2");
            //pcrplotter.LegendVisible = false;

            graphPCR3 = new PCRPointCollection();
            // graphPCRCycle = 0;

            var dsPCR3 = new EnumerableDataSource <PCRPoint>(graphPCR3);

            dsPCR3.SetXMapping(x => (double)x.Cycle);
            dsPCR3.SetYMapping(y => y.Reading);

            pcrplotter.AddLineGraph(dsPCR3, Colors.Blue, 1, "R3");

            graphPCR4 = new PCRPointCollection();
            // graphPCRCycle = 0;

            var dsPCR4 = new EnumerableDataSource <PCRPoint>(graphPCR4);

            dsPCR4.SetXMapping(x => (double)x.Cycle);
            dsPCR4.SetYMapping(y => y.Reading);

            pcrplotter.AddLineGraph(dsPCR4, Colors.Brown, 1, "R4");

            _vmMain.PropertyChanged     += _vmMain_PropertyChanged;
            model.PCRCyclerTempChanged  += Model_PCRCyclerTempChanged;
            model.PCRCyclerTempChanged2 += Model_PCRCyclerTempChanged2;

            model.evtPCRReadingsStarted += Model_evtPCRReadingsStarted;
            model.evtPCRReadingsTaken   += Model_evtPCRReadingsTaken;
            //model.evtPCRReadingsTaken2 += Model_evtPCRReadingsTaken2;
            model.evtBeginAnalysis += model_evtBeginAnalysis;

            //protected List<double> m_data_r2;
            //m_data_r2 = new List<double>();
            //protected List<double> m_data_r3;
            //m_data_r3 = new List<double>();
            //protected List<double> m_data_r4;
            //m_data_r4 = new List<double>();
        }