Commit 757cd11e authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Checks polarity of VMN

Showing with 3 additions and 3 deletions
+3 -3
......@@ -52,7 +52,7 @@ if within_ohmpi:
k._hw.switch_mux([1, 4, 2, 3], state='on')
k._hw.vab_square_wave(12,1)
k._hw.switch_mux([1, 4, 2, 3], state='off')
print(f'Resistance: {k._hw.last_rho :.2f} ohm, dev. {k._hw.last_dev:.2f} %, rx bias: {k._hw.rx._bias:.2f} ohm')
print(f'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()
plot_exec_log('ohmpi/logs/exec.log')
change_config('../configs/config_default.py', verbose=False)
\ No newline at end of file
......@@ -254,6 +254,6 @@ class Rx(RxAbstract):
""" Gets the voltage VMN in Volts
"""
self.exec_logger.event(f'{self.board_name}\trx_voltage\tbegin\t{datetime.datetime.utcnow()}')
u = AnalogIn(self._ads_voltage, ads.P0, ads.P1).voltage * self._coef_p2 * 1000. - self._bias # TODO: check if it should be negated
u = -AnalogIn(self._ads_voltage, ads.P0, ads.P1).voltage * self._coef_p2 * 1000. - self._bias # TODO: check if it should be negated
self.exec_logger.event(f'{self.board_name}\trx_voltage\tend\t{datetime.datetime.utcnow()}')
return u
......@@ -202,7 +202,7 @@ class OhmPiHardware:
@property
def last_rho(self):
if len(self.readings) > 1:
return np.mean(self.readings[:, 2] * self.readings[:, 4] / self.readings[:, 3])
return np.mean(np.abs(self.readings[:, 4]) / self.readings[:, 3])
else:
return np.nan
......
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