Exemple #1
0
        public override void AcquisitionStarting()
        {
            //connect to the hardware controller
            hardwareControl = new DecelerationHardwareControl.Controller();

            // initialise the output hardware, full scale -10 to 10 volts
            outputTask = new Task("analog output");
            if (!Environs.Debug)
            {
                AnalogOutputChannel oc =
                    (AnalogOutputChannel)Environs.Hardware.AnalogOutputChannels[(string)settings["channel"]];
                oc.AddToTask(outputTask, -10, 10);
                writer = new AnalogSingleChannelWriter(outputTask.Stream);
                if (!Blocked())
                {
                    writer.WriteSingleSample(true, 0);
                }
            }
            scanParameter = 0;
            //go gently to the correct start position
            if (((string)settings["scanMode"] == "up" || (string)settings["scanMode"] == "updown") && !Blocked())
            {
                rampOutputToVoltage((double)settings["start"]);
            }
            if (((string)settings["scanMode"] == "down" || (string)settings["scanMode"] == "downup") && !Blocked())
            {
                rampOutputToVoltage((double)settings["end"]);
            }
        }
        public void Start()
        {
            proportionalGain = 0;
            integralGain     = 0;
//            derivativeGain = 0;

            ui            = new MainForm();
            ui.controller = this;

            // get access to ScanMaster and the DecelerationHardwareController
            RemotingHelper.ConnectScanMaster();
            RemotingHelper.ConnectDecelerationHardwareControl();

            scanMaster      = new ScanMaster.Controller();
            hardwareControl = new DecelerationHardwareControl.Controller();
            fitter          = new DAQ.Analyze.GaussianFitter();


            if (!Environs.Debug)
            {
                outputTask   = new Task("LaserControllerOutput");
                laserChannel =
                    (AnalogOutputChannel)Environs.Hardware.AnalogOutputChannels["laser"];
                laserChannel.AddToTask(outputTask, -10, 10);
                outputTask.Control(TaskAction.Verify);
                laserWriter = new AnalogSingleChannelWriter(outputTask.Stream);

                inputTask     = new Task("LaserControllerInput");
                cavityChannel = (AnalogInputChannel)Environs.Hardware.AnalogInputChannels["lockcavity"];
                cavityChannel.AddToTask(inputTask, -10, 10);
                cavityReader = new AnalogSingleChannelReader(inputTask.Stream);

                inputrefTask     = new Task("ReferenceLaserControllerInput");
                cavityrefChannel = (AnalogInputChannel)Environs.Hardware.AnalogInputChannels["refcavity"];
                cavityrefChannel.AddToTask(inputrefTask, -10, 10);
                cavityrefReader = new AnalogSingleChannelReader(inputrefTask.Stream);
            }

            timerDelegate        = new TimerCallback(TalkToHardwareControl);
            hardwareControlTimer = new System.Threading.Timer(timerDelegate, null, 5000, HARDWARE_CONTROL_TALK_PERIOD);

            Application.Run(ui);
        }
        public override void AcquisitionStarting()
        {
            //connect to the hardware controller
            hardwareControl = new DecelerationHardwareControl.Controller();

            // initialise the output hardware, full scale -10 to 10 volts
            outputTask = new Task("analog output");
            if (!Environs.Debug)
            {
                AnalogOutputChannel oc =
                    (AnalogOutputChannel)Environs.Hardware.AnalogOutputChannels[(string)settings["channel"]];
                oc.AddToTask(outputTask, -10, 10);
                writer = new AnalogSingleChannelWriter(outputTask.Stream);
                if (!Blocked()) writer.WriteSingleSample(true, 0);
            }
            scanParameter = 0;
            //go gently to the correct start position
            if (((string)settings["scanMode"] == "up" || (string)settings["scanMode"] == "updown") && !Blocked())
                rampOutputToVoltage((double)settings["start"]);
            if (((string)settings["scanMode"] == "down" || (string)settings["scanMode"] == "downup") && !Blocked())
                rampOutputToVoltage((double)settings["end"]);
        }
        public void Start()
        {
            proportionalGain = 0;
            integralGain = 0;
            //            derivativeGain = 0;

            ui = new MainForm();
            ui.controller = this;

            // get access to ScanMaster and the DecelerationHardwareController
            RemotingHelper.ConnectScanMaster();
            RemotingHelper.ConnectDecelerationHardwareControl();

            scanMaster = new ScanMaster.Controller();
            hardwareControl = new DecelerationHardwareControl.Controller();
            fitter = new DAQ.Analyze.GaussianFitter();

            if (!Environs.Debug)
            {
                outputTask = new Task("LaserControllerOutput");
                laserChannel =
                        (AnalogOutputChannel)Environs.Hardware.AnalogOutputChannels["laser"];
                laserChannel.AddToTask(outputTask, -10, 10);
                outputTask.Control(TaskAction.Verify);
                laserWriter = new AnalogSingleChannelWriter(outputTask.Stream);

                inputTask = new Task("LaserControllerInput");
                cavityChannel = (AnalogInputChannel)Environs.Hardware.AnalogInputChannels["lockcavity"];
                cavityChannel.AddToTask(inputTask, -10, 10);
                cavityReader = new AnalogSingleChannelReader(inputTask.Stream);

                inputrefTask = new Task("ReferenceLaserControllerInput");
                cavityrefChannel = (AnalogInputChannel)Environs.Hardware.AnalogInputChannels["refcavity"];
                cavityrefChannel.AddToTask(inputrefTask, -10, 10);
                cavityrefReader = new AnalogSingleChannelReader(inputrefTask.Stream);
            }

            timerDelegate = new TimerCallback(TalkToHardwareControl);
            hardwareControlTimer = new System.Threading.Timer(timerDelegate, null, 5000, HARDWARE_CONTROL_TALK_PERIOD);

            Application.Run(ui);
        }
        public override void AcquisitionStarting()
        {
            //connect to the hardware controller
            hardwareControl = new DecelerationHardwareControl.Controller();

            // configure the analog input
            inputTask = new Task("analog inputs");

            string[] channels = ((String)settings["channelList"]).Split(',');
            // check whether the lock cavity is in the list
            bool cavityFound = false;
            lockCavityChannel = 0;
            while (!cavityFound && lockCavityChannel < channels.Length)
            {
                if (channels[lockCavityChannel] == "lockcavity") cavityFound = true;
                else lockCavityChannel++;
            }
            // check whether the reference cavity is in the list
            bool refcavityFound = false;
            refCavityChannel = 0;
            while (!refcavityFound && refCavityChannel < channels.Length)
            {
                if (channels[refCavityChannel] == "refcavity") refcavityFound = true;
                else refCavityChannel++;
            }
            if (!Environs.Debug)
            {
                foreach (string channel in channels)
                {
                    ((AnalogInputChannel)Environs.Hardware.AnalogInputChannels[channel]).AddToTask(
                        inputTask,
                        (double)settings["inputRangeLow"],
                        (double)settings["inputRangeHigh"]
                        );
                }
                // Add the lockcavity if it's not already there
                if (!cavityFound)
                {
                    ((AnalogInputChannel)Environs.Hardware.AnalogInputChannels["lockcavity"]).AddToTask(
                        inputTask,
                        (double)settings["inputRangeLow"],
                        (double)settings["inputRangeHigh"]
                        );
                }
                inputTask.Control(TaskAction.Verify);
                // Add the refcavity if it's not already there
                if (!refcavityFound)
                {
                    ((AnalogInputChannel)Environs.Hardware.AnalogInputChannels["refcavity"]).AddToTask(
                        inputTask,
                        (double)settings["inputRangeLow"],
                        (double)settings["inputRangeHigh"]
                        );
                }
                inputTask.Control(TaskAction.Verify);
            }
            reader = new AnalogMultiChannelReader(inputTask.Stream);

            // block the ADC to all other applications
            hardwareControl.AnalogInputsAvailable = false;
        }
        public override void AcquisitionStarting()
        {
            //connect to the hardware controller
            hardwareControl = new DecelerationHardwareControl.Controller();

            // configure the analog input
            inputTask = new Task("analog inputs");

            string[] channels = ((String)settings["channelList"]).Split(',');
            // check whether the lock cavity is in the list
            bool cavityFound = false;

            lockCavityChannel = 0;
            while (!cavityFound && lockCavityChannel < channels.Length)
            {
                if (channels[lockCavityChannel] == "lockcavity")
                {
                    cavityFound = true;
                }
                else
                {
                    lockCavityChannel++;
                }
            }
            // check whether the reference cavity is in the list
            bool refcavityFound = false;

            refCavityChannel = 0;
            while (!refcavityFound && refCavityChannel < channels.Length)
            {
                if (channels[refCavityChannel] == "refcavity")
                {
                    refcavityFound = true;
                }
                else
                {
                    refCavityChannel++;
                }
            }
            if (!Environs.Debug)
            {
                foreach (string channel in channels)
                {
                    ((AnalogInputChannel)Environs.Hardware.AnalogInputChannels[channel]).AddToTask(
                        inputTask,
                        (double)settings["inputRangeLow"],
                        (double)settings["inputRangeHigh"]
                        );
                }
                // Add the lockcavity if it's not already there
                if (!cavityFound)
                {
                    ((AnalogInputChannel)Environs.Hardware.AnalogInputChannels["lockcavity"]).AddToTask(
                        inputTask,
                        (double)settings["inputRangeLow"],
                        (double)settings["inputRangeHigh"]
                        );
                }
                inputTask.Control(TaskAction.Verify);
                // Add the refcavity if it's not already there
                if (!refcavityFound)
                {
                    ((AnalogInputChannel)Environs.Hardware.AnalogInputChannels["refcavity"]).AddToTask(
                        inputTask,
                        (double)settings["inputRangeLow"],
                        (double)settings["inputRangeHigh"]
                        );
                }
                inputTask.Control(TaskAction.Verify);
            }
            reader = new AnalogMultiChannelReader(inputTask.Stream);

            // block the ADC to all other applications
            hardwareControl.AnalogInputsAvailable = false;
        }