/// <summary>
        /// Sets the function of the source to voltage or current
        /// </summary>
        /// <param name="type">Voltage or current selection</param>
        protected virtual void setSourceFunction(VIType type)
        {
            string wrt = string.Empty;

            try {
                wrt = String.Format("SOUR:FUNC:MODE {0}", type.ToString( ).ToUpper( ).Substring(0, 4));
                this.gpib.Write(wrt);
            }
            catch (Exception ex) {
                throw new Exception(ex.Message + this.gpib.Device.PrimaryAddress + wrt);
            }
        }
        /// <summary>
        /// Sets the output level of the source according to voltage / current selection
        /// </summary>
        /// <param name="level">The voltage or current level in absolute units (V or A)</param>
        /// <param name="type">Voltage or current selection</param>
        private void setOutputLevel(float level, VIType type)
        {
            string wrt = string.Empty;

            try {
                wrt = "*CLS";
                this.gpib.Device.Write(wrt);
                wrt = ":ABOR";
                this.gpib.Device.Write(wrt);
                wrt = string.Format(":SOUR:{0}:LEV:IMM:AMPL {1}", type.ToString( ).Substring(0, 4), level.ToString( ));
                //wrt = string.Format( ":SOUR:{0}:LEV {1}", type.ToString( ).Substring( 0, 4 ), level.ToString( ) );
                this.gpib.Device.Write(wrt);
                this.Init( );
            }
            catch (Exception ex) {
                throw new Exception(ex.Message + this.gpib.Device.PrimaryAddress.ToString( ) + wrt);
            }
        }
        /// <summary>
        /// Sets measurement function to V/I AC/DC values
        /// </summary>
        /// <param name="type">V/I</param>
        /// <param name="acdcType">AC/DC</param>
        public virtual void setMeasureFunction(VIType type, ACDCType acdcType)
        {
            string wrt = string.Empty;

            try {
                if (this.settings.SourceOrMeasurement == SourceMeasurement.Measurement || this.settings.SourceOrMeasurement == SourceMeasurement.SourceMeasurement)
                {
                    wrt = string.Format("SENS:FUNC '{0}:{1}'", type.ToString( ).ToUpper( ).Substring(0, 4), acdcType.ToString( ).ToUpper( ));
                }
                else
                {
                    wrt = string.Format("INCORRECT CONFIGURATION FOR {0}. Must be configured as measurement if inside SetMeasureFunction( ).", this.Name);
                }
                this.gpib.Write(wrt);
                this.measurementVI   = ( VIType )type;
                this.measurementACDC = ( ACDCType )acdcType;
            }
            catch (Exception ex) {
                throw new Exception(ex.Message + this.gpib.Device.PrimaryAddress.ToString());
            }
        }