Ejemplo n.º 1
0
 // selectPowersupply
 public void selectPowerSupply(int type)
 {
     if (type > 3 || type < 1)
     {
         throw new Exception("Invalid Type: Type must equal 1, 2 or 3");
     }
     else
     {
         string cmd = (":INST:NSEL" + Convert.ToString(type));
         vxi11Device.write(cmd);
     }
 }
Ejemplo n.º 2
0
        private void writeButton_Click(object sender, EventArgs e)
        {
            string     ipstr       = ipAddrTextBox.Text;
            string     gpibAddr    = "inst" + gpibAddrTextBox.Text;
            string     cmd         = commandComboBox.Text;;
            int        timeout_ms  = 0;
            VXI11Class remote_inst = new VXI11Class(gpibAddr, ipstr);
            string     resp        = string.Empty;

            try
            {
                /*if (LockDeviceCheckBox.Checked )
                 * {
                 *  // device lock is requested, min 1000 ms is chosen for demo
                 *  if (Convert.ToInt32(timeOutTextBox.Text) >= 1000)
                 *  {
                 *      remote_inst.write(cmd, Convert.ToInt32(timeOutTextBox.Text));
                 *  }
                 * }
                 * else
                 * {
                 *      remote_inst.write(cmd);
                 *
                 * }*/
                remote_inst.write(cmd);
            }
            catch (Exception ex)
            {
                resp = ex.Message;
                responseTextBox.Text += resp + "\r\n";
            }
        }
        public double GetCurrent()
        {
            double retVal = 0;

            vxi11Device.write(":SOUR:CURR?");
            retVal = Convert.ToDouble(vxi11Device.read());
            return(retVal);
        }
Ejemplo n.º 4
0
 public String getTrace()
 {
     try
     {
         //vxi11Device.write("from ascii"); // Line gives undefined header error
         vxi11Device.write("trac? tra");
         String response = vxi11Device.read();
         int    count    = 0;
         bool   flag     = response.Contains("\n");
         // Count how many lines in response
         while (!flag)
         {
             String temp = vxi11Device.read();
             response = response + temp;
             flag     = temp.Contains("\n");
             count++;
         }
         return(response);
     }
     catch (System.Exception)
     {
         throw new System.Exception("Agilent 86142 get trace failed");
     }
 }
Ejemplo n.º 5
0
 public void setCurrent(double curr, int output_num = 0)
 {
     try
     {
         if (output_num != 0)
         {
             vxi11Device.write("INST:NSEL " + Convert.ToString(output_num));
         }
         vxi11Device.write("CURR " + Convert.ToString(curr));
     }
     catch (System.Exception)
     {
         throw new Exception("Agilent E3649A set current fails");
     }
 }