diff --git a/README.md b/README.md index 36c2180e..90f3b37d 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ Instrument standard from the [IVI foundation](http://www.ivifoundation.org/). * DC Power Supplies (dcpwr): * Agilent E3600A series * Agilent 603xA series + * B&K Precision 9130B series * Chroma 62000P series * Rigol DP800 series * Rigol DP1000 series diff --git a/ivi/__init__.py b/ivi/__init__.py index d0b7e404..ba951c5e 100644 --- a/ivi/__init__.py +++ b/ivi/__init__.py @@ -46,6 +46,7 @@ # IVI drivers "agilent", "anritsu", + "bkprecision", "dicon", "chroma", "colby", diff --git a/ivi/agilent/__init__.py b/ivi/agilent/__init__.py index 6080b3ca..b78f2979 100644 --- a/ivi/agilent/__init__.py +++ b/ivi/agilent/__init__.py @@ -215,6 +215,7 @@ # Source measure units from .agilentU2722A import agilentU2722A from .agilentU2723A import agilentU2723A +from .agilentB2901A import agilentB2901A # RF Power Meters from .agilent436A import agilent436A diff --git a/ivi/agilent/agilentB2900A.py b/ivi/agilent/agilentB2900A.py new file mode 100644 index 00000000..42b17256 --- /dev/null +++ b/ivi/agilent/agilentB2900A.py @@ -0,0 +1,120 @@ +""" + +Python Interchangeable Virtual Instrument Library + +Copyright (c) 2012-2020 Alex Forencich + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +""" + +from .. import extra +from .. import ivi +from .. import scpi + +class agilentB2900A( + scpi.dcpwr.Base, + scpi.dcpwr.Measurement): + "Agilent/Keysight generic IVI DC power supply driver" + + def __init__(self, *args, **kwargs): + self.__dict__.setdefault('_instrument_id', '') + + super().__init__(*args, **kwargs) + + self._add_property('outputs[].mode', + self._get_output_mode, + self._set_output_mode, + None, + ivi.Doc(""" + Select source output mode. + + Values + + * 'current' - Select current source mode. + * 'voltage' - Select voltage source mode. + """)) + + self._output_count = 0 + + self._output_spec = [] + + self._identity_description = "Agilent/Keysight generic IVI DC power supply driver" + self._identity_identifier = "" + self._identity_revision = "" + self._identity_vendor = "" + self._identity_instrument_manufacturer = "Agilent" + self._identity_instrument_model = "" + self._identity_instrument_firmware_revision = "" + self._identity_specification_major_version = 1 + self._identity_specification_minor_version = 0 + self._identity_supported_instrument_models = [] + + self._init_outputs() + + def _init_outputs(self): + try: + super()._init_outputs() + except AttributeError: + pass + + self._output_mode = list() + for i in range(self._output_count): + self._output_mode.append('voltage') + + def _set_output_current_limit(self, index, value): + super()._set_output_current_limit(index, value) + if not self._driver_operation_simulate: + self._write("sense:current:protection:level %.6f" % value) + + def _set_output_voltage_level(self, index, value): + super()._set_output_voltage_level(index, value) + if not self._driver_operation_simulate: + self._write("sense:voltage:protection:level %.6f" % value) + + def _get_output_mode(self, index): + index = ivi.get_index(self._output_name, index) + if not self._driver_operation_simulate and not self._get_cache_valid(index=index): + if self._output_count > 1: + self._write("instrument:nselect %d" % (index+1)) + _value = self._ask("source:function:mode?") + if _value == 'VOLT': + self._output_mode[index] = 'voltage' + elif _value == 'CURR': + self._output_mode[index] = 'current' + else: + raise ivi.ValueNotSupportedException() + self._set_cache_valid(index=index) + return self._output_mode[index] + + def _set_output_mode(self, index, value): + index = ivi.get_index(self._output_name, index) + if value == 'voltage': + _value = 'VOLT' + elif value == 'current': + _value = 'CURR' + else: + raise ivi.ValueNotSupportedException() + if not self._driver_operation_simulate: + if self._output_count > 1: + self._write("instrument:nselect %d" % (index+1)) + self._write("source:function:mode %s" % _value) + self._output_mode[index] = value + self._set_cache_valid(index=index) + diff --git a/ivi/agilent/agilentB2901A.py b/ivi/agilent/agilentB2901A.py new file mode 100644 index 00000000..de47d553 --- /dev/null +++ b/ivi/agilent/agilentB2901A.py @@ -0,0 +1,54 @@ +""" + +Python Interchangeable Virtual Instrument Library + +Copyright (c) 2012-2020 Alex Forencich + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +""" + +from .agilentB2900A import agilentB2900A + +class agilentB2901A(agilentB2900A): + "Agilent/Keysight generic IVI DC power supply driver" + + def __init__(self, *args, **kwargs): + self.__dict__.setdefault('_instrument_id', 'B2901A') + + super().__init__(*args, **kwargs) + + self._output_count = 1 + + self._output_spec = [ + { + 'range': { + 'P': (200.0, 10.0) + }, + 'ovp_max': 210.0, + 'ocp_max': 10.0, + 'voltage_max': 200.0, + 'current_max': 10.0 + } + ] + + self._identity_description = "Keysight B2901A IVI DC power supply driver" + self._identity_supported_instrument_models = ['B2901A'] + + self._init_outputs() diff --git a/ivi/bkprecision/__init__.py b/ivi/bkprecision/__init__.py new file mode 100644 index 00000000..03d35d8a --- /dev/null +++ b/ivi/bkprecision/__init__.py @@ -0,0 +1,30 @@ +""" + +Python Interchangeable Virtual Instrument Library + +Copyright (c) 2013-2020 Alex Forencich + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +""" + +# DC Power Supplies +# 9130B series +from .bkprecision9130B import bkprecision9130B +from .bkprecision9132B import bkprecision9132B diff --git a/ivi/bkprecision/bkprecision9130B.py b/ivi/bkprecision/bkprecision9130B.py new file mode 100644 index 00000000..ec62d2e6 --- /dev/null +++ b/ivi/bkprecision/bkprecision9130B.py @@ -0,0 +1,77 @@ +""" + +Python Interchangeable Virtual Instrument Library + +Copyright (c) 2013-2020 Alex Forencich + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +""" + +from .bkprecisionBaseDCPwr import * + +class bkprecision9130B(bkprecisionBaseDCPwr): + "B&K Precision series IVI DC power supply driver" + + def __init__(self, *args, **kwargs): + self.__dict__.setdefault('_instrument_id', '') + + super(bkprecision9130B, self).__init__(*args, **kwargs) + + self._output_count = 3 + + self._output_spec = [ + { + 'range': { + 'P30V': (30.0, 3.0) + }, + 'ovp_max': 30.0, + 'ocp_max': 3.0, + 'voltage_max': 30.0, + 'current_max': 3.0 + }, + { + 'range': { + 'P30V': (30.0, 3.0) + }, + 'ovp_max': 30.0, + 'ocp_max': 3.0, + 'voltage_max': 30.0, + 'current_max': 3.0 + }, + { + 'range': { + 'P5V': (5.0, 3.0) + }, + 'ovp_max': 5.0, + 'ocp_max': 3.0, + 'voltage_max': 5.0, + 'current_max': 3.0 + } + ] + + self._identity_description = "B&K Precision 9130B series IVI DC power supply driver" + self._identity_specification_major_version = 1 + self._identity_specification_minor_version = 0 + self._identity_supported_instrument_models = ['9130B', '9131B', '9132B'] + + self._init_outputs() + + + diff --git a/ivi/bkprecision/bkprecision9132B.py b/ivi/bkprecision/bkprecision9132B.py new file mode 100644 index 00000000..c255300e --- /dev/null +++ b/ivi/bkprecision/bkprecision9132B.py @@ -0,0 +1,77 @@ +""" + +Python Interchangeable Virtual Instrument Library + +Copyright (c) 2013-2020 Alex Forencich + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +""" + +from .bkprecision9130B import * + +class bkprecision9132B(bkprecision9130B): + "B&K Precision series IVI DC power supply driver" + + def __init__(self, *args, **kwargs): + self.__dict__.setdefault('_instrument_id', '') + + super(bkprecision9132B, self).__init__(*args, **kwargs) + + self._output_count = 3 + + self._output_spec = [ + { + 'range': { + 'P30V': (60.0, 3.0) + }, + 'ovp_max': 61.0, + 'ocp_max': 3.1, + 'voltage_max': 60.0, + 'current_max': 3.0 + }, + { + 'range': { + 'P30V': (60.0, 3.0) + }, + 'ovp_max': 61.0, + 'ocp_max': 3.1, + 'voltage_max': 60.0, + 'current_max': 3.0 + }, + { + 'range': { + 'P5V': (5.0, 3.0) + }, + 'ovp_max': 5.0, + 'ocp_max': 3.0, + 'voltage_max': 5.0, + 'current_max': 3.0 + } + ] + + self._identity_description = "B&K Precision 9132B IVI DC power supply driver" + self._identity_specification_major_version = 1 + self._identity_specification_minor_version = 0 + self._identity_supported_instrument_models = ['9132B'] + + self._init_outputs() + + + diff --git a/ivi/bkprecision/bkprecisionBaseDCPwr.py b/ivi/bkprecision/bkprecisionBaseDCPwr.py new file mode 100644 index 00000000..591b1eee --- /dev/null +++ b/ivi/bkprecision/bkprecisionBaseDCPwr.py @@ -0,0 +1,71 @@ +""" + +Python Interchangeable Virtual Instrument Library + +Copyright (c) 2013-2020 Alex Forencich + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +""" + +from .. import ivi +from .. import dcpwr +from .. import scpi + +TrackingType = set(['floating']) +TriggerSourceMapping = { + 'immediate': 'imm', + 'bus': 'bus'} + +class bkprecisionBaseDCPwr(scpi.dcpwr.Base, scpi.dcpwr.Trigger, scpi.dcpwr.SoftwareTrigger, + scpi.dcpwr.Measurement): + "B&K Precision generic IVI DC power supply driver" + + def __init__(self, *args, **kwargs): + self.__dict__.setdefault('_instrument_id', '') + + super(bkprecisionBaseDCPwr, self).__init__(*args, **kwargs) + + self._output_count = 0 + + self._output_spec = [] + + self._identity_description = "B&K Precision generic IVI DC power supply driver" + self._identity_identifier = "" + self._identity_revision = "" + self._identity_vendor = "" + self._identity_instrument_manufacturer = "B&K Precision" + self._identity_instrument_model = "" + self._identity_instrument_firmware_revision = "" + self._identity_specification_major_version = 1 + self._identity_specification_minor_version = 0 + self._identity_supported_instrument_models = [] + + self._init_outputs() + + def _utility_self_test(self): + code = 0 + message = "No Response" + if not self._driver_operation_simulate: + self._write("*TST?") + # wait for test to complete + message = self._read() + if message != "0": + code = -1 + return (code, message) diff --git a/setup.py b/setup.py index 45205bbf..e4f005e4 100644 --- a/setup.py +++ b/setup.py @@ -62,6 +62,7 @@ def run_tests(self): 'ivi.scpi', 'ivi.agilent', 'ivi.anritsu', + 'ivi.bkprecision', 'ivi.chroma', 'ivi.colby', 'ivi.dicon',