From 94764c2e35d31ca952ed2518a049a355bd2dbe45 Mon Sep 17 00:00:00 2001 From: su530201 <olivier.kaufmann@umons.ac.be> Date: Sat, 15 Apr 2023 12:01:28 +0200 Subject: [PATCH] Fixes bugs in TX_CONFIG initialization --- hardware/abstract_hardware.py | 1 - hardware/dummy_tx.py | 2 +- hardware/mb_2024_rev_0_0.py | 2 +- hardware/{ohmpi_card_3.15.py => ohmpi_card_3_15.py} | 4 +--- test_ohmpi_card_3.15.py | 13 +++++++++++++ 5 files changed, 16 insertions(+), 6 deletions(-) rename hardware/{ohmpi_card_3.15.py => ohmpi_card_3_15.py} (98%) create mode 100644 test_ohmpi_card_3.15.py diff --git a/hardware/abstract_hardware.py b/hardware/abstract_hardware.py index 7b7773f7..17f465c9 100644 --- a/hardware/abstract_hardware.py +++ b/hardware/abstract_hardware.py @@ -27,7 +27,6 @@ class TxAbstract(ABC): self._inj_time = None self._dps_state = 'off' self._adc_gain = 1. - print(f'polarity : {polarity}') self.polarity = polarity self.inj_time = inj_time self.exec_logger.debug(f'{self.board_name} TX initialization') diff --git a/hardware/dummy_tx.py b/hardware/dummy_tx.py index a3c55218..09a270a4 100644 --- a/hardware/dummy_tx.py +++ b/hardware/dummy_tx.py @@ -17,7 +17,7 @@ dps_switch_on_warmup = 4. # seconds tx_low_battery = 12. # V TX_CONFIG['current_min'] = np.min([current_adc_voltage_min / (TX_CONFIG['r_shunt'] * 50), TX_CONFIG.pop('current_min', np.inf)]) # mA -TX_CONFIG['current_max'] = np.min([current_adc_voltage_max / (TX_CONFIG['r_shunt'] * 50), TX_CONFIG.pop(['current_max'], np.inf)]) # mA +TX_CONFIG['current_max'] = np.min([current_adc_voltage_max / (TX_CONFIG['r_shunt'] * 50), TX_CONFIG.pop('current_max', np.inf)]) # mA TX_CONFIG['voltage_max'] = np.min([dps_voltage_max, TX_CONFIG.pop('voltage_max', np.inf)]) # V TX_CONFIG['default_voltage'] = np.min([TX_CONFIG.pop('default_voltage', dps_default_voltage), TX_CONFIG['voltage_max']]) # V TX_CONFIG['dps_switch_on_warm_up'] = TX_CONFIG.pop('dps_switch_on_warmup', dps_switch_on_warmup) diff --git a/hardware/mb_2024_rev_0_0.py b/hardware/mb_2024_rev_0_0.py index 37e86d4d..9eff9597 100644 --- a/hardware/mb_2024_rev_0_0.py +++ b/hardware/mb_2024_rev_0_0.py @@ -35,7 +35,7 @@ dps_switch_on_warmup = 4. # seconds tx_low_battery = 12. # V TX_CONFIG['current_min'] = np.min([current_adc_voltage_min / (TX_CONFIG['r_shunt'] * 50), TX_CONFIG.pop('current_min', np.inf)]) # mA -TX_CONFIG['current_max'] = np.min([current_adc_voltage_max / (TX_CONFIG['r_shunt'] * 50), TX_CONFIG.pop(['current_max'], np.inf)]) # mA +TX_CONFIG['current_max'] = np.min([current_adc_voltage_max / (TX_CONFIG['r_shunt'] * 50), TX_CONFIG.pop('current_max', np.inf)]) # mA TX_CONFIG['voltage_max'] = np.min([dps_voltage_max, TX_CONFIG.pop('voltage_max', np.inf)]) # V TX_CONFIG['default_voltage'] = np.min([TX_CONFIG.pop('default_voltage', dps_default_voltage), TX_CONFIG['voltage_max']]) # V TX_CONFIG['dps_switch_on_warm_up'] = TX_CONFIG.pop('dps_switch_on_warmup', dps_switch_on_warmup) diff --git a/hardware/ohmpi_card_3.15.py b/hardware/ohmpi_card_3_15.py similarity index 98% rename from hardware/ohmpi_card_3.15.py rename to hardware/ohmpi_card_3_15.py index 2a89a12d..01670154 100644 --- a/hardware/ohmpi_card_3.15.py +++ b/hardware/ohmpi_card_3_15.py @@ -27,14 +27,12 @@ RX_CONFIG['voltage_max'] = np.min([voltage_adc_voltage_max, RX_CONFIG.pop('volta # ADC for current current_adc_voltage_min = 10. # mV current_adc_voltage_max = 4500. # mV - -# DPS dps_voltage_max = 12. # V dps_default_voltage = 12. # V dps_switch_on_warmup = 0. # seconds TX_CONFIG['current_min'] = np.min([current_adc_voltage_min / (TX_CONFIG['r_shunt'] * 50), TX_CONFIG.pop('current_min', np.inf)]) # mA -TX_CONFIG['current_max'] = np.min([current_adc_voltage_max / (TX_CONFIG['r_shunt'] * 50), TX_CONFIG.pop(['current_max'], np.inf)]) # mA +TX_CONFIG['current_max'] = np.min([current_adc_voltage_max / (TX_CONFIG['r_shunt'] * 50), TX_CONFIG.pop('current_max', np.inf)]) # mA TX_CONFIG['voltage_max'] = np.min([dps_voltage_max, TX_CONFIG.pop('voltage_max', np.inf)]) # V TX_CONFIG['default_voltage'] = np.min([TX_CONFIG.pop('default_voltage', dps_default_voltage), TX_CONFIG['voltage_max']]) # V TX_CONFIG['dps_switch_on_warm_up'] = TX_CONFIG.pop('dps_switch_on_warmup', dps_switch_on_warmup) diff --git a/test_ohmpi_card_3.15.py b/test_ohmpi_card_3.15.py new file mode 100644 index 00000000..7dfcf9df --- /dev/null +++ b/test_ohmpi_card_3.15.py @@ -0,0 +1,13 @@ +import sys +sys.path.extend(['/home/su530201/PycharmProjects/ohmpi_reversaal/OhmPi']) +from OhmPi.hardware.ohmpi_card_3_15 import Tx +from OhmPi.hardware.ohmpi_card_3_15 import Rx +from OhmPi.logging_setup import create_stdout_logger + +exec_logger = create_stdout_logger(name='exec') +soh_logger = create_stdout_logger(name='soh') + +print('\nCreating TX...') +tx = Tx(exec_logger= exec_logger, soh_logger= soh_logger) +print('\nCreating RX...') +rx = Rx(exec_logger= exec_logger, soh_logger= soh_logger) -- GitLab