Пример #1
0
        private void _SetReadingFormat(SenseMode mode)
        {
            if (mode != _currentReadingFormatMode)
            {
                _currentReadingFormatMode = mode;

                switch (mode)
                {
                case SenseMode.Voltage:
                    _driver.SendCommandRequest(":FORM:ELEM VOLT");
                    break;

                case SenseMode.Current:
                    _driver.SendCommandRequest(":FORM:ELEM CURR");
                    break;

                case SenseMode.Resistance:
                    _driver.SendCommandRequest(":FORM:ELEM RES");
                    break;

                default:
                    break;
                }
            }
        }
Пример #2
0
        private void _SetSenseMode(SenseMode mode)
        {
            if (mode != _currentSenseMode)
            {
                _currentSenseMode = mode;

                switch (mode)
                {
                case SenseMode.Voltage:
                    _driver.SendCommandRequest(":SENS:FUNC \"VOLT\"");
                    break;

                case SenseMode.Current:
                    _driver.SendCommandRequest(":SENS:FUNC \"CURR\"");
                    break;

                case SenseMode.Resistance:
                    _driver.SendCommandRequest("FUNC \"RES\"");
                    break;

                default:
                    break;
                }
            }
        }
Пример #3
0
        private void _SetMeasurementRange(double val, SenseMode mode)
        {
            switch (mode)
            {
            case SenseMode.Voltage:
            {
                var query = (from range in _VoltageRanges
                             where range - Math.Abs(val) > 0.0
                             select new
                    {
                        range = range,
                        distance = range - Math.Abs(val)
                    }).OrderBy(p => p.distance).First().range;

                if (query != _currentMeasurementVoltageRange)
                {
                    _currentMeasurementVoltageRange = query;
                    _driver.SendCommandRequest(string.Format(":SENS:VOLT:RANG {0}", query.ToString(NumberFormatInfo.InvariantInfo)));
                }
            } break;

            case SenseMode.Current:
            {
                var query = (from range in _CurrentRanges
                             where range - Math.Abs(val) > 0.0
                             select new
                    {
                        range = range,
                        distance = range - Math.Abs(val)
                    }).OrderBy(p => p.distance).First().range;

                if (query != _currentMeasurementCurrentRange)
                {
                    _currentMeasurementCurrentRange = query;
                    _driver.SendCommandRequest(string.Format(":SENS:CURR:RANG {0}", query.ToString(NumberFormatInfo.InvariantInfo)));
                }
            } break;

            default:
                break;
            }
        }
Пример #4
0
        private void _SetMeasurementAutoRange(SenseMode mode, bool autorange)
        {
            if (autorange)
            {
                switch (mode)
                {
                case SenseMode.Voltage:
                {
                    if (autorange != _voltageAutorangeState)
                    {
                        _driver.SendCommandRequest(":SENS:VOLT:RANG:AUTO ON");
                    }
                    _voltageAutorangeState = true;
                } break;

                case SenseMode.Current:
                {
                    if (autorange != _currentAutorangeState)
                    {
                        _driver.SendCommandRequest(":SENS:CURR:RANG:AUTO ON");
                    }
                    _currentAutorangeState = true;
                } break;

                case SenseMode.Resistance:
                {
                    if (autorange != _resistanceAutorangeState)
                    {
                        _driver.SendCommandRequest("RES:RANG:AUTO ON");
                    }
                    _resistanceAutorangeState = true;
                } break;

                default:
                    break;
                }
            }
            else
            {
                switch (mode)
                {
                case SenseMode.Voltage:
                {
                    if (autorange != _voltageAutorangeState)
                    {
                        _driver.SendCommandRequest(":SENS:VOLT:RANG:AUTO OFF");
                    }
                    _voltageAutorangeState = false;
                } break;

                case SenseMode.Current:
                {
                    if (autorange != _currentAutorangeState)
                    {
                        _driver.SendCommandRequest(":SENS:CURR:RANG:AUTO OFF");
                    }
                    _currentAutorangeState = false;
                } break;

                case SenseMode.Resistance:
                {
                    if (autorange != _resistanceAutorangeState)
                    {
                        _driver.SendCommandRequest("RES:RANG:AUTO OFF");
                    }
                    _resistanceAutorangeState = false;
                } break;

                default:
                    break;
                }
            }
        }
        private void _SetSenseMode(SenseMode mode)
        {
            if (mode != _currentSenseMode)
            {
                _currentSenseMode = mode;

                switch (mode)
                {
                    case SenseMode.Voltage:
                        _driver.SendCommandRequest(":SENS:FUNC \"VOLT\"");
                        break;
                    case SenseMode.Current:
                        _driver.SendCommandRequest(":SENS:FUNC \"CURR\"");
                        break;
                    case SenseMode.Resistance:
                        _driver.SendCommandRequest("FUNC \"RES\"");
                        break;
                    default:
                        break;
                }
            }
        }
        private void _SetReadingFormat(SenseMode mode)
        {
            if (mode != _currentReadingFormatMode)
            {
                _currentReadingFormatMode = mode;

                switch (mode)
                {
                    case SenseMode.Voltage:
                        _driver.SendCommandRequest(":FORM:ELEM VOLT");
                        break;
                    case SenseMode.Current:
                        _driver.SendCommandRequest(":FORM:ELEM CURR");
                        break;
                    case SenseMode.Resistance:
                        _driver.SendCommandRequest(":FORM:ELEM RES");
                        break;
                    default:
                        break;
                }
            }
        }
        private void _SetMeasurementRange(double val, SenseMode mode)
        {
            switch (mode)
            {
                case SenseMode.Voltage:
                    {
                        var query = (from range in _VoltageRanges
                                     where range - Math.Abs(val) > 0.0
                                     select new
                                     {
                                         range = range,
                                         distance = range - Math.Abs(val)
                                     }).OrderBy(p => p.distance).First().range;

                        if (query != _currentMeasurementVoltageRange)
                        {
                            _currentMeasurementVoltageRange = query;
                            _driver.SendCommandRequest(string.Format(":SENS:VOLT:RANG {0}", query.ToString(NumberFormatInfo.InvariantInfo)));
                        }
                    } break;
                case SenseMode.Current:
                    {
                        var query = (from range in _CurrentRanges
                                     where range - Math.Abs(val) > 0.0
                                     select new
                                     {
                                         range = range,
                                         distance = range - Math.Abs(val)
                                     }).OrderBy(p => p.distance).First().range;

                        if (query != _currentMeasurementCurrentRange)
                        {
                            _currentMeasurementCurrentRange = query;
                            _driver.SendCommandRequest(string.Format(":SENS:CURR:RANG {0}", query.ToString(NumberFormatInfo.InvariantInfo)));
                        }
                    } break;
                default:
                    break;
            }
        }
 private void _SetMeasurementAutoRange(SenseMode mode, bool autorange)
 {
     if (autorange)
     {
         switch (mode)
         {
             case SenseMode.Voltage:
                 {
                     if (autorange != _voltageAutorangeState)
                         _driver.SendCommandRequest(":SENS:VOLT:RANG:AUTO ON");
                     _voltageAutorangeState = true;
                 } break;
             case SenseMode.Current:
                 {
                     if (autorange != _currentAutorangeState)
                         _driver.SendCommandRequest(":SENS:CURR:RANG:AUTO ON");
                     _currentAutorangeState = true;
                 } break;
             case SenseMode.Resistance:
                 {
                     if (autorange != _resistanceAutorangeState)
                         _driver.SendCommandRequest("RES:RANG:AUTO ON");
                     _resistanceAutorangeState = true;
                 } break;
             default:
                 break;
         }
     }
     else
     {
         switch (mode)
         {
             case SenseMode.Voltage:
                 {
                     if (autorange != _voltageAutorangeState)
                         _driver.SendCommandRequest(":SENS:VOLT:RANG:AUTO OFF");
                     _voltageAutorangeState = false;
                 } break;
             case SenseMode.Current:
                 {
                     if (autorange != _currentAutorangeState)
                         _driver.SendCommandRequest(":SENS:CURR:RANG:AUTO OFF");
                     _currentAutorangeState = false;
                 } break;
             case SenseMode.Resistance:
                 {
                     if (autorange != _resistanceAutorangeState)
                         _driver.SendCommandRequest("RES:RANG:AUTO OFF");
                     _resistanceAutorangeState = false;
                 } break;
             default:
                 break;
         }
     }
 }