Example #1
0
 public Boolean Start_Single_TTA()
 {
     //1.Strom einschalten
     MyRack.MeasCurrent_on();
     //2.Spannung bei Imeas und RaumTemperatur messen
     V_f_at_Imeas_Troom = MyDAQ.Get_Constant_Voltage(this, this.GUI);
     //3.Strom aus
     MyRack.MeasCurrent_off();
     //Eigentliche TTA messung
     return(MyDAQ.Measure_TTA_Several_Cycles(this, this.GUI));
 }
Example #2
0
        //**************************************************************************************************
        //                                       Globale Funktionen
        //**************************************************************************************************

        #region GlobaleFunktionen

        public bool Start_Measurement()
        {
            //1. Pre-Settings ................................................................................
            //Anzahl LEDs für Counter
            Nr_of_LEDs = MyMovement.GetLength(0);

            //Text StatusBar ändern
            GUI.StatusBar_Sensitivity_all(0, Nr_of_LEDs, 1, TempSteps.Count);

            //Define voltage measurement array
            Voltage_Values = new List <Sensitivity_DataPoint_Voltage> [Nr_of_LEDs];
            for (int i = 0; i < Nr_of_LEDs; i++)
            {
                Voltage_Values[i] = new List <Sensitivity_DataPoint_Voltage>();
            }

            //Start plotting the temperature
            IsRunning = true;
            Start_OnLine_Temp_Plotting();

            //2. Set Temperature .................................................................................

            //Set temperatures in a for loop
            for (Counter_TempStep = 0; Counter_TempStep < TempSteps.Count; Counter_TempStep++)
            {
                //Set temperature to new target value
                MyTEC.SetTemperature_w_TimerStop((float)TempSteps[Counter_TempStep]);

                //Text StatusBar ändern
                GUI.StatusBar_Sensitivity_all(0, Nr_of_LEDs, Counter_TempStep + 1, TempSteps.Count);

                //Wait 500ms, so Temperature is measured one time (avoid failure)
                System.Threading.Tasks.Task.Delay(1000);

                //Wait until temperature is stable (Cancel if temp no stable after 5 min)
                int cancel_time = 0;
                while (!GUI.myTEC.Stable_for_30sec)
                {
                    //Abfragen ob abbrechen
                    if (GUI.break_is_wished)
                    {
                        goto END_kFactor_all;
                    }

                    // Eine Sekunde Warten
                    System.Threading.Thread.Sleep(1000);

                    cancel_time++;

                    if (cancel_time >= 300) //Nach 5 Minuten Warunung abbrechen
                    {
                        //Warning Message
                        MessageBox.Show("Attention: The Temperature is never stable in the range. Please control the settings of the TEC");
                        //Zum Ende springen
                        goto END_kFactor_all;
                    }
                }

                //3. Measure all DUTs..........................................................................

                //Switch On Current Source with selected current
                MyRack.MeasCurrent_on();

                //Rauffahrn (immer genau auf 0)
                MyXYZ.Move2Position(MyXYZ.Akt_x_Koordinate, MyXYZ.Akt_y_Koordinate, 0, MyXYZ.Akt_Winkel);

                //An Startpunkt fahren lassen (oberer Anschlag)
                MyXYZ.Move2Position(MyMovement[0, 0], MyMovement[0, 1], -70, 0);

                //Measure all LEDs after one other
                Flag_LED_Measurement = true;
                for (int akt_DUT_Nr = 1; akt_DUT_Nr <= Nr_of_LEDs; akt_DUT_Nr++)
                {
                    //Abfragen ob abbrechen
                    if (GUI.break_is_wished)
                    {
                        goto END_kFactor_all;
                    }

                    //Text StatusBar ändern
                    GUI.StatusBar_Sensitivity_all(akt_DUT_Nr, Nr_of_LEDs, Counter_TempStep + 1, TempSteps.Count);

                    //Drive XYZ down to LED
                    MyXYZ.MoveADistance(0, 0, -25, 0);

                    //Short break against starting oscillations (100ms)
                    System.Threading.Thread.Sleep(100);

                    //Measure LED and save to data array
                    MySpectrum.Measure_Sensitivity(this, GUI);

                    //Save Point
                    decimal voltage_help = (decimal)RawData.Average(x => x) / MyRack.Cycles * MySpectrum.Range / 1000 / (decimal)Math.Pow(2, 15) + MyRack.U_offset / 1000;
                    Voltage_Values[akt_DUT_Nr - 1].Add(new Sensitivity_DataPoint_Voltage()
                    {
                        Voltage     = (decimal)RawData.Average(x => x) / MyRack.Cycles * MySpectrum.Range / 1000 / (decimal)Math.Pow(2, 15) / MyRack.Gain + MyRack.U_offset / 1000,
                        Temperature = TempSteps[Counter_TempStep]
                    });

                    GUI.Update_Voltage_Plot_for_Sensitivity(this);

                    //Drive XYZ up
                    MyXYZ.MoveADistance(0, 0, 25, 0);

                    //Drive to next LED (exept at the end)
                    if (akt_DUT_Nr < Nr_of_LEDs)
                    {
                        MyXYZ.MoveADistance(MyMovement[akt_DUT_Nr, 0], MyMovement[akt_DUT_Nr, 1], 0, 0);
                    }
                }

                Flag_LED_Measurement = false;


                //Switch Current source of (until next temperature is reached
                MyRack.MeasCurrent_off();
            }
            //Speicher wieder Frei geben (gegen überflutung Arbeitsspeicher)
            //hBufferHandle.Free();

            //4. Daten auswerten..........................................................................
            Sensitivity_Calculation();

            //Fertig (Trotzdem müssen Grundeinstellungen wieder hergestellt werden)
            goto END_kFactor_all;

END_kFactor_all:

            //set start temperature to TEC controller
            MyTEC.SetTemperature_w_TimerStop((float)TempSteps[0]);

            //stop Plotting
            IsRunning = false;
            Stop_OnLine_Temp_Plotting();

            //Zu Parkposition fahren
            //GUI.xyZ_table1.Move2Position(xyz_park_pos[0], xyz_park_pos[1], xyz_park_pos[2]);

            //Wenn abgebrochen wurde dann false zurückgeben
            if (GUI.break_is_wished)
            {
                GUI.break_is_wished = false;// zurücksetzen
                //Text StatusBar ändern
                GUI.StatusBar_Measurement_CANCELED();
                return(false);
            }
            //Text StatusBar ändern
            GUI.StatusBar_Measurement_FINISHED();
            //sonst true
            return(true);
        }