Commit 25e0327a authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Fixes misinterpretation of sampling_rate as sample duration

Showing with 8 additions and 8 deletions
+8 -8
...@@ -28,7 +28,7 @@ HARDWARE_CONFIG = { ...@@ -28,7 +28,7 @@ HARDWARE_CONFIG = {
}, },
'rx': {'model': 'ohmpi_card_3_15', 'rx': {'model': 'ohmpi_card_3_15',
'coef_p2': 2.50, # slope for current conversion for ADS.P2, measurement in V/V 'coef_p2': 2.50, # slope for current conversion for ADS.P2, measurement in V/V
'sampling_rate': 40., # ms 'sampling_rate': 100., # Hz
'nb_samples': 20, # Max value 10 # was named integer before... 'nb_samples': 20, # Max value 10 # was named integer before...
}, },
'mux': # default properties are system properties that will be 'mux': # default properties are system properties that will be
......
...@@ -29,7 +29,7 @@ HARDWARE_CONFIG = { ...@@ -29,7 +29,7 @@ HARDWARE_CONFIG = {
}, },
'rx' : {'model': 'ohmpi_card_3_15', 'rx' : {'model': 'ohmpi_card_3_15',
'coef_p2': 2.50, # slope for current conversion for ADS.P2, measurement in V/V 'coef_p2': 2.50, # slope for current conversion for ADS.P2, measurement in V/V
'sampling_rate': 10., # ms 'sampling_rate': 100., # Hz
'nb_samples': 20, # Max value 10 # was named integer before... 'nb_samples': 20, # Max value 10 # was named integer before...
}, },
'mux': # default properties are system properties that will be 'mux': # default properties are system properties that will be
......
...@@ -27,7 +27,7 @@ HARDWARE_CONFIG = { ...@@ -27,7 +27,7 @@ HARDWARE_CONFIG = {
}, },
'rx' : {'model': 'ohmpi_card_3_15', 'rx' : {'model': 'ohmpi_card_3_15',
'coef_p2': 2.50, # slope for current conversion for ADS.P2, measurement in V/V 'coef_p2': 2.50, # slope for current conversion for ADS.P2, measurement in V/V
'sampling_rate': 10., # ms 'sampling_rate': 100., # Hz
'nb_samples': 20, # Max value 10 # was named integer before... 'nb_samples': 20, # Max value 10 # was named integer before...
}, },
'mux': {'model' : 'dummy_mux', # 'ohmpi_i2c_mux64_v1.01', 'mux': {'model' : 'dummy_mux', # 'ohmpi_i2c_mux64_v1.01',
......
...@@ -326,7 +326,7 @@ class RxAbstract(ABC): ...@@ -326,7 +326,7 @@ class RxAbstract(ABC):
self.soh_logger = create_stdout_logger('soh_rx') self.soh_logger = create_stdout_logger('soh_rx')
self.ctl = kwargs.pop('ctl', None) self.ctl = kwargs.pop('ctl', None)
self.board_name = kwargs.pop('board_name', 'unknown RX hardware') self.board_name = kwargs.pop('board_name', 'unknown RX hardware')
self._sampling_rate = kwargs.pop('sampling_rate', 1) self._sampling_rate = kwargs.pop('sampling_rate', 1) # ms
self.exec_logger.debug(f'{self.board_name} RX initialization') self.exec_logger.debug(f'{self.board_name} RX initialization')
self._adc_gain = 1. self._adc_gain = 1.
self._max_sampling_rate = np.inf self._max_sampling_rate = np.inf
......
...@@ -21,7 +21,7 @@ RX_CONFIG = HARDWARE_CONFIG['rx'] ...@@ -21,7 +21,7 @@ RX_CONFIG = HARDWARE_CONFIG['rx']
# ADC for voltage # ADC for voltage
voltage_adc_voltage_min = 10. # mV voltage_adc_voltage_min = 10. # mV
voltage_adc_voltage_max = 4500. # mV voltage_adc_voltage_max = 4500. # mV
sampling_rate = 10. # ms sampling_rate = 100. # Hz
data_rate = 860. # S/s? data_rate = 860. # S/s?
RX_CONFIG['voltage_min'] = np.min([voltage_adc_voltage_min, RX_CONFIG.pop('voltage_min', np.inf)]) # mV RX_CONFIG['voltage_min'] = np.min([voltage_adc_voltage_min, RX_CONFIG.pop('voltage_min', np.inf)]) # mV
RX_CONFIG['voltage_max'] = np.min([voltage_adc_voltage_max, RX_CONFIG.pop('voltage_max', np.inf)]) # mV RX_CONFIG['voltage_max'] = np.min([voltage_adc_voltage_max, RX_CONFIG.pop('voltage_max', np.inf)]) # mV
......
...@@ -172,7 +172,7 @@ class OhmPiHardware: ...@@ -172,7 +172,7 @@ class OhmPiHardware:
_readings.append([elapsed_seconds(self._start_time), self._pulse, self.tx.polarity, self.tx.current, _readings.append([elapsed_seconds(self._start_time), self._pulse, self.tx.polarity, self.tx.current,
self.rx.voltage]) self.rx.voltage])
sample += 1 sample += 1
sleep_time = self._start_time + datetime.timedelta(seconds=sample * sampling_rate / 1000) - lap sleep_time = self._start_time + datetime.timedelta(seconds=sample / sampling_rate * 1000) - lap
if sleep_time.total_seconds() < 0.: if sleep_time.total_seconds() < 0.:
_readings.append([elapsed_seconds(self._start_time), self._pulse, self.tx.polarity, np.nan, np.nan]) _readings.append([elapsed_seconds(self._start_time), self._pulse, self.tx.polarity, np.nan, np.nan])
sample += 1 sample += 1
...@@ -249,8 +249,8 @@ class OhmPiHardware: ...@@ -249,8 +249,8 @@ class OhmPiHardware:
vmn_min = np.abs(vmn_min) vmn_min = np.abs(vmn_min)
vab = np.min([np.abs(tx_volt), vab_max]) vab = np.min([np.abs(tx_volt), vab_max])
self.tx.turn_on() self.tx.turn_on()
if self.rx.sampling_rate*1000 > best_tx_injtime: if 1000 / self.rx.sampling_rate > best_tx_injtime:
sampling_rate = best_tx_injtime # TODO: check this... sampling_rate = 1000.0 / best_tx_injtime # TODO: check this...
else: else:
sampling_rate = self.tx.sampling_rate sampling_rate = self.tx.sampling_rate
self._vab_pulse(vab=vab, length=best_tx_injtime, sampling_rate=sampling_rate) # TODO: use a square wave pulse? self._vab_pulse(vab=vab, length=best_tx_injtime, sampling_rate=sampling_rate) # TODO: use a square wave pulse?
......
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