Пример #1
0
 /// <summary>
 /// Выйти на длину волны
 /// </summary>
 /// <param name="v_Num">Статичный монахраматор?</param>
 /// <param name="v_TimeToSleep">время на выполнение</param>
 public void F_GoWave(bool v_Static, Int32 v_TimeToSleep = 100)
 {
     try
     {
         if (V_Command_D02.V_Status)
         {
             float v_WaveLenght = 200;
             if (v_Static)
             {
                 v_WaveLenght = (float)(V_Options.V_WaveStatic.Fv_wave / (C_ParametorGrid.F_GridGet().FindIndex(x => x.Equals(V_Options.V_WaveStatic.Fv_ParameterGrid)) + 1));
             }
             else
             {
                 v_WaveLenght = (float)(V_Options.V_WaveDynamic.Fv_wave / (C_ParametorGrid.F_GridGet().FindIndex(x => x.Equals(V_Options.V_WaveDynamic.Fv_ParameterGrid)) + 1));
             }
             V_Command_D02.F_ComOut_200_WaveLength(
                 (byte)(v_Static == true ? V_Options.Fv_NumTypeMeasurement : Math.Abs(V_Options.Fv_NumTypeMeasurement - 1)),
                 v_WaveLenght,
                 v_TimeToSleep);
         }
     }
     catch (ApplicationException v_Ex)
     {
         F_MyException(v_Ex);
     }
 }
Пример #2
0
 /// <summary>
 /// Выйти на длину волны
 /// </summary>
 /// <param name="v_Num">номер монохраматора</param>
 /// <param name="v_TimeToSleep">время на выполнение</param>
 public void F_GoWave(int v_Num, Int32 v_TimeToSleep = 100)
 {
     try
     {
         if (V_Command_D02.V_Status)
         {
             float v_WaveLenght = 200;
             if (v_Num == 0)
             {
                 v_WaveLenght = (float)(V_Options.V_WaveFirst.Fv_wave / (C_ParametorGrid.F_GridGet().FindIndex(x => x.Equals(V_Options.V_WaveFirst.Fv_ParameterGrid)) + 1));
             }
             else
             {
                 v_WaveLenght = (float)(V_Options.V_WaveSecond.Fv_wave / (C_ParametorGrid.F_GridGet().FindIndex(x => x.Equals(V_Options.V_WaveSecond.Fv_ParameterGrid)) + 1));
             }
             V_Command_D02.F_ComOut_200_WaveLength(
                 (byte)v_Num,
                 v_WaveLenght,
                 v_TimeToSleep);
         }
     }
     catch (ApplicationException v_Ex)
     {
         F_MyException(v_Ex);
     }
 }
Пример #3
0
        public C_Waves()
        {
            var v_OptionsGrids = C_ParametorGrid.F_GridGet();

            V_Waves = new C_Wave[]
            {
                new C_Wave(v_OptionsGrids[0], v_OptionsGrids[0].Fv_Min),
                new C_Wave(v_OptionsGrids[0], v_OptionsGrids[0].Fv_Min),
            };
        }
Пример #4
0
 /*
  * public void F_NewWaveAndGrid(double v_NewWave)
  * {
  *  V_Wave = v_NewWave;
  *  foreach (var v_grid in C_ParametorGrid.F_GridGet())
  *      if (F_WaveValidity(v_grid))
  *          Fv_ParameterGrid = v_grid;
  * }
  * */
 private string F_GridNew() // Дать нормальное имя
 {
     foreach (var v_grid in C_ParametorGrid.F_GridGet())
     {
         if (F_WaveValidity(v_grid))
         {
             return("Подходящая решётка: " + v_grid.Fv_NumberStrokes.ToString() + " штр/мм.");
         }
     }
     return("Подходящих решёток нет");
 }
Пример #5
0
        /// <summary>
        /// Запуск измерения с параметрами
        /// </summary>
        /// <param name="v_Shift">Номер шага</param>
        /// <param name="v_PMT">Установка напряжения ФЭУ. 0xFF соответствует 1250 В.</param>
        /// <param name="v_k">Количество повторов</param>
        /// <param name="v_Name">Название образца</param>
        /// <param name="v_MinWave">Минимальная Длина</param>
        public void F_Measurement_(double v_Shift, int v_k, string v_Name, double v_PMT, double v_MinWave)
        {
            try
            {
                if (V_Command_D01.V_Status)
                {
                    V_Command_D01.F_CommandOut_PMT((byte)(255 * (v_PMT / 1250)));
                }

                if (V_Command_D02.V_Status)
                {
                    double V_DynamicMax = V_Options.V_WaveDynamic.Fv_wave;
                    F_GoWave(true);
                    for (; v_MinWave <= V_Options.V_WaveDynamic.Fv_wave; V_Options.V_WaveDynamic.Fv_wave -= v_Shift)
                    {
                        if (V_Options.V_WaveDynamic.V_Error != null)
                        {
                            if (MessageBox.Show(V_Options.V_WaveDynamic.V_Error.Message + " Для подтверждения замены нажмите 'Ок'", "Требуется смена решётки", MessageBoxButton.OK) != MessageBoxResult.OK)
                            {
                                break;
                            }
                            else
                            {
                                V_Options.V_WaveDynamic.Fv_ParameterGrid = C_ParametorGrid.F_GridGet().Find(x => V_Options.V_WaveDynamic.F_WaveValidity(x));
                            }
                        }
                        F_GoWave(false);
                        if (V_Command_D01.V_Status)
                        {
                            for (int i = v_k; 0 < i; --i)
                            {
                                F_Request(v_Name);
                            }
                        }
                    }
                    V_Options.V_WaveDynamic.Fv_wave = V_DynamicMax;
                }
            }
            catch (ApplicationException v_Ex)
            {
                F_MyException(v_Ex);
            }
            catch (Exception v_Ex)
            {
                F_MyException(v_Ex);
            }
        }
Пример #6
0
 private void B_UseCorrection_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (Event_UseCorrection != null)
         {
             float[] v_Monohromators = new float[] { float.Parse(TB_Monochromator1.Text.Replace(',', '.'), CultureInfo.InvariantCulture), float.Parse(TB_Monochromator2.Text.Replace(',', '.'), CultureInfo.InvariantCulture) };
             if ((C_ParametorGrid.F_GridGet()[0].Fv_Min <= v_Monohromators.Min()) && (v_Monohromators.Max() <= C_ParametorGrid.F_GridGet()[0].Fv_Max))
             {
                 B_UseCorrection.IsEnabled = !B_UseCorrection.IsEnabled;
                 Event_UseCorrection(v_Monohromators);
                 this.Close();
             }
             else
             {
                 MessageBox.Show("Показания счётчика за границами рабочего диапазона [ " + C_ParametorGrid.F_GridGet()[0].Fv_Min.ToString() + " ; " + C_ParametorGrid.F_GridGet()[0].Fv_Max.ToString() + " ]", "Ошибка данных");
             }
         }
     }
     catch (System.FormatException v_Ex)
     {
         MessageBox.Show(v_Ex.Message, "Ошибка данных");
     }
 }
Пример #7
0
        /// <summary>
        /// Обновление настроек
        /// </summary>
        private void F_NewOptions()
        {
            lock (v_Key)
            {
                B_Start.IsEnabled = true;
                try
                {
                    V_Logic.Fv_Options.V_WaveStatic.Fv_wave           = double.Parse(TB_MonochromatorStatic.Text.Replace(',', '.'), CultureInfo.InvariantCulture);
                    V_Logic.Fv_Options.V_WaveDynamic.Fv_wave          = double.Parse(TB_MonochromatorDynamic.Text.Replace(',', '.'), CultureInfo.InvariantCulture);
                    V_Logic.Fv_Options.V_WaveDynamic.Fv_ParameterGrid = C_ParametorGrid.F_GridGet()[CB_MonochromatorDynamicGrid.SelectedIndex];
                    V_Logic.Fv_Options.V_WaveStatic.Fv_ParameterGrid  = C_ParametorGrid.F_GridGet()[CB_MonochromatorStaticGrid.SelectedIndex];
                }
                catch (ApplicationException)
                {
                    B_Start.IsEnabled = false;
                }
                catch (System.FormatException)
                {
                    B_Start.IsEnabled = false;
                }
            }

            //F_Paint();
        }
Пример #8
0
        public W_Measurements(C_Logic v_Logic)
        {
            InitializeComponent();

            V_Logic = v_Logic;

            foreach (var v_type in V_Logic.Fv_Options.F_GetTypeMeasurement())
            {
                CB_TypeMeasurement.Items.Add(v_type);
            }

            foreach (C_ParametorGrid.S_ParameterGrid v_grid in C_ParametorGrid.F_GridGet())
            {
                CB_MonochromatorDynamicGrid.Items.Add(v_grid.Fv_NumberStrokes);
                CB_MonochromatorStaticGrid.Items.Add(v_grid.Fv_NumberStrokes);
            }

            CB_TypeMeasurement.SelectionChanged += delegate(object sender, SelectionChangedEventArgs e)
            {
                if (CB_TypeMeasurement.SelectedIndex == 0)
                {
                    T_MonochromatorStaticOrDynamic.Text = "Длина волны возбуждения";
                }
                else
                {
                    T_MonochromatorStaticOrDynamic.Text = "Длина волны эмиссии";
                }
                V_Logic.Fv_Options.Fv_NumTypeMeasurement = CB_TypeMeasurement.SelectedIndex;

                TB_MonochromatorStatic.Text     = V_Logic.Fv_Options.V_WaveStatic.Fv_wave.ToString("F3", CultureInfo.InvariantCulture);
                TB_MonochromatorDynamic.Text    = V_Logic.Fv_Options.V_WaveDynamic.Fv_wave.ToString("F3", CultureInfo.InvariantCulture);
                TB_MonochromatorMinDynamic.Text = V_Logic.Fv_Options.V_WaveDynamic.Fv_ParameterGrid.Fv_Min.ToString("F3", CultureInfo.InvariantCulture);

                CB_MonochromatorDynamicGrid.SelectedIndex = C_ParametorGrid.F_GridGet().FindIndex(x => x.Equals(V_Logic.Fv_Options.V_WaveDynamic.Fv_ParameterGrid));
                CB_MonochromatorStaticGrid.SelectedIndex  = C_ParametorGrid.F_GridGet().FindIndex(x => x.Equals(V_Logic.Fv_Options.V_WaveStatic.Fv_ParameterGrid));
            };
            CB_TypeMeasurement.SelectedIndex = V_Logic.Fv_Options.Fv_NumTypeMeasurement;

            CB_MonochromatorDynamicGrid.LostFocus       += delegate(object sender, RoutedEventArgs e) { F_NewOptions(); };           // Применение новых настроек
            CB_MonochromatorStaticGrid.SelectionChanged += delegate(object sender, SelectionChangedEventArgs e) { F_NewOptions(); }; // Применение новых настроек
            TB_MonochromatorStatic.LostFocus            += delegate(object sender, RoutedEventArgs e) { F_NewOptions(); };           // Применение новых настроек
            TB_MonochromatorDynamic.LostFocus           += delegate(object sender, RoutedEventArgs e) { F_NewOptions(); };           // Применение новых настроек
            TB_MonochromatorMinDynamic.LostFocus        += delegate(object sender, RoutedEventArgs e) { F_NewOptions(); };           // Применение новых настроек

            V_Logic.E_CloseException += delegate() { this.Close(); };                                                                // Закрытие из за ошибок

            V_Logic.E_MeasurementOnSuccess += delegate()
            {
                B_Correction.IsEnabled    = B_Free.IsEnabled = B_Save.IsEnabled = B_Stop.IsEnabled = TB_Name.IsEnabled = Gr_OptionsD01.IsEnabled = true;
                B_Сalibration02.IsEnabled = B_On.IsEnabled = B_D01.IsEnabled = B_D02.IsEnabled = false;
            }; // Блокировка/Активация элементов интерфейса при успешном подключении

            V_Logic.E_MeasurementCorrectionSuccess += delegate()
            {
                B_Start.IsEnabled = B_WaveSattic.IsEnabled = B_Dynamic.IsEnabled = Gr_OptionsD01.IsEnabled = Gr_OptionsD02.IsEnabled = true;
                B_D01.IsEnabled   = B_D02.IsEnabled = B_On.IsEnabled = false;
            }; // Блокировка/Активация элементов интерфейса при успешной корекции

            V_Logic.E_MeasurementOffSuccess += delegate()
            {
                B_Сalibration02.IsEnabled = B_D01.IsEnabled = B_D02.IsEnabled = B_On.IsEnabled = true;
                B_Correction.IsEnabled    = B_Free.IsEnabled = B_Start.IsEnabled = B_Save.IsEnabled = B_WaveSattic.IsEnabled = B_Dynamic.IsEnabled = B_Stop.IsEnabled = TB_Name.IsEnabled = Gr_OptionsD02.IsEnabled = Gr_OptionsD01.IsEnabled = false;
            }; // Блокировка/Активация элементов интерфейса при успешном отключении

            V_Logic.E_MeasurementNew += delegate(int V_PMTOut, int v_ReferenceOut, int v_ProbeOut, double v_OutExcitation, double v_OutEmission, double v_WaveDynamic, double v_WaveStatic, C_Calibration02 v_Calibration02)
            {
                TB_NumberRequest.Text = (int.Parse(TB_NumberRequest.Text) + 1).ToString(); TB_PMTOut.Text = V_PMTOut.ToString();
                TB_ReferenceOut.Text  = v_ReferenceOut.ToString();
                TB_ProbeOut.Text      = v_ProbeOut.ToString();

                TB_OutEmission.Text   = v_OutEmission.ToString("e2");
                TB_OutExcitation.Text = v_OutExcitation.ToString("e2");
            };

            WinFH_Paint = new System.Windows.Forms.Integration.WindowsFormsHost();
        }