diff --git a/dev/test_mb_2024_4_mux_2024.py b/dev/test_mb_2024_4_mux_2024.py index 259ac9b7f747ce210ceae5c687d22ea5c7ed4b3e..e225cc90406e286de046e5dae48c4457effd0490 100644 --- a/dev/test_mb_2024_4_mux_2024.py +++ b/dev/test_mb_2024_4_mux_2024.py @@ -106,9 +106,9 @@ if within_ohmpi: # print(f'OhmPiHardware Resistance: {k._hw.last_rho :.2f} ohm, dev. {k._hw.last_dev:.2f} %, rx bias: {k._hw.rx._bias:.2f} mV') # k._hw._plot_readings() # k.load_sequence('sequences/9991_GRAD_16_s1_a1.txt') - # k.run_sequence(tx_volt=5., injection_duration=1., nb_stack=2, duty_cycle=0.5) + # k.run_sequence(tx_volt=5, injection_duration=1., nb_stack=2, duty_cycle=0.5) print('using OhmPi') - d = k.run_measurement([A, B, M, N], injection_duration=1., nb_stack=2, duty_cycle=0.5) + d = k.run_measurement([A, B, M, N], injection_duration=3., nb_stack=2, duty_cycle=0.5, tx_volt=5.) # print(d) k._hw._plot_readings() print(f'OhmPiHardware: Resistance: {k._hw.last_resistance() :.2f} ohm, dev. {k._hw.last_dev():.2f} %, sp: {k._hw.sp:.2f} mV, rx bias: {k._hw.rx._bias:.2f} mV') diff --git a/ohmpi/hardware_components/mb_2024_0_2.py b/ohmpi/hardware_components/mb_2024_0_2.py index 9f480990231441d37dab20c59840b60a7eb051b6..776457e4ea832e26a87566ad7d765ac8f082ea8b 100644 --- a/ohmpi/hardware_components/mb_2024_0_2.py +++ b/ohmpi/hardware_components/mb_2024_0_2.py @@ -26,7 +26,7 @@ SPECS = {'rx': {'model': {'default': os.path.basename(__file__).rstrip('.py')}, 'tx': {'model': {'default': os.path.basename(__file__).rstrip('.py')}, 'adc_voltage_min': {'default': 10.}, # Minimum voltage value used in vmin strategy 'adc_voltage_max': {'default': 4500.}, # Maximum voltage on ads1115 used to measure current - 'voltage_max': {'min': 0., 'default': 12., 'max': 12.}, # Maximum input voltage + 'voltage_max': {'min': 0., 'default': 12., 'max': 50.}, # Maximum input voltage 'data_rate': {'default': 860.}, 'mcp_address': {'default': 0x21}, 'ads_address': {'default': 0x48}, diff --git a/ohmpi/hardware_system.py b/ohmpi/hardware_system.py index c7a3b5268530558cf43a74bdb4661700579ef07e..3e8d6d3d2c5e8916ab69b9705401652a7e32319f 100644 --- a/ohmpi/hardware_system.py +++ b/ohmpi/hardware_system.py @@ -404,8 +404,9 @@ class OhmPiHardware: # polarity = 1 # return vab, polarity, rab - def _compute_tx_volt(self, pulse_duration=0.1, strategy='vmax', tx_volt=5., - vab_max=voltage_max, vmn_min=voltage_min, polarities=(1, -1), delay=0.050): + def _compute_tx_volt(self, pulse_duration=0.1, strategy='vmax', tx_volt=5., vab_max=voltage_max, + iab_max=current_max, vmn_max = 5., vmn_min=voltage_min, polarities=(1, -1), delay=0.050): + # TODO: Optimise how to pass iab_max, vab_max, vmn_min """Estimates best Tx voltage based on different strategies. At first a half-cycle is made for a short duration with a fixed known voltage. This gives us Iab and Rab. We also measure Vmn. @@ -446,11 +447,8 @@ class OhmPiHardware: """ if self.tx.pwr.voltage_adjustable: - # TODO: Get those values from components - - p_max = 2.5 - vmn_max = 5. - vab_max = 50. + # Get those values from components + p_max = vab_max * iab_max # define a sill diff_vab_lim = 2.5 @@ -570,7 +568,7 @@ class OhmPiHardware: # polarity = -1 # TODO: check if we really need to return polarity # else: # polarity = 1 - return vab_opt, None, None + return vab_opt def _plot_readings(self, save_fig=False): # Plot graphs