Exemple #1
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 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);
        }
Exemple #3
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);
        }
        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 #5
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 #6
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);
        }