Commit 57221362 authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Updates the config.py settings for controller and upgrades ohmpi version

Showing with 27 additions and 10 deletions
+27 -10
...@@ -59,8 +59,24 @@ MQTT_LOGGING_CONFIG = { ...@@ -59,8 +59,24 @@ MQTT_LOGGING_CONFIG = {
'protocol': MQTTv31, 'protocol': MQTTv31,
'transport': 'tcp', 'transport': 'tcp',
'client_id': f'ohmpi_sn_{OHMPI_CONFIG["id"]}', 'client_id': f'ohmpi_sn_{OHMPI_CONFIG["id"]}',
'control_topic': f'ctrl_ohmpi_sn_{OHMPI_CONFIG["id"]}', 'ctrl_topic': f'ctrl_ohmpi_sn_{OHMPI_CONFIG["id"]}',
'exec_topic': f'exec_ohmpi_sn_{OHMPI_CONFIG["id"]}', 'exec_topic': f'exec_ohmpi_sn_{OHMPI_CONFIG["id"]}',
'data_topic': f'data_ohmpi_sn_{OHMPI_CONFIG["id"]}', 'data_topic': f'data_ohmpi_sn_{OHMPI_CONFIG["id"]}',
'soh_topic': f'soh_ohmpi_sn_{OHMPI_CONFIG["id"]}' 'soh_topic': f'soh_ohmpi_sn_{OHMPI_CONFIG["id"]}'
} }
# MQTT command configuration parameters
MQTT_CONTROL_CONFIG = {
'hostname': 'ohmpy.umons.ac.be',
'port': 1883,
'qos': 0,
'retain': False,
'keepalive': 60,
'will': None,
'auth': None,
'tls': None,
'protocol': MQTTv31,
'transport': 'tcp',
'client_id': f'ohmpi_sn_{OHMPI_CONFIG["id"]}',
'cmd_topic': f'cmd_ohmpi_sn_{OHMPI_CONFIG["id"]}'
}
\ No newline at end of file
In this folder will be logged all measurements done with the OhmPi as .csv.
...@@ -137,7 +137,7 @@ class OhmPi(object): ...@@ -137,7 +137,7 @@ class OhmPi(object):
self.exec_logger.debug('Acquisition parameters updated: ' + str(self.pardict)) self.exec_logger.debug('Acquisition parameters updated: ' + str(self.pardict))
def _read_hardware_parameters(self): def _read_hardware_parameters(self):
"""Read hardware parameters from settings.py. """Read hardware parameters from config.py
""" """
from config import OHMPI_CONFIG from config import OHMPI_CONFIG
self.id = OHMPI_CONFIG['id'] # ID of the OhmPi self.id = OHMPI_CONFIG['id'] # ID of the OhmPi
...@@ -161,7 +161,7 @@ class OhmPi(object): ...@@ -161,7 +161,7 @@ class OhmPi(object):
Parameters Parameters
---------- ----------
quads : 1D or 2D array quads : numpy.ndarray
List of quadrupoles of shape nquad x 4 or 1D vector of shape nquad. List of quadrupoles of shape nquad x 4 or 1D vector of shape nquad.
Returns Returns
...@@ -195,7 +195,11 @@ class OhmPi(object): ...@@ -195,7 +195,11 @@ class OhmPi(object):
@staticmethod @staticmethod
def get_platform(): def get_platform():
"""Get platform name and check if it is a raspberry pi""" """Get platform name and check if it is a raspberry pi
Returns
=======
str, bool
name of the platform on which the code is running, boolean that is true if the platform is a raspberry pi"""
platform = 'unknown' platform = 'unknown'
on_pi = False on_pi = False
...@@ -219,7 +223,7 @@ class OhmPi(object): ...@@ -219,7 +223,7 @@ class OhmPi(object):
Returns Returns
------- -------
output : numpy.array output : numpy.ndarray
Array of shape (number quadrupoles * 4). Array of shape (number quadrupoles * 4).
""" """
output = np.loadtxt(filename, delimiter=" ", dtype=int) # load quadrupole file output = np.loadtxt(filename, delimiter=" ", dtype=int) # load quadrupole file
...@@ -455,7 +459,7 @@ class OhmPi(object): ...@@ -455,7 +459,7 @@ class OhmPi(object):
sum_ps = sum_ps + vmn1 sum_ps = sum_ps + vmn1
# TODO get battery voltage and warn if battery is running low # TODO get battery voltage and warn if battery is running low
# TODO send a message on SOH stating the battery level
end_calc = time.time() end_calc = time.time()
# TODO I am not sure I understand the computation below # TODO I am not sure I understand the computation below
...@@ -661,9 +665,7 @@ class OhmPi(object): ...@@ -661,9 +665,7 @@ class OhmPi(object):
self.exec_logger.debug(f'Status: {self.status}') self.exec_logger.debug(f'Status: {self.status}')
# mqtt_client, measurement_topic = mqtt_client_setup() VERSION = '2.1.0'
VERSION = '2.0.2'
print(colored(r' ________________________________' + '\n' + print(colored(r' ________________________________' + '\n' +
r'| _ | | | || \/ || ___ \_ _|' + '\n' + r'| _ | | | || \/ || ___ \_ _|' + '\n' +
......
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