コード例 #1
0
ファイル: NI_USB6281.cs プロジェクト: schmidmaxi1/RthTEC_ATIM
        public override string AutoOpen(AutoConnect_Window myLoadScreen)
        {
            int iterration = 2;

            Communication_LOG += "Try to connect NI_USB6281:\n";

            //Öffnen
            if (ComPort_select.Text == "")   //Wenn kein Port gewählt ist
            {
                MessageBox.Show("No Channel selected! \nTry again.", "Warning",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);

                return("DAQ-Unit: Connection was not found!" + Environment.NewLine);
            }

            VISA_or_Channel_Name = ComPort_select.Text;
            Communication_LOG   += "Seccessful\n";


            myLoadScreen.ChangeTask("Change UI ...", iterration);

            IsConnected = true;

            //UI anpassen
            ComPort_select.Enabled        = false;
            comboBox_Frequency.Enabled    = true;
            comboBox_Range.Enabled        = true;
            numericUpDown_Trigger.Enabled = true;

            //Text und Kontext-Menü auf Button ändern
            button_OpenClose.Text = "Close";

            return("");
        }
コード例 #2
0
        public string AutoOpen(AutoConnect_Window myLoadScreen)
        {
            int iterration = 10;

            //NI-Karte muss nicht geöffnet werden (immer Verbunden)
            //--> Abfragen ob Kanal ausgewählt wurde

            Communication_LOG += "Try to connect NI_USB6281:\n";

            if (Channel_select.Text == "")   //Wenn kein Port gewählt ist
            {
                return("No Channel selected!");
            }

            myLoadScreen.ChangeTask("Change UI ...", iterration);

            Channel_Name       = Channel_select.Text;
            Communication_LOG += "Seccessful\n";

            IsConnected = true;

            //UI anpassen
            Channel_select.Enabled  = false;
            Voltage_Trigger.Enabled = true;

            //Text und Kontext-Menü auf Button ändern
            button_OpenClose.Text = "Close";

            return("");
        }
コード例 #3
0
        public override string AutoOpen(AutoConnect_Window myLoadScreen)
        {
            int iterration = 7;

            Communication_LOG += "Try to connect SPECTRUM:\n";

            //Öffnen
            try
            {
                H_Device = Drv.spcm_hOpen(VISA_or_Channel_Name);
            }
            catch (System.DllNotFoundException)
            {
                Communication_LOG += "FAILED!\n";
                return("DAQ-Unit: Connection was not found!" + Environment.NewLine);
            }

            //Prüfen ob verbindung erfolgreich war, sonst abbrechen
            if ((long)H_Device == 0)
            {
                Communication_LOG += "FAILED!\n";
                return("DAQ-Unit: Connection was not seccessfull!" + Environment.NewLine);
            }
            Communication_LOG += "Seccessful\n";

            myLoadScreen.ChangeTask("Reset ...", iterration);

            //Reseten
            ErrorCode_Spectrum += Reset();

            myLoadScreen.ChangeTask("Change UI ...", iterration);

            //Ab hier verbunden
            IsConnected = true;

            //UI anpassen
            button_OpenClose.Text         = "Close";
            comboBox_Frequency.Enabled    = true;
            comboBox_Range.Enabled        = true;
            numericUpDown_Trigger.Enabled = true;

            return("");
        }
コード例 #4
0
 public virtual string AutoOpen(AutoConnect_Window myLoadScreen)
 {
     return("");
 }
コード例 #5
0
        //**************************************************************************************************
        //                                        AUTO CONNECT
        //**************************************************************************************************

        #region AutoConnect
        /// <summary>
        /// Tries to connect all available Devices in the GUI (when not already connected)
        /// Returns report.
        /// </summary>
        private void AutoConnect_ALL()
        {
            //Ausgabe String für MessageBox
            string errorText = "";

            //Fenster erzeugen
            AutoConnect_Window myAutoConnect_Window = new AutoConnect_Window();

            myAutoConnect_Window.Show();
            myAutoConnect_Window.Update();

            //Power-Supply
            myAutoConnect_Window.ChangeAll_newValue("Power Supply ...", "Starting Connection ...", 0);

            if (!myPowerSupply.IsConnected)
            {
                errorText += myPowerSupply.AutoOpen(myAutoConnect_Window);
            }


            //Spectrum
            myAutoConnect_Window.ChangeAll_newValue("Spectrum DAQ ...", "Starting Connection ...", 20);

            if (!DAQ_Unit.IsConnected)
            {
                //errorText += DAQ_Unit.AutoOpen(myAutoConnect_Window);
                errorText += "DAQ fehlt.";
            }

            //TEC Controller
            myAutoConnect_Window.ChangeAll_newValue("TEC Controller ...", "Starting Connection ...", 40);

            if (!myTEC.IsConnected)
            {
                errorText += myTEC.AutoOpen(myAutoConnect_Window);
            }

            //XYZ-Table
            myAutoConnect_Window.ChangeAll_newValue("XYZ table ...", "Starting Connection ...", 60);

            if (!myXYZ.IsConnected)
            {
                errorText += myXYZ.AutoOpen(myAutoConnect_Window);
            }

            //Rth-Rack
            myAutoConnect_Window.ChangeAll_newValue("Rth-Rack ...", "Starting Connection ...", 80);

            if (!rthTEC_Rack1.IsConnected)
            {
                errorText += rthTEC_Rack1.AutoOpen(myAutoConnect_Window);
            }

            //Fenster schließen
            myAutoConnect_Window.Close();

            //Bericht ausgeben
            if (errorText != "")
            {
                MessageBox.Show(errorText, "Following device(s) must be connected manueally:",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
コード例 #6
0
        //********************************************************************************************************************
        //                                           AutoConnect
        //********************************************************************************************************************

        public string AutoOpen(AutoConnect_Window myLoadScreen)
        {
            int iterration = 5;

            if (ComPort_select.Text == "")   //Wenn kein Port gewählt ist
            {
                return("Rth-Rack: No COM-Port selected!" + Environment.NewLine);
            }

            //COMPort anpassen
            Serial_Interface.PortName = ComPort_select.Text;

            //Verbindung herstellen
            try
            {
                Serial_Interface.Open();
            }
            catch (UnauthorizedAccessException)
            {
                return("Rth-Rack: COM Port is allready in use!" + Environment.NewLine);
            }
            catch (System.IO.IOException)
            {
                return("Rth-Rack: COM Port is not available!" + Environment.NewLine);
            }

            myLoadScreen.ChangeTask("Checking device ...", iterration);

            //Abfragen ob richtiges Gerät
            DeviceType = Write_N_Read("GID");

            //Checken ob vom richtigen Typ
            if (!DeviceType.Contains("RthTEC TTA-Equipment"))
            {
                Serial_Interface.Close();
                return("Rth-Rack: COM Port represents no Rth-Rack!" + Environment.NewLine);
            }

            myLoadScreen.ChangeTask("Reset ...", iterration);
            //Reset
            Write_N_Read("RST");

            //Delay
            Thread.Sleep(2000);

            //Default Einstellungen setzen
            SetEnable(false);

            //SetDefaultSetup();

            myLoadScreen.ChangeTask("Change GUI ...", iterration);

            //Oberfläche anpassen
            IsConnected = true;

            //Reset_Button.Enabled = true;
            TestPulse.Enabled     = true;
            Enable_Button.Enabled = true;

            UI_KindOfComponent.Enabled = true;
            UI_Heat_Time.Enabled       = true;
            UI_Heat_Current.Enabled    = true;
            UI_Heat_Voltage.Enabled    = true;
            UI_Meas_Time.Enabled       = true;
            UI_Meas_Current.Enabled    = true;
            UI_Meas_Voltage.Enabled    = true;
            UI_Cycles.Enabled          = true;
            UI_Offset_Voltage.Enabled  = true;


            ComPort_select.Enabled = false;

            OpenClose.Text = "Close";

            cm.Items["Reset"].Enabled = true;

            return("");
        }