Commit 92d73cea authored by Arnaud WATLET's avatar Arnaud WATLET
Browse files

Fix sign issue with mux2023 and mb2023

Showing with 31 additions and 264 deletions
+31 -264
...@@ -70,7 +70,7 @@ HARDWARE_CONFIG = { ...@@ -70,7 +70,7 @@ HARDWARE_CONFIG = {
# SET THE LOGGING LEVELS, MQTT BROKERS AND MQTT OPTIONS ACCORDING TO YOUR NEEDS # SET THE LOGGING LEVELS, MQTT BROKERS AND MQTT OPTIONS ACCORDING TO YOUR NEEDS
# Execution logging configuration # Execution logging configuration
EXEC_LOGGING_CONFIG = { EXEC_LOGGING_CONFIG = {
'logging_level': logging.DEBUG, # TODO: set logging level back to INFO 'logging_level': logging.INFO, # TODO: set logging level back to INFO
'log_file_logging_level': logging.DEBUG, 'log_file_logging_level': logging.DEBUG,
'logging_to_console': True, 'logging_to_console': True,
'file_name': f'exec{logging_suffix}.log', 'file_name': f'exec{logging_suffix}.log',
......
...@@ -68,7 +68,7 @@ if within_ohmpi: ...@@ -68,7 +68,7 @@ if within_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=1., nb_stack=2, duty_cycle=0.5)
print(d) print(d)
#k._hw._plot_readings() #k._hw._plot_readings()
print(f'OhmPiHardware: Resistance: {k._hw.last_rho :.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_rho :.2f} ohm, dev. {k._hw.last_dev:.2f} %, sp: {k._hw.sp:.2f} mV, rx bias: {k._hw.rx._bias:.2f} mV')
print(f'OhmPi: Resistance: {d["R [ohm]"] :.2f} ohm, dev. {d["R_std [%]"]:.2f} %, rx bias: {k._hw.rx._bias:.2f} mV') print(f'OhmPi: Resistance: {d["R [ohm]"] :.2f} ohm, dev. {d["R_std [%]"]:.2f} %, rx bias: {k._hw.rx._bias:.2f} mV')
k._hw._plot_readings(save_fig=False) k._hw._plot_readings(save_fig=False)
# plot_exec_log('ohmpi/logs/exec.log') # plot_exec_log('ohmpi/logs/exec.log')
......
import matplotlib import matplotlib
matplotlib.use('TkAgg') matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
from ohmpi.utils import change_config from ohmpi.utils import change_config
change_config('../configs/config_mb_2023_4_mux_2023.py', verbose=False) change_config('../configs/config_mb_2023_4_mux_2023.py', verbose=False)
import importlib import importlib
...@@ -7,6 +8,7 @@ import os ...@@ -7,6 +8,7 @@ import os
import time import time
import logging import logging
from ohmpi.config import HARDWARE_CONFIG from ohmpi.config import HARDWARE_CONFIG
import pandas as pd
stand_alone = False stand_alone = False
part_of_hardware_system = False part_of_hardware_system = False
...@@ -82,7 +84,7 @@ if within_ohmpi: ...@@ -82,7 +84,7 @@ if within_ohmpi:
print('Starting test with OhmPi.') print('Starting test with OhmPi.')
k = OhmPi() k = OhmPi()
k.load_sequence(os.path.join(os.path.dirname(__file__), '../sequences/01_GRAD_8_s4_a4.txt')) # k.load_sequence(os.path.join(os.path.dirname(__file__), '../sequences/test_circuit_1423.txt'))
k.reset_mux() k.reset_mux()
# k.test_mux(mux_id=None, activation_time=0.2) # k.test_mux(mux_id=None, activation_time=0.2)
# k._hw.switch_mux([A, B, M, N], state='on') # k._hw.switch_mux([A, B, M, N], state='on')
...@@ -97,12 +99,20 @@ if within_ohmpi: ...@@ -97,12 +99,20 @@ if within_ohmpi:
# k._hw.switch_mux([A, B, M, N], state='off') # k._hw.switch_mux([A, B, M, N], state='off')
# 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()
A, B, M, N = (16, 13, 15, 14)
A, B, M, N = (1, 4, 2, 3) A, B, M, N = (1, 4, 2, 3)
d = k.run_measurement([A, B, M, N], injection_duration=2., nb_stack=2, duty_cycle=0.5) d = k.run_measurement([A, B, M, N], injection_duration=0.5, nb_stack=2, duty_cycle=0.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')
print(f'OhmPi: Resistance: {d["R [ohm]"] :.2f} ohm, dev. {d["R_std [%]"]:.2f} %, rx bias: {k._hw.rx._bias:.2f} mV') # print(f'OhmPi: Resistance: {d["R [ohm]"] :.2f} ohm, dev. {d["R_std [%]"]:.2f} %, rx bias: {k._hw.rx._bias:.2f} mV')
k._hw._plot_readings(save_fig=False) # k._hw._plot_readings(save_fig=False)
# k.run_sequence(nb_stack=2, injection_duration=0.2, duty_cycle=0.5)
# ddir = os.path.join(os.path.dirname(__file__), '../data/')
# print(sorted(os.listdir(ddir)))
# df = pd.read_csv(os.path.join(ddir, sorted(os.listdir(ddir))[-3]))
# fig, ax = plt.subplots()
# df['R [Ohm]'].plot(ax=ax)
# fig.show(block=True)
# plot_exec_log('ohmpi/logs/exec.log') # plot_exec_log('ohmpi/logs/exec.log')
change_config('../configs/config_default.py', verbose=False) change_config('../configs/config_default.py', verbose=False)
...@@ -268,6 +268,6 @@ class Rx(RxAbstract): ...@@ -268,6 +268,6 @@ class Rx(RxAbstract):
""" Gets the voltage VMN in Volts """ Gets the voltage VMN in Volts
""" """
self.exec_logger.event(f'{self.model}\trx_voltage\tbegin\t{datetime.datetime.utcnow()}') self.exec_logger.event(f'{self.model}\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.model}\trx_voltage\tend\t{datetime.datetime.utcnow()}') self.exec_logger.event(f'{self.model}\trx_voltage\tend\t{datetime.datetime.utcnow()}')
return u return u
1 4 2 3 1 4 2 3
1 4 2 3 2 5 3 4
1 4 2 3 3 6 4 5
1 4 2 3 4 7 5 6
1 4 2 3 5 8 6 7
1 4 2 3 6 9 7 8
1 4 2 3 7 10 8 9
1 4 2 3 8 11 9 10
1 4 2 3 9 12 10 11
1 4 2 3 10 13 11 12
1 4 2 3 11 14 12 13
1 4 2 3 12 15 13 14
1 4 2 3 13 16 14 15
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 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3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
1 4 2 3
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