From 410c89e9120411e176565fc0d17d1e5fb3a4e5e4 Mon Sep 17 00:00:00 2001 From: awatlet <arnaud.watlet@umons.ac.be> Date: Tue, 17 Oct 2023 18:56:16 +0200 Subject: [PATCH] Updates config_mb2023_0_2__3_mux_2024_dps --- configs/config_mb_2023_3_mux_2024.py | 62 ++++---- configs/config_mb_2023__3_mux_2024_dps5005.py | 147 ++++++++++++++++++ 2 files changed, 180 insertions(+), 29 deletions(-) create mode 100644 configs/config_mb_2023__3_mux_2024_dps5005.py diff --git a/configs/config_mb_2023_3_mux_2024.py b/configs/config_mb_2023_3_mux_2024.py index 7f83b2a4..892582ab 100644 --- a/configs/config_mb_2023_3_mux_2024.py +++ b/configs/config_mb_2023_3_mux_2024.py @@ -19,7 +19,7 @@ OHMPI_CONFIG = { HARDWARE_CONFIG = { 'ctl': {'model': 'raspberry_pi'}, - 'pwr': {'model': 'pwr_batt', 'voltage': 12.}, + 'pwr': {'model': 'pwr_batt', 'voltage': 12.,'interface_name':'none'}, 'tx': {'model': 'mb_2023_0_X', 'voltage_max': 12., # Maximum voltage supported by the TX board [V] 'adc_voltage_max': 4800., # Maximum voltage read by the current ADC on the TX board [mA] @@ -36,34 +36,38 @@ HARDWARE_CONFIG = { # 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_02': - {'model': 'mux_2024_0_X', - 'tca_address': None, - 'tca_channel': 0, - 'mcp_0': '0x22', # TODO: Replace this with pos of jumper on MUX board (address doesn't mean anything for the average user...) - 'mcp_1': '0x23', # TODO: Replace this with pos of jumper on MUX board (address doesn't mean anything for the average user...) - 'roles': {'A': 'X', 'B': 'Y', 'M': 'XX', 'N': 'YY'}, - 'cabling': {(i+8, j): ('mux_02', i) for j in ['A', 'B', 'M', 'N'] for i in range(1, 9)}, - 'voltage_max': 12.}, - 'mux_00': - {'model': 'mux_2024_0_X', - 'tca_address': None, - 'tca_channel': 0, - 'mcp_0': '0x24', # TODO : Replace this with pos of jumper on MUX board (address doesn't mean anything for the average user...) - 'mcp_1': '0x25', # TODO : Replace this with pos of jumper on MUX board (address doesn't mean anything for the average user...) - 'roles': {'A': 'X', 'B': 'Y', 'M': 'XX', 'N': 'YY'}, - 'cabling': {(i+16, j): ('mux_00', i) for j in ['A', 'B', 'M', 'N'] for i in range(1, 9)}, - 'voltage_max': 12.}, - 'mux_04': - {'model': 'mux_2024_0_X', - 'tca_address': None, - 'tca_channel': 0, - 'mcp_0': '0x26', # TODO : Replace this with pos of jumper on MUX board (address doesn't mean anything for the average user... - 'mcp_1': '0x27', # TODO : Replace this with pos of jumper on MUX board (address doesn't mean anything for the average user...) - 'roles': {'A': 'X', 'B': 'Y', 'M': 'XX', 'N': 'YY'}, - 'cabling': {(i+24, j): ('mux_04', i) for j in ['A', 'B', 'M', 'N'] for i in range(1, 9)}, - 'voltage_max': 12.} - }, + {'mux_02': + {'model': 'mux_2024_0_X', + 'tca_address': None, + 'tca_channel': 0, + 'addr2': 'up', + 'addr1': 'up', + # 'mcp_0': '0x26', + # 'mcp_1': '0x27', + 'roles': {'A': 'X', 'B': 'Y', 'M': 'XX', 'N': 'YY'}, + 'cabling': {(i + 8, j): ('mux_02', i) for j in ['A', 'B', 'M', 'N'] for i in range(1, 9)}, + 'voltage_max': 50.}, + 'mux_03': + {'model': 'mux_2024_0_X', + 'tca_address': None, + 'tca_channel': 0, + 'addr2': 'down', + 'addr1': 'up', + # 'mcp_0': '0x26', + # 'mcp_1': '0x27', + 'roles': {'A': 'X', 'B': 'Y', 'M': 'XX', 'N': 'YY'}, + 'cabling': {(i + 16, j): ('mux_03', i) for j in ['A', 'B', 'M', 'N'] for i in range(1, 9)}, + 'voltage_max': 50.}, + 'mux_05': + {'model': 'mux_2024_0_X', + 'tca_address': None, + 'tca_channel': 0, + 'addr2': 'up', + 'addr1': 'down', + 'roles': {'A': 'X', 'B': 'Y', 'M': 'XX', 'N': 'YY'}, + 'cabling': {(i + 0, j): ('mux_05', i) for j in ['A', 'B', 'M', 'N'] for i in range(1, 9)}, + 'voltage_max': 50.}, + }, 'default': {'interface_name': 'i2c', 'voltage_max': 100., 'current_max': 3.} diff --git a/configs/config_mb_2023__3_mux_2024_dps5005.py b/configs/config_mb_2023__3_mux_2024_dps5005.py new file mode 100644 index 00000000..26c0dddc --- /dev/null +++ b/configs/config_mb_2023__3_mux_2024_dps5005.py @@ -0,0 +1,147 @@ +import logging +from ohmpi.utils import get_platform + +from paho.mqtt.client import MQTTv31 # noqa + +_, on_pi = get_platform() +# DEFINE THE ID OF YOUR OhmPi +ohmpi_id = '0001' if on_pi else 'XXXX' +# DEFINE YOUR MQTT BROKER (DEFAULT: 'localhost') +mqtt_broker = 'localhost' if on_pi else 'NAME_YOUR_BROKER_WHEN_IN_SIMULATION_MODE_HERE' +# DEFINE THE SUFFIX TO ADD TO YOUR LOGS FILES +logging_suffix = '' + +# OhmPi configuration +OHMPI_CONFIG = { + 'id': ohmpi_id, # Unique identifier of the OhmPi board (string) + 'settings': 'ohmpi_settings.json', # INSERT YOUR FAVORITE SETTINGS FILE HERE +} + +HARDWARE_CONFIG = { + 'ctl': {'model': 'raspberry_pi'}, + 'pwr': {'model': 'pwr_batt', 'voltage': 12., 'interface_name': 'none'}, + 'tx': {'model': 'mb_2023_0_X', + 'voltage_max': 12., # Maximum voltage supported by the TX board [V] + 'adc_voltage_max': 4800., # Maximum voltage read by the current ADC on the TX board [mA] + 'r_shunt': 2., # Shunt resistance in Ohms + 'interface_name': 'i2c', + }, + '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': # 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_02': + {'model': 'mux_2024_0_X', + 'tca_address': None, + 'tca_channel': 0, + 'addr2': 'up', + 'addr1': 'up', + # 'mcp_0': '0x26', + # 'mcp_1': '0x27', + 'roles': {'A': 'X', 'B': 'Y', 'M': 'XX', 'N': 'YY'}, + 'cabling': {(i+8, j): ('mux_02', i) for j in ['A', 'B', 'M', 'N'] for i in range(1, 9)}, + 'voltage_max': 50.}, + 'mux_03': + {'model': 'mux_2024_0_X', + 'tca_address': None, + 'tca_channel': 0, + 'addr2': 'down', + 'addr1': 'up', + # 'mcp_0': '0x26', + # 'mcp_1': '0x27', + 'roles': {'A': 'X', 'B': 'Y', 'M': 'XX', 'N': 'YY'}, + 'cabling': {(i+16, j): ('mux_03', i) for j in ['A', 'B', 'M', 'N'] for i in range(1, 9)}, + 'voltage_max': 50.}, + 'mux_05': + {'model': 'mux_2024_0_X', + 'tca_address': None, + 'tca_channel': 0, + 'addr2': 'up', + 'addr1': 'down', + 'roles': {'A': 'X', 'B': 'Y', 'M': 'XX', 'N': 'YY'}, + 'cabling': {(i+0, j): ('mux_05', i) for j in ['A', 'B', 'M', 'N'] for i in range(1, 9)}, + 'voltage_max': 50.}, + }, + 'default': {'interface_name': 'i2c', + 'voltage_max': 100., + '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.DEBUG, # TODO: set logging level back to INFO + 'log_file_logging_level': logging.DEBUG, + 'logging_to_console': True, + 'file_name': f'exec{logging_suffix}.log', + 'max_bytes': 262144, + 'backup_count': 30, + 'when': 'd', + 'interval': 1 +} + +# Data logging configuration +DATA_LOGGING_CONFIG = { + 'logging_level': logging.INFO, + 'logging_to_console': True, + 'file_name': f'data{logging_suffix}.log', + 'max_bytes': 16777216, + 'backup_count': 1024, + 'when': 'd', + 'interval': 1 +} + +# State of Health logging configuration (For a future release) +SOH_LOGGING_CONFIG = { + 'logging_level': logging.INFO, + 'logging_to_console': True, + 'log_file_logging_level': logging.DEBUG, + 'file_name': f'soh{logging_suffix}.log', + 'max_bytes': 16777216, + 'backup_count': 1024, + 'when': 'd', + 'interval': 1 +} + +# MQTT logging configuration parameters +MQTT_LOGGING_CONFIG = { + 'hostname': mqtt_broker, + 'port': 1883, + 'qos': 2, + 'retain': False, + 'keepalive': 60, + 'will': None, + 'auth': {'username': 'mqtt_user', 'password': 'mqtt_password'}, + 'tls': None, + 'protocol': MQTTv31, + 'transport': 'tcp', + 'client_id': f'{OHMPI_CONFIG["id"]}', + 'exec_topic': f'ohmpi_{OHMPI_CONFIG["id"]}/exec', + 'exec_logging_level': logging.DEBUG, + 'data_topic': f'ohmpi_{OHMPI_CONFIG["id"]}/data', + 'data_logging_level': DATA_LOGGING_CONFIG['logging_level'], + 'soh_topic': f'ohmpi_{OHMPI_CONFIG["id"]}/soh', + 'soh_logging_level': SOH_LOGGING_CONFIG['logging_level'] +} + +# MQTT control configuration parameters +MQTT_CONTROL_CONFIG = { + 'hostname': mqtt_broker, + 'port': 1883, + 'qos': 2, + 'retain': False, + 'keepalive': 60, + 'will': None, + 'auth': {'username': 'mqtt_user', 'password': 'mqtt_password'}, + 'tls': None, + 'protocol': MQTTv31, + 'transport': 'tcp', + 'client_id': f'{OHMPI_CONFIG["id"]}', + 'ctrl_topic': f'ohmpi_{OHMPI_CONFIG["id"]}/ctrl' +} -- GitLab