Commit 11152ff4 authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Improve code consistency

Showing with 388 additions and 757 deletions
+388 -757
import datetime
import importlib
from ohmpi.config import HARDWARE_CONFIG # TODO: Remove references at config here -> move it in ohmpi_hardware as done for mux_2024
import adafruit_ads1x15.ads1115 as ads # noqa
from adafruit_ads1x15.analog_in import AnalogIn # noqa
from adafruit_ads1x15.ads1x15 import Mode # noqa
from adafruit_mcp230xx.mcp23008 import MCP23008 # noqa
from digitalio import Direction # noqa
import minimalmodbus # noqa
from busio import I2C # noqa
import time
import numpy as np
import os
from ohmpi.hardware_components import TxAbstract, RxAbstract
from ohmpi.utils import enforce_specs
# ctl_name = HARDWARE_CONFIG['ctl'].pop('board_name', 'raspberry_pi')
# ctl_connection = HARDWARE_CONFIG['ctl'].pop('connection', 'i2c')
# ctl_module = importlib.import_module(f'ohmpi.hardware_components.{ctl_name}')
#
# TX_CONFIG = HARDWARE_CONFIG['tx']
# RX_CONFIG = HARDWARE_CONFIG['rx']
# hardware characteristics and limitations
# voltages are given in mV, currents in mA, sampling rates in Hz and data_rate in S/s
SPECS = {'rx': {'sampling_rate': {'min': 2., 'default': 10., 'max': 100.},
'data_rate': {'default': 860.},
'bias': {'min': -5000., 'default': 0., 'max': 5000.},
'coef_p2': {'default': 2.50},
'voltage_min': {'default': 10.0},
},
'tx': {'adc_voltage_min': {'default': 10.}, # Minimum voltage value used in vmin strategy
'adc_voltage_max': {'default': 4500.}, # Maximum voltage on ads1115 used to measure current
'voltage_max': {'min': 0., 'default': 12., 'max': 12.}, # Maximum input voltage
'data_rate': {'default': 860.},
'compatible_power_sources': {'default': 'pwr_batt', 'others' : ['dps5005']},
'r_shunt': {'min': 0., 'default': 2. },
'activation_delay': {'default': 0.005}, # Max turn on time of 211EH relays = 5ms
'release_delay': {'default': 0.001}, # Max turn off time of 211EH relays = 1ms
}}
# TODO: move low_battery spec in pwr
#
# # hardware characteristics and limitations
# # *** RX ***
# # ADC for voltage
# voltage_adc_voltage_min = 10. # mV
# voltage_adc_voltage_max = 4500. # mV
# sampling_rate = 20. # Hz
# data_rate = 860. # S/s?
# rx_mcp_board_address = 0x27
# 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['sampling_rate'] = RX_CONFIG.pop('sampling_rate', sampling_rate)
# RX_CONFIG['data_rate'] = RX_CONFIG.pop('data_rate', data_rate)
# # RX_CONFIG['coef_p2'] = RX_CONFIG.pop('coef_p2', 2.5)
# RX_CONFIG['latency'] = RX_CONFIG.pop('latency', 0.01)
# RX_CONFIG['bias'] = RX_CONFIG.pop('bias', 0.)
# RX_CONFIG['mcp_board_address'] = TX_CONFIG.pop('mcp_board_address', tx_mcp_board_address)
#
#
# # *** TX ***
# # ADC for current
# current_adc_voltage_min = 10. # mV
# current_adc_voltage_max = 4500. # mV
# low_battery = 12. # V (conventional value as it is not measured on this board)
# tx_mcp_board_address = 0x21 #
# # pwr_voltage_max = 12. # V
# # pwr_default_voltage = 12. # V
# # pwr_switch_on_warmup = 0. # seconds
#
# TX_CONFIG['current_min'] = np.min([current_adc_voltage_min / (TX_CONFIG['r_shunt'] * 50),
# TX_CONFIG.pop('current_min', np.inf)]) # mA
# TX_CONFIG['current_max'] = np.min([current_adc_voltage_max / (TX_CONFIG['r_shunt'] * 50),
# TX_CONFIG.pop('current_max', np.inf)]) # mA
# # TX_CONFIG['voltage_max'] = np.min([pwr_voltage_max, TX_CONFIG.pop('voltage_max', np.inf)]) # V
# TX_CONFIG['voltage_max'] = TX_CONFIG.pop('voltage_max', np.inf) # V
# TX_CONFIG['voltage_min'] = -TX_CONFIG['voltage_max'] # V
# TX_CONFIG['default_voltage'] = np.min([TX_CONFIG.pop('default_voltage', np.inf), TX_CONFIG['voltage_max']]) # V
# # TX_CONFIG['pwr_switch_on_warm_up'] = TX_CONFIG.pop('pwr_switch_on_warmup', pwr_switch_on_warmup)
# TX_CONFIG['mcp_board_address'] = TX_CONFIG.pop('mcp_board_address', tx_mcp_board_address)
# TX_CONFIG['low_battery'] = TX_CONFIG.pop('low_battery', low_battery)
# TX_CONFIG['latency'] = TX_CONFIG.pop('latency', 0.01)
# TX_CONFIG['bias'] = TX_CONFIG.pop('bias', 0.)
def _gain_auto(channel):
"""Automatically sets the gain on a channel
Parameters
----------
channel : ads.ADS1x15
Instance of ADS where voltage is measured.
Returns
-------
gain : float
Gain to be applied on ADS1115.
"""
gain = 2 / 3
if (abs(channel.voltage) < 2.048) and (abs(channel.voltage) >= 1.024):
gain = 2
elif (abs(channel.voltage) < 1.024) and (abs(channel.voltage) >= 0.512):
gain = 4
elif (abs(channel.voltage) < 0.512) and (abs(channel.voltage) >= 0.256):
gain = 8
elif abs(channel.voltage) < 0.256:
gain = 16
return gain
class Tx(TxAbstract):
def __init__(self, **kwargs):
for key in SPECS['tx'].keys():
kwargs = enforce_specs(kwargs, SPECS['tx'], key)
kwargs.update({'board_name': os.path.basename(__file__).rstrip('.py')})
super().__init__(**kwargs)
assert isinstance(self.connection, I2C)
kwargs.update({'pwr': kwargs.pop('pwr', SPECS['tx']['compatible_power_sources']['default'])})
if (kwargs['pwr'] != SPECS['tx']['compatible_power_sources']['default']
and kwargs['pwr'] not in SPECS['tx']['compatible_power_sources']['other']):
self.exec_logger.warning(f'Incompatible power source specified check config')
assert kwargs['pwr'] in SPECS['tx']
# self.pwr = None # TODO: set a list of compatible power system with the tx
self.exec_logger.event(f'{self.model}\ttx_init\tbegin\t{datetime.datetime.utcnow()}')
# self.voltage_max = kwargs['voltage_max'] # TODO: check if used
self._activation_delay = kwargs['activation_delay']
self._release_delay = kwargs['release_delay']
self.voltage_adjustable = False
self.current_adjustable = False
# I2C connexion to MCP23008, for current injection
self.mcp_board = MCP23008(self.connection, address=0x21)
# ADS1115 for current measurement (AB)
self._ads_current_address = 0x48
self._ads_current_data_rate = kwargs['data_rate']
self._ads_current = ads.ADS1115(self.connection, gain=self.adc_gain, data_rate=self._ads_current_data_rate,
address=self._ads_current_address)
self._ads_current.mode = Mode.CONTINUOUS
self.r_shunt = kwargs['r_shunt']
self.adc_voltage_min = kwargs['adc_voltage_min']
self.adc_voltage_max = kwargs['adc_voltage_max']
# Relays for pulse polarity
self.pin0 = self.mcp_board.get_pin(0)
self.pin0.direction = Direction.OUTPUT
self.pin1 = self.mcp_board.get_pin(1)
self.pin1.direction = Direction.OUTPUT
self.polarity = 0
self.gain = 2 / 3
# Initialize LEDs
self.pin4 = self.mcp_board.get_pin(4) # Ohmpi_run
self.pin4.direction = Direction.OUTPUT
self.pin4.value = True
self._latency = kwargs.pop('latency', TX_CONFIG['latency'])
self._bias = kwargs.pop('bias', TX_CONFIG['bias'])
self.exec_logger.event(f'{self.model}\ttx_init\tend\t{datetime.datetime.utcnow()}')
@property
def gain(self):
return self._adc_gain
@gain.setter
def gain(self, value):
assert value in [2/3, 2, 4, 8, 16]
self._adc_gain = value
self._ads_current = ads.ADS1115(self.connection, gain=self.adc_gain,
data_rate=SPECS['tx']['data_rate']['default'],
address=self._ads_current_address)
self._ads_current.mode = Mode.CONTINUOUS
self.exec_logger.debug(f'Setting TX ADC gain to {value}')
def _adc_gain_auto(self):
self.exec_logger.event(f'{self.model}\ttx_adc_auto_gain\tbegin\t{datetime.datetime.utcnow()}')
gain = _gain_auto(AnalogIn(self._ads_current, ads.P0))
self.exec_logger.debug(f'Setting TX ADC gain automatically to {gain}')
self.gain = gain
self.exec_logger.event(f'{self.model}\ttx_adc_auto_gain\tend\t{datetime.datetime.utcnow()}')
def current_pulse(self, **kwargs):
TxAbstract.current_pulse(self, **kwargs)
self.exec_logger.warning(f'Current pulse is not implemented for the {self.model} board')
@property
def current(self):
""" Gets the current IAB in Amps
"""
iab = AnalogIn(self._ads_current, ads.P0).voltage * 1000. / (50 * self.r_shunt) # measure current
self.exec_logger.debug(f'Reading TX current: {iab} mA')
return iab
@ current.setter
def current(self, value):
assert self.adc_voltage_min / (50 * self.r_shunt) <= value <= self.adc_voltage_max / (50 * self.r_shunt)
self.exec_logger.warning(f'Current pulse is not implemented for the {self.model} board')
def gain_auto(self):
self._adc_gain_auto()
def inject(self, polarity=1, injection_duration=None):
self.polarity = polarity
TxAbstract.inject(self, polarity=polarity, injection_duration=injection_duration)
@property
def polarity(self):
return self._polarity
@polarity.setter
def polarity(self, polarity):
assert polarity in [-1, 0, 1]
self._polarity = polarity
if polarity == 1:
self.pin0.value = True
self.pin1.value = False
time.sleep(self._activation_delay) # Max turn on time of 211EH relays = 5ms
elif polarity == -1:
self.pin0.value = False
self.pin1.value = True
time.sleep(self._activation_delay) # Max turn on time of 211EH relays = 5ms
else:
self.pin0.value = False
self.pin1.value = False
time.sleep(self._release_delay) # Max turn off time of 211EH relays = 1ms
def turn_off(self):
self.pwr.turn_off(self)
def turn_on(self):
self.pwr.turn_on(self)
@property
def tx_bat(self):
self.soh_logger.warning(f'Cannot get battery voltage on {self.model}')
self.exec_logger.debug(f'{self.model} cannot read battery voltage. Returning default battery voltage.')
return self.pwr.voltage
def voltage_pulse(self, voltage=None, length=None, polarity=1):
""" Generates a square voltage pulse
Parameters
----------
voltage: float, optional
Voltage to apply in volts, tx_v_def is applied if omitted.
length: float, optional
Length of the pulse in seconds
polarity: 1,0,-1
Polarity of the pulse
"""
self.exec_logger.event(f'{self.model}\ttx_voltage_pulse\tbegin\t{datetime.datetime.utcnow()}')
# self.exec_logger.info(f'injection_duration: {length}') # TODO: delete me
if length is None:
length = self.injection_duration
if voltage is not None:
self.pwr.voltage = voltage
self.exec_logger.debug(f'Voltage pulse of {polarity*self.pwr.voltage:.3f} V for {length:.3f} s')
self.inject(polarity=polarity, injection_duration=length)
self.exec_logger.event(f'{self.model}\ttx_voltage_pulse\tend\t{datetime.datetime.utcnow()}')
class Rx(RxAbstract):
def __init__(self, **kwargs):
for key in SPECS['rx'].keys():
kwargs = enforce_specs(kwargs, SPECS['rx'], key)
kwargs.update({'board_name': os.path.basename(__file__).rstrip('.py')})
super().__init__(**kwargs)
assert isinstance(self.connection, I2C)
self.exec_logger.event(f'{self.model}\trx_init\tbegin\t{datetime.datetime.utcnow()}')
# I2C connexion to MCP23008, for DG411
self.mcp_board = MCP23008(self.connection, address=0x27)
# ADS1115 for voltage measurement (MN)
self._ads_voltage_address = 0x49
self._adc_gain = 2/3
self._ads_voltage = ads.ADS1115(self.connection, gain=self._adc_gain,
data_rate=SPECS['rx']['data_rate']['default'],
address=self._ads_voltage_address)
self._ads_voltage.mode = Mode.CONTINUOUS
self._coef_p2 = kwargs['coef_p2']
# self._voltage_max = kwargs['voltage_max']
self._sampling_rate = kwargs['sampling_rate']
self._bias = kwargs['bias']
self.exec_logger.event(f'{self.model}\trx_init\tend\t{datetime.datetime.utcnow()}')
self.pin_DG0 = self.mcp_board.get_pin(0)
self.pin_DG0.direction = Direction.OUTPUT
self.pin_DG1 = self.mcp_board.get_pin(1)
self.pin_DG1.direction = Direction.OUTPUT
self.pin_DG2 = self.mcp_board.get_pin(2)
self.pin_DG2.direction = Direction.OUTPUT
self.pin_DG0.value = True # open
self.pin_DG1.value = True # open gain 1 inactive
self.pin_DG2.value = False # close gain 0.5 active
self._voltage_gain = 0.5
@property
def gain(self):
return self._adc_gain
@gain.setter
def gain(self, value):
assert value in [2/3, 2, 4, 8, 16]
self._adc_gain = value
self._ads_voltage = ads.ADS1115(self.connection, gain=self.adc_gain,
data_rate=SPECS['rx']['data_rate']['default'],
address=self._ads_voltage_address)
self._ads_voltage.mode = Mode.CONTINUOUS
self.exec_logger.debug(f'Setting RX ADC gain to {value}')
def _adc_gain_auto(self):
self.exec_logger.event(f'{self.model}\trx_adc_auto_gain\tbegin\t{datetime.datetime.utcnow()}')
gain_0 = _gain_auto(AnalogIn(self._ads_voltage, ads.P0))
gain_2 = _gain_auto(AnalogIn(self._ads_voltage, ads.P2))
gain = np.min([gain_0, gain_2])
self.exec_logger.debug(f'Setting RX ADC gain automatically to {gain}')
self.gain = gain
self.exec_logger.event(f'{self.model}\trx_adc_auto_gain\tend\t{datetime.datetime.utcnow()}')
def gain_auto(self):
self._adc_gain_auto()
@property
def voltage(self):
""" Gets the voltage VMN in Volts
"""
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
self.exec_logger.event(f'{self.model}\trx_voltage\tend\t{datetime.datetime.utcnow()}')
return u
@property
def voltage_gain(self):
return self._voltage_gain
@voltage_gain.setter
def voltage_gain(self,value):
assert value in [0.5, 1]
self._voltage_gain = value
if self._voltage_gain == 1:
self.pin_DG1.value = False # closed gain 1 active
self.pin_DG2.value = True # open gain 0.5 inactive
elif self._voltage_gain == 0.5:
self.pin_DG1.value = True # closed gain 1 active
self.pin_DG2.value = False # open gain 0.5 inactive
def voltage_gain_auto(self):
u = ((AnalogIn(self.ads_voltage, ads.P0).voltage * 1000) - self.vmn_hardware_offset) / self.voltage_gain
if abs(vmn1) < 2500 and abs(vmn2) < 2500: ###TODO change voltage gain auto logic
self.voltage_gain = 1
else:
self.voltage_gain = 0.5
from ohmpi.hardware_components.abstract_hardware_components import PwrAbstract
import numpy as np
import datetime
import os
from ohmpi.utils import enforce_specs
......@@ -20,9 +21,13 @@ class Pwr(PwrAbstract):
else:
subclass_init = True
super().__init__(**kwargs)
if not subclass_init:
self.exec_logger.event(f'{self.model}\tpwr_init\tbegin\t{datetime.datetime.utcnow()}')
self._voltage = kwargs['voltage']
self._current = np.nan
self._state = 'on'
if not subclass_init:
self.exec_logger.event(f'{self.model}\tpwr_init\tend\t{datetime.datetime.utcnow()}')
@property
def current(self):
......@@ -44,4 +49,4 @@ class Pwr(PwrAbstract):
@voltage.setter
def voltage(self, value):
PwrAbstract.voltage.fset(self, value)
\ No newline at end of file
PwrAbstract.voltage.fset(self, value)
from ohmpi.hardware_components.abstract_hardware_components import PwrAbstract
import datetime
import numpy as np
#import minimalmodbus # noqa
import datetime
import os
from ohmpi.utils import enforce_specs
#import minimalmodbus # noqa
# hardware characteristics and limitations
SPECS = {'model': {'default': os.path.basename(__file__).rstrip('.py')},
......@@ -26,7 +26,7 @@ class Pwr(PwrAbstract):
subclass_init = True
super().__init__(**kwargs)
if not subclass_init:
self.exec_logger.event(f'{self.model}\tpwr_init\tstart\t{datetime.datetime.utcnow()}')
self.exec_logger.event(f'{self.model}\tpwr_init\tbegin\t{datetime.datetime.utcnow()}')
# if a controller is passed in kwargs, it will be instantiated
#if self.ctl is None:
# self.ctl = ctl_module.Ctl(**CTL_CONFIG)
......
......@@ -4,22 +4,32 @@ import busio # noqa
from adafruit_extended_bus import ExtendedI2C # noqa
import minimalmodbus # noqa
import os
from ohmpi.utils import get_platform
from ohmpi.utils import get_platform, enforce_specs
from gpiozero import CPUTemperature # noqa
import warnings
# hardware characteristics and limitations
SPECS = {'model': {'default': os.path.basename(__file__).rstrip('.py')},
'voltage': {'default': 12., 'max': 50., 'min': 0.},
'modbus_baudrate': {'default': 9600},
'modbus_bitesize': {'default': 8},
'modbus_timeout': {'default': 1},
'modbus_debug': {'default': False},
'modbus_parity': {'default': 'N'},
'modbus_mode': {'default': minimalmodbus.MODE_RTU},
'modbus_port': {'default': '/dev/ttyUSB0'},
'modbus_slave_address': {'default': 1}
}
class Ctl(CtlAbstract):
def __init__(self, **kwargs):
kwargs.update({'board_name': os.path.basename(__file__).rstrip('.py')})
modbus_baudrate = kwargs.pop('modbus_baudrate', 9600)
modbus_bitesize = kwargs.pop('modbus_bitesize', 8)
modbus_timeout = kwargs.pop('modbus_timeout', 1)
modbus_debug = kwargs.pop('modbus_debug', False)
modbus_parity = kwargs.pop('modbus_parity', 'N')
modbus_mode = kwargs.pop('modbus_mode', minimalmodbus.MODE_RTU)
modbus_port = kwargs.pop('modbus_port', '/dev/ttyUSB0')
modbus_slave_address = kwargs.pop('modbus_slave_address', 1)
if 'model' not in kwargs.keys():
for key in SPECS['tx'].keys():
kwargs = enforce_specs(kwargs, SPECS['tx'], key)
subclass_init = False
else:
subclass_init = True
super().__init__(**kwargs)
self.interfaces = dict()
......@@ -42,19 +52,20 @@ class Ctl(CtlAbstract):
# modbus
try:
self.interfaces['modbus'] = minimalmodbus.Instrument(port=modbus_port, slaveaddress=modbus_slave_address)
self.interfaces['modbus'].serial.baudrate = modbus_baudrate # Baud rate 9600 as listed in doc
self.interfaces['modbus'].serial.bytesize = modbus_bitesize #
self.interfaces['modbus'].serial.timeout = modbus_timeout # greater than 0.5 for it to work
self.interfaces['modbus'].debug = modbus_debug #
self.interfaces['modbus'].serial.parity = modbus_parity # No parity
self.interfaces['modbus'].mode = modbus_mode # RTU mode
self.interfaces['modbus'] = minimalmodbus.Instrument(port=kwargs['modbus_port'],
slaveaddress=kwargs['modbus_slave_address'])
self.interfaces['modbus'].serial.baudrate = kwargs['modbus_baudrate'] # Baud rate 9600 as listed in doc
self.interfaces['modbus'].serial.bytesize = kwargs['modbus_bitesize'] #
self.interfaces['modbus'].serial.timeout = kwargs['modbus_timeout'] # greater than 0.5 for it to work
self.interfaces['modbus'].debug = kwargs['modbus_debug'] #
self.interfaces['modbus'].serial.parity = kwargs['modbus_parity'] # No parity
self.interfaces['modbus'].mode = kwargs['modbus_mode'] # RTU mode
except Exception as e:
self.exec_logger.warning(f'Could not initialize Extended modbus:\n{e}')
platform, on_pi = get_platform()
assert on_pi
self.board_name = platform
self.model = platform
self._cpu_temp_available = True
self.max_cpu_temp = 85. # °C
......
......@@ -2,28 +2,28 @@ digraph "classes_uml_ohmpi" {
charset="utf-8"
rankdir=BT
"0" [label="{CompressedSizedTimedRotatingFileHandler|maxBytes : int\lstream\lzip_mode : int\l|doRollover()\lfind_last_rotated_file()\lshouldRollover(record)\l}", shape="record"];
"1" [label="{Ctl|board_name : str\linterfaces : dict\lmax_cpu_temp : float\l|}", shape="record"];
"1" [label="{Ctl|interfaces : dict\lmax_cpu_temp : float\lmodel : str\l|}", shape="record"];
"2" [label="{Ctl|\l|}", shape="record"];
"3" [label="{CtlAbstract|board_name\lconnection : NoneType\lcpu_temperature\lexec_logger : NoneType, RootLogger\linterfaces : NoneType\lmax_cpu_temp\lsoh_logger : NoneType, RootLogger\l|}", shape="record"];
"3" [label="{CtlAbstract|connection\lcpu_temperature\lexec_logger : RootLogger, NoneType\linterfaces : NoneType\lmax_cpu_temp\lmodel\lsoh_logger : RootLogger, NoneType\l|}", shape="record"];
"4" [label="{MQTTHandler|auth : NoneType\lclient_id : str\lhostname\lkeepalive : int\lport : int\lprotocol\lqos : int\lretain : bool\ltls : NoneType\ltopic\ltransport : str\lwill : NoneType\l|emit(record)\l}", shape="record"];
"5" [label="{Mux|addresses : dict\lio\l|reset()\lswitch_one(elec, role, state)\l}", shape="record"];
"5" [label="{Mux|addresses : dict\l|reset()\lswitch_one(elec, role, state)\l}", shape="record"];
"6" [label="{Mux|\l|reset()\lswitch_one()\ltest()\l}", shape="record"];
"7" [label="{Mux|addresses : dict\l|reset()\lswitch_one(elec, role, state)\l}", shape="record"];
"8" [label="{MuxAbstract|addresses\lbarrier\lboard_id\lboard_name\lcabling : dict\lconnection\lexec_logger : NoneType, RootLogger\lsoh_logger : NoneType, RootLogger\l|reset()\lswitch(elec_dict, state, bypass_check)\lswitch_one(elec, role, state)\ltest(elec_dict, activation_time)\l}", shape="record"];
"8" [label="{MuxAbstract|addresses\lbarrier\lboard_id\lcabling : dict\lconnection\lexec_logger\lmodel\lsoh_logger\l|reset()\lswitch(elec_dict, state, bypass_check)\lswitch_one(elec, role, state)\ltest(elec_dict, activation_time)\l}", shape="record"];
"9" [label="{MyServer|\l|do_POST()\l}", shape="record"];
"10" [label="{OhmPi|cmd_id : NoneType\lcontroller : NoneType\ldata_logger : NoneType, RootLogger\lexec_logger : NoneType, RootLogger\lid : str\lmqtt : bool\lnb_samples : int\lon_pi : NoneType, bool\lsequence\lsequence : ndarray, NoneType\lsettings : dict\lsoh_logger : NoneType, RootLogger\lstatus : str\lthread : Thread, NoneType\l|append_and_save(filename, last_measurement, cmd_id)\lget_data(survey_names, cmd_id)\lget_deprecated_methods(cls)\linterrupt(cmd_id)\lload_sequence(filename, cmd_id)\lquit(cmd_id)\lremove_data(cmd_id)\lreset_mux(cmd_id)\lrestart(cmd_id)\lrs_check(tx_volt, cmd_id)\lrun_measurement(quad, nb_stack, injection_duration, autogain, strategy, tx_volt, best_tx_injtime, cmd_id)\lrun_multiple_sequences(cmd_id, sequence_delay, nb_meas)\lrun_sequence(cmd_id)\lrun_sequence_async(cmd_id)\lset_sequence(sequence, cmd_id)\lswitch_mux_off(quadrupole, cmd_id)\lswitch_mux_on(quadrupole, bypass_check, cmd_id)\ltest_mux(activation_time, mux_id, cmd_id)\lupdate_settings(settings, cmd_id)\l}", shape="record"];
"11" [label="{OhmPiHardware|ctl\ldata_logger : NoneType, RootLogger\lexec_logger : NoneType, RootLogger\llast_dev\llast_rho\lmux_barrier : Barrier\lmux_boards : dict\lpulses\lpwr\lreadings : ndarray\lrx\lsoh_logger : NoneType, RootLogger\lsp\ltx\ltx_sync : Event\l|calibrate_rx_bias()\lreset_mux()\lswitch_mux(electrodes, roles, state)\ltest_mux(channel, activation_time)\lvab_square_wave(vab, cycle_duration, sampling_rate, cycles, polarity, duty_cycle, append)\l}", shape="record"];
"12" [label="{Pwr|connection\lctl\lcurrent\lcurrent_max\lvoltage\lvoltage_adjustable : bool\l|battery_voltage()\lturn_off()\lturn_on()\l}", shape="record"];
"13" [label="{Pwr|current\lvoltage\lvoltage_adjustable : bool\l|turn_off()\lturn_on()\l}", shape="record"];
"14" [label="{PwrAbstract|board_name\lconnection\lctl\lcurrent\lexec_logger : NoneType, RootLogger\lsoh_logger : NoneType, RootLogger\lvoltage\lvoltage_adjustable\l|turn_off()\lturn_on()\l}", shape="record"];
"15" [label="{Rx|adc_gain\ladc_gain\lconnection\lctl\lvoltage\l|adc_gain_auto()\l}", shape="record"];
"10" [label="{OhmPi|cmd_id : NoneType\lcontroller : NoneType\ldata_logger : RootLogger, NoneType\lexec_logger : RootLogger, NoneType\lid : str\lmqtt : bool\lnb_samples : int\lon_pi : bool, NoneType\lsequence\lsequence : NoneType, ndarray\lsettings : dict\lsoh_logger : RootLogger, NoneType\lstatus : str\lthread : Thread, NoneType\l|append_and_save(filename, last_measurement, cmd_id)\lget_data(survey_names, cmd_id)\lget_deprecated_methods(cls)\linterrupt(cmd_id)\lload_sequence(filename, cmd_id)\lquit(cmd_id)\lremove_data(cmd_id)\lreset_mux(cmd_id)\lrestart(cmd_id)\lrs_check(tx_volt, cmd_id)\lrun_measurement(quad, nb_stack, injection_duration, autogain, strategy, tx_volt, best_tx_injtime, cmd_id)\lrun_multiple_sequences(cmd_id, sequence_delay, nb_meas)\lrun_sequence(cmd_id)\lrun_sequence_async(cmd_id)\lset_sequence(sequence, cmd_id)\lswitch_mux_off(quadrupole, cmd_id)\lswitch_mux_on(quadrupole, bypass_check, cmd_id)\ltest_mux(activation_time, mux_id, cmd_id)\lupdate_settings(settings, cmd_id)\l}", shape="record"];
"11" [label="{OhmPiHardware|ctl\ldata_logger\lexec_logger\lmux_barrier : Barrier\lmux_boards : dict\lpulses\lpwr\lreadings : ndarray\lrx\lsoh_logger\lsp\ltx\ltx_sync : Event\l|calibrate_rx_bias()\llast_dev(delay)\llast_resistance(delay)\lreset_mux()\lswitch_mux(electrodes, roles, state)\ltest_mux(channel, activation_time)\lvab_square_wave(vab, cycle_duration, sampling_rate, cycles, polarity, duty_cycle, append)\l}", shape="record"];
"12" [label="{Pwr|current\lcurrent_adjustable : bool\lvoltage\lvoltage_adjustable : bool\l|battery_voltage()\lcurrent_max(value)\lturn_off()\lturn_on()\l}", shape="record"];
"13" [label="{Pwr|current\lvoltage\l|turn_off()\lturn_on()\l}", shape="record"];
"14" [label="{PwrAbstract|connection\lcurrent\lcurrent_adjustable\lexec_logger : RootLogger, NoneType\lmodel\lsoh_logger : RootLogger, NoneType\lvoltage\lvoltage_adjustable\l|turn_off()\lturn_on()\l}", shape="record"];
"15" [label="{Rx|gain\lgain : int, float\lvoltage\l|gain_auto()\l}", shape="record"];
"16" [label="{Rx|adc_gain\ladc_gain : float\lvoltage\l|adc_gain_auto()\l}", shape="record"];
"17" [label="{Rx|adc_gain\ladc_gain : float\lctl\lio\lmcp_board : MCP23008\lpin_DG0 : DigitalInOut\lpin_DG1 : DigitalInOut\lpin_DG2 : DigitalInOut\lvoltage\lvoltage_gain\lvoltage_gain : int, float\l|adc_gain_auto()\lvoltage_gain_auto()\l}", shape="record"];
"18" [label="{RxAbstract|adc_gain\lboard_name\lconnection\lctl\lexec_logger : NoneType, RootLogger\lsampling_rate\lsoh_logger : NoneType, RootLogger\lvoltage\l|adc_gain_auto()\l}", shape="record"];
"19" [label="{Tx|adc_gain\ladc_gain : int, float\lconnection\lctl\lcurrent\lcurrent_adjustable : bool\lmcp_board : MCP23008\lpin0 : DigitalInOut\lpin1 : DigitalInOut\lpin4 : DigitalInOut\lpolarity\lpolarity : int\lpwr : NoneType\ltx_bat\lvoltage_adjustable : bool\l|adc_gain_auto()\lcurrent_pulse()\linject(polarity, injection_duration)\lturn_off()\lturn_on()\lvoltage_pulse(voltage, length, polarity)\l}", shape="record"];
"17" [label="{Rx|gain\lgain : int, float\lmcp_board : MCP23008\lpin_DG0 : DigitalInOut\lpin_DG1 : DigitalInOut\lpin_DG2 : DigitalInOut\lvoltage\l|gain_auto()\l}", shape="record"];
"18" [label="{RxAbstract|adc_gain\lconnection\lexec_logger : RootLogger, NoneType\lmodel\lsampling_rate\lsoh_logger : RootLogger, NoneType\lvoltage\l|}", shape="record"];
"19" [label="{Tx|adc_voltage_max\ladc_voltage_min\lcurrent\lcurrent_adjustable : bool\lgain\lgain : int, float\lmcp_board : MCP23008\lpin0 : DigitalInOut\lpin1 : DigitalInOut\lpolarity\lpolarity : int\lr_shunt\ltx_bat\lvoltage_adjustable : bool\l|current_pulse()\lgain_auto()\linject(polarity, injection_duration)\lturn_off()\lturn_on()\lvoltage_pulse(voltage, length, polarity)\l}", shape="record"];
"20" [label="{Tx|adc_gain\ladc_gain : float\lcurrent\lpolarity : int\ltx_bat\lvoltage\l|adc_gain_auto()\lcurrent_pulse()\linject(state)\lvoltage_pulse(voltage, length, polarity)\l}", shape="record"];
"21" [label="{Tx|adc_gain\ladc_gain : int, float\lctl\lcurrent\lcurrent_adjustable : bool\lio\lmcp_board : MCP23008\lpin0 : DigitalInOut\lpin1 : DigitalInOut\lpin4 : DigitalInOut\lpolarity\lpolarity : int\lpwr : NoneType\ltx_bat\lvoltage_adjustable : bool\l|adc_gain_auto()\lcurrent_pulse()\linject(polarity, injection_duration)\lturn_off()\lturn_on()\lvoltage_pulse(voltage, length, polarity)\l}", shape="record"];
"22" [label="{TxAbstract|adc_gain\lboard_name\lconnection\lctl\lexec_logger : NoneType, RootLogger\linjection_duration\linjection_duration\lpolarity\lpwr\lsoh_logger : NoneType, RootLogger\ltx_bat\ltx_sync\l|adc_gain_auto()\lcurrent_pulse()\linject(polarity, injection_duration)\lvoltage_pulse(voltage, length, polarity)\l}", shape="record"];
"21" [label="{Tx|pin4 : DigitalInOut\lpin6 : DigitalInOut\l|inject(polarity, injection_duration)\l}", shape="record"];
"22" [label="{TxAbstract|adc_gain\lconnection\lexec_logger : RootLogger, NoneType\linjection_duration\linjection_duration\lmodel\lpolarity\lpwr\lsoh_logger : RootLogger, NoneType\ltx_bat\ltx_sync\l|current_pulse()\linject(polarity, injection_duration, switch_pwr)\lvoltage_pulse(voltage, length, polarity)\l}", shape="record"];
"1" -> "3" [arrowhead="empty", arrowtail="none"];
"2" -> "3" [arrowhead="empty", arrowtail="none"];
"5" -> "8" [arrowhead="empty", arrowtail="none"];
......@@ -33,9 +33,9 @@ rankdir=BT
"13" -> "14" [arrowhead="empty", arrowtail="none"];
"15" -> "18" [arrowhead="empty", arrowtail="none"];
"16" -> "18" [arrowhead="empty", arrowtail="none"];
"17" -> "18" [arrowhead="empty", arrowtail="none"];
"17" -> "15" [arrowhead="empty", arrowtail="none"];
"19" -> "22" [arrowhead="empty", arrowtail="none"];
"20" -> "22" [arrowhead="empty", arrowtail="none"];
"21" -> "22" [arrowhead="empty", arrowtail="none"];
"21" -> "19" [arrowhead="empty", arrowtail="none"];
"11" -> "10" [arrowhead="diamond", arrowtail="none", fontcolor="green", label="_hw", style="solid"];
}
uml_diagrams/classes_uml_ohmpi.dot.png

408 KB | W: | H:

uml_diagrams/classes_uml_ohmpi.dot.png

443 KB | W: | H:

uml_diagrams/classes_uml_ohmpi.dot.png
uml_diagrams/classes_uml_ohmpi.dot.png
uml_diagrams/classes_uml_ohmpi.dot.png
uml_diagrams/classes_uml_ohmpi.dot.png
  • 2-up
  • Swipe
  • Onion skin
This diff is collapsed.
......@@ -36,17 +36,18 @@ rankdir=BT
"8" -> "21" [arrowhead="open", arrowtail="none"];
"9" -> "2" [arrowhead="open", arrowtail="none"];
"9" -> "4" [arrowhead="open", arrowtail="none"];
"10" -> "2" [arrowhead="open", arrowtail="none"];
"10" -> "4" [arrowhead="open", arrowtail="none"];
"11" -> "2" [arrowhead="open", arrowtail="none"];
"11" -> "4" [arrowhead="open", arrowtail="none"];
"12" -> "2" [arrowhead="open", arrowtail="none"];
"10" -> "23" [arrowhead="open", arrowtail="none"];
"11" -> "10" [arrowhead="open", arrowtail="none"];
"11" -> "23" [arrowhead="open", arrowtail="none"];
"12" -> "4" [arrowhead="open", arrowtail="none"];
"13" -> "2" [arrowhead="open", arrowtail="none"];
"12" -> "23" [arrowhead="open", arrowtail="none"];
"13" -> "4" [arrowhead="open", arrowtail="none"];
"13" -> "23" [arrowhead="open", arrowtail="none"];
"14" -> "5" [arrowhead="open", arrowtail="none"];
"15" -> "2" [arrowhead="open", arrowtail="none"];
"14" -> "23" [arrowhead="open", arrowtail="none"];
"15" -> "5" [arrowhead="open", arrowtail="none"];
"15" -> "23" [arrowhead="open", arrowtail="none"];
"16" -> "4" [arrowhead="open", arrowtail="none"];
"16" -> "23" [arrowhead="open", arrowtail="none"];
"17" -> "2" [arrowhead="open", arrowtail="none"];
......
uml_diagrams/packages_uml_ohmpi.dot.png

209 KB | W: | H:

uml_diagrams/packages_uml_ohmpi.dot.png

193 KB | W: | H:

uml_diagrams/packages_uml_ohmpi.dot.png
uml_diagrams/packages_uml_ohmpi.dot.png
uml_diagrams/packages_uml_ohmpi.dot.png
uml_diagrams/packages_uml_ohmpi.dot.png
  • 2-up
  • Swipe
  • Onion skin
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