Commit 4c47fc1b authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Merges modifs by Arnaud and Olivier

Showing with 9 additions and 11 deletions
+9 -11
...@@ -106,9 +106,9 @@ if within_ohmpi: ...@@ -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') # 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._hw._plot_readings()
# k.load_sequence('sequences/9991_GRAD_16_s1_a1.txt') # 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') 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) # print(d)
k._hw._plot_readings() 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') 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')
......
...@@ -26,7 +26,7 @@ SPECS = {'rx': {'model': {'default': os.path.basename(__file__).rstrip('.py')}, ...@@ -26,7 +26,7 @@ SPECS = {'rx': {'model': {'default': os.path.basename(__file__).rstrip('.py')},
'tx': {'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_min': {'default': 10.}, # Minimum voltage value used in vmin strategy
'adc_voltage_max': {'default': 4500.}, # Maximum voltage on ads1115 used to measure current '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.}, 'data_rate': {'default': 860.},
'mcp_address': {'default': 0x21}, 'mcp_address': {'default': 0x21},
'ads_address': {'default': 0x48}, 'ads_address': {'default': 0x48},
......
...@@ -404,8 +404,9 @@ class OhmPiHardware: ...@@ -404,8 +404,9 @@ class OhmPiHardware:
# polarity = 1 # polarity = 1
# return vab, polarity, rab # return vab, polarity, rab
def _compute_tx_volt(self, pulse_duration=0.1, strategy='vmax', tx_volt=5., def _compute_tx_volt(self, pulse_duration=0.1, strategy='vmax', tx_volt=5., vab_max=voltage_max,
vab_max=voltage_max, vmn_min=voltage_min, polarities=(1, -1), delay=0.050): 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. """Estimates best Tx voltage based on different strategies.
At first a half-cycle is made for a short duration with a fixed 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. known voltage. This gives us Iab and Rab. We also measure Vmn.
...@@ -446,11 +447,8 @@ class OhmPiHardware: ...@@ -446,11 +447,8 @@ class OhmPiHardware:
""" """
if self.tx.pwr.voltage_adjustable: if self.tx.pwr.voltage_adjustable:
# TODO: Get those values from components # Get those values from components
p_max = vab_max * iab_max
p_max = 2.5
vmn_max = 5.
vab_max = 50.
# define a sill # define a sill
diff_vab_lim = 2.5 diff_vab_lim = 2.5
...@@ -570,7 +568,7 @@ class OhmPiHardware: ...@@ -570,7 +568,7 @@ class OhmPiHardware:
# polarity = -1 # TODO: check if we really need to return polarity # polarity = -1 # TODO: check if we really need to return polarity
# else: # else:
# polarity = 1 # polarity = 1
return vab_opt, None, None return vab_opt
def _plot_readings(self, save_fig=False): def _plot_readings(self, save_fig=False):
# Plot graphs # Plot graphs
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment