diff --git a/configs/config_mb_2024_0_2__1_mux_2024_4roles_dph5005.py b/configs/config_mb_2024_0_2__1_mux_2024_4roles_dph5005.py index c3fb537eba8e6a73a7f94ecedb9e548b73c54cf7..0842b8ef2567b7096f0451dcd7fc1935138806a7 100644 --- a/configs/config_mb_2024_0_2__1_mux_2024_4roles_dph5005.py +++ b/configs/config_mb_2024_0_2__1_mux_2024_4roles_dph5005.py @@ -25,7 +25,7 @@ r_shunt = 2. HARDWARE_CONFIG = { 'ctl': {'model': 'raspberry_pi'}, - 'pwr': {'model': 'pwr_dph5005', 'voltage': 3., 'interface_name': 'modbus'}, + 'pwr': {'model': 'pwr_dph5005', 'voltage': 2., 'interface_name': 'modbus'}, 'tx': {'model': 'mb_2024_0_2', '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] diff --git a/configs/config_mb_2024_0_2__2_mux_2024_2roles_dph5005.py b/configs/config_mb_2024_0_2__2_mux_2024_2roles_dph5005.py index 611b62807df840724cb3dbd19d15d4863c259845..a1921a23c65269050aaf6b89928194328793e686 100644 --- a/configs/config_mb_2024_0_2__2_mux_2024_2roles_dph5005.py +++ b/configs/config_mb_2024_0_2__2_mux_2024_2roles_dph5005.py @@ -25,7 +25,7 @@ r_shunt = 2. HARDWARE_CONFIG = { 'ctl': {'model': 'raspberry_pi'}, - 'pwr': {'model': 'pwr_dph5005', 'voltage': 3., 'interface_name': 'modbus'}, + 'pwr': {'model': 'pwr_dph5005', 'voltage': 2., 'interface_name': 'modbus'}, 'tx': {'model': 'mb_2024_0_2', '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] diff --git a/configs/config_mb_2024_0_2__2_mux_2024_4roles_dph5005.py b/configs/config_mb_2024_0_2__2_mux_2024_4roles_dph5005.py index ab63fb42f09224483e01c650be6ee226e9bb02f2..c4e013e1da2209c8f48d85ed5a515374cb5a9d57 100644 --- a/configs/config_mb_2024_0_2__2_mux_2024_4roles_dph5005.py +++ b/configs/config_mb_2024_0_2__2_mux_2024_4roles_dph5005.py @@ -25,7 +25,7 @@ r_shunt = 2. HARDWARE_CONFIG = { 'ctl': {'model': 'raspberry_pi'}, - 'pwr': {'model': 'pwr_dph5005', 'voltage': 3., 'interface_name': 'modbus'}, + 'pwr': {'model': 'pwr_dph5005', 'voltage': 2., 'interface_name': 'modbus'}, 'tx': {'model': 'mb_2024_0_2', '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] diff --git a/configs/config_mb_2024_0_2__3_mux_2024_4roles_dph5005.py b/configs/config_mb_2024_0_2__3_mux_2024_4roles_dph5005.py index 04a57854295e728cbf2e98464bc8ac21e40ed448..e0d5ea3818b5abfbdefaaf1a4ee482bd3cf975b9 100644 --- a/configs/config_mb_2024_0_2__3_mux_2024_4roles_dph5005.py +++ b/configs/config_mb_2024_0_2__3_mux_2024_4roles_dph5005.py @@ -25,7 +25,7 @@ r_shunt = 2. HARDWARE_CONFIG = { 'ctl': {'model': 'raspberry_pi'}, - 'pwr': {'model': 'pwr_dph5005', 'voltage': 3., 'interface_name': 'modbus'}, + 'pwr': {'model': 'pwr_dph5005', 'voltage': 2., 'interface_name': 'modbus'}, 'tx': {'model': 'mb_2024_0_2', '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] diff --git a/configs/config_mb_2024_0_2__4_mux_2023_dph5005.py b/configs/config_mb_2024_0_2__4_mux_2023_dph5005.py index 1d2fd7d9f5ec64b778d61b8f6fba7101808f85be..a05c4c6dbfed5066f421657dffc2e644e1720de7 100644 --- a/configs/config_mb_2024_0_2__4_mux_2023_dph5005.py +++ b/configs/config_mb_2024_0_2__4_mux_2023_dph5005.py @@ -25,7 +25,7 @@ r_shunt = 2. HARDWARE_CONFIG = { 'ctl': {'model': 'raspberry_pi'}, - 'pwr': {'model': 'pwr_dph5005', 'voltage': 3., 'interface_name': 'modbus'}, + 'pwr': {'model': 'pwr_dph5005', 'voltage': 2., 'interface_name': 'modbus'}, 'tx': {'model': 'mb_2024_0_2', '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] diff --git a/configs/config_mb_2024_0_2__4_mux_2024_2roles_dph5005.py b/configs/config_mb_2024_0_2__4_mux_2024_2roles_dph5005.py index 72711b9f26aa495f6ccad6ea9857a88827ae9f96..ca687bf62e9acaead53bd68dad90f8d54ee1a3b0 100644 --- a/configs/config_mb_2024_0_2__4_mux_2024_2roles_dph5005.py +++ b/configs/config_mb_2024_0_2__4_mux_2024_2roles_dph5005.py @@ -25,7 +25,7 @@ r_shunt = 2. HARDWARE_CONFIG = { 'ctl': {'model': 'raspberry_pi'}, - 'pwr': {'model': 'pwr_dph5005', 'voltage': 3., 'interface_name': 'modbus'}, + 'pwr': {'model': 'pwr_dph5005', 'voltage': 2., 'interface_name': 'modbus'}, 'tx': {'model': 'mb_2024_0_2', '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] diff --git a/configs/config_mb_2024_0_2__4_mux_2024_4roles_dph5005.py b/configs/config_mb_2024_0_2__4_mux_2024_4roles_dph5005.py index 34eac8fb510023e908b371879211e1e6976710b6..94c4d18dfc400527649229e7f98f87306eedcf8d 100644 --- a/configs/config_mb_2024_0_2__4_mux_2024_4roles_dph5005.py +++ b/configs/config_mb_2024_0_2__4_mux_2024_4roles_dph5005.py @@ -25,7 +25,7 @@ r_shunt = 2. HARDWARE_CONFIG = { 'ctl': {'model': 'raspberry_pi'}, - 'pwr': {'model': 'pwr_dph5005', 'voltage': 3., 'interface_name': 'modbus'}, + 'pwr': {'model': 'pwr_dph5005', 'voltage': 2., 'interface_name': 'modbus'}, 'tx': {'model': 'mb_2024_0_2', '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] diff --git a/configs/config_mb_2024_0_2_dph5005.py b/configs/config_mb_2024_0_2_dph5005.py index bbf1437c065fdec79292993a6eacf9a5030bc3fb..751536764619951ded351929acd71ef598cca9b3 100644 --- a/configs/config_mb_2024_0_2_dph5005.py +++ b/configs/config_mb_2024_0_2_dph5005.py @@ -25,7 +25,7 @@ r_shunt = 2. HARDWARE_CONFIG = { 'ctl': {'model': 'raspberry_pi'}, - 'pwr': {'model': 'pwr_dph5005', 'voltage': 3., 'interface_name': 'modbus'}, + 'pwr': {'model': 'pwr_dph5005', 'voltage': 2., 'interface_name': 'modbus'}, 'tx': {'model': 'mb_2024_0_2', '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] diff --git a/configs/config_mb_2024_1_X.py b/configs/config_mb_2024_1_X.py new file mode 100644 index 0000000000000000000000000000000000000000..014b125737e2a52aecc4d908275a9c0f6e6030be --- /dev/null +++ b/configs/config_mb_2024_1_X.py @@ -0,0 +1,116 @@ +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 +} + +r_shunt = 2. + +# default properties of system components that will be +# overwritten by properties defined in each the board dict below. +# if bounds are 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 + +HARDWARE_CONFIG = { + 'ctl': {'model': 'raspberry_pi'}, + 'pwr': {'model': 'pwr_batt', 'voltage': 12., 'interface_name': 'none'}, + 'tx': {'model': 'mb_2024_1_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', + 'vmn_hardware_offset': 2500. + }, + 'rx': {'model': 'mb_2024_1_X', + 'latency': 0.010, # latency in seconds in continuous mode + 'sampling_rate': 200, # number of samples per second + 'interface_name': 'i2c', + }, + 'mux': {'boards': {}, + 'default': {} + } +} +# SET THE LOGGING LEVELS, MQTT BROKERS AND MQTT OPTIONS ACCORDING TO YOUR NEEDS +# Execution logging configuration +EXEC_LOGGING_CONFIG = { + 'logging_level': logging.INFO, + 'log_file_logging_level': logging.INFO, + 'logging_to_console': True, + 'file_name': f'exec{logging_suffix}.log', + 'max_bytes': 2097152, + '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.INFO, + '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': EXEC_LOGGING_CONFIG['logging_level'], + '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' +} diff --git a/configs/config_mb_2024_1_X__1_mux_2024_4roles.py b/configs/config_mb_2024_1_X__1_mux_2024_4roles.py new file mode 100644 index 0000000000000000000000000000000000000000..6f910345460fa7343f2395795cb04e6db972ba01 --- /dev/null +++ b/configs/config_mb_2024_1_X__1_mux_2024_4roles.py @@ -0,0 +1,127 @@ +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 +} + +r_shunt = 2. + +# default properties of system components that will be +# overwritten by properties defined in each the board dict below. +# if bounds are 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 + +HARDWARE_CONFIG = { + 'ctl': {'model': 'raspberry_pi'}, + 'pwr': {'model': 'pwr_batt', 'voltage': 12., 'interface_name': 'none'}, + 'tx': {'model': 'mb_2024_1_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', + 'vmn_hardware_offset': 2500. + }, + 'rx': {'model': 'mb_2024_1_X', + 'latency': 0.010, # latency in seconds in continuous mode + 'sampling_rate': 200, # number of samples per second + 'interface_name': 'i2c', + }, + 'mux': {'boards': + {'mux_01': + {'model': 'mux_2024_0_X', + 'electrodes': range(1, 9), + 'roles': ['A', 'B', 'M', 'N'], + 'addr1': 'up', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0,}, + }, + 'default': {'interface_name': 'i2c_ext', + 'voltage_max': 50., + '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, + 'log_file_logging_level': logging.INFO, + 'logging_to_console': True, + 'file_name': f'exec{logging_suffix}.log', + 'max_bytes': 2097152, + '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.INFO, + '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': EXEC_LOGGING_CONFIG['logging_level'], + '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' +} diff --git a/configs/config_mb_2024_1_X__1_mux_2024_4roles_dph5005.py b/configs/config_mb_2024_1_X__1_mux_2024_4roles_dph5005.py new file mode 100644 index 0000000000000000000000000000000000000000..06c0d6a6aed121e3c0e6c90514e152ba11281b2b --- /dev/null +++ b/configs/config_mb_2024_1_X__1_mux_2024_4roles_dph5005.py @@ -0,0 +1,127 @@ +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 +} + +r_shunt = 2. + +# default properties of system components that will be +# overwritten by properties defined in each the board dict below. +# if bounds are 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 + +HARDWARE_CONFIG = { + 'ctl': {'model': 'raspberry_pi'}, + 'pwr': {'model': 'pwr_dph5005', 'voltage': 2., 'interface_name': 'modbus'}, + 'tx': {'model': 'mb_2024_1_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', + 'vmn_hardware_offset': 2500. + }, + 'rx': {'model': 'mb_2024_1_X', + 'latency': 0.010, # latency in seconds in continuous mode + 'sampling_rate': 200, # number of samples per second + 'interface_name': 'i2c', + }, + 'mux': {'boards': + {'mux_01': + {'model': 'mux_2024_0_X', + 'electrodes': range(1, 9), + 'roles': ['A', 'B', 'M', 'N'], + 'addr1': 'up', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0,}, + }, + 'default': {'interface_name': 'i2c_ext', + 'voltage_max': 50., + '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, + 'log_file_logging_level': logging.INFO, + 'logging_to_console': True, + 'file_name': f'exec{logging_suffix}.log', + 'max_bytes': 2097152, + '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.INFO, + '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': EXEC_LOGGING_CONFIG['logging_level'], + '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' +} diff --git a/configs/config_mb_2024_1_X__2_mux_2024_2roles.py b/configs/config_mb_2024_1_X__2_mux_2024_2roles.py new file mode 100644 index 0000000000000000000000000000000000000000..4cfe1ab439dae12c33d02476b0d6af9761531793 --- /dev/null +++ b/configs/config_mb_2024_1_X__2_mux_2024_2roles.py @@ -0,0 +1,137 @@ +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 +} + +r_shunt = 2. + +# default properties of system components that will be +# overwritten by properties defined in each the board dict below. +# if bounds are 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 + +HARDWARE_CONFIG = { + 'ctl': {'model': 'raspberry_pi'}, + 'pwr': {'model': 'pwr_batt', 'voltage': 12., 'interface_name': 'none'}, + 'tx': {'model': 'mb_2024_1_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', + 'vmn_hardware_offset': 2500. + }, + 'rx': {'model': 'mb_2024_1_X', + 'latency': 0.010, # latency in seconds in continuous mode + 'sampling_rate': 200, # number of samples per second + 'interface_name': 'i2c', + }, + 'mux': {'boards': + {'mux_01': + {'model': 'mux_2024_0_X', + 'roles': ['A', 'B'], + 'electrodes': range(1, 17), + 'addr1': 'up', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0, + }, + 'mux_02': + {'model': 'mux_2024_0_X', + 'roles': ['M', 'N'], + 'electrodes': range(1, 17), + 'addr1': 'down', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0, + }, + }, + 'default': {'interface_name': 'i2c_ext', + 'voltage_max': 50., + '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, + 'log_file_logging_level': logging.INFO, + 'logging_to_console': True, + 'file_name': f'exec{logging_suffix}.log', + 'max_bytes': 2097152, + '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.INFO, + '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': EXEC_LOGGING_CONFIG['logging_level'], + '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' +} diff --git a/configs/config_mb_2024_1_X__2_mux_2024_2roles_dph5005.py b/configs/config_mb_2024_1_X__2_mux_2024_2roles_dph5005.py new file mode 100644 index 0000000000000000000000000000000000000000..09d7419e429d0ce6fdbda88aaeb3edcec6226dea --- /dev/null +++ b/configs/config_mb_2024_1_X__2_mux_2024_2roles_dph5005.py @@ -0,0 +1,137 @@ +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 +} + +r_shunt = 2. + +# default properties of system components that will be +# overwritten by properties defined in each the board dict below. +# if bounds are 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 + +HARDWARE_CONFIG = { + 'ctl': {'model': 'raspberry_pi'}, + 'pwr': {'model': 'pwr_dph5005', 'voltage': 2., 'interface_name': 'modbus'}, + 'tx': {'model': 'mb_2024_1_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', + 'vmn_hardware_offset': 2500. + }, + 'rx': {'model': 'mb_2024_1_X', + 'latency': 0.010, # latency in seconds in continuous mode + 'sampling_rate': 200, # number of samples per second + 'interface_name': 'i2c', + }, + 'mux': {'boards': + {'mux_01': + {'model': 'mux_2024_0_X', + 'roles': ['A', 'B'], + 'electrodes': range(1, 17), + 'addr1': 'up', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0, + }, + 'mux_02': + {'model': 'mux_2024_0_X', + 'roles': ['M', 'N'], + 'electrodes': range(1, 17), + 'addr1': 'down', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0, + }, + }, + 'default': {'interface_name': 'i2c_ext', + 'voltage_max': 50., + '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, + 'log_file_logging_level': logging.INFO, + 'logging_to_console': True, + 'file_name': f'exec{logging_suffix}.log', + 'max_bytes': 2097152, + '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.INFO, + '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': EXEC_LOGGING_CONFIG['logging_level'], + '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' +} diff --git a/configs/config_mb_2024_1_X__2_mux_2024_4roles.py b/configs/config_mb_2024_1_X__2_mux_2024_4roles.py new file mode 100644 index 0000000000000000000000000000000000000000..8c2d94cee8164fe088c64485007a4d5f599f7600 --- /dev/null +++ b/configs/config_mb_2024_1_X__2_mux_2024_4roles.py @@ -0,0 +1,135 @@ +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 +} + +r_shunt = 2. + +# default properties of system components that will be +# overwritten by properties defined in each the board dict below. +# if bounds are 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 + +HARDWARE_CONFIG = { + 'ctl': {'model': 'raspberry_pi'}, + 'pwr': {'model': 'pwr_batt', 'voltage': 12., 'interface_name': 'none'}, + 'tx': {'model': 'mb_2024_1_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', + 'vmn_hardware_offset': 2500. + }, + 'rx': {'model': 'mb_2024_1_X', + 'latency': 0.010, # latency in seconds in continuous mode + 'sampling_rate': 200, # number of samples per second + 'interface_name': 'i2c', + }, + 'mux': {'boards': + {'mux_01': + {'model': 'mux_2024_0_X', + 'electrodes': range(1, 9), + 'roles': ['A', 'B', 'M', 'N'], + 'addr1': 'up', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0,}, + 'mux_02': + {'model': 'mux_2024_0_X', + 'electrodes': range(9, 17), + 'roles': ['A', 'B', 'M', 'N'], + 'addr1': 'down', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0,}, + }, + 'default': {'interface_name': 'i2c_ext', + 'voltage_max': 50., + '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, + 'log_file_logging_level': logging.INFO, + 'logging_to_console': True, + 'file_name': f'exec{logging_suffix}.log', + 'max_bytes': 2097152, + '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.INFO, + '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': EXEC_LOGGING_CONFIG['logging_level'], + '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' +} diff --git a/configs/config_mb_2024_1_X__2_mux_2024_4roles_dph5005.py b/configs/config_mb_2024_1_X__2_mux_2024_4roles_dph5005.py new file mode 100644 index 0000000000000000000000000000000000000000..a1f07f1f09019517f01b667d22d05424f5e2873f --- /dev/null +++ b/configs/config_mb_2024_1_X__2_mux_2024_4roles_dph5005.py @@ -0,0 +1,135 @@ +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 +} + +r_shunt = 2. + +# default properties of system components that will be +# overwritten by properties defined in each the board dict below. +# if bounds are 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 + +HARDWARE_CONFIG = { + 'ctl': {'model': 'raspberry_pi'}, + 'pwr': {'model': 'pwr_dph5005', 'voltage': 2., 'interface_name': 'modbus'}, + 'tx': {'model': 'mb_2024_1_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', + 'vmn_hardware_offset': 2500. + }, + 'rx': {'model': 'mb_2024_1_X', + 'latency': 0.010, # latency in seconds in continuous mode + 'sampling_rate': 200, # number of samples per second + 'interface_name': 'i2c', + }, + 'mux': {'boards': + {'mux_01': + {'model': 'mux_2024_0_X', + 'electrodes': range(1, 9), + 'roles': ['A', 'B', 'M', 'N'], + 'addr1': 'up', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0,}, + 'mux_02': + {'model': 'mux_2024_0_X', + 'electrodes': range(9, 17), + 'roles': ['A', 'B', 'M', 'N'], + 'addr1': 'down', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0,}, + }, + 'default': {'interface_name': 'i2c_ext', + 'voltage_max': 50., + '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, + 'log_file_logging_level': logging.INFO, + 'logging_to_console': True, + 'file_name': f'exec{logging_suffix}.log', + 'max_bytes': 2097152, + '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.INFO, + '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': EXEC_LOGGING_CONFIG['logging_level'], + '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' +} diff --git a/configs/config_mb_2024_1_X__3_mux_2024_4roles.py b/configs/config_mb_2024_1_X__3_mux_2024_4roles.py new file mode 100644 index 0000000000000000000000000000000000000000..c1552914010b84cef5a6064606c27f24e2a7c8b9 --- /dev/null +++ b/configs/config_mb_2024_1_X__3_mux_2024_4roles.py @@ -0,0 +1,143 @@ +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 +} + +r_shunt = 2. + +# default properties of system components that will be +# overwritten by properties defined in each the board dict below. +# if bounds are 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 + +HARDWARE_CONFIG = { + 'ctl': {'model': 'raspberry_pi'}, + 'pwr': {'model': 'pwr_batt', 'voltage': 12., 'interface_name': 'none'}, + 'tx': {'model': 'mb_2024_1_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', + 'vmn_hardware_offset': 2500. + }, + 'rx': {'model': 'mb_2024_1_X', + 'latency': 0.010, # latency in seconds in continuous mode + 'sampling_rate': 200, # number of samples per second + 'interface_name': 'i2c', + }, + 'mux': {'boards': + {'mux_01': + {'model': 'mux_2024_0_X', + 'electrodes': range(1, 9), + 'roles': ['A', 'B', 'M', 'N'], + 'addr1': 'up', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0,}, + 'mux_02': + {'model': 'mux_2024_0_X', + 'electrodes': range(9, 17), + 'roles': ['A', 'B', 'M', 'N'], + 'addr1': 'down', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0,}, + 'mux_03': + {'model': 'mux_2024_0_X', + 'electrodes': range(17, 25), + 'roles': ['A', 'B', 'M', 'N'], + 'addr1': 'up', + 'addr2': 'down', + 'tca_address': None, + 'tca_channel': 0,}, + }, + 'default': {'interface_name': 'i2c_ext', + 'voltage_max': 50., + '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, + 'log_file_logging_level': logging.INFO, + 'logging_to_console': True, + 'file_name': f'exec{logging_suffix}.log', + 'max_bytes': 2097152, + '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.INFO, + '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': EXEC_LOGGING_CONFIG['logging_level'], + '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' +} diff --git a/configs/config_mb_2024_1_X__3_mux_2024_4roles_dph5005.py b/configs/config_mb_2024_1_X__3_mux_2024_4roles_dph5005.py new file mode 100644 index 0000000000000000000000000000000000000000..49355f828ab928e7d14009bbe85f192512b9f20c --- /dev/null +++ b/configs/config_mb_2024_1_X__3_mux_2024_4roles_dph5005.py @@ -0,0 +1,143 @@ +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 +} + +r_shunt = 2. + +# default properties of system components that will be +# overwritten by properties defined in each the board dict below. +# if bounds are 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 + +HARDWARE_CONFIG = { + 'ctl': {'model': 'raspberry_pi'}, + 'pwr': {'model': 'pwr_dph5005', 'voltage': 2., 'interface_name': 'modbus'}, + 'tx': {'model': 'mb_2024_1_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', + 'vmn_hardware_offset': 2500. + }, + 'rx': {'model': 'mb_2024_1_X', + 'latency': 0.010, # latency in seconds in continuous mode + 'sampling_rate': 200, # number of samples per second + 'interface_name': 'i2c', + }, + 'mux': {'boards': + {'mux_01': + {'model': 'mux_2024_0_X', + 'electrodes': range(1, 9), + 'roles': ['A', 'B', 'M', 'N'], + 'addr1': 'up', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0,}, + 'mux_02': + {'model': 'mux_2024_0_X', + 'electrodes': range(9, 17), + 'roles': ['A', 'B', 'M', 'N'], + 'addr1': 'down', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0,}, + 'mux_03': + {'model': 'mux_2024_0_X', + 'electrodes': range(17, 25), + 'roles': ['A', 'B', 'M', 'N'], + 'addr1': 'up', + 'addr2': 'down', + 'tca_address': None, + 'tca_channel': 0,}, + }, + 'default': {'interface_name': 'i2c_ext', + 'voltage_max': 50., + '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, + 'log_file_logging_level': logging.INFO, + 'logging_to_console': True, + 'file_name': f'exec{logging_suffix}.log', + 'max_bytes': 2097152, + '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.INFO, + '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': EXEC_LOGGING_CONFIG['logging_level'], + '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' +} diff --git a/configs/config_mb_2024_1_X__4_mux_2023.py b/configs/config_mb_2024_1_X__4_mux_2023.py new file mode 100644 index 0000000000000000000000000000000000000000..d8fba77a10356b9f4a9c85bdc4e3c2a1aa9d103b --- /dev/null +++ b/configs/config_mb_2024_1_X__4_mux_2023.py @@ -0,0 +1,143 @@ +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 +} + +r_shunt = 2. + +# default properties of system components that will be +# overwritten by properties defined in each the board dict below. +# if bounds are 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 + +HARDWARE_CONFIG = { + 'ctl': {'model': 'raspberry_pi'}, + 'pwr': {'model': 'pwr_batt', 'voltage': 12., 'interface_name': 'none'}, + 'tx': {'model': 'mb_2024_1_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', + 'vmn_hardware_offset': 2500. + }, + 'rx': {'model': 'mb_2024_1_X', + 'latency': 0.010, # latency in seconds in continuous mode + 'sampling_rate': 200, # number of samples per second + 'interface_name': 'i2c', + }, + 'mux': {'boards': + {'mux_A': + {'model': 'mux_2023_0_X', + 'mux_tca_address': 0x70, + 'roles': 'A', + 'electrodes': range(1, 65), + }, + 'mux_B': + {'model': 'mux_2023_0_X', + 'mux_tca_address': 0x71, + 'roles': 'B', + 'electrodes': range(1, 65), + }, + 'mux_M': + {'model': 'mux_2023_0_X', + 'mux_tca_address': 0x72, + 'roles': 'M', + 'electrodes': range(1, 65), + }, + 'mux_N': + {'model': 'mux_2023_0_X', + 'mux_tca_address': 0x73, + 'roles': 'N', + 'electrodes': range(1, 65), + } + }, + 'default': {'interface_name': 'i2c_ext', + 'voltage_max': 50., + '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, + 'log_file_logging_level': logging.INFO, + 'logging_to_console': True, + 'file_name': f'exec{logging_suffix}.log', + 'max_bytes': 2097152, + '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.INFO, + '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': EXEC_LOGGING_CONFIG['logging_level'], + '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' +} diff --git a/configs/config_mb_2024_1_X__4_mux_2023_dph5005.py b/configs/config_mb_2024_1_X__4_mux_2023_dph5005.py new file mode 100644 index 0000000000000000000000000000000000000000..3de1a48bbccd5d5851c95967dc88ec213ac62d92 --- /dev/null +++ b/configs/config_mb_2024_1_X__4_mux_2023_dph5005.py @@ -0,0 +1,143 @@ +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 +} + +r_shunt = 2. + +# default properties of system components that will be +# overwritten by properties defined in each the board dict below. +# if bounds are 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 + +HARDWARE_CONFIG = { + 'ctl': {'model': 'raspberry_pi'}, + 'pwr': {'model': 'pwr_dph5005', 'voltage': 2., 'interface_name': 'modbus'}, + 'tx': {'model': 'mb_2024_1_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', + 'vmn_hardware_offset': 2500. + }, + 'rx': {'model': 'mb_2024_1_X', + 'latency': 0.010, # latency in seconds in continuous mode + 'sampling_rate': 200, # number of samples per second + 'interface_name': 'i2c', + }, + 'mux': {'boards': + {'mux_A': + {'model': 'mux_2023_0_X', + 'mux_tca_address': 0x70, + 'roles': 'A', + 'electrodes': range(1, 65), + }, + 'mux_B': + {'model': 'mux_2023_0_X', + 'mux_tca_address': 0x71, + 'roles': 'B', + 'electrodes': range(1, 65), + }, + 'mux_M': + {'model': 'mux_2023_0_X', + 'mux_tca_address': 0x72, + 'roles': 'M', + 'electrodes': range(1, 65), + }, + 'mux_N': + {'model': 'mux_2023_0_X', + 'mux_tca_address': 0x73, + 'roles': 'N', + 'electrodes': range(1, 65), + } + }, + 'default': {'interface_name': 'i2c_ext', + 'voltage_max': 50., + '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, + 'log_file_logging_level': logging.INFO, + 'logging_to_console': True, + 'file_name': f'exec{logging_suffix}.log', + 'max_bytes': 2097152, + '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.INFO, + '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': EXEC_LOGGING_CONFIG['logging_level'], + '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' +} diff --git a/configs/config_mb_2024_1_X__4_mux_2024_2roles.py b/configs/config_mb_2024_1_X__4_mux_2024_2roles.py new file mode 100644 index 0000000000000000000000000000000000000000..5a4c490a3c11edae65aff8972a6d22d2c253d002 --- /dev/null +++ b/configs/config_mb_2024_1_X__4_mux_2024_2roles.py @@ -0,0 +1,154 @@ +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 +} + +r_shunt = 2. + +# default properties of system components that will be +# overwritten by properties defined in each the board dict below. +# if bounds are 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 + +HARDWARE_CONFIG = { + 'ctl': {'model': 'raspberry_pi'}, + 'pwr': {'model': 'pwr_batt', 'voltage': 12., 'interface_name': 'none'}, + 'tx': {'model': 'mb_2024_1_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', + 'vmn_hardware_offset': 2500. + }, + 'rx': {'model': 'mb_2024_1_X', + 'latency': 0.010, # latency in seconds in continuous mode + 'sampling_rate': 200, # number of samples per second + 'interface_name': 'i2c', + }, + 'mux': {'boards': + {'mux_01': + {'model': 'mux_2024_0_X', + 'roles': ['A', 'B'], + 'electrodes': range(1, 17), + 'addr1': 'up', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0, + }, + 'mux_02': + {'model': 'mux_2024_0_X', + 'roles': ['M', 'N'], + 'electrodes': range(1, 17), + 'addr1': 'down', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0, + }, + 'mux_03': + {'model': 'mux_2024_0_X', + 'roles': ['A', 'B'], + 'electrodes': range(17, 33), + 'addr1': 'up', + 'addr2': 'down', + 'tca_address': None, + 'tca_channel': 0,}, + 'mux_04': + {'model': 'mux_2024_0_X', + 'roles': ['M', 'N'], + 'electrodes': range(17, 33), + 'addr1': 'down', + 'addr2': 'down', + 'tca_address': None, + 'tca_channel': 0, + } + }, + 'default': {'interface_name': 'i2c_ext', + 'voltage_max': 50., + '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, + 'log_file_logging_level': logging.INFO, + 'logging_to_console': True, + 'file_name': f'exec{logging_suffix}.log', + 'max_bytes': 2097152, + '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.INFO, + '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': EXEC_LOGGING_CONFIG['logging_level'], + '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' +} diff --git a/configs/config_mb_2024_1_X__4_mux_2024_2roles_dph5005.py b/configs/config_mb_2024_1_X__4_mux_2024_2roles_dph5005.py new file mode 100644 index 0000000000000000000000000000000000000000..52598b6ce38ed843a8b896b02cbfdb8e5d1efc4e --- /dev/null +++ b/configs/config_mb_2024_1_X__4_mux_2024_2roles_dph5005.py @@ -0,0 +1,154 @@ +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 +} + +r_shunt = 2. + +# default properties of system components that will be +# overwritten by properties defined in each the board dict below. +# if bounds are 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 + +HARDWARE_CONFIG = { + 'ctl': {'model': 'raspberry_pi'}, + 'pwr': {'model': 'pwr_dph5005', 'voltage': 2., 'interface_name': 'modbus'}, + 'tx': {'model': 'mb_2024_1_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', + 'vmn_hardware_offset': 2500. + }, + 'rx': {'model': 'mb_2024_1_X', + 'latency': 0.010, # latency in seconds in continuous mode + 'sampling_rate': 200, # number of samples per second + 'interface_name': 'i2c', + }, + 'mux': {'boards': + {'mux_01': + {'model': 'mux_2024_0_X', + 'roles': ['A', 'B'], + 'electrodes': range(1, 17), + 'addr1': 'up', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0, + }, + 'mux_02': + {'model': 'mux_2024_0_X', + 'roles': ['M', 'N'], + 'electrodes': range(1, 17), + 'addr1': 'down', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0, + }, + 'mux_03': + {'model': 'mux_2024_0_X', + 'roles': ['A', 'B'], + 'electrodes': range(17, 33), + 'addr1': 'up', + 'addr2': 'down', + 'tca_address': None, + 'tca_channel': 0,}, + 'mux_04': + {'model': 'mux_2024_0_X', + 'roles': ['M', 'N'], + 'electrodes': range(17, 33), + 'addr1': 'down', + 'addr2': 'down', + 'tca_address': None, + 'tca_channel': 0, + } + }, + 'default': {'interface_name': 'i2c_ext', + 'voltage_max': 50., + '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, + 'log_file_logging_level': logging.INFO, + 'logging_to_console': True, + 'file_name': f'exec{logging_suffix}.log', + 'max_bytes': 2097152, + '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.INFO, + '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': EXEC_LOGGING_CONFIG['logging_level'], + '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' +} diff --git a/configs/config_mb_2024_1_X__4_mux_2024_4roles.py b/configs/config_mb_2024_1_X__4_mux_2024_4roles.py new file mode 100644 index 0000000000000000000000000000000000000000..1fb27eee8c15999d5d89aa5a9fa9ec0b6db4b658 --- /dev/null +++ b/configs/config_mb_2024_1_X__4_mux_2024_4roles.py @@ -0,0 +1,151 @@ +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 +} + +r_shunt = 2. + +# default properties of system components that will be +# overwritten by properties defined in each the board dict below. +# if bounds are 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 + +HARDWARE_CONFIG = { + 'ctl': {'model': 'raspberry_pi'}, + 'pwr': {'model': 'pwr_batt', 'voltage': 12., 'interface_name': 'none'}, + 'tx': {'model': 'mb_2024_1_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', + 'vmn_hardware_offset': 2500. + }, + 'rx': {'model': 'mb_2024_1_X', + 'latency': 0.010, # latency in seconds in continuous mode + 'sampling_rate': 200, # number of samples per second + 'interface_name': 'i2c', + }, + 'mux': {'boards': + {'mux_01': + {'model': 'mux_2024_0_X', + 'electrodes': range(1, 9), + 'roles': ['A', 'B', 'M', 'N'], + 'addr1': 'up', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0,}, + 'mux_02': + {'model': 'mux_2024_0_X', + 'electrodes': range(9, 17), + 'roles': ['A', 'B', 'M', 'N'], + 'addr1': 'down', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0,}, + 'mux_03': + {'model': 'mux_2024_0_X', + 'electrodes': range(17, 25), + 'roles': ['A', 'B', 'M', 'N'], + 'addr1': 'up', + 'addr2': 'down', + 'tca_address': None, + 'tca_channel': 0,}, + 'mux_04': + {'model': 'mux_2024_0_X', + 'electrodes': range(25, 33), + 'roles': ['A', 'B', 'M', 'N'], + 'addr1': 'down', + 'addr2': 'down', + 'tca_address': None, + 'tca_channel': 0,}, + }, + 'default': {'interface_name': 'i2c_ext', + 'voltage_max': 50., + '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, + 'log_file_logging_level': logging.INFO, + 'logging_to_console': True, + 'file_name': f'exec{logging_suffix}.log', + 'max_bytes': 2097152, + '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.INFO, + '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': EXEC_LOGGING_CONFIG['logging_level'], + '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' +} diff --git a/configs/config_mb_2024_1_X__4_mux_2024_4roles_dph5005.py b/configs/config_mb_2024_1_X__4_mux_2024_4roles_dph5005.py new file mode 100644 index 0000000000000000000000000000000000000000..357f11f9cfbb6465871b204ad84adebb3ff674e1 --- /dev/null +++ b/configs/config_mb_2024_1_X__4_mux_2024_4roles_dph5005.py @@ -0,0 +1,151 @@ +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 +} + +r_shunt = 2. + +# default properties of system components that will be +# overwritten by properties defined in each the board dict below. +# if bounds are 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 + +HARDWARE_CONFIG = { + 'ctl': {'model': 'raspberry_pi'}, + 'pwr': {'model': 'pwr_dph5005', 'voltage': 2., 'interface_name': 'modbus'}, + 'tx': {'model': 'mb_2024_1_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', + 'vmn_hardware_offset': 2500. + }, + 'rx': {'model': 'mb_2024_1_X', + 'latency': 0.010, # latency in seconds in continuous mode + 'sampling_rate': 200, # number of samples per second + 'interface_name': 'i2c', + }, + 'mux': {'boards': + {'mux_01': + {'model': 'mux_2024_0_X', + 'electrodes': range(1, 9), + 'roles': ['A', 'B', 'M', 'N'], + 'addr1': 'up', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0,}, + 'mux_02': + {'model': 'mux_2024_0_X', + 'electrodes': range(9, 17), + 'roles': ['A', 'B', 'M', 'N'], + 'addr1': 'down', + 'addr2': 'up', + 'tca_address': None, + 'tca_channel': 0,}, + 'mux_03': + {'model': 'mux_2024_0_X', + 'electrodes': range(17, 25), + 'roles': ['A', 'B', 'M', 'N'], + 'addr1': 'up', + 'addr2': 'down', + 'tca_address': None, + 'tca_channel': 0,}, + 'mux_04': + {'model': 'mux_2024_0_X', + 'electrodes': range(25, 33), + 'roles': ['A', 'B', 'M', 'N'], + 'addr1': 'down', + 'addr2': 'down', + 'tca_address': None, + 'tca_channel': 0,}, + }, + 'default': {'interface_name': 'i2c_ext', + 'voltage_max': 50., + '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, + 'log_file_logging_level': logging.INFO, + 'logging_to_console': True, + 'file_name': f'exec{logging_suffix}.log', + 'max_bytes': 2097152, + '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.INFO, + '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': EXEC_LOGGING_CONFIG['logging_level'], + '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' +} diff --git a/configs/config_mb_2024_1_X_dph5005.py b/configs/config_mb_2024_1_X_dph5005.py new file mode 100644 index 0000000000000000000000000000000000000000..fdb92dc43d7471e73d63eb110604894e438e231d --- /dev/null +++ b/configs/config_mb_2024_1_X_dph5005.py @@ -0,0 +1,116 @@ +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 +} + +r_shunt = 2. + +# default properties of system components that will be +# overwritten by properties defined in each the board dict below. +# if bounds are 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 + +HARDWARE_CONFIG = { + 'ctl': {'model': 'raspberry_pi'}, + 'pwr': {'model': 'pwr_dph5005', 'voltage': 2., 'interface_name': 'modbus'}, + 'tx': {'model': 'mb_2024_1_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', + 'vmn_hardware_offset': 2500. + }, + 'rx': {'model': 'mb_2024_1_X', + 'latency': 0.010, # latency in seconds in continuous mode + 'sampling_rate': 200, # number of samples per second + 'interface_name': 'i2c', + }, + 'mux': {'boards': {}, + 'default': {} + } +} +# SET THE LOGGING LEVELS, MQTT BROKERS AND MQTT OPTIONS ACCORDING TO YOUR NEEDS +# Execution logging configuration +EXEC_LOGGING_CONFIG = { + 'logging_level': logging.INFO, + 'log_file_logging_level': logging.INFO, + 'logging_to_console': True, + 'file_name': f'exec{logging_suffix}.log', + 'max_bytes': 2097152, + '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.INFO, + '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': EXEC_LOGGING_CONFIG['logging_level'], + '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' +} diff --git a/ohmpi/hardware_components/mb_2024_1_X.py b/ohmpi/hardware_components/mb_2024_1_X.py index 93fd1fd1a29ea9bfb950eeec31b4b4b4bd49e20b..fad12d78ecc8ef00af247e14a5b91ce39a2e71c1 100644 --- a/ohmpi/hardware_components/mb_2024_1_X.py +++ b/ohmpi/hardware_components/mb_2024_1_X.py @@ -95,7 +95,6 @@ class Tx(Tx_mb_2024_0_2): def measuring(self, mode="off"): self._measuring = mode - def discharge_pwr(self, latency=None): if self.pwr.voltage_adjustable: if latency is None: @@ -115,6 +114,7 @@ class Tx(Tx_mb_2024_0_2): else: self.exec_logger.debug(f'Pwr discharge not supported by {self.pwr.model}') + class Rx(Rx_mb_2024_0_2): """RX Class""" def __init__(self, **kwargs): diff --git a/ohmpi/utils.py b/ohmpi/utils.py index 6b0d061b16c8aa69c7ccbf8b9707ff97edb7632a..c784e81dfcdcf9ae63c8db745462ed0ccbcab596 100644 --- a/ohmpi/utils.py +++ b/ohmpi/utils.py @@ -189,7 +189,21 @@ def generate_preset_configs(configs_to_generate=None): 'config_mb_2024_0_2__4_mux_2024_4roles.py', 'config_mb_2024_0_2__4_mux_2024_4roles_dph5005.py', 'config_mb_2024_0_2__4_mux_2024_2roles.py', - 'config_mb_2024_0_2__4_mux_2024_2roles_dph5005.py' + 'config_mb_2024_0_2__4_mux_2024_2roles_dph5005.py', + 'config_mb_2024_1_X.py', 'config_mb_2024_1_X_dph5005.py', + 'config_mb_2024_1_X__4_mux_2023.py', 'config_mb_2024_1_X__4_mux_2023_dph5005.py', + 'config_mb_2024_1_X__1_mux_2024_4roles.py', + 'config_mb_2024_1_X__1_mux_2024_4roles_dph5005.py', + 'config_mb_2024_1_X__2_mux_2024_4roles.py', + 'config_mb_2024_1_X__2_mux_2024_4roles_dph5005.py', + 'config_mb_2024_1_X__2_mux_2024_2roles.py', + 'config_mb_2024_1_X__2_mux_2024_2roles_dph5005.py', + 'config_mb_2024_1_X__3_mux_2024_4roles.py', + 'config_mb_2024_1_X__3_mux_2024_4roles_dph5005.py', + 'config_mb_2024_1_X__4_mux_2024_4roles.py', + 'config_mb_2024_1_X__4_mux_2024_4roles_dph5005.py', + 'config_mb_2024_1_X__4_mux_2024_2roles.py', + 'config_mb_2024_1_X__4_mux_2024_2roles_dph5005.py' ] header = """import logging @@ -223,9 +237,21 @@ HARDWARE_CONFIG = { r_shunt = 2. options = {'pwr': {'battery': """{'model': 'pwr_batt', 'voltage': 12., 'interface_name': 'none'},""", - 'dph5005': """{'model': 'pwr_dph5005', 'voltage': 3., 'interface_name': 'modbus'},""" + 'dph5005': """{'model': 'pwr_dph5005', 'voltage': 2., 'interface_name': 'modbus'},""" }, - 'mb': {'mb_2024_0_2': {'tx': """{'model': 'mb_2024_0_2', + 'mb': {'mb_2024_1_X': {'tx': """{'model': 'mb_2024_1_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', + 'vmn_hardware_offset': 2500. + }""", + 'rx': """{'model': 'mb_2024_1_X', + 'latency': 0.010, # latency in seconds in continuous mode + 'sampling_rate': 200, # number of samples per second + 'interface_name': 'i2c', + }"""}, + 'mb_2024_0_2': {'tx': """{'model': 'mb_2024_0_2', '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 @@ -351,6 +377,11 @@ HARDWARE_CONFIG = { 'current_max': 3.} }\n}\n""", 'mb_2024_0_2': """\n }, + 'default': {'interface_name': 'i2c_ext', + 'voltage_max': 50., + 'current_max': 3.} + }\n}\n""", + 'mb_2024_1_X': """\n }, 'default': {'interface_name': 'i2c_ext', 'voltage_max': 50., 'current_max': 3.} diff --git a/setup_config.py b/setup_config.py index 764fc1da8580110d70c8eb6d275113e85f9b3e79..6b6d56e4ee3dd3b4c5eab9f7c43442d1bf0488cf 100644 --- a/setup_config.py +++ b/setup_config.py @@ -5,7 +5,7 @@ check_r_shunt = True check_jumpers_msg = False print('This assistant helps you configure a basic system with a measurement board and from 0 to 4 mux of the same type.' '\nFor more complex configurations including a combination of mux boards with different types or roles, ' - 'please have a look in the configs folder for examples and write your customized configuration file.') + 'please read the docs and explore the configs folder for examples and write your customized configuration file.') mb = None while True: @@ -15,7 +15,7 @@ while True: mb = input('Choose a measurement boards: [v2023/v2024]: ') if mb == 'v2024': - mb = 'v2024_0_2_' + mb = 'v2024_1_X_' # NOTE: used to be set to mb_2024_0_2 by default mux = None while True: @@ -64,9 +64,6 @@ if os.path.exists('configs/' + config): print(f'Your configuration has been set. Your OhmPi id is set to {ohmpi_id}.') print(f'The configuration file is stored in ohmpi/config.py, a backup copy is stored in configs/config_backup.py') print('You should now carefully verify that the configuration file fits your hardware setup.\n') - if pwr != 'battery': - print("It is advised to set a temporary limit on injection voltage while conducting the initial tests." - " To do so, add 'voltage': 2. in the 'pwr' value of the HARDWARE_CONFIG dictionary in ohmpi.config.py") k = 1 if check_r_shunt: print(f'{k}. Check that the value of the shunt resistor value is {r_shunt} Ohm as stated in the config file.') @@ -79,20 +76,29 @@ if os.path.exists('configs/' + config): k += 1 print(f'\n{k}. If you experience problems while starting or operation your OhmPi, analyse the logs and/or try ' f'setting your the loggers "logging_level" to logging.DEBUG.') - k +=1 + k += 1 + print(f'\n{k}. Refer to the documentation for optional tests to conduct before using your instrument.') # print('\n' + '_'*100) # with open('ohmpi/config.py', mode='rt') as f: # for line in f.readlines(): # print(line, end='') # print('\n'+'_'*100) - print('\n'+'*' * 93) + print('\n' + '*' * 93) print('*** You may customize the configuration of your OhmPi by editing the ohmpi/config.py file ***') print('*** The MQTT communication can be encrypted with TLS/SSL but it is not set by default ***') print('*** You should then change the username and password used to connect to the mqtt broker ***') print('*** Make sure you understand what you are doing to avoid damaging to your system ***') print('*' * 93) - + if pwr != 'battery': + print('\n' + '#' * 93) + print('### WARNING - INJECTION VOLTAGE LIMITATION SET! ###') + print('### =========================================== ###') + print('### A limitation has been set on the injection voltage to conduct the initial tests. ###') + print('### To lift this voltage limitation, please edit your ohmpi/config.py (and backup) and ###') + print("### adapt or remove the 'voltage' specification in the 'pwr' ###") + print("### value of the HARDWARE_CONFIG dictionary. ###") + print('\n' + '#' * 93) else: print('The configuration you have selected cannot be set by this tool.\n' 'You probably requested a configuration that makes little sense in most cases.')