Commit 11147ec0 authored by mikolajr's avatar mikolajr
Browse files

In PSI9000 device: wait time config opts, refactor config errors tests, fixed...

In PSI9000 device: wait time config opts, refactor config errors tests, fixed type check errors, format (black), and copyright notice
parent 76d21c07
Pipeline #53089 passed with stages
in 3 minutes and 26 seconds
...@@ -39,7 +39,7 @@ class PSI9000VisaCommunicationConfig(VisaCommunicationConfig): ...@@ -39,7 +39,7 @@ class PSI9000VisaCommunicationConfig(VisaCommunicationConfig):
interface_type: Union[ interface_type: Union[
str, VisaCommunicationConfig.InterfaceType str, VisaCommunicationConfig.InterfaceType
] = VisaCommunicationConfig.InterfaceType.TCPIP_SOCKET ] = VisaCommunicationConfig.InterfaceType.TCPIP_SOCKET # type: ignore
class PSI9000VisaCommunication(VisaCommunication): class PSI9000VisaCommunication(VisaCommunication):
...@@ -80,6 +80,10 @@ class PSI9000Config(VisaDeviceConfig): ...@@ -80,6 +80,10 @@ class PSI9000Config(VisaDeviceConfig):
#: Upper current limit in A, depending on the experimental setup. #: Upper current limit in A, depending on the experimental setup.
current_upper_limit: Number = 2040.0 current_upper_limit: Number = 2040.0
wait_sec_system_lock: Number = 0.5
wait_sec_settings_effect: Number = 1
wait_sec_initialisation: Number = 2
# limit with 63 A grid connection, absolute limit, never ever change this value # limit with 63 A grid connection, absolute limit, never ever change this value
_POWER_GRID_LIMIT: ClassVar = 43500 _POWER_GRID_LIMIT: ClassVar = 43500
...@@ -126,6 +130,18 @@ class PSI9000Config(VisaDeviceConfig): ...@@ -126,6 +130,18 @@ class PSI9000Config(VisaDeviceConfig):
or self.current_upper_limit > self._CURRENT_UPPER_LIMIT or self.current_upper_limit > self._CURRENT_UPPER_LIMIT
): ):
raise ValueError("Upper current limit out of range.") raise ValueError("Upper current limit out of range.")
if self.wait_sec_system_lock <= 0:
raise ValueError(
"Wait time for system lock must be a positive value (in seconds)."
)
if self.wait_sec_settings_effect <= 0:
raise ValueError(
"Wait time for settings effect must be a positive value (in seconds)."
)
if self.wait_sec_initialisation <= 0:
raise ValueError(
"Wait time after initialisation must be a positive value (in seconds)."
)
class PSI9000(VisaDevice): class PSI9000(VisaDevice):
...@@ -173,9 +189,9 @@ class PSI9000(VisaDevice): ...@@ -173,9 +189,9 @@ class PSI9000(VisaDevice):
if current_lock and self.get_output(): if current_lock and self.get_output():
# locked and output on # locked and output on
self.set_voltage_current(0, 0) self.set_voltage_current(0, 0)
time.sleep(1) time.sleep(self.config.wait_sec_settings_effect)
self.set_output(False) self.set_output(False)
time.sleep(1) time.sleep(self.config.wait_sec_settings_effect)
if current_lock: if current_lock:
# locked # locked
...@@ -204,7 +220,7 @@ class PSI9000(VisaDevice): ...@@ -204,7 +220,7 @@ class PSI9000(VisaDevice):
if lock: if lock:
# we want to lock the system # we want to lock the system
self.com.write("SYSTem:LOCK ON") self.com.write("SYSTem:LOCK ON")
time.sleep(0.5) time.sleep(self.config.wait_sec_system_lock)
new_system_lock = self.get_system_lock() new_system_lock = self.get_system_lock()
if not new_system_lock: if not new_system_lock:
...@@ -230,7 +246,7 @@ class PSI9000(VisaDevice): ...@@ -230,7 +246,7 @@ class PSI9000(VisaDevice):
raise PSI9000Error(err_msg) raise PSI9000Error(err_msg)
self.com.write("SYSTem:LOCK OFF") self.com.write("SYSTem:LOCK OFF")
time.sleep(0.5) time.sleep(self.config.wait_sec_system_lock)
new_system_lock = self.get_system_lock() new_system_lock = self.get_system_lock()
if new_system_lock: if new_system_lock:
...@@ -308,8 +324,9 @@ class PSI9000(VisaDevice): ...@@ -308,8 +324,9 @@ class PSI9000(VisaDevice):
""" """
list_ret = self.com.query("MEASure:VOLTage?", "MEASure:CURRent?") list_ret = self.com.query("MEASure:VOLTage?", "MEASure:CURRent?")
assert len(list_ret) == 2
return self._remove_units(list_ret) ret = self._remove_units(list_ret)
return ret[0], ret[1]
def set_voltage_current(self, volt: float, current: float) -> None: def set_voltage_current(self, volt: float, current: float) -> None:
""" """
...@@ -356,8 +373,9 @@ class PSI9000(VisaDevice): ...@@ -356,8 +373,9 @@ class PSI9000(VisaDevice):
""" """
list_ret = self.com.query("SOURce:VOLTage?", "SOURce:CURRent?") list_ret = self.com.query("SOURce:VOLTage?", "SOURce:CURRent?")
assert len(list_ret) == 2
return self._remove_units(list_ret) ret = self._remove_units(list_ret)
return ret[0], ret[1]
def set_upper_limits( def set_upper_limits(
self, self,
...@@ -410,7 +428,7 @@ class PSI9000(VisaDevice): ...@@ -410,7 +428,7 @@ class PSI9000(VisaDevice):
) )
# wait until settings are made # wait until settings are made
time.sleep(0.5) time.sleep(self.config.wait_sec_settings_effect)
v_higher, i_higher, p_higher = self.get_uip_upper_limits() v_higher, i_higher, p_higher = self.get_uip_upper_limits()
...@@ -489,8 +507,9 @@ class PSI9000(VisaDevice): ...@@ -489,8 +507,9 @@ class PSI9000(VisaDevice):
list_ret = self.com.query( list_ret = self.com.query(
"SOURce:VOLTage:LIMit:LOW?", "SOURce:CURRent:LIMit:LOW?" "SOURce:VOLTage:LIMit:LOW?", "SOURce:CURRent:LIMit:LOW?"
) )
assert len(list_ret) == 2
return self._remove_units(list_ret) ret = self._remove_units(list_ret)
return ret[0], ret[1]
def get_uip_upper_limits(self) -> Tuple[float, float, float]: def get_uip_upper_limits(self) -> Tuple[float, float, float]:
""" """
...@@ -504,8 +523,9 @@ class PSI9000(VisaDevice): ...@@ -504,8 +523,9 @@ class PSI9000(VisaDevice):
"SOURce:CURRent:LIMit:HIGH?", "SOURce:CURRent:LIMit:HIGH?",
"SOURce:POWer:LIMit:HIGH?", "SOURce:POWer:LIMit:HIGH?",
) )
assert len(list_ret) == 3
return self._remove_units(list_ret) ret = self._remove_units(list_ret)
return ret[0], ret[1], ret[2]
def check_master_slave_config(self) -> None: def check_master_slave_config(self) -> None:
""" """
...@@ -526,7 +546,7 @@ class PSI9000(VisaDevice): ...@@ -526,7 +546,7 @@ class PSI9000(VisaDevice):
# begin initialization # begin initialization
self.com.write("SYSTem:MS:INITialisation") self.com.write("SYSTem:MS:INITialisation")
time.sleep(2) time.sleep(self.config.wait_sec_initialisation)
# check for correct init # check for correct init
if self.com.query("SYSTem:MS:CONDition?") != "INIT": if self.com.query("SYSTem:MS:CONDition?") != "INIT":
...@@ -554,7 +574,7 @@ class PSI9000(VisaDevice): ...@@ -554,7 +574,7 @@ class PSI9000(VisaDevice):
logging.info("Initialization of Master/Slave successful") logging.info("Initialization of Master/Slave successful")
@staticmethod @staticmethod
def _remove_units(list_with_strings: Iterable[str]) -> Tuple: def _remove_units(list_with_strings: Iterable[str]) -> Tuple[float, ...]:
""" """
Removes the last two characters of each string in the list and Removes the last two characters of each string in the list and
convert it to float (is only working for units with one character e.g. V, A, W) convert it to float (is only working for units with one character e.g. V, A, W)
......
# Copyright (c) 2019 ETH Zurich, SIS ID and HVL D-ITET
#
""" """
Tests for the Elektro Automatik PSI 9000 power supply device classes. Tests for the Elektro Automatik PSI 9000 power supply device classes.
""" """
...@@ -8,26 +10,29 @@ from hvl_ccb.dev import ( ...@@ -8,26 +10,29 @@ from hvl_ccb.dev import (
PSI9000, PSI9000,
PSI9000Error, PSI9000Error,
PSI9000VisaCommunicationConfig, PSI9000VisaCommunicationConfig,
PSI9000Config PSI9000Config,
) )
from tests.masked_comm import MaskedVisaCommunication from tests.masked_comm import MaskedVisaCommunication
@pytest.fixture(scope='module') @pytest.fixture(scope="module")
def com_config(): def com_config():
return { return {
'interface_type': PSI9000VisaCommunicationConfig.InterfaceType.TCPIP_SOCKET, "interface_type": PSI9000VisaCommunicationConfig.InterfaceType.TCPIP_SOCKET,
'host': '127.0.0.1', "host": "127.0.0.1",
'open_timeout': 10, "open_timeout": 10,
'timeout': 50, "timeout": 50,
} }
@pytest.fixture(scope='module') @pytest.fixture(scope="module")
def dev_config(): def dev_config():
return { return {
'spoll_interval': 0.01, "spoll_interval": 0.01,
'spoll_start_delay': 0, "spoll_start_delay": 0,
"wait_sec_system_lock": 0.01,
"wait_sec_settings_effect": 0.01,
"wait_sec_initialisation": 0.01,
} }
...@@ -38,26 +43,36 @@ def testdev(com_config, dev_config): ...@@ -38,26 +43,36 @@ def testdev(com_config, dev_config):
return dev return dev
def test_psi9000_config(): def test_psi9000_config(dev_config):
# currently there are no non-default config values # currently there are no non-default config values
PSI9000Config() PSI9000Config()
PSI9000Config(**dev_config)
@pytest.mark.parametrize(
"wrong_config_dict",
[
{"power_limit": -1.0},
{"voltage_lower_limit": 20, "voltage_upper_limit": 19.0},
{
"voltage_lower_limit": 4,
"voltage_upper_limit": PSI9000Config._VOLTAGE_UPPER_LIMIT + 1,
},
{"current_lower_limit": -1.0},
{
"current_lower_limit": 4,
"current_upper_limit": PSI9000Config._CURRENT_UPPER_LIMIT + 1,
},
{"wait_sec_system_lock": 0},
{"wait_sec_system_lock": -1},
{"wait_sec_settings_effect": 0},
{"wait_sec_initialisation": 0},
],
)
def test_psi9000_config_wrong_value(wrong_config_dict):
with pytest.raises(ValueError): with pytest.raises(ValueError):
PSI9000Config(power_limit=-1.0) PSI9000Config(**wrong_config_dict)
with pytest.raises(ValueError):
PSI9000Config(voltage_lower_limit=20, voltage_upper_limit=19.0)
with pytest.raises(ValueError):
PSI9000Config(voltage_lower_limit=4,
voltage_upper_limit=PSI9000Config._VOLTAGE_UPPER_LIMIT + 1)
with pytest.raises(ValueError):
PSI9000Config(current_lower_limit=-1.0)
with pytest.raises(ValueError):
PSI9000Config(current_lower_limit=4,
current_upper_limit=PSI9000Config._CURRENT_UPPER_LIMIT + 1)
def test_instantiation(com_config): def test_instantiation(com_config):
...@@ -72,17 +87,17 @@ def test_start_stop(testdev: PSI9000): ...@@ -72,17 +87,17 @@ def test_start_stop(testdev: PSI9000):
power_supply.start() power_supply.start()
# stop successful # stop successful
test_com.put_name('SYSTem:LOCK:OWNer?', 'NONE') test_com.put_name("SYSTem:LOCK:OWNer?", "NONE")
test_com.put_name('OUTput?', 'OFF') test_com.put_name("OUTput?", "OFF")
power_supply.stop() power_supply.stop()
# stop successful: output and lock on # stop successful: output and lock on
test_com.put_name('SYSTem:LOCK:OWNer?', 'REMOTE') test_com.put_name("SYSTem:LOCK:OWNer?", "REMOTE")
test_com.put_name('OUTPut?', 'ON') test_com.put_name("OUTPut?", "ON")
test_com.put_name('SOURce:VOLTage?', '0 V') test_com.put_name("SOURce:VOLTage?", "0 V")
test_com.put_name('SOURce:CURRent?', '0 A') test_com.put_name("SOURce:CURRent?", "0 A")
test_com.put_name('OUTPut?', 'OFF') test_com.put_name("OUTPut?", "OFF")
test_com.put_name('SYSTem:LOCK:OWNer?', 'NONE') test_com.put_name("SYSTem:LOCK:OWNer?", "NONE")
power_supply.stop() power_supply.stop()
...@@ -91,45 +106,45 @@ def test_locking(testdev: PSI9000): ...@@ -91,45 +106,45 @@ def test_locking(testdev: PSI9000):
test_com = power_supply.com test_com = power_supply.com
# lock failed # lock failed
test_com.put_name('SYSTem:LOCK:OWNer?', 'NONE') test_com.put_name("SYSTem:LOCK:OWNer?", "NONE")
test_com.put_name('SYSTem:LOCK:OWNer?', 'NONE') test_com.put_name("SYSTem:LOCK:OWNer?", "NONE")
with pytest.raises(PSI9000Error): with pytest.raises(PSI9000Error):
power_supply.set_system_lock(True) power_supply.set_system_lock(True)
assert test_com.get_written() == 'SYSTem:LOCK ON' assert test_com.get_written() == "SYSTem:LOCK ON"
# lock successful # lock successful
test_com.put_name('SYSTem:LOCK:OWNer?', 'NONE') test_com.put_name("SYSTem:LOCK:OWNer?", "NONE")
test_com.put_name('SYSTem:LOCK:OWNer?', 'REMOTE') test_com.put_name("SYSTem:LOCK:OWNer?", "REMOTE")
power_supply.set_system_lock(True) power_supply.set_system_lock(True)
assert test_com.get_written() == 'SYSTem:LOCK ON' assert test_com.get_written() == "SYSTem:LOCK ON"
# unlock failed due to still on current # unlock failed due to still on current
test_com.put_name('SYSTem:LOCK:OWNer?', 'REMOTE') test_com.put_name("SYSTem:LOCK:OWNer?", "REMOTE")
test_com.put_name('MEASure:VOLTage?', '20 V') test_com.put_name("MEASure:VOLTage?", "20 V")
test_com.put_name('MEASure:CURRent?', '100 A') test_com.put_name("MEASure:CURRent?", "100 A")
with pytest.raises(PSI9000Error): with pytest.raises(PSI9000Error):
power_supply.set_system_lock(False) power_supply.set_system_lock(False)
assert test_com.get_written() is None assert test_com.get_written() is None
# unlock failed # unlock failed
test_com.put_name('SYSTem:LOCK:OWNer?', 'REMOTE') test_com.put_name("SYSTem:LOCK:OWNer?", "REMOTE")
test_com.put_name('MEASure:VOLTage?', '0 V') test_com.put_name("MEASure:VOLTage?", "0 V")
test_com.put_name('MEASure:CURRent?', '0 A') test_com.put_name("MEASure:CURRent?", "0 A")
test_com.put_name('SYSTem:LOCK:OWNer?', 'REMOTE') test_com.put_name("SYSTem:LOCK:OWNer?", "REMOTE")
with pytest.raises(PSI9000Error): with pytest.raises(PSI9000Error):
power_supply.set_system_lock(False) power_supply.set_system_lock(False)
assert test_com.get_written() == 'SYSTem:LOCK OFF' assert test_com.get_written() == "SYSTem:LOCK OFF"
# unlock successful # unlock successful
test_com.put_name('SYSTem:LOCK:OWNer?', 'REMOTE') test_com.put_name("SYSTem:LOCK:OWNer?", "REMOTE")
test_com.put_name('MEASure:VOLTage?', '0 V') test_com.put_name("MEASure:VOLTage?", "0 V")
test_com.put_name('MEASure:CURRent?', '0 A') test_com.put_name("MEASure:CURRent?", "0 A")
test_com.put_name('SYSTem:LOCK:OWNer?', 'NONE') test_com.put_name("SYSTem:LOCK:OWNer?", "NONE")
power_supply.set_system_lock(False) power_supply.set_system_lock(False)
assert test_com.get_written() == 'SYSTem:LOCK OFF' assert test_com.get_written() == "SYSTem:LOCK OFF"
# illegal answer # illegal answer
test_com.put_name('SYSTem:LOCK:OWNer?', 'bla') test_com.put_name("SYSTem:LOCK:OWNer?", "bla")
with pytest.raises(PSI9000Error): with pytest.raises(PSI9000Error):
power_supply.get_system_lock() power_supply.get_system_lock()
...@@ -138,43 +153,43 @@ def test_output(testdev: PSI9000): ...@@ -138,43 +153,43 @@ def test_output(testdev: PSI9000):
power_supply = testdev power_supply = testdev
test_com = power_supply.com test_com = power_supply.com
test_com.put_name('OUTPut?', 'ON') test_com.put_name("OUTPut?", "ON")
assert power_supply.get_output() assert power_supply.get_output()
test_com.put_name('OUTPut?', 'OFF') test_com.put_name("OUTPut?", "OFF")
assert not power_supply.get_output() assert not power_supply.get_output()
test_com.put_name('OUTPut?', 'bla') test_com.put_name("OUTPut?", "bla")
with pytest.raises(PSI9000Error): with pytest.raises(PSI9000Error):
power_supply.get_output() power_supply.get_output()
# setting output # setting output
test_com.put_name('OUTPut?', 'ON') test_com.put_name("OUTPut?", "ON")
power_supply.set_output(True) power_supply.set_output(True)
assert test_com.get_written() == 'OUTPut ON' assert test_com.get_written() == "OUTPut ON"
test_com.put_name('OUTPut?', 'OFF') test_com.put_name("OUTPut?", "OFF")
power_supply.set_output(False) power_supply.set_output(False)
assert test_com.get_written() == 'OUTPut OFF' assert test_com.get_written() == "OUTPut OFF"
test_com.put_name('OUTPut?', 'ON') test_com.put_name("OUTPut?", "ON")
with pytest.raises(PSI9000Error): with pytest.raises(PSI9000Error):
power_supply.set_output(False) power_supply.set_output(False)
assert test_com.get_written() == 'OUTPut OFF' assert test_com.get_written() == "OUTPut OFF"
test_com.put_name('OUTPut?', 'OFF') test_com.put_name("OUTPut?", "OFF")
with pytest.raises(PSI9000Error): with pytest.raises(PSI9000Error):
power_supply.set_output(True) power_supply.set_output(True)
assert test_com.get_written() == 'OUTPut ON' assert test_com.get_written() == "OUTPut ON"
def test_get_uip_upper_limits(testdev: PSI9000): def test_get_uip_upper_limits(testdev: PSI9000):
test_com = testdev.com test_com = testdev.com
# get upper limits # get upper limits
test_com.put_name('SOURce:VOLTage:LIMit:HIGH?', '80 V') test_com.put_name("SOURce:VOLTage:LIMit:HIGH?", "80 V")
test_com.put_name('SOURce:CURRent:LIMit:HIGH?', '1000 A') test_com.put_name("SOURce:CURRent:LIMit:HIGH?", "1000 A")
test_com.put_name('SOURce:POWer:LIMit:HIGH?', '10000 W') test_com.put_name("SOURce:POWer:LIMit:HIGH?", "10000 W")
assert testdev.get_uip_upper_limits() == (80, 1000, 10000) assert testdev.get_uip_upper_limits() == (80, 1000, 10000)
...@@ -182,8 +197,8 @@ def test_get_ui_lower_limits(testdev: PSI9000): ...@@ -182,8 +197,8 @@ def test_get_ui_lower_limits(testdev: PSI9000):
test_com = testdev.com test_com = testdev.com
# get lower limits # get lower limits
test_com.put_name('SOURce:VOLTage:LIMit:LOW?', '2 V') test_com.put_name("SOURce:VOLTage:LIMit:LOW?", "2 V")
test_com.put_name('SOURce:CURRent:LIMit:LOW?', '5 A') test_com.put_name("SOURce:CURRent:LIMit:LOW?", "5 A")
assert testdev.get_ui_lower_limits() == (2, 5) assert testdev.get_ui_lower_limits() == (2, 5)
...@@ -191,31 +206,31 @@ def test_set_upper_limits(testdev: PSI9000): ...@@ -191,31 +206,31 @@ def test_set_upper_limits(testdev: PSI9000):
test_com = testdev.com test_com = testdev.com
# set upper limits, success # set upper limits, success
test_com.put_name('SOURce:VOLTage:LIMit:LOW?', '2 V') test_com.put_name("SOURce:VOLTage:LIMit:LOW?", "2 V")
test_com.put_name('SOURce:CURRent:LIMit:LOW?', '5 A') test_com.put_name("SOURce:CURRent:LIMit:LOW?", "5 A")
test_com.put_name('SOURce:VOLTage:LIMit:HIGH?', '10 V') test_com.put_name("SOURce:VOLTage:LIMit:HIGH?", "10 V")
test_com.put_name('SOURce:CURRent:LIMit:HIGH?', '20 A') test_com.put_name("SOURce:CURRent:LIMit:HIGH?", "20 A")
test_com.put_name('SOURce:POWer:LIMit:HIGH?', '10000 W') test_com.put_name("SOURce:POWer:LIMit:HIGH?", "10000 W")
testdev.set_upper_limits(10, 20, 10000) testdev.set_upper_limits(10, 20, 10000)
assert test_com.get_written() == 'SOURce:VOLTage:LIMit:HIGH 10' assert test_com.get_written() == "SOURce:VOLTage:LIMit:HIGH 10"
assert test_com.get_written() == 'SOURce:CURRent:LIMit:HIGH 20' assert test_com.get_written() == "SOURce:CURRent:LIMit:HIGH 20"
assert test_com.get_written() == 'SOURce:POWer:LIMit:HIGH 10000' assert test_com.get_written() == "SOURce:POWer:LIMit:HIGH 10000"
# set upper limits, set fail # set upper limits, set fail
test_com.put_name('SOURce:VOLTage:LIMit:LOW?', '2 V') test_com.put_name("SOURce:VOLTage:LIMit:LOW?", "2 V")
test_com.put_name('SOURce:CURRent:LIMit:LOW?', '5 A') test_com.put_name("SOURce:CURRent:LIMit:LOW?", "5 A")
test_com.put_name('SOURce:VOLTage:LIMit:HIGH?', '10 V') test_com.put_name("SOURce:VOLTage:LIMit:HIGH?", "10 V")
test_com.put_name('SOURce:CURRent:LIMit:HIGH?', '200 A') test_com.put_name("SOURce:CURRent:LIMit:HIGH?", "200 A")
test_com.put_name('SOURce:POWer:LIMit:HIGH?', '10000 W') test_com.put_name("SOURce:POWer:LIMit:HIGH?", "10000 W")
with pytest.raises(PSI9000Error): with pytest.raises(PSI9000Error):
testdev.set_upper_limits(10, 20, 10000) testdev.set_upper_limits(10, 20, 10000)
assert test_com.get_written() == 'SOURce:VOLTage:LIMit:HIGH 10' assert test_com.get_written() == "SOURce:VOLTage:LIMit:HIGH 10"
assert test_com.get_written() == 'SOURce:CURRent:LIMit:HIGH 20' assert test_com.get_written() == "SOURce:CURRent:LIMit:HIGH 20"
assert test_com.get_written() == 'SOURce:POWer:LIMit:HIGH 10000' assert test_com.get_written() == "SOURce:POWer:LIMit:HIGH 10000"
# set upper limits, limit fail # set upper limits, limit fail
test_com.put_name('SOURce:VOLTage:LIMit:LOW?', '20 V') test_com.put_name("SOURce:VOLTage:LIMit:LOW?", "20 V")
test_com.put_name('SOURce:CURRent:LIMit:LOW?', '5 A') test_com.put_name("SOURce:CURRent:LIMit:LOW?", "5 A")
with pytest.raises(ValueError): with pytest.raises(ValueError):
testdev.set_upper_limits(10, 20, 10000) testdev.set_upper_limits(10, 20, 10000)
assert test_com.get_written() is None assert test_com.get_written() is None
...@@ -225,30 +240,30 @@ def test_set_lower_limits(testdev: PSI9000): ...@@ -225,30 +240,30 @@ def test_set_lower_limits(testdev: PSI9000):
test_com = testdev.com test_com = testdev.com
# set lower limits, success # set lower limits, success
test_com.put_name('SOURce:VOLTage:LIMit:HIGH?', '80 V') test_com.put_name("SOURce:VOLTage:LIMit:HIGH?", "80 V")
test_com.put_name('SOURce:CURRent:LIMit:HIGH?', '2000 A') test_com.put_name("SOURce:CURRent:LIMit:HIGH?", "2000 A")
test_com.put_name('SOURce:POWer:LIMit:HIGH?', '10000 W') test_com.put_name("SOURce:POWer:LIMit:HIGH?", "10000 W")
test_com.put_name('SOURce:VOLTage:LIMit:LOW?', '2 V') test_com.put_name("SOURce:VOLTage:LIMit:LOW?", "2 V")
test_com.put_name('SOURce:CURRent:LIMit:LOW?', '5.2 A') test_com.put_name("SOURce:CURRent:LIMit:LOW?", "5.2 A")
testdev.set_lower_limits(2, 5.2) testdev.set_lower_limits(2, 5.2)
assert test_com.get_written() == 'SOURce:VOLTage:LIMit:LOW 2' assert test_com.get_written() == "SOURce:VOLTage:LIMit:LOW 2"
assert test_com.get_written() == 'SOURce:CURRent:LIMit:LOW 5.2'