From 33f2b7767fdc0ad3759cd6f3e87c40e73d9d8088 Mon Sep 17 00:00:00 2001 From: ljsplitthoff <55853994+ljsplitthoff@users.noreply.github.com> Date: Thu, 26 Mar 2020 21:10:11 +0100 Subject: [PATCH 1/3] Keysight E36313A current source --- .../drivers/Keysight/Keysight_E36313A.py | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 qcodes_contrib_drivers/drivers/Keysight/Keysight_E36313A.py diff --git a/qcodes_contrib_drivers/drivers/Keysight/Keysight_E36313A.py b/qcodes_contrib_drivers/drivers/Keysight/Keysight_E36313A.py new file mode 100644 index 000000000..6a2eb65ec --- /dev/null +++ b/qcodes_contrib_drivers/drivers/Keysight/Keysight_E36313A.py @@ -0,0 +1,111 @@ +from qcodes import VisaInstrument +from qcodes import Instrument +from qcodes.instrument.channel import InstrumentChannel + + +class E36313AChannel(InstrumentChannel): + """ + + """ + def __init__(self, parent: Instrument, name: str, chan: int) -> None: + """ + Args: + parent (Instrument): The instrument to which the channel is + attached. + name (str): The name of the channel + channum (int): The number of the channel in question (1-2) + """ + # Sanity Check inputs + if name not in ['ch1', 'ch2', 'ch3']: + raise ValueError("Invalid Channel: {}, expected 'ch1' or 'ch2' or 'ch3'" + .format(name)) + if chan not in [1, 2, 3]: + raise ValueError("Invalid Channel: {}, expected '1' or '2' or '3'" + .format(chan)) + + super().__init__(parent, name) + + self.add_parameter('source_voltage', + label="Channel {} Voltage".format(chan), + get_cmd='SOURCE{:d}:VOLT?'.format(chan), + get_parser=float, + set_cmd='SOURCE{:d}:VOLT {{:.8G}}'.format(chan), + unit='V') + + self.add_parameter('source_current', + label="Channel {} Current".format(chan), + get_cmd='SOURCE{:d}:CURR?'.format(chan), + get_parser=float, + set_cmd='SOURCE{:d}:CURR {{:.8G}}'.format(chan), + unit='A') + + self.add_parameter('voltage', + get_cmd='MEAS:VOLT? (@{:d})'.format(chan), + get_parser=float, + label='Channel {} Voltage'.format(chan), + unit='V') + + self.add_parameter('current', + get_cmd='MEAS:CURR? (@{:d})'.format(chan), + get_parser=float, + label='Channel {} Current'.format(chan), + unit='A') + + self.add_parameter('resistance', + get_cmd='MEAS:RES? (@{:d})'.format(chan), + get_parser=float, + label='Channel {} Resistance'.format(chan), + unit='ohm') + + self.add_parameter('voltage_limit', + get_cmd='SENS{:d}:VOLT:PROT?'.format(chan), + get_parser=float, + set_cmd='SENS{:d}:VOLT:PROT {{:.8G}}'.format(chan), + label='Channel {} Voltage Limit'.format(chan), + unit='V') + + self.add_parameter('current_limit', + get_cmd='SENS{:d}:CURR:PROT?'.format(chan), + get_parser=float, + set_cmd='SENS{:d}:CURR:PROT {{:.8G}}'.format(chan), + label='Channel {} Current Limit', + unit='A') + + self.add_parameter('enable', + get_cmd='OUTP{:d}?'.format(chan), + set_cmd='OUTP{:d} {{:d}}'.format(chan), + val_mapping={'on': 1, 'off': 0}) + + self.add_parameter('source_mode', + get_cmd=':SOUR{:d}:FUNC:MODE?'.format(chan), + set_cmd=':SOUR{:d}:FUNC:MODE {{:s}}'.format(chan), + val_mapping={'current': 'CURR', 'voltage': 'VOLT'}) + + self.channel = chan + + +class E36313A(VisaInstrument): + """ + This is the qcodes driver for the Keysight E36313A programmable DC power supply + + Status: + TODO: + - + """ + def __init__(self, name, address, **kwargs): + super().__init__(name, address, terminator='\n', **kwargs) + + # The E36313A supports two channels + for ch_num in [1, 2, 3]: + ch_name = "ch{:d}".format(ch_num) + channel = E36313AChannel(self, ch_name, ch_num) + self.add_submodule(ch_name, channel) + + self.connect_message() + + def get_idn(self): + IDN = self.ask_raw('*IDN?') + vendor, model, serial, firmware = map(str.strip, IDN.split(',')) + IDN = {'vendor': vendor, 'model': model, + 'serial': serial, 'firmware': firmware} + return IDN From db8b78e02a05e2061bba01b2776a0fbecdd75dbc Mon Sep 17 00:00:00 2001 From: Arno Bargerbos Date: Fri, 27 Mar 2020 15:46:40 +0100 Subject: [PATCH 2/3] fix snapshot issues --- .../drivers/Keysight/Keysight_E36313A.py | 37 +++---------------- 1 file changed, 6 insertions(+), 31 deletions(-) diff --git a/qcodes_contrib_drivers/drivers/Keysight/Keysight_E36313A.py b/qcodes_contrib_drivers/drivers/Keysight/Keysight_E36313A.py index 6a2eb65ec..f00c810e1 100644 --- a/qcodes_contrib_drivers/drivers/Keysight/Keysight_E36313A.py +++ b/qcodes_contrib_drivers/drivers/Keysight/Keysight_E36313A.py @@ -27,16 +27,16 @@ def __init__(self, parent: Instrument, name: str, chan: int) -> None: self.add_parameter('source_voltage', label="Channel {} Voltage".format(chan), - get_cmd='SOURCE{:d}:VOLT?'.format(chan), + get_cmd='VOLT? (@{:d})'.format(chan), get_parser=float, - set_cmd='SOURCE{:d}:VOLT {{:.8G}}'.format(chan), + set_cmd='VOLT {{:.8G}} (@{:d})'.format(chan), unit='V') self.add_parameter('source_current', label="Channel {} Current".format(chan), - get_cmd='SOURCE{:d}:CURR?'.format(chan), + get_cmd='CURR? (@{:d})'.format(chan), get_parser=float, - set_cmd='SOURCE{:d}:CURR {{:.8G}}'.format(chan), + set_cmd='CURR {{:.8G}} (@{:d})'.format(chan), unit='A') self.add_parameter('voltage', @@ -51,36 +51,11 @@ def __init__(self, parent: Instrument, name: str, chan: int) -> None: label='Channel {} Current'.format(chan), unit='A') - self.add_parameter('resistance', - get_cmd='MEAS:RES? (@{:d})'.format(chan), - get_parser=float, - label='Channel {} Resistance'.format(chan), - unit='ohm') - - self.add_parameter('voltage_limit', - get_cmd='SENS{:d}:VOLT:PROT?'.format(chan), - get_parser=float, - set_cmd='SENS{:d}:VOLT:PROT {{:.8G}}'.format(chan), - label='Channel {} Voltage Limit'.format(chan), - unit='V') - - self.add_parameter('current_limit', - get_cmd='SENS{:d}:CURR:PROT?'.format(chan), - get_parser=float, - set_cmd='SENS{:d}:CURR:PROT {{:.8G}}'.format(chan), - label='Channel {} Current Limit', - unit='A') - self.add_parameter('enable', - get_cmd='OUTP{:d}?'.format(chan), - set_cmd='OUTP{:d} {{:d}}'.format(chan), + get_cmd='OUTP? (@{:d})'.format(chan), + set_cmd='OUTP {{:d}} (@{:d})'.format(chan), val_mapping={'on': 1, 'off': 0}) - self.add_parameter('source_mode', - get_cmd=':SOUR{:d}:FUNC:MODE?'.format(chan), - set_cmd=':SOUR{:d}:FUNC:MODE {{:s}}'.format(chan), - val_mapping={'current': 'CURR', 'voltage': 'VOLT'}) - self.channel = chan From d0d57cb170b2cea2a90ad403e38aff242524790a Mon Sep 17 00:00:00 2001 From: lakhotiaharshit Date: Mon, 6 Apr 2020 09:26:34 +0200 Subject: [PATCH 3/3] Fix docstrings --- .../drivers/Keysight/Keysight_E36313A.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/qcodes_contrib_drivers/drivers/Keysight/Keysight_E36313A.py b/qcodes_contrib_drivers/drivers/Keysight/Keysight_E36313A.py index f00c810e1..bce22a0fd 100644 --- a/qcodes_contrib_drivers/drivers/Keysight/Keysight_E36313A.py +++ b/qcodes_contrib_drivers/drivers/Keysight/Keysight_E36313A.py @@ -10,10 +10,10 @@ class E36313AChannel(InstrumentChannel): def __init__(self, parent: Instrument, name: str, chan: int) -> None: """ Args: - parent (Instrument): The instrument to which the channel is + parent: The instrument to which the channel is attached. - name (str): The name of the channel - channum (int): The number of the channel in question (1-2) + name: The name of the channel + chan: The number of the channel in question (1-3) """ # Sanity Check inputs if name not in ['ch1', 'ch2', 'ch3']: @@ -62,10 +62,6 @@ def __init__(self, parent: Instrument, name: str, chan: int) -> None: class E36313A(VisaInstrument): """ This is the qcodes driver for the Keysight E36313A programmable DC power supply - - Status: - TODO: - - """ def __init__(self, name, address, **kwargs): super().__init__(name, address, terminator='\n', **kwargs)