Commit 832a876d authored by Arnaud WATLET's avatar Arnaud WATLET
Browse files

updates test_contact_Resistance_board

Showing with 2 additions and 134 deletions
+2 -134
...@@ -11,10 +11,11 @@ k = OhmPi() ...@@ -11,10 +11,11 @@ k = OhmPi()
# Set or load sequence # Set or load sequence
sequence = np.array([np.array([1,2,3,4])+k for k in range(29)]) # [[1,2,3,4],[2,3,4,5]...] but can actually make other combinations of AB to increase number of contact resistance tested sequence = np.array([np.array([1,2,3,4])+k for k in range(29)]) # [[1,2,3,4],[2,3,4,5]...] but can actually make other combinations of AB to increase number of contact resistance tested
sequence = np.vstack([sequence,np.array([[30,31,1,2],[31,32,2,3]])]) sequence = np.vstack([sequence,np.array([[30,31,1,2],[31,32,2,3]])])
sequence = sequence[-4:]
k.sequence = contact_resistance_test_board(sequence) # checks if sequence contains potential shortcut quads (AB odd odd or even even) k.sequence = contact_resistance_test_board(sequence) # checks if sequence contains potential shortcut quads (AB odd odd or even even)
# Run contact resistance check # Run contact resistance check
k.rs_check() k.rs_check()
# Run sequence # Run sequence
k.run_sequence(strategy='vmax',vab="5.", vab_max='30', nb_stack=2, injection_duration=.5, duty_cycle=1.) k.run_sequence(strategy='vmax',vab=2., vab_max=5, nb_stack=2, injection_duration=.5, duty_cycle=1.)
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': 'settings/default.json', # INSERT YOUR FAVORITE SETTINGS FILE HERE
}
r_shunt = 2.
HARDWARE_CONFIG = {
'ctl': {'model': 'raspberry_pi'},
'pwr': {'model': 'pwr_dps5005', 'voltage': 3., '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]
'r_shunt': r_shunt, # Shunt resistance in Ohms
'interface_name': 'i2c'
},
'rx': {'model': 'mb_2024_0_2',
'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',
'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.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': 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'
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment