Commit 829f8f58 authored by Arnaud WATLET's avatar Arnaud WATLET
Browse files

Adds vmax settings in default settings so that they can be passed with update_settings

Showing with 21 additions and 3 deletions
+21 -3
......@@ -407,7 +407,7 @@ class OhmPiHardware:
return new_vab
def compute_tx_volt(self, pulse_duration=0.1, strategy='vmax', tx_volt=5., vab_max=None,
iab_max=None, vmn_max=None, vmn_min=voltage_min, polarities=(1, -1), delay=0.05,
iab_max=None, vmn_max=None, vmn_min=None, polarities=(1, -1), delay=0.05,
p_max=None, diff_vab_lim=2.5, n_steps=4):
# TODO: Optimise how to pass iab_max, vab_max, vmn_min
# TODO: Update docstring
......@@ -458,6 +458,8 @@ class OhmPiHardware:
iab_max = current_max
if vab_max is None:
vab_max = voltage_max
if vmn_min is None:
vmn_min = voltage_min
# print(f'Vmn max: {vmn_max}')
if p_max is None:
p_max = vab_max * iab_max
......
......@@ -452,7 +452,7 @@ class OhmPi(object):
os.system('poweroff') # this may require admin rights
def run_measurement(self, quad=None, nb_stack=None, injection_duration=None, duty_cycle=None,
autogain=True, strategy='constant', tx_volt=5., best_tx_injtime=0.1,
autogain=True, strategy=None, tx_volt=None, best_tx_injtime=0.1,
cmd_id=None, vab_max=None, iab_max=None, vmn_max=None, vmn_min=None, **kwargs):
# TODO: add sampling_interval -> impact on _hw.rx.sampling_rate (store the current value, change the _hw.rx.sampling_rate, do the measurement, reset the sampling_rate to the previous value)
# TODO: default value of tx_volt and other parameters set to None should be given in config.py and used in function definition
......@@ -514,10 +514,22 @@ class OhmPi(object):
injection_duration = self.settings['injection_duration']
if duty_cycle is None:
duty_cycle = self.settings['duty_cycle']
if tx_volt is None:
tx_volt = self.settings['tx_volt']
if strategy is None:
strategy = self.settings['strategy']
if vab_max is None:
vab_max = self.settings['vab_max']
if iab_max is None:
iab_max = self.settings['iab_max']
if vmn_max is None:
vmn_max = self.settings['vmn_max']
if vmn_min is None:
vmn_min = self.settings['vmn_min']
bypass_check = kwargs['bypass_check'] if 'bypass_check' in kwargs.keys() else False
d = {}
if self.switch_mux_on(quad, bypass_check=bypass_check, cmd_id=cmd_id):
tx_volt = self._hw.compute_tx_volt(tx_volt=tx_volt, strategy=strategy, vmn_max=vmn_max, vab_max=vab_max, iab_max=iab_max) # TODO: use tx_volt and vmn_max instead of hardcoded values
tx_volt = self._hw.compute_tx_volt(tx_volt=tx_volt, strategy=strategy, vmn_max=vmn_max, vab_max=vab_max, iab_max=iab_max, vmn_min=vmn_min) # TODO: use tx_volt and vmn_max instead of hardcoded values
time.sleep(0.5) # to wait for pwr discharge
self._hw.vab_square_wave(tx_volt, cycle_duration=injection_duration*2/duty_cycle, cycles=nb_stack, duty_cycle=duty_cycle)
if 'delay' in kwargs.keys():
......
......@@ -7,6 +7,10 @@
"tx_volt": 5,
"duty_cycle": 0.5,
"strategy": "constant",
"iab_max": null,
"vab_max": null,
"vmn_max": null,
"vmn_min": null,
"fw_in_csv": true,
"fw_in_zip": true,
"export_path": "data/measurements.csv"
......
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