Commit 97149ee3 authored by Guillaume Blanchy's avatar Guillaume Blanchy
Browse files

Add troubleshooting text (to be reviewed)

Showing with 81 additions and 45 deletions
+81 -45
......@@ -15,7 +15,7 @@
import os
import sys
sys.path.append(os.path.abspath('../..'))
import ohmpi # import Ohmpi module to be documented in api.rst by numpydoc
#import ohmpi # import Ohmpi module to be documented in api.rst by numpydoc
import sphinx_rtd_theme
......
......@@ -3,7 +3,7 @@ API reference
.. toctree::
:maxdepth: 2
:caption: Contents:
.. automodule:: ohmpi
.. automodule:: ohmpi.ohmpi
:members:
import logging
from ohmpi.utils import get_platform
from paho.mqtt.client import MQTTv31
from paho.mqtt.client import MQTTv31 # noqa
_, on_pi = get_platform()
# DEFINE THE ID OF YOUR OhmPi
......@@ -17,26 +17,61 @@ OHMPI_CONFIG = {
'settings': 'ohmpi_settings.json', # INSERT YOUR FAVORITE SETTINGS FILE HERE
}
r_shunt = 2.
HARDWARE_CONFIG = {
'ctl': {'model' : 'dummy_ctl'
},
'tx' : {'model' : 'dummy_tx',
'current_max': 4800 / 50 / 2, # Maximum current mA
'r_shunt': 2, # Shunt resistance in Ohms
'low_battery': 12. # Volts
'ctl': {'model': 'raspberry_pi'},
'pwr': {'model': 'pwr_batt', 'voltage': 12., 'interface_name': 'none'},
'tx': {'model': 'mb_2023_0_X',
'voltage_max': 50., # Maximum voltage supported by the TX board [V]
'current_max': 4.80/(50*r_shunt), # Maximum voltage read by the current ADC on the TX board [A]
'r_shunt': r_shunt, # Shunt resistance in Ohms
'interface_name': 'i2c'
},
'rx' : {'model': 'dummy_rx',
'rx': {'model': 'mb_2023_0_X',
'coef_p2': 2.50, # slope for conversion for ADS, measurement in V/V
'sampling_rate': 50., # number of samples per second
'interface_name': 'i2c',
},
'mux': {'model' : 'dummy_mux',
'max_elec': 64,
'voltage_max' : 100,
'current_max' : 3
}
'mux': # default properties given in config are system properties that will be
# overwritten by properties defined in each the board dict below.
# if defined in board specs, values out of specs will be bounded to remain in specs
# omitted properties in config will be set to board specs default values if they exist
{'boards':
{'mux_A':
{'model': 'mux_2023_0_X',
'mux_tca_address': 0x70,
'roles': {'A': 'X'},
'cabling': {(i, j): ('mux_A', i) for j in ['A'] for i in range(1, 65)},
'voltage_max': 12.},
'mux_B':
{'model': 'mux_2023_0_X',
'mux_tca_address': 0x71,
'roles': {'B': 'X'},
'cabling': {(i, j): ('mux_B', i) for j in ['B'] for i in range(1, 65)},
'voltage_max': 12.},
'mux_M':
{'model': 'mux_2023_0_X',
'mux_tca_address': 0x72,
'roles': {'M': 'X'},
'cabling': {(i, j): ('mux_M', i) for j in ['M'] for i in range(1, 65)},
'voltage_max': 12.},
'mux_N':
{'model': 'mux_2023_0_X',
'mux_tca_address': 0x73,
'roles': {'N': 'X'},
'cabling': {(i, j): ('mux_N', i) for j in ['N'] for i in range(1, 65)},
'voltage_max': 12.},
},
'default': {'interface_name': 'i2c',
'voltage_max': 12.,
'current_max': 3.}
}
}
# SET THE LOGGING LEVELS, MQTT BROKERS AND MQTT OPTIONS ACCORDING TO YOUR NEEDS
# Execution logging configuration
EXEC_LOGGING_CONFIG = {
'logging_level': logging.INFO,
'logging_level': logging.INFO, # TODO: set logging level back to INFO
'log_file_logging_level': logging.DEBUG,
'logging_to_console': True,
'file_name': f'exec{logging_suffix}.log',
......@@ -60,8 +95,8 @@ DATA_LOGGING_CONFIG = {
# State of Health logging configuration (For a future release)
SOH_LOGGING_CONFIG = {
'logging_level': logging.INFO,
'log_file_logging_level': logging.DEBUG,
'logging_to_console': True,
'log_file_logging_level': logging.DEBUG,
'file_name': f'soh{logging_suffix}.log',
'max_bytes': 16777216,
'backup_count': 1024,
......
......@@ -44,23 +44,24 @@ VERSION = '3.0.0-beta'
class OhmPi(object):
"""OhmPi class.
Construct the ohmpi object.
Parameters
----------
settings : dict, optional
Dictionnary of parameters. Possible parameters with their default values:
`{'injection_duration': 0.2, 'nb_meas': 1, 'sequence_delay': 1,
'nb_stack': 1, 'sampling_interval': 2, 'tx_volt': 5, 'duty_cycle': 0.5,
'strategy': 'constant', 'export_path': None
sequence : str, optional
Path of the .csv or .txt file with A, B, M and N electrodes.
Electrode index starts at 1. See `OhmPi.load_sequence()` for full docstring.
mqtt : bool, optional
If True (default), publish on mqtt topics while logging,
otherwise use other loggers only (print).
"""
def __init__(self, settings=None, sequence=None, mqtt=True):
"""Construct the ohmpi object.
Parameters
----------
settings : dict, optional
Dictionnary of parameters. Possible parameters with their default values:
`{'injection_duration': 0.2, 'nb_meas': 1, 'sequence_delay': 1,
'nb_stack': 1, 'sampling_interval': 2, 'tx_volt': 5, 'duty_cycle': 0.5,
'strategy': 'constant', 'export_path': None
sequence : str, optional
Path of the .csv or .txt file with A, B, M and N electrodes.
Electrode index starts at 1. See `OhmPi.load_sequence()` for full docstring.
mqtt : bool, optional
If True (default), publish on mqtt topics while logging,
otherwise use other loggers only (print).
"""
self._sequence = sequence
self.nb_samples = 0
self.status = 'idle' # either running or idle
......@@ -473,10 +474,10 @@ class OhmPi(object):
Either:
- vmax : compute Vab to reach a maximum Vmn_max and Iab without exceeding vab_max
- vmin : compute Vab to reach at least Vmn_min
- constant : apply given Vab (tx_volt) -
Safety check (i.e. short voltage pulses) performed prior to injection to ensure
injection within bounds defined in vab_max, iab_max, vmn_max or vmn_min. This can adapt Vab.
To bypass safety check before injection, tx_volt should be set equal to vab_max (not recpommanded)
- constant : apply given Vab (tx_volt)
Safety check (i.e. short voltage pulses) performed prior to injection to ensure
injection within bounds defined in vab_max, iab_max, vmn_max or vmn_min. This can adapt Vab.
To bypass safety check before injection, tx_volt should be set equal to vab_max (not recpommanded)
vab_max : str, optional
Maximum injection voltage.
Default value set by config or boards specs
......@@ -947,14 +948,14 @@ class OhmPi(object):
def update_settings(self, settings: str, cmd_id=None):
"""Updates acquisition settings from a json file or dictionary.
Parameters can be:
- nb_electrodes (number of electrode used, if 4, no MUX needed)
- injection_duration (in seconds)
- nb_meas (total number of times the sequence will be run)
- sequence_delay (delay in second between each sequence run)
- nb_stack (number of stack for each quadrupole measurement)
- strategy (injection strategy: constant, vmax, vmin)
- duty_cycle (injection duty cycle comprised between 0.5 - 1)
- export_path (path where to export the data, timestamp will be added to filename)
- nb_electrodes (number of electrode used, if 4, no MUX needed)
- injection_duration (in seconds)
- nb_meas (total number of times the sequence will be run)
- sequence_delay (delay in second between each sequence run)
- nb_stack (number of stack for each quadrupole measurement)
- strategy (injection strategy: constant, vmax, vmin)
- duty_cycle (injection duty cycle comprised between 0.5 - 1)
- export_path (path where to export the data, timestamp will be added to filename)
Parameters
----------
......
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