コード例 #1
0
        //The photodiode inputs have been bundled into one task. We never read one photodiode without reading
        //the other.
        public void ConfigureReadAI(int numberOfMeasurements, bool autostart) //AND CAVITY VOLTAGE!!!
        {
            readAIsTask = new Task("readAI");

            channels = new Dictionary <string, AnalogInputChannel>();
            foreach (string s in analogInputs)
            {
                AnalogInputChannel channel = (AnalogInputChannel)Environs.Hardware.AnalogInputChannels[s];
                channels.Add(s, channel);
            }

            foreach (KeyValuePair <string, AnalogInputChannel> pair in channels)
            {
                pair.Value.AddToTask(readAIsTask, 0, 10);
            }

            if (autostart == false)
            {
                readAIsTask.Timing.ConfigureSampleClock(
                    "",
                    40000,
                    SampleClockActiveEdge.Rising,
                    SampleQuantityMode.FiniteSamples, numberOfMeasurements);
                readAIsTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger(
                    (string)Environs.Hardware.GetInfo(trigger),
                    DigitalEdgeStartTriggerEdge.Rising);
            }
            readAIsTask.Control(TaskAction.Verify);
            analogReader = new AnalogMultiChannelReader(readAIsTask.Stream);
        }
コード例 #2
0
        private void ConfigureReadAI(int numberOfMeasurements, double sampleRate, bool triggerSense, bool autostart) //AND CAVITY VOLTAGE!!!
        {
            readAIsTask = new Task("readAIsTask");

            foreach (string inputName in analogInputs)
            {
                AnalogInputChannel channel = (AnalogInputChannel)Environs.Hardware.AnalogInputChannels[inputName];
                channel.AddToTask(readAIsTask, 0, 10);
            }

            SampleClockActiveEdge       clockEdge   = SampleClockActiveEdge.Rising;
            DigitalEdgeStartTriggerEdge triggerEdge = triggerSense ? DigitalEdgeStartTriggerEdge.Rising : DigitalEdgeStartTriggerEdge.Falling;

            if (!autostart)
            {
                // Use internal clock
                readAIsTask.Timing.ConfigureSampleClock("", sampleRate, clockEdge, SampleQuantityMode.FiniteSamples, numberOfMeasurements);
                readAIsTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger(trigger, triggerEdge);
            }

            readAIsTask.Control(TaskAction.Verify);
            analogReader = new AnalogMultiChannelReader(readAIsTask.Stream);


            // Commiting now apparently saves time when we actually run the task
            readAIsTask.Control(TaskAction.Commit);
        }
コード例 #3
0
 //The photodiode inputs have been bundled into one task. We never read one photodiode without reading
 //the other.
 public void ConfigureReadPhotodiodes(int numberOfMeasurements, bool autostart)
 {
     readPhotodiodesTask   = new Task("ReadPhotodiodes");
     referenceLaserChannel = (AnalogInputChannel)Environs.Hardware.AnalogInputChannels[masterPDChannelName];
     lockingLaserChannel   = (AnalogInputChannel)Environs.Hardware.AnalogInputChannels[slavePDChannelName];
     referenceLaserChannel.AddToTask(readPhotodiodesTask, 0, 10);
     lockingLaserChannel.AddToTask(readPhotodiodesTask, 0, 10);
     readPhotodiodesTask.Control(TaskAction.Verify);
     photodiodesReader = new AnalogMultiChannelReader(readPhotodiodesTask.Stream);
 }
コード例 #4
0
ファイル: LaserController.cs プロジェクト: lcaldwell/EDMSuite
        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.ConnectMoleculeMOTHardwareControl();

            scanMaster      = new ScanMaster.Controller();
            hardwareControl = new MoleculeMOTHardwareControl.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);
        }
コード例 #5
0
 //The photodiode inputs have been bundled into one task. We never read one photodiode without reading
 //the other.
 public void ConfigureReadAI(int numberOfMeasurements, bool autostart) //AND CAVITY VOLTAGE!!!
 {
     readAIsTask           = new Task("readAI");
     referenceLaserChannel = (AnalogInputChannel)Environs.Hardware.AnalogInputChannels[masterPDChannelName];
     lockingLaserChannel   = (AnalogInputChannel)Environs.Hardware.AnalogInputChannels[slavePDChannelName];
     cavityVoltageChannel  = (AnalogInputChannel)Environs.Hardware.AnalogInputChannels[cavityReadChannelName];
     referenceLaserChannel.AddToTask(readAIsTask, 0, 10);
     lockingLaserChannel.AddToTask(readAIsTask, 0, 10);
     cavityVoltageChannel.AddToTask(readAIsTask, 0, 10);
     if (autostart == false)
     {
         readAIsTask.Timing.ConfigureSampleClock(
             "",
             66000,
             SampleClockActiveEdge.Rising,
             SampleQuantityMode.FiniteSamples, numberOfMeasurements);
         readAIsTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger(
             (string)Environs.Hardware.GetInfo(AITriggerInputName),
             DigitalEdgeStartTriggerEdge.Rising);
     }
     readAIsTask.Control(TaskAction.Verify);
     analogReader = new AnalogMultiChannelReader(readAIsTask.Stream);
 }
コード例 #6
0
        //The photodiode inputs have been bundled into one task. We never read one photodiode without reading
        //the other.
        public void ConfigureReadPhotodiodes(int numberOfMeasurements, bool autostart)
        {
            readPhotodiodesTask   = new Task("ReadPhotodiodes");
            referenceLaserChannel = (AnalogInputChannel)Environs.Hardware.AnalogInputChannels[masterPDChannelName];
            lockingLaserChannel   = (AnalogInputChannel)Environs.Hardware.AnalogInputChannels[slavePDChannelName];
            referenceLaserChannel.AddToTask(readPhotodiodesTask, 0, 10);
            lockingLaserChannel.AddToTask(readPhotodiodesTask, 0, 10);

            if (!autostart)
            {
                readPhotodiodesTask.Timing.ConfigureSampleClock(
                    "",
                    500,
                    SampleClockActiveEdge.Rising,
                    SampleQuantityMode.FiniteSamples, 2 * numberOfMeasurements);
                readPhotodiodesTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger(
                    (string)Environs.Hardware.GetInfo(photodiodeTriggerInputName),
                    DigitalEdgeStartTriggerEdge.Rising);
            }
            readPhotodiodesTask.AIChannels[0].DataTransferMechanism = AIDataTransferMechanism.UsbBulk;
            readPhotodiodesTask.AIChannels[1].DataTransferMechanism = AIDataTransferMechanism.UsbBulk;
            readPhotodiodesTask.Control(TaskAction.Verify);
            photodiodesReader = new AnalogMultiChannelReader(readPhotodiodesTask.Stream);
        }
コード例 #7
0
        private void AddChannelToSinglePointTask(string chan)
        {
            AnalogInputChannel aic = ((AnalogInputChannel)Environs.Hardware.AnalogInputChannels[chan]);

            aic.AddToTask(singlePointInputTask, 0, 10);
        }