mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
3. Dev/voltage to power (#816)
* getVoltageList, getVoltage /set, getMeasuredVoltage, getVoltageNames /set, getVoltageIndex moved to 'Power' as its misleading * added cstdint and names slowadc, added division to mV * changed uV to mV in command line slow adc help. removed all python slowadcs (as it was already implemented as slowadc --------- Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
This commit is contained in:
parent
d003a6d8e0
commit
dad3dc3e46
@ -28,8 +28,7 @@ set( PYTHON_FILES
|
|||||||
slsdet/__init__.py
|
slsdet/__init__.py
|
||||||
slsdet/adcs.py
|
slsdet/adcs.py
|
||||||
slsdet/dacs.py
|
slsdet/dacs.py
|
||||||
slsdet/voltages.py
|
slsdet/powers.py
|
||||||
slsdet/slowadcs.py
|
|
||||||
slsdet/decorators.py
|
slsdet/decorators.py
|
||||||
slsdet/detector_property.py
|
slsdet/detector_property.py
|
||||||
slsdet/detector.py
|
slsdet/detector.py
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
from .eiger import Eiger
|
from .eiger import Eiger
|
||||||
from .ctb import Ctb
|
from .ctb import Ctb
|
||||||
from .dacs import DetectorDacs, Dac
|
from .dacs import DetectorDacs, Dac
|
||||||
from .voltages import DetectorVoltages, Voltage
|
from .powers import DetectorPowers, Power
|
||||||
from .slowadcs import DetectorSlowAdcs, SlowAdc
|
|
||||||
from .detector import Detector
|
from .detector import Detector
|
||||||
from .jungfrau import Jungfrau
|
from .jungfrau import Jungfrau
|
||||||
from .mythen3 import Mythen3
|
from .mythen3 import Mythen3
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
from .detector import Detector, freeze
|
from .detector import Detector, freeze
|
||||||
from .utils import element_if_equal
|
from .utils import element_if_equal
|
||||||
from .dacs import DetectorDacs, NamedDacs
|
from .dacs import DetectorDacs, NamedDacs
|
||||||
from .voltages import DetectorVoltages, NamedVoltages
|
from .powers import DetectorPowers, NamedPowers
|
||||||
from .slowadcs import DetectorSlowAdcs, NamedSlowAdcs
|
|
||||||
import _slsdet
|
import _slsdet
|
||||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||||
from .detector_property import DetectorProperty
|
from .detector_property import DetectorProperty
|
||||||
@ -17,17 +16,12 @@ class Ctb(Detector):
|
|||||||
super().__init__(id)
|
super().__init__(id)
|
||||||
self._frozen = False
|
self._frozen = False
|
||||||
self._dacs = NamedDacs(self)
|
self._dacs = NamedDacs(self)
|
||||||
self._voltages = NamedVoltages(self)
|
self._powers = NamedPowers(self)
|
||||||
self._slowadcs = NamedSlowAdcs(self)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dacs(self):
|
def dacs(self):
|
||||||
return self._dacs
|
return self._dacs
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def voltages(self):
|
def powers(self):
|
||||||
return self._voltages
|
return self._powers
|
||||||
|
|
||||||
@property
|
|
||||||
def slowadcs(self):
|
|
||||||
return self._slowadcs
|
|
@ -1839,17 +1839,17 @@ class Detector(CppDetectorApi):
|
|||||||
self.setSignalNames(value)
|
self.setSignalNames(value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def voltagelist(self):
|
def powerlist(self):
|
||||||
"""
|
"""
|
||||||
List of names for every voltage for this board. 5 voltage supply
|
List of names for every power for this board. 5 power supply
|
||||||
:setter: Only implemented for Chiptestboard
|
:setter: Only implemented for Chiptestboard
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.getVoltageNames()
|
return self.getPowerNames()
|
||||||
|
|
||||||
@voltagelist.setter
|
@powerlist.setter
|
||||||
def voltagelist(self, value):
|
def powerlist(self, value):
|
||||||
self.setVoltageNames(value)
|
self.setPowerNames(value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def slowadclist(self):
|
def slowadclist(self):
|
||||||
@ -1873,11 +1873,11 @@ class Detector(CppDetectorApi):
|
|||||||
}
|
}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def voltagevalues(self):
|
def powervalues(self):
|
||||||
"""Gets the voltage values for every voltage for this detector."""
|
"""Gets the power values for every power for this detector."""
|
||||||
return {
|
return {
|
||||||
voltage.name.lower(): element_if_equal(np.array(self.getVoltage(voltage)))
|
power.name.lower(): element_if_equal(np.array(self.getPower(power)))
|
||||||
for voltage in self.getVoltageList()
|
for power in self.getPowerList()
|
||||||
}
|
}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -3846,73 +3846,73 @@ class Detector(CppDetectorApi):
|
|||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def v_a(self):
|
def v_a(self):
|
||||||
"""[Ctb] Voltage supply a in mV."""
|
"""[Ctb] Power supply a in mV."""
|
||||||
return self.getVoltage(dacIndex.V_POWER_A)
|
return self.getPower(dacIndex.V_POWER_A)
|
||||||
|
|
||||||
@v_a.setter
|
@v_a.setter
|
||||||
def v_a(self, value):
|
def v_a(self, value):
|
||||||
value = ut.merge_args(dacIndex.V_POWER_A, value)
|
value = ut.merge_args(dacIndex.V_POWER_A, value)
|
||||||
ut.set_using_dict(self.setVoltage, *value)
|
ut.set_using_dict(self.setPower, *value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def v_b(self):
|
def v_b(self):
|
||||||
"""[Ctb] Voltage supply b in mV."""
|
"""[Ctb] Power supply b in mV."""
|
||||||
return self.getVoltage(dacIndex.V_POWER_B)
|
return self.getPower(dacIndex.V_POWER_B)
|
||||||
|
|
||||||
@v_b.setter
|
@v_b.setter
|
||||||
def v_b(self, value):
|
def v_b(self, value):
|
||||||
value = ut.merge_args(dacIndex.V_POWER_B, value)
|
value = ut.merge_args(dacIndex.V_POWER_B, value)
|
||||||
ut.set_using_dict(self.setVoltage, *value)
|
ut.set_using_dict(self.setPower, *value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def v_c(self):
|
def v_c(self):
|
||||||
"""[Ctb] Voltage supply c in mV."""
|
"""[Ctb] Power supply c in mV."""
|
||||||
return self.getVoltage(dacIndex.V_POWER_C)
|
return self.getPower(dacIndex.V_POWER_C)
|
||||||
|
|
||||||
@v_c.setter
|
@v_c.setter
|
||||||
def v_c(self, value):
|
def v_c(self, value):
|
||||||
value = ut.merge_args(dacIndex.V_POWER_C, value)
|
value = ut.merge_args(dacIndex.V_POWER_C, value)
|
||||||
ut.set_using_dict(self.setVoltage, *value)
|
ut.set_using_dict(self.setPower, *value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def v_d(self):
|
def v_d(self):
|
||||||
"""[Ctb] Voltage supply d in mV."""
|
"""[Ctb] Power supply d in mV."""
|
||||||
return self.getVoltage(dacIndex.V_POWER_D)
|
return self.getPower(dacIndex.V_POWER_D)
|
||||||
|
|
||||||
@v_d.setter
|
@v_d.setter
|
||||||
def v_d(self, value):
|
def v_d(self, value):
|
||||||
value = ut.merge_args(dacIndex.V_POWER_D, value)
|
value = ut.merge_args(dacIndex.V_POWER_D, value)
|
||||||
ut.set_using_dict(self.setVoltage, *value)
|
ut.set_using_dict(self.setPower, *value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def v_io(self):
|
def v_io(self):
|
||||||
"""[Ctb] Voltage supply io in mV. Minimum 1200 mV.
|
"""[Ctb] Power supply io in mV. Minimum 1200 mV.
|
||||||
|
|
||||||
Note
|
Note
|
||||||
----
|
----
|
||||||
Must be the first power regulator to be set after fpga reset (on-board detector server start up).
|
Must be the first power regulator to be set after fpga reset (on-board detector server start up).
|
||||||
"""
|
"""
|
||||||
return self.getVoltage(dacIndex.V_POWER_IO)
|
return self.getPower(dacIndex.V_POWER_IO)
|
||||||
|
|
||||||
@v_io.setter
|
@v_io.setter
|
||||||
def v_io(self, value):
|
def v_io(self, value):
|
||||||
value = ut.merge_args(dacIndex.V_POWER_IO, value)
|
value = ut.merge_args(dacIndex.V_POWER_IO, value)
|
||||||
ut.set_using_dict(self.setVoltage, *value)
|
ut.set_using_dict(self.setPower, *value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def v_limit(self):
|
def v_limit(self):
|
||||||
"""[Ctb] Soft limit for power supplies (ctb only) and DACS in mV."""
|
"""[Ctb] Soft limit for power supplies (ctb only) and DACS in mV."""
|
||||||
return self.getVoltage(dacIndex.V_LIMIT)
|
return self.getPower(dacIndex.V_LIMIT)
|
||||||
|
|
||||||
@v_limit.setter
|
@v_limit.setter
|
||||||
def v_limit(self, value):
|
def v_limit(self, value):
|
||||||
value = ut.merge_args(dacIndex.V_LIMIT, value)
|
value = ut.merge_args(dacIndex.V_LIMIT, value)
|
||||||
ut.set_using_dict(self.setVoltage, *value)
|
ut.set_using_dict(self.setPower, *value)
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
195
python/slsdet/powers.py
Executable file
195
python/slsdet/powers.py
Executable file
@ -0,0 +1,195 @@
|
|||||||
|
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||||
|
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
|
from .detector_property import DetectorProperty
|
||||||
|
from functools import partial
|
||||||
|
import numpy as np
|
||||||
|
import _slsdet
|
||||||
|
from .detector import freeze
|
||||||
|
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||||
|
class Power(DetectorProperty):
|
||||||
|
"""
|
||||||
|
This class represents a power on the Chip Test Board. One instance handles all
|
||||||
|
powers with the same name for a multi detector instance. (TODO: Not needed for CTB)
|
||||||
|
|
||||||
|
.. note ::
|
||||||
|
|
||||||
|
This class is used to build up DetectorPowers and is in general
|
||||||
|
not directly accessible to the user.
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
def __init__(self, name, enum, default, detector):
|
||||||
|
|
||||||
|
super().__init__(partial(detector.getPower, enum),
|
||||||
|
lambda x, y : detector.setPower(enum, x, y),
|
||||||
|
detector.size,
|
||||||
|
name)
|
||||||
|
|
||||||
|
self.default = default
|
||||||
|
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
"""String representation for a single power in all modules"""
|
||||||
|
powerstr = ''.join([f'{item:5d}' for item in self.get()])
|
||||||
|
return f'{self.__name__:15s}:{powerstr}'
|
||||||
|
|
||||||
|
class NamedPowers:
|
||||||
|
"""
|
||||||
|
New implementation of the detector powers.
|
||||||
|
"""
|
||||||
|
_frozen = False
|
||||||
|
_direct_access = ['_detector', '_current', '_powernames']
|
||||||
|
def __init__(self, detector):
|
||||||
|
self._detector = detector
|
||||||
|
self._current = 0
|
||||||
|
|
||||||
|
#only get the powernames if we have modules attached
|
||||||
|
if detector.size() == 0:
|
||||||
|
self._powernames = ["VA", "VB", "VC", "VD", "VIO"]
|
||||||
|
else:
|
||||||
|
self._powernames = [n.replace(" ", "") for n in detector.getPowerNames()]
|
||||||
|
|
||||||
|
# Populate the powers
|
||||||
|
for i,name in enumerate(self._powernames):
|
||||||
|
#name, enum, low, high, default, detector
|
||||||
|
k = dacIndex(i + int(dacIndex.V_POWER_A))
|
||||||
|
setattr(self, name, Power(name, k, 0, detector))
|
||||||
|
|
||||||
|
self._frozen = True
|
||||||
|
|
||||||
|
# def __getattr__(self, name):
|
||||||
|
# return self.__getattribute__('_' + name)
|
||||||
|
|
||||||
|
def __setattr__(self, name, value):
|
||||||
|
if not self._frozen:
|
||||||
|
#durning init we need to be able to set up the class
|
||||||
|
super().__setattr__(name, value)
|
||||||
|
else:
|
||||||
|
#Later we restrict us to manipulate powers and a few fields
|
||||||
|
if name in self._direct_access:
|
||||||
|
super().__setattr__(name, value)
|
||||||
|
elif name in self._powernames:
|
||||||
|
return self.__getattribute__(name).__setitem__(slice(None, None), value)
|
||||||
|
else:
|
||||||
|
raise AttributeError(f'Power not found: {name}')
|
||||||
|
|
||||||
|
def __next__(self):
|
||||||
|
if self._current >= len(self._powernames):
|
||||||
|
self._current = 0
|
||||||
|
raise StopIteration
|
||||||
|
else:
|
||||||
|
self._current += 1
|
||||||
|
return self.__getattribute__(self._powernames[self._current-1])
|
||||||
|
# return self.__getattr__(self._powernames[self._current-1])
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
r_str = ['========== POWERS =========']
|
||||||
|
r_str += [repr(power) for power in self]
|
||||||
|
return '\n'.join(r_str)
|
||||||
|
def get_asarray(self):
|
||||||
|
"""
|
||||||
|
Read the powers into a numpy array with dimensions [npowers, nmodules]
|
||||||
|
"""
|
||||||
|
power_array = np.zeros((len(self._powernames), len(self._detector)))
|
||||||
|
for i, _d in enumerate(self):
|
||||||
|
power_array[i,:] = _d[:]
|
||||||
|
return power_array
|
||||||
|
|
||||||
|
def to_array(self):
|
||||||
|
return self.get_asarray()
|
||||||
|
|
||||||
|
def set_from_array(self, power_array):
|
||||||
|
"""
|
||||||
|
Set the power from an numpy array with power values. [npowers, nmodules]
|
||||||
|
"""
|
||||||
|
power_array = power_array.astype(np.int)
|
||||||
|
for i, _d in enumerate(self):
|
||||||
|
_d[:] = power_array[i]
|
||||||
|
|
||||||
|
def from_array(self, power_array):
|
||||||
|
self.set_from_array(power_array)
|
||||||
|
|
||||||
|
class DetectorPowers:
|
||||||
|
_powers = []
|
||||||
|
_powernames = [_d[0] for _d in _powers]
|
||||||
|
_allowed_attr = ['_detector', '_current']
|
||||||
|
_frozen = False
|
||||||
|
|
||||||
|
def __init__(self, detector):
|
||||||
|
# We need to at least initially know which detector we are connected to
|
||||||
|
self._detector = detector
|
||||||
|
|
||||||
|
# Index to support iteration
|
||||||
|
self._current = 0
|
||||||
|
|
||||||
|
# Name the attributes?
|
||||||
|
for _d in self._powers:
|
||||||
|
setattr(self, '_'+_d[0], Power(*_d, detector))
|
||||||
|
|
||||||
|
self._frozen = True
|
||||||
|
|
||||||
|
def __getattr__(self, name):
|
||||||
|
return self.__getattribute__('_' + name)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def powernames(self):
|
||||||
|
return [_d[0] for _d in _powers]
|
||||||
|
|
||||||
|
def __setattr__(self, name, value):
|
||||||
|
if name in self._powernames:
|
||||||
|
return self.__getattribute__('_' + name).__setitem__(slice(None, None), value)
|
||||||
|
else:
|
||||||
|
if self._frozen == True and name not in self._allowed_attr:
|
||||||
|
raise AttributeError(f'Power not found: {name}')
|
||||||
|
super().__setattr__(name, value)
|
||||||
|
|
||||||
|
|
||||||
|
def __next__(self):
|
||||||
|
if self._current >= len(self._powers):
|
||||||
|
self._current = 0
|
||||||
|
raise StopIteration
|
||||||
|
else:
|
||||||
|
self._current += 1
|
||||||
|
return self.__getattr__(self._powernames[self._current-1])
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
r_str = ['========== POWERS =========']
|
||||||
|
r_str += [repr(power) for power in self]
|
||||||
|
return '\n'.join(r_str)
|
||||||
|
|
||||||
|
def get_asarray(self):
|
||||||
|
"""
|
||||||
|
Read the powers into a numpy array with dimensions [npowers, nmodules]
|
||||||
|
"""
|
||||||
|
power_array = np.zeros((len(self._powers), len(self._detector)))
|
||||||
|
for i, _d in enumerate(self):
|
||||||
|
power_array[i,:] = _d[:]
|
||||||
|
return power_array
|
||||||
|
|
||||||
|
def to_array(self):
|
||||||
|
return self.get_asarray()
|
||||||
|
|
||||||
|
def set_from_array(self, power_array):
|
||||||
|
"""
|
||||||
|
Set the powers from an numpy array with power values. [npowers, nmodules]
|
||||||
|
"""
|
||||||
|
power_array = power_array.astype(np.int)
|
||||||
|
for i, _d in enumerate(self):
|
||||||
|
_d[:] = power_array[i]
|
||||||
|
|
||||||
|
def from_array(self, power_array):
|
||||||
|
self.set_from_array(power_array)
|
||||||
|
|
||||||
|
def set_default(self):
|
||||||
|
"""
|
||||||
|
Set all powers to their default values
|
||||||
|
"""
|
||||||
|
for _d in self:
|
||||||
|
_d[:] = _d.default
|
||||||
|
|
@ -60,19 +60,28 @@ class SlowAdcProxy:
|
|||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
dac_index = dacIndex(int(dacIndex.SLOW_ADC0)+key)
|
dac_index = dacIndex(int(dacIndex.SLOW_ADC0)+key)
|
||||||
return element_if_equal(self.det.getSlowADC(dac_index))
|
return element_if_equal(self.det.getSlowADC(dac_index))/1000 #TODO! Multi module?
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
rstr = ''
|
rstr = ''
|
||||||
for i in range(8):
|
for i,name in enumerate(self.det.getSlowADCNames()):
|
||||||
r = element_if_equal(self.__getitem__(i))
|
r = element_if_equal(self.__getitem__(i))
|
||||||
if isinstance(r, list):
|
if isinstance(r, list):
|
||||||
rstr += ' '.join(f'{item} uV' for item in r)
|
rstr += ' '.join(f'{item/1000} mV' for item in r)
|
||||||
else:
|
else:
|
||||||
rstr += f'{i}: {r} uV\n'
|
rstr += f'[{i}] {name}: {r/1000} mV\n'
|
||||||
|
|
||||||
return rstr.strip('\n')
|
return rstr.strip('\n')
|
||||||
|
|
||||||
|
def __getattr__(self, name):
|
||||||
|
if name in self.det.getSlowADCNames():
|
||||||
|
i = self.det.getSlowADCIndex(name)
|
||||||
|
return element_if_equal(self.det.getSlowADC(i))
|
||||||
|
else:
|
||||||
|
raise ValueError(f"Could not find slow adc with name: {name}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ClkDivProxy:
|
class ClkDivProxy:
|
||||||
"""
|
"""
|
||||||
Proxy class to allow for more intuitive reading clockdivider
|
Proxy class to allow for more intuitive reading clockdivider
|
||||||
|
@ -1,195 +0,0 @@
|
|||||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
|
||||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
||||||
from .detector_property import DetectorProperty
|
|
||||||
from functools import partial
|
|
||||||
import numpy as np
|
|
||||||
import _slsdet
|
|
||||||
from .detector import freeze
|
|
||||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
|
||||||
class SlowAdc(DetectorProperty):
|
|
||||||
"""
|
|
||||||
This class represents a slowadc on the Chip Test Board. One instance handles all
|
|
||||||
slowadcs with the same name for a multi detector instance. (TODO: Not needed for CTB)
|
|
||||||
|
|
||||||
.. note ::
|
|
||||||
|
|
||||||
This class is used to build up DetectorSlowAdcs and is in general
|
|
||||||
not directly accessible to the user.
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
|
||||||
def __init__(self, name, enum, default, detector):
|
|
||||||
|
|
||||||
super().__init__(partial(detector.getVoltage, enum),
|
|
||||||
lambda x, y : detector.setVoltage(enum, x, y),
|
|
||||||
detector.size,
|
|
||||||
name)
|
|
||||||
|
|
||||||
self.default = default
|
|
||||||
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
"""String representation for a single slowadc in all modules"""
|
|
||||||
slowadcstr = ''.join([f'{item:5d}' for item in self.get()])
|
|
||||||
return f'{self.__name__:15s}:{slowadcstr}'
|
|
||||||
|
|
||||||
class NamedSlowAdcs:
|
|
||||||
"""
|
|
||||||
New implementation of the detector slowadcs.
|
|
||||||
"""
|
|
||||||
_frozen = False
|
|
||||||
_direct_access = ['_detector', '_current', '_voltagenames']
|
|
||||||
def __init__(self, detector):
|
|
||||||
self._detector = detector
|
|
||||||
self._current = 0
|
|
||||||
|
|
||||||
#only get the voltagenames if we have modules attached
|
|
||||||
if detector.size() == 0:
|
|
||||||
self._voltagenames = ["VA", "VB", "VC", "VD", "VIO"]
|
|
||||||
else:
|
|
||||||
self._voltagenames = [n.replace(" ", "") for n in detector.getVoltageNames()]
|
|
||||||
|
|
||||||
# Populate the slowadcs
|
|
||||||
for i,name in enumerate(self._voltagenames):
|
|
||||||
#name, enum, low, high, default, detector
|
|
||||||
k = dacIndex(i + int(dacIndex.V_POWER_A))
|
|
||||||
setattr(self, name, SlowAdc(name, k, 0, detector))
|
|
||||||
|
|
||||||
self._frozen = True
|
|
||||||
|
|
||||||
# def __getattr__(self, name):
|
|
||||||
# return self.__getattribute__('_' + name)
|
|
||||||
|
|
||||||
def __setattr__(self, name, value):
|
|
||||||
if not self._frozen:
|
|
||||||
#durning init we need to be able to set up the class
|
|
||||||
super().__setattr__(name, value)
|
|
||||||
else:
|
|
||||||
#Later we restrict us to manipulate slowadcs and a few fields
|
|
||||||
if name in self._direct_access:
|
|
||||||
super().__setattr__(name, value)
|
|
||||||
elif name in self._voltagenames:
|
|
||||||
return self.__getattribute__(name).__setitem__(slice(None, None), value)
|
|
||||||
else:
|
|
||||||
raise AttributeError(f'SlowAdc not found: {name}')
|
|
||||||
|
|
||||||
def __next__(self):
|
|
||||||
if self._current >= len(self._voltagenames):
|
|
||||||
self._current = 0
|
|
||||||
raise StopIteration
|
|
||||||
else:
|
|
||||||
self._current += 1
|
|
||||||
return self.__getattribute__(self._voltagenames[self._current-1])
|
|
||||||
# return self.__getattr__(self._voltagenames[self._current-1])
|
|
||||||
|
|
||||||
def __iter__(self):
|
|
||||||
return self
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
r_str = ['========== SLOW ADCS =========']
|
|
||||||
r_str += [repr(slowadc) for slowadc in self]
|
|
||||||
return '\n'.join(r_str)
|
|
||||||
def get_asarray(self):
|
|
||||||
"""
|
|
||||||
Read the slowadcs into a numpy array with dimensions [nslowadcs, nmodules]
|
|
||||||
"""
|
|
||||||
voltage_array = np.zeros((len(self._voltagenames), len(self._detector)))
|
|
||||||
for i, _d in enumerate(self):
|
|
||||||
voltage_array[i,:] = _d[:]
|
|
||||||
return voltage_array
|
|
||||||
|
|
||||||
def to_array(self):
|
|
||||||
return self.get_asarray()
|
|
||||||
|
|
||||||
def set_from_array(self, voltage_array):
|
|
||||||
"""
|
|
||||||
Set the slowadc from an numpy array with slowadc values. [nslowadcs, nmodules]
|
|
||||||
"""
|
|
||||||
voltage_array = voltage_array.astype(np.int)
|
|
||||||
for i, _d in enumerate(self):
|
|
||||||
_d[:] = voltage_array[i]
|
|
||||||
|
|
||||||
def from_array(self, voltage_array):
|
|
||||||
self.set_from_array(voltage_array)
|
|
||||||
|
|
||||||
class DetectorSlowAdcs:
|
|
||||||
_slowadcs = []
|
|
||||||
_voltagenames = [_d[0] for _d in _slowadcs]
|
|
||||||
_allowed_attr = ['_detector', '_current']
|
|
||||||
_frozen = False
|
|
||||||
|
|
||||||
def __init__(self, detector):
|
|
||||||
# We need to at least initially know which detector we are connected to
|
|
||||||
self._detector = detector
|
|
||||||
|
|
||||||
# Index to support iteration
|
|
||||||
self._current = 0
|
|
||||||
|
|
||||||
# Name the attributes?
|
|
||||||
for _d in self._slowadcs:
|
|
||||||
setattr(self, '_'+_d[0], SlowAdc(*_d, detector))
|
|
||||||
|
|
||||||
self._frozen = True
|
|
||||||
|
|
||||||
def __getattr__(self, name):
|
|
||||||
return self.__getattribute__('_' + name)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def voltagenames(self):
|
|
||||||
return [_d[0] for _d in _slowadcs]
|
|
||||||
|
|
||||||
def __setattr__(self, name, value):
|
|
||||||
if name in self._voltagenames:
|
|
||||||
return self.__getattribute__('_' + name).__setitem__(slice(None, None), value)
|
|
||||||
else:
|
|
||||||
if self._frozen == True and name not in self._allowed_attr:
|
|
||||||
raise AttributeError(f'SlowAdc not found: {name}')
|
|
||||||
super().__setattr__(name, value)
|
|
||||||
|
|
||||||
|
|
||||||
def __next__(self):
|
|
||||||
if self._current >= len(self._slowadcs):
|
|
||||||
self._current = 0
|
|
||||||
raise StopIteration
|
|
||||||
else:
|
|
||||||
self._current += 1
|
|
||||||
return self.__getattr__(self._voltagenames[self._current-1])
|
|
||||||
|
|
||||||
def __iter__(self):
|
|
||||||
return self
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
r_str = ['========== SLOW ADCS =========']
|
|
||||||
r_str += [repr(slowadc) for slowadc in self]
|
|
||||||
return '\n'.join(r_str)
|
|
||||||
|
|
||||||
def get_asarray(self):
|
|
||||||
"""
|
|
||||||
Read the slowadcs into a numpy array with dimensions [nslowadcs, nmodules]
|
|
||||||
"""
|
|
||||||
voltage_array = np.zeros((len(self._slowadcs), len(self._detector)))
|
|
||||||
for i, _d in enumerate(self):
|
|
||||||
voltage_array[i,:] = _d[:]
|
|
||||||
return voltage_array
|
|
||||||
|
|
||||||
def to_array(self):
|
|
||||||
return self.get_asarray()
|
|
||||||
|
|
||||||
def set_from_array(self, voltage_array):
|
|
||||||
"""
|
|
||||||
Set the slowadcs from an numpy array with slowadc values. [nslowadcs, nmodules]
|
|
||||||
"""
|
|
||||||
voltage_array = voltage_array.astype(np.int)
|
|
||||||
for i, _d in enumerate(self):
|
|
||||||
_d[:] = voltage_array[i]
|
|
||||||
|
|
||||||
def from_array(self, voltage_array):
|
|
||||||
self.set_from_array(voltage_array)
|
|
||||||
|
|
||||||
def set_default(self):
|
|
||||||
"""
|
|
||||||
Set all slowadcs to their default values
|
|
||||||
"""
|
|
||||||
for _d in self:
|
|
||||||
_d[:] = _d.default
|
|
||||||
|
|
@ -1,195 +0,0 @@
|
|||||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
|
||||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
||||||
from .detector_property import DetectorProperty
|
|
||||||
from functools import partial
|
|
||||||
import numpy as np
|
|
||||||
import _slsdet
|
|
||||||
from .detector import freeze
|
|
||||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
|
||||||
class Voltage(DetectorProperty):
|
|
||||||
"""
|
|
||||||
This class represents a voltage on the Chip Test Board. One instance handles all
|
|
||||||
voltages with the same name for a multi detector instance. (TODO: Not needed for CTB)
|
|
||||||
|
|
||||||
.. note ::
|
|
||||||
|
|
||||||
This class is used to build up DetectorVoltages and is in general
|
|
||||||
not directly accessible to the user.
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
|
||||||
def __init__(self, name, enum, default, detector):
|
|
||||||
|
|
||||||
super().__init__(partial(detector.getVoltage, enum),
|
|
||||||
lambda x, y : detector.setVoltage(enum, x, y),
|
|
||||||
detector.size,
|
|
||||||
name)
|
|
||||||
|
|
||||||
self.default = default
|
|
||||||
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
"""String representation for a single voltage in all modules"""
|
|
||||||
voltagestr = ''.join([f'{item:5d}' for item in self.get()])
|
|
||||||
return f'{self.__name__:15s}:{voltagestr}'
|
|
||||||
|
|
||||||
class NamedVoltages:
|
|
||||||
"""
|
|
||||||
New implementation of the detector voltages.
|
|
||||||
"""
|
|
||||||
_frozen = False
|
|
||||||
_direct_access = ['_detector', '_current', '_voltagenames']
|
|
||||||
def __init__(self, detector):
|
|
||||||
self._detector = detector
|
|
||||||
self._current = 0
|
|
||||||
|
|
||||||
#only get the voltagenames if we have modules attached
|
|
||||||
if detector.size() == 0:
|
|
||||||
self._voltagenames = ["VA", "VB", "VC", "VD", "VIO"]
|
|
||||||
else:
|
|
||||||
self._voltagenames = [n.replace(" ", "") for n in detector.getVoltageNames()]
|
|
||||||
|
|
||||||
# Populate the voltages
|
|
||||||
for i,name in enumerate(self._voltagenames):
|
|
||||||
#name, enum, low, high, default, detector
|
|
||||||
k = dacIndex(i + int(dacIndex.V_POWER_A))
|
|
||||||
setattr(self, name, Voltage(name, k, 0, detector))
|
|
||||||
|
|
||||||
self._frozen = True
|
|
||||||
|
|
||||||
# def __getattr__(self, name):
|
|
||||||
# return self.__getattribute__('_' + name)
|
|
||||||
|
|
||||||
def __setattr__(self, name, value):
|
|
||||||
if not self._frozen:
|
|
||||||
#durning init we need to be able to set up the class
|
|
||||||
super().__setattr__(name, value)
|
|
||||||
else:
|
|
||||||
#Later we restrict us to manipulate voltages and a few fields
|
|
||||||
if name in self._direct_access:
|
|
||||||
super().__setattr__(name, value)
|
|
||||||
elif name in self._voltagenames:
|
|
||||||
return self.__getattribute__(name).__setitem__(slice(None, None), value)
|
|
||||||
else:
|
|
||||||
raise AttributeError(f'Voltage not found: {name}')
|
|
||||||
|
|
||||||
def __next__(self):
|
|
||||||
if self._current >= len(self._voltagenames):
|
|
||||||
self._current = 0
|
|
||||||
raise StopIteration
|
|
||||||
else:
|
|
||||||
self._current += 1
|
|
||||||
return self.__getattribute__(self._voltagenames[self._current-1])
|
|
||||||
# return self.__getattr__(self._voltagenames[self._current-1])
|
|
||||||
|
|
||||||
def __iter__(self):
|
|
||||||
return self
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
r_str = ['========== VOLTAGES =========']
|
|
||||||
r_str += [repr(voltage) for voltage in self]
|
|
||||||
return '\n'.join(r_str)
|
|
||||||
def get_asarray(self):
|
|
||||||
"""
|
|
||||||
Read the voltages into a numpy array with dimensions [nvoltages, nmodules]
|
|
||||||
"""
|
|
||||||
voltage_array = np.zeros((len(self._voltagenames), len(self._detector)))
|
|
||||||
for i, _d in enumerate(self):
|
|
||||||
voltage_array[i,:] = _d[:]
|
|
||||||
return voltage_array
|
|
||||||
|
|
||||||
def to_array(self):
|
|
||||||
return self.get_asarray()
|
|
||||||
|
|
||||||
def set_from_array(self, voltage_array):
|
|
||||||
"""
|
|
||||||
Set the voltage from an numpy array with voltage values. [nvoltages, nmodules]
|
|
||||||
"""
|
|
||||||
voltage_array = voltage_array.astype(np.int)
|
|
||||||
for i, _d in enumerate(self):
|
|
||||||
_d[:] = voltage_array[i]
|
|
||||||
|
|
||||||
def from_array(self, voltage_array):
|
|
||||||
self.set_from_array(voltage_array)
|
|
||||||
|
|
||||||
class DetectorVoltages:
|
|
||||||
_voltages = []
|
|
||||||
_voltagenames = [_d[0] for _d in _voltages]
|
|
||||||
_allowed_attr = ['_detector', '_current']
|
|
||||||
_frozen = False
|
|
||||||
|
|
||||||
def __init__(self, detector):
|
|
||||||
# We need to at least initially know which detector we are connected to
|
|
||||||
self._detector = detector
|
|
||||||
|
|
||||||
# Index to support iteration
|
|
||||||
self._current = 0
|
|
||||||
|
|
||||||
# Name the attributes?
|
|
||||||
for _d in self._voltages:
|
|
||||||
setattr(self, '_'+_d[0], Voltage(*_d, detector))
|
|
||||||
|
|
||||||
self._frozen = True
|
|
||||||
|
|
||||||
def __getattr__(self, name):
|
|
||||||
return self.__getattribute__('_' + name)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def voltagenames(self):
|
|
||||||
return [_d[0] for _d in _voltages]
|
|
||||||
|
|
||||||
def __setattr__(self, name, value):
|
|
||||||
if name in self._voltagenames:
|
|
||||||
return self.__getattribute__('_' + name).__setitem__(slice(None, None), value)
|
|
||||||
else:
|
|
||||||
if self._frozen == True and name not in self._allowed_attr:
|
|
||||||
raise AttributeError(f'Voltage not found: {name}')
|
|
||||||
super().__setattr__(name, value)
|
|
||||||
|
|
||||||
|
|
||||||
def __next__(self):
|
|
||||||
if self._current >= len(self._voltages):
|
|
||||||
self._current = 0
|
|
||||||
raise StopIteration
|
|
||||||
else:
|
|
||||||
self._current += 1
|
|
||||||
return self.__getattr__(self._voltagenames[self._current-1])
|
|
||||||
|
|
||||||
def __iter__(self):
|
|
||||||
return self
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
r_str = ['========== VOLTAGES =========']
|
|
||||||
r_str += [repr(voltage) for voltage in self]
|
|
||||||
return '\n'.join(r_str)
|
|
||||||
|
|
||||||
def get_asarray(self):
|
|
||||||
"""
|
|
||||||
Read the voltages into a numpy array with dimensions [nvoltages, nmodules]
|
|
||||||
"""
|
|
||||||
voltage_array = np.zeros((len(self._voltages), len(self._detector)))
|
|
||||||
for i, _d in enumerate(self):
|
|
||||||
voltage_array[i,:] = _d[:]
|
|
||||||
return voltage_array
|
|
||||||
|
|
||||||
def to_array(self):
|
|
||||||
return self.get_asarray()
|
|
||||||
|
|
||||||
def set_from_array(self, voltage_array):
|
|
||||||
"""
|
|
||||||
Set the voltages from an numpy array with voltage values. [nvoltages, nmodules]
|
|
||||||
"""
|
|
||||||
voltage_array = voltage_array.astype(np.int)
|
|
||||||
for i, _d in enumerate(self):
|
|
||||||
_d[:] = voltage_array[i]
|
|
||||||
|
|
||||||
def from_array(self, voltage_array):
|
|
||||||
self.set_from_array(voltage_array)
|
|
||||||
|
|
||||||
def set_default(self):
|
|
||||||
"""
|
|
||||||
Set all voltages to their default values
|
|
||||||
"""
|
|
||||||
for _d in self:
|
|
||||||
_d[:] = _d.default
|
|
||||||
|
|
@ -1535,21 +1535,21 @@ void init_det(py::module &m) {
|
|||||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||||
Detector::getSYNCClock,
|
Detector::getSYNCClock,
|
||||||
py::arg() = Positions{});
|
py::arg() = Positions{});
|
||||||
CppDetectorApi.def("getVoltageList",
|
CppDetectorApi.def("getPowerList",
|
||||||
(std::vector<defs::dacIndex>(Detector::*)() const) &
|
(std::vector<defs::dacIndex>(Detector::*)() const) &
|
||||||
Detector::getVoltageList);
|
Detector::getPowerList);
|
||||||
CppDetectorApi.def("getSlowADCList",
|
CppDetectorApi.def("getSlowADCList",
|
||||||
(std::vector<defs::dacIndex>(Detector::*)() const) &
|
(std::vector<defs::dacIndex>(Detector::*)() const) &
|
||||||
Detector::getSlowADCList);
|
Detector::getSlowADCList);
|
||||||
CppDetectorApi.def(
|
CppDetectorApi.def(
|
||||||
"getVoltage",
|
"getPower",
|
||||||
(Result<int>(Detector::*)(defs::dacIndex, sls::Positions) const) &
|
(Result<int>(Detector::*)(defs::dacIndex, sls::Positions) const) &
|
||||||
Detector::getVoltage,
|
Detector::getPower,
|
||||||
py::arg(), py::arg() = Positions{});
|
py::arg(), py::arg() = Positions{});
|
||||||
CppDetectorApi.def(
|
CppDetectorApi.def(
|
||||||
"setVoltage",
|
"setPower",
|
||||||
(void (Detector::*)(defs::dacIndex, int, sls::Positions)) &
|
(void (Detector::*)(defs::dacIndex, int, sls::Positions)) &
|
||||||
Detector::setVoltage,
|
Detector::setPower,
|
||||||
py::arg(), py::arg(), py::arg() = Positions{});
|
py::arg(), py::arg(), py::arg() = Positions{});
|
||||||
CppDetectorApi.def("getADCVpp",
|
CppDetectorApi.def("getADCVpp",
|
||||||
(Result<int>(Detector::*)(bool, sls::Positions) const) &
|
(Result<int>(Detector::*)(bool, sls::Positions) const) &
|
||||||
@ -1617,9 +1617,9 @@ void init_det(py::module &m) {
|
|||||||
Detector::setDBITClock,
|
Detector::setDBITClock,
|
||||||
py::arg(), py::arg() = Positions{});
|
py::arg(), py::arg() = Positions{});
|
||||||
CppDetectorApi.def(
|
CppDetectorApi.def(
|
||||||
"getMeasuredVoltage",
|
"getMeasuredPower",
|
||||||
(Result<int>(Detector::*)(defs::dacIndex, sls::Positions) const) &
|
(Result<int>(Detector::*)(defs::dacIndex, sls::Positions) const) &
|
||||||
Detector::getMeasuredVoltage,
|
Detector::getMeasuredPower,
|
||||||
py::arg(), py::arg() = Positions{});
|
py::arg(), py::arg() = Positions{});
|
||||||
CppDetectorApi.def(
|
CppDetectorApi.def(
|
||||||
"getMeasuredCurrent",
|
"getMeasuredCurrent",
|
||||||
@ -1736,26 +1736,26 @@ void init_det(py::module &m) {
|
|||||||
(std::string(Detector::*)(const int) const) &
|
(std::string(Detector::*)(const int) const) &
|
||||||
Detector::getSignalName,
|
Detector::getSignalName,
|
||||||
py::arg());
|
py::arg());
|
||||||
CppDetectorApi.def("setVoltageNames",
|
CppDetectorApi.def("setPowerNames",
|
||||||
(void (Detector::*)(const std::vector<std::string>)) &
|
(void (Detector::*)(const std::vector<std::string>)) &
|
||||||
Detector::setVoltageNames,
|
Detector::setPowerNames,
|
||||||
py::arg());
|
py::arg());
|
||||||
CppDetectorApi.def("getVoltageNames",
|
CppDetectorApi.def("getPowerNames",
|
||||||
(std::vector<std::string>(Detector::*)() const) &
|
(std::vector<std::string>(Detector::*)() const) &
|
||||||
Detector::getVoltageNames);
|
Detector::getPowerNames);
|
||||||
CppDetectorApi.def(
|
CppDetectorApi.def(
|
||||||
"getVoltageIndex",
|
"getPowerIndex",
|
||||||
(defs::dacIndex(Detector::*)(const std::string &) const) &
|
(defs::dacIndex(Detector::*)(const std::string &) const) &
|
||||||
Detector::getVoltageIndex,
|
Detector::getPowerIndex,
|
||||||
py::arg());
|
py::arg());
|
||||||
CppDetectorApi.def(
|
CppDetectorApi.def(
|
||||||
"setVoltageName",
|
"setPowerName",
|
||||||
(void (Detector::*)(const defs::dacIndex, const std::string &)) &
|
(void (Detector::*)(const defs::dacIndex, const std::string &)) &
|
||||||
Detector::setVoltageName,
|
Detector::setPowerName,
|
||||||
py::arg(), py::arg());
|
py::arg(), py::arg());
|
||||||
CppDetectorApi.def("getVoltageName",
|
CppDetectorApi.def("getPowerName",
|
||||||
(std::string(Detector::*)(const defs::dacIndex) const) &
|
(std::string(Detector::*)(const defs::dacIndex) const) &
|
||||||
Detector::getVoltageName,
|
Detector::getPowerName,
|
||||||
py::arg());
|
py::arg());
|
||||||
CppDetectorApi.def("setSlowADCNames",
|
CppDetectorApi.def("setSlowADCNames",
|
||||||
(void (Detector::*)(const std::vector<std::string>)) &
|
(void (Detector::*)(const std::vector<std::string>)) &
|
||||||
|
@ -1629,21 +1629,21 @@ class Detector {
|
|||||||
/** [CTB] in MHZ */
|
/** [CTB] in MHZ */
|
||||||
Result<int> getSYNCClock(Positions pos = {}) const;
|
Result<int> getSYNCClock(Positions pos = {}) const;
|
||||||
|
|
||||||
/** gets list of voltage enums */
|
/** gets list of power enums */
|
||||||
std::vector<defs::dacIndex> getVoltageList() const;
|
std::vector<defs::dacIndex> getPowerList() const;
|
||||||
|
|
||||||
/** gets list of slow adc enums */
|
/** gets list of slow adc enums */
|
||||||
std::vector<defs::dacIndex> getSlowADCList() const;
|
std::vector<defs::dacIndex> getSlowADCList() const;
|
||||||
|
|
||||||
/** [CTB] */
|
/** [CTB] */
|
||||||
Result<int> getVoltage(defs::dacIndex index, Positions pos = {}) const;
|
Result<int> getPower(defs::dacIndex index, Positions pos = {}) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [CTB] mV
|
* [CTB] mV
|
||||||
* [Ctb] Options: V_LIMIT, V_POWER_A, V_POWER_B, V_POWER_C,
|
* [Ctb] Options: V_LIMIT, V_POWER_A, V_POWER_B, V_POWER_C,
|
||||||
* V_POWER_D, V_POWER_IO, V_POWER_CHIP
|
* V_POWER_D, V_POWER_IO, V_POWER_CHIP
|
||||||
*/
|
*/
|
||||||
void setVoltage(defs::dacIndex index, int value, Positions pos = {});
|
void setPower(defs::dacIndex index, int value, Positions pos = {});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [CTB] Options: [0- 4] or [1V, 1.14V, 1.33V, 1.6V, 2V]
|
* [CTB] Options: [0- 4] or [1V, 1.14V, 1.33V, 1.6V, 2V]
|
||||||
@ -1711,7 +1711,7 @@ class Detector {
|
|||||||
/**
|
/**
|
||||||
* [CTB] mV
|
* [CTB] mV
|
||||||
* Options: V_POWER_A, V_POWER_B, V_POWER_C, V_POWER_D, V_POWER_IO */
|
* Options: V_POWER_A, V_POWER_B, V_POWER_C, V_POWER_D, V_POWER_IO */
|
||||||
Result<int> getMeasuredVoltage(defs::dacIndex index,
|
Result<int> getMeasuredPower(defs::dacIndex index,
|
||||||
Positions pos = {}) const;
|
Positions pos = {}) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1806,19 +1806,19 @@ class Detector {
|
|||||||
std::string getSignalName(const int i) const;
|
std::string getSignalName(const int i) const;
|
||||||
|
|
||||||
/** [CTB] */
|
/** [CTB] */
|
||||||
void setVoltageNames(const std::vector<std::string> names);
|
void setPowerNames(const std::vector<std::string> names);
|
||||||
|
|
||||||
/** [CTB] */
|
/** [CTB] */
|
||||||
std::vector<std::string> getVoltageNames() const;
|
std::vector<std::string> getPowerNames() const;
|
||||||
|
|
||||||
/** [CTB] */
|
/** [CTB] */
|
||||||
defs::dacIndex getVoltageIndex(const std::string &name) const;
|
defs::dacIndex getPowerIndex(const std::string &name) const;
|
||||||
|
|
||||||
/** [CTB] */
|
/** [CTB] */
|
||||||
void setVoltageName(const defs::dacIndex i, const std::string &name);
|
void setPowerName(const defs::dacIndex i, const std::string &name);
|
||||||
|
|
||||||
/** [CTB] */
|
/** [CTB] */
|
||||||
std::string getVoltageName(const defs::dacIndex i) const;
|
std::string getPowerName(const defs::dacIndex i) const;
|
||||||
|
|
||||||
/** [CTB] */
|
/** [CTB] */
|
||||||
void setSlowADCNames(const std::vector<std::string> names);
|
void setSlowADCNames(const std::vector<std::string> names);
|
||||||
|
@ -2719,7 +2719,7 @@ std::string CmdProxy::SlowADC(int action) {
|
|||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[n_channel (0-7 for channel]\n\t[Ctb] Slow "
|
os << "[n_channel (0-7 for channel]\n\t[Ctb] Slow "
|
||||||
"ADC channel in uV"
|
"ADC channel in mV"
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
if (args.size() != 1) {
|
if (args.size() != 1) {
|
||||||
|
@ -1053,10 +1053,10 @@ class CmdProxy {
|
|||||||
{"signallist", &CmdProxy::signallist},
|
{"signallist", &CmdProxy::signallist},
|
||||||
{"signalname", &CmdProxy::signalname},
|
{"signalname", &CmdProxy::signalname},
|
||||||
{"signalindex", &CmdProxy::signalindex},
|
{"signalindex", &CmdProxy::signalindex},
|
||||||
{"voltagelist", &CmdProxy::voltagelist},
|
{"powerlist", &CmdProxy::powerlist},
|
||||||
{"voltagename", &CmdProxy::voltagename},
|
{"powername", &CmdProxy::powername},
|
||||||
{"voltageindex", &CmdProxy::voltageindex},
|
{"powerindex", &CmdProxy::powerindex},
|
||||||
{"voltagevalues", &CmdProxy::voltagevalues},
|
{"powervalues", &CmdProxy::powervalues},
|
||||||
{"slowadclist", &CmdProxy::slowadclist},
|
{"slowadclist", &CmdProxy::slowadclist},
|
||||||
{"slowadcname", &CmdProxy::slowadcname},
|
{"slowadcname", &CmdProxy::slowadcname},
|
||||||
{"slowadcindex", &CmdProxy::slowadcindex},
|
{"slowadcindex", &CmdProxy::slowadcindex},
|
||||||
@ -1779,22 +1779,21 @@ class CmdProxy {
|
|||||||
"[name] \n\t\t[ChipTestBoard] Get "
|
"[name] \n\t\t[ChipTestBoard] Get "
|
||||||
"the signal index for the given name.");
|
"the signal index for the given name.");
|
||||||
|
|
||||||
CTB_NAMED_LIST(voltagelist, getVoltageNames, setVoltageNames,
|
CTB_NAMED_LIST(powerlist, getPowerNames, setPowerNames,
|
||||||
"[voltagename1 voltagename2 .. voltagename4] "
|
"[powername1 powername2 .. powername4] "
|
||||||
"\n\t\t[ChipTestBoard] Set "
|
"\n\t\t[ChipTestBoard] Set "
|
||||||
"the list of voltage names for this board.");
|
"the list of power names for this board.");
|
||||||
|
|
||||||
CTB_SINGLE_DACNAME(voltagename, getVoltageName, setVoltageName,
|
CTB_SINGLE_DACNAME(powername, getPowerName, setPowerName, defs::V_POWER_A,
|
||||||
defs::V_POWER_A,
|
|
||||||
"[0-4][name] \n\t\t[ChipTestBoard] Set "
|
"[0-4][name] \n\t\t[ChipTestBoard] Set "
|
||||||
"the voltage at the given position to the given name.");
|
"the power at the given position to the given name.");
|
||||||
|
|
||||||
CTB_GET_DACINDEX(voltageindex, getVoltageIndex, defs::V_POWER_A,
|
CTB_GET_DACINDEX(powerindex, getPowerIndex, defs::V_POWER_A,
|
||||||
"[name] \n\t\t[ChipTestBoard] Get "
|
"[name] \n\t\t[ChipTestBoard] Get "
|
||||||
"the voltage index for the given name.");
|
"the power index for the given name.");
|
||||||
|
|
||||||
CTB_VALUES(voltagevalues, getVoltage, getVoltageList, getVoltageNames,
|
CTB_VALUES(powervalues, getPower, getPowerList, getPowerNames,
|
||||||
"[name] \n\t\t[ChipTestBoard] Get values of all voltages.");
|
"[name] \n\t\t[ChipTestBoard] Get values of all powers.");
|
||||||
|
|
||||||
CTB_VALUES(slowadcvalues, getSlowADC, getSlowADCList, getSlowADCNames,
|
CTB_VALUES(slowadcvalues, getSlowADC, getSlowADCList, getSlowADCNames,
|
||||||
"[name] \n\t\t[ChipTestBoard] Get values of all slow adcs.");
|
"[name] \n\t\t[ChipTestBoard] Get values of all slow adcs.");
|
||||||
@ -2426,7 +2425,7 @@ class CmdProxy {
|
|||||||
GET_COMMAND(syncclk, getSYNCClock,
|
GET_COMMAND(syncclk, getSYNCClock,
|
||||||
"[n_clk in MHz]\n\t[Ctb] Sync clock in MHz.");
|
"[n_clk in MHz]\n\t[Ctb] Sync clock in MHz.");
|
||||||
|
|
||||||
INTEGER_IND_COMMAND(v_limit, getVoltage, setVoltage, StringTo<int>,
|
INTEGER_IND_COMMAND(v_limit, getPower, setPower, StringTo<int>,
|
||||||
defs::V_LIMIT,
|
defs::V_LIMIT,
|
||||||
"[n_value]\n\t[Ctb] Soft limit for power "
|
"[n_value]\n\t[Ctb] Soft limit for power "
|
||||||
"supplies (ctb only) and DACS in mV.");
|
"supplies (ctb only) and DACS in mV.");
|
||||||
@ -2468,47 +2467,43 @@ class CmdProxy {
|
|||||||
"[n_clk in MHz]\n\t[Ctb] Clock for latching the "
|
"[n_clk in MHz]\n\t[Ctb] Clock for latching the "
|
||||||
"digital bits in MHz.");
|
"digital bits in MHz.");
|
||||||
|
|
||||||
INTEGER_IND_COMMAND(v_a, getVoltage, setVoltage, StringTo<int>,
|
INTEGER_IND_COMMAND(v_a, getPower, setPower, StringTo<int>, defs::V_POWER_A,
|
||||||
defs::V_POWER_A,
|
"[n_value]\n\t[Ctb] Power supply a in mV.");
|
||||||
"[n_value]\n\t[Ctb] Voltage supply a in mV.");
|
|
||||||
|
|
||||||
INTEGER_IND_COMMAND(v_b, getVoltage, setVoltage, StringTo<int>,
|
INTEGER_IND_COMMAND(v_b, getPower, setPower, StringTo<int>, defs::V_POWER_B,
|
||||||
defs::V_POWER_B,
|
"[n_value]\n\t[Ctb] Power supply b in mV.");
|
||||||
"[n_value]\n\t[Ctb] Voltage supply b in mV.");
|
|
||||||
|
|
||||||
INTEGER_IND_COMMAND(v_c, getVoltage, setVoltage, StringTo<int>,
|
INTEGER_IND_COMMAND(v_c, getPower, setPower, StringTo<int>, defs::V_POWER_C,
|
||||||
defs::V_POWER_C,
|
"[n_value]\n\t[Ctb] Power supply c in mV.");
|
||||||
"[n_value]\n\t[Ctb] Voltage supply c in mV.");
|
|
||||||
|
|
||||||
INTEGER_IND_COMMAND(v_d, getVoltage, setVoltage, StringTo<int>,
|
INTEGER_IND_COMMAND(v_d, getPower, setPower, StringTo<int>, defs::V_POWER_D,
|
||||||
defs::V_POWER_D,
|
"[n_value]\n\t[Ctb] Power supply d in mV.");
|
||||||
"[n_value]\n\t[Ctb] Voltage supply d in mV.");
|
|
||||||
|
|
||||||
INTEGER_IND_COMMAND(
|
INTEGER_IND_COMMAND(
|
||||||
v_io, getVoltage, setVoltage, StringTo<int>, defs::V_POWER_IO,
|
v_io, getPower, setPower, StringTo<int>, defs::V_POWER_IO,
|
||||||
"[n_value]\n\t[Ctb] Voltage supply io in mV. Minimum 1200 mV. Must "
|
"[n_value]\n\t[Ctb] Power supply io in mV. Minimum 1200 mV. Must "
|
||||||
"be the first power regulator to be set after fpga reset (on-board "
|
"be the first power regulator to be set after fpga reset (on-board "
|
||||||
"detector server start up).");
|
"detector server start up).");
|
||||||
|
|
||||||
INTEGER_IND_COMMAND(
|
INTEGER_IND_COMMAND(
|
||||||
v_chip, getVoltage, setVoltage, StringTo<int>, defs::V_POWER_CHIP,
|
v_chip, getPower, setPower, StringTo<int>, defs::V_POWER_CHIP,
|
||||||
"[n_value]\n\t[Ctb] Voltage supply chip in mV. Do not use it "
|
"[n_value]\n\t[Ctb] Power supply chip in mV. Do not use it "
|
||||||
"unless "
|
"unless "
|
||||||
"you are completely sure you will not fry the board.");
|
"you are completely sure you will not fry the board.");
|
||||||
|
|
||||||
GET_IND_COMMAND(vm_a, getMeasuredVoltage, defs::V_POWER_A, "",
|
GET_IND_COMMAND(vm_a, getMeasuredPower, defs::V_POWER_A, "",
|
||||||
"\n\t[Ctb] Measured voltage of power supply a in mV.");
|
"\n\t[Ctb] Measured voltage of power supply a in mV.");
|
||||||
|
|
||||||
GET_IND_COMMAND(vm_b, getMeasuredVoltage, defs::V_POWER_B, "",
|
GET_IND_COMMAND(vm_b, getMeasuredPower, defs::V_POWER_B, "",
|
||||||
"\n\t[Ctb] Measured voltage of power supply b in mV.");
|
"\n\t[Ctb] Measured voltage of power supply b in mV.");
|
||||||
|
|
||||||
GET_IND_COMMAND(vm_c, getMeasuredVoltage, defs::V_POWER_C, "",
|
GET_IND_COMMAND(vm_c, getMeasuredPower, defs::V_POWER_C, "",
|
||||||
"\n\t[Ctb] Measured voltage of power supply c in mV.");
|
"\n\t[Ctb] Measured voltage of power supply c in mV.");
|
||||||
|
|
||||||
GET_IND_COMMAND(vm_d, getMeasuredVoltage, defs::V_POWER_D, "",
|
GET_IND_COMMAND(vm_d, getMeasuredPower, defs::V_POWER_D, "",
|
||||||
"\n\t[Ctb] Measured voltage of power supply d in mV.");
|
"\n\t[Ctb] Measured voltage of power supply d in mV.");
|
||||||
|
|
||||||
GET_IND_COMMAND(vm_io, getMeasuredVoltage, defs::V_POWER_IO, "",
|
GET_IND_COMMAND(vm_io, getMeasuredPower, defs::V_POWER_IO, "",
|
||||||
"\n\t[Ctb] Measured voltage of power supply io in mV.");
|
"\n\t[Ctb] Measured voltage of power supply io in mV.");
|
||||||
|
|
||||||
GET_IND_COMMAND(im_a, getMeasuredCurrent, defs::I_POWER_A, "",
|
GET_IND_COMMAND(im_a, getMeasuredCurrent, defs::I_POWER_A, "",
|
||||||
|
@ -20,11 +20,11 @@ CtbConfig::CtbConfig() {
|
|||||||
for (size_t i = 0; i != num_signals; ++i) {
|
for (size_t i = 0; i != num_signals; ++i) {
|
||||||
setSignalName(i, "BIT" + ToString(i));
|
setSignalName(i, "BIT" + ToString(i));
|
||||||
}
|
}
|
||||||
setVoltageName(0, "VA");
|
setPowerName(0, "VA");
|
||||||
setVoltageName(1, "VB");
|
setPowerName(1, "VB");
|
||||||
setVoltageName(2, "VC");
|
setPowerName(2, "VC");
|
||||||
setVoltageName(3, "VD");
|
setPowerName(3, "VD");
|
||||||
setVoltageName(4, "VIO");
|
setPowerName(4, "VIO");
|
||||||
for (size_t i = 0; i != num_slowADCs; ++i) {
|
for (size_t i = 0; i != num_slowADCs; ++i) {
|
||||||
setSlowADCName(i, "SLOWADC" + ToString(i));
|
setSlowADCName(i, "SLOWADC" + ToString(i));
|
||||||
}
|
}
|
||||||
@ -54,10 +54,10 @@ void CtbConfig::check_signal_index(size_t i) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CtbConfig::check_voltage_index(size_t i) const {
|
void CtbConfig::check_power_index(size_t i) const {
|
||||||
if (i >= num_voltages) {
|
if (i >= num_powers) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "Invalid Voltage index. Options: 0 - " << num_voltages
|
oss << "Invalid Power index. Options: 0 - " << num_powers
|
||||||
<< " or V_POWER_A - V_POWER_IO";
|
<< " or V_POWER_A - V_POWER_IO";
|
||||||
throw RuntimeError(oss.str());
|
throw RuntimeError(oss.str());
|
||||||
}
|
}
|
||||||
@ -176,33 +176,33 @@ std::vector<std::string> CtbConfig::getSignalNames() const {
|
|||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CtbConfig::setVoltageName(size_t index, const std::string &name) {
|
void CtbConfig::setPowerName(size_t index, const std::string &name) {
|
||||||
check_voltage_index(index);
|
check_power_index(index);
|
||||||
check_size(name);
|
check_size(name);
|
||||||
char *dst = &voltagenames[index * name_length];
|
char *dst = &powernames[index * name_length];
|
||||||
memset(dst, '\0', name_length);
|
memset(dst, '\0', name_length);
|
||||||
memcpy(dst, &name[0], name.size());
|
memcpy(dst, &name[0], name.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CtbConfig::setVoltageNames(const std::vector<std::string> &names) {
|
void CtbConfig::setPowerNames(const std::vector<std::string> &names) {
|
||||||
if (names.size() != num_voltages) {
|
if (names.size() != num_powers) {
|
||||||
throw RuntimeError("Voltage names need to be of size " +
|
throw RuntimeError("Power names need to be of size " +
|
||||||
std::to_string(num_voltages));
|
std::to_string(num_powers));
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i != num_voltages; ++i) {
|
for (size_t i = 0; i != num_powers; ++i) {
|
||||||
setVoltageName(i, names[i]);
|
setPowerName(i, names[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CtbConfig::getVoltageName(size_t index) const {
|
std::string CtbConfig::getPowerName(size_t index) const {
|
||||||
check_voltage_index(index);
|
check_power_index(index);
|
||||||
return voltagenames + index * name_length;
|
return powernames + index * name_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> CtbConfig::getVoltageNames() const {
|
std::vector<std::string> CtbConfig::getPowerNames() const {
|
||||||
std::vector<std::string> names;
|
std::vector<std::string> names;
|
||||||
for (size_t i = 0; i != num_voltages; ++i)
|
for (size_t i = 0; i != num_powers; ++i)
|
||||||
names.push_back(getVoltageName(i));
|
names.push_back(getPowerName(i));
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,19 +8,19 @@ class CtbConfig {
|
|||||||
static constexpr size_t num_dacs = 18;
|
static constexpr size_t num_dacs = 18;
|
||||||
static constexpr size_t num_adcs = 32;
|
static constexpr size_t num_adcs = 32;
|
||||||
static constexpr size_t num_signals = 64;
|
static constexpr size_t num_signals = 64;
|
||||||
static constexpr size_t num_voltages = 5;
|
static constexpr size_t num_powers = 5;
|
||||||
static constexpr size_t num_slowADCs = 8;
|
static constexpr size_t num_slowADCs = 8;
|
||||||
static constexpr const char *shm_tag_ = "ctbdacs";
|
static constexpr const char *shm_tag_ = "ctbdacs";
|
||||||
char dacnames[name_length * num_dacs]{};
|
char dacnames[name_length * num_dacs]{};
|
||||||
char adcnames[name_length * num_adcs]{};
|
char adcnames[name_length * num_adcs]{};
|
||||||
char signalnames[name_length * num_signals]{};
|
char signalnames[name_length * num_signals]{};
|
||||||
char voltagenames[name_length * num_voltages]{};
|
char powernames[name_length * num_powers]{};
|
||||||
char slowADCnames[name_length * num_slowADCs]{};
|
char slowADCnames[name_length * num_slowADCs]{};
|
||||||
|
|
||||||
void check_dac_index(size_t i) const;
|
void check_dac_index(size_t i) const;
|
||||||
void check_adc_index(size_t i) const;
|
void check_adc_index(size_t i) const;
|
||||||
void check_signal_index(size_t i) const;
|
void check_signal_index(size_t i) const;
|
||||||
void check_voltage_index(size_t i) const;
|
void check_power_index(size_t i) const;
|
||||||
void check_slow_adc_index(size_t i) const;
|
void check_slow_adc_index(size_t i) const;
|
||||||
void check_size(const std::string &name) const;
|
void check_size(const std::string &name) const;
|
||||||
|
|
||||||
@ -46,10 +46,10 @@ class CtbConfig {
|
|||||||
std::string getSignalName(size_t index) const;
|
std::string getSignalName(size_t index) const;
|
||||||
std::vector<std::string> getSignalNames() const;
|
std::vector<std::string> getSignalNames() const;
|
||||||
|
|
||||||
void setVoltageNames(const std::vector<std::string> &names);
|
void setPowerNames(const std::vector<std::string> &names);
|
||||||
void setVoltageName(size_t index, const std::string &name);
|
void setPowerName(size_t index, const std::string &name);
|
||||||
std::string getVoltageName(size_t index) const;
|
std::string getPowerName(size_t index) const;
|
||||||
std::vector<std::string> getVoltageNames() const;
|
std::vector<std::string> getPowerNames() const;
|
||||||
|
|
||||||
void setSlowADCNames(const std::vector<std::string> &names);
|
void setSlowADCNames(const std::vector<std::string> &names);
|
||||||
void setSlowADCName(size_t index, const std::string &name);
|
void setSlowADCName(size_t index, const std::string &name);
|
||||||
|
@ -2069,9 +2069,9 @@ Result<int> Detector::getSYNCClock(Positions pos) const {
|
|||||||
return pimpl->Parallel(&Module::getClockFrequency, pos, defs::SYNC_CLOCK);
|
return pimpl->Parallel(&Module::getClockFrequency, pos, defs::SYNC_CLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<defs::dacIndex> Detector::getVoltageList() const {
|
std::vector<defs::dacIndex> Detector::getPowerList() const {
|
||||||
if (getDetectorType().squash() != defs::CHIPTESTBOARD) {
|
if (getDetectorType().squash() != defs::CHIPTESTBOARD) {
|
||||||
throw RuntimeError("Voltage list not implemented for this detector");
|
throw RuntimeError("Power list not implemented for this detector");
|
||||||
}
|
}
|
||||||
return std::vector<defs::dacIndex>{defs::V_POWER_A, defs::V_POWER_B,
|
return std::vector<defs::dacIndex>{defs::V_POWER_A, defs::V_POWER_B,
|
||||||
defs::V_POWER_C, defs::V_POWER_D,
|
defs::V_POWER_C, defs::V_POWER_D,
|
||||||
@ -2087,7 +2087,7 @@ std::vector<defs::dacIndex> Detector::getSlowADCList() const {
|
|||||||
defs::SLOW_ADC4, defs::SLOW_ADC5, defs::SLOW_ADC6, defs::SLOW_ADC7};
|
defs::SLOW_ADC4, defs::SLOW_ADC5, defs::SLOW_ADC6, defs::SLOW_ADC7};
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getVoltage(defs::dacIndex index, Positions pos) const {
|
Result<int> Detector::getPower(defs::dacIndex index, Positions pos) const {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case defs::V_LIMIT:
|
case defs::V_LIMIT:
|
||||||
case defs::V_POWER_A:
|
case defs::V_POWER_A:
|
||||||
@ -2098,12 +2098,12 @@ Result<int> Detector::getVoltage(defs::dacIndex index, Positions pos) const {
|
|||||||
case defs::V_POWER_CHIP:
|
case defs::V_POWER_CHIP:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw RuntimeError("Unknown Voltage Index");
|
throw RuntimeError("Unknown Power Index");
|
||||||
}
|
}
|
||||||
return pimpl->Parallel(&Module::getDAC, pos, index, true);
|
return pimpl->Parallel(&Module::getDAC, pos, index, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setVoltage(defs::dacIndex index, int value, Positions pos) {
|
void Detector::setPower(defs::dacIndex index, int value, Positions pos) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case defs::V_LIMIT:
|
case defs::V_LIMIT:
|
||||||
case defs::V_POWER_A:
|
case defs::V_POWER_A:
|
||||||
@ -2114,7 +2114,7 @@ void Detector::setVoltage(defs::dacIndex index, int value, Positions pos) {
|
|||||||
case defs::V_POWER_CHIP:
|
case defs::V_POWER_CHIP:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw RuntimeError("Unknown Voltage Index");
|
throw RuntimeError("Unknown Power Index");
|
||||||
}
|
}
|
||||||
pimpl->Parallel(&Module::setDAC, pos, value, index, true);
|
pimpl->Parallel(&Module::setDAC, pos, value, index, true);
|
||||||
}
|
}
|
||||||
@ -2185,7 +2185,7 @@ void Detector::setDBITClock(int value_in_MHz, Positions pos) {
|
|||||||
value_in_MHz);
|
value_in_MHz);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<int> Detector::getMeasuredVoltage(defs::dacIndex index,
|
Result<int> Detector::getMeasuredPower(defs::dacIndex index,
|
||||||
Positions pos) const {
|
Positions pos) const {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case defs::V_POWER_A:
|
case defs::V_POWER_A:
|
||||||
@ -2196,7 +2196,7 @@ Result<int> Detector::getMeasuredVoltage(defs::dacIndex index,
|
|||||||
case defs::V_POWER_CHIP:
|
case defs::V_POWER_CHIP:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw RuntimeError("Unknown Voltage Index");
|
throw RuntimeError("Unknown Power Index");
|
||||||
}
|
}
|
||||||
return pimpl->Parallel(&Module::getADC, pos, index);
|
return pimpl->Parallel(&Module::getADC, pos, index);
|
||||||
}
|
}
|
||||||
@ -2377,39 +2377,39 @@ std::string Detector::getSignalName(const int i) const {
|
|||||||
return pimpl->getCtbSignalName(i);
|
return pimpl->getCtbSignalName(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setVoltageNames(const std::vector<std::string> names) {
|
void Detector::setPowerNames(const std::vector<std::string> names) {
|
||||||
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
|
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
|
||||||
throw RuntimeError("Named powers only for CTB");
|
throw RuntimeError("Named powers only for CTB");
|
||||||
pimpl->setCtbVoltageNames(names);
|
pimpl->setCtbPowerNames(names);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> Detector::getVoltageNames() const {
|
std::vector<std::string> Detector::getPowerNames() const {
|
||||||
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
|
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
|
||||||
throw RuntimeError("Named powers only for CTB");
|
throw RuntimeError("Named powers only for CTB");
|
||||||
return pimpl->getCtbVoltageNames();
|
return pimpl->getCtbPowerNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
defs::dacIndex Detector::getVoltageIndex(const std::string &name) const {
|
defs::dacIndex Detector::getPowerIndex(const std::string &name) const {
|
||||||
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
|
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
|
||||||
throw RuntimeError("Named powers only for CTB");
|
throw RuntimeError("Named powers only for CTB");
|
||||||
auto names = getVoltageNames();
|
auto names = getPowerNames();
|
||||||
auto it = std::find(names.begin(), names.end(), name);
|
auto it = std::find(names.begin(), names.end(), name);
|
||||||
if (it == names.end())
|
if (it == names.end())
|
||||||
throw RuntimeError("Voltage name not found");
|
throw RuntimeError("Power name not found");
|
||||||
return static_cast<defs::dacIndex>(it - names.begin() + defs::V_POWER_A);
|
return static_cast<defs::dacIndex>(it - names.begin() + defs::V_POWER_A);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setVoltageName(const defs::dacIndex index,
|
void Detector::setPowerName(const defs::dacIndex index,
|
||||||
const std::string &name) {
|
const std::string &name) {
|
||||||
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
|
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
|
||||||
throw RuntimeError("Named powers only for CTB");
|
throw RuntimeError("Named powers only for CTB");
|
||||||
pimpl->setCtbVoltageName(index, name);
|
pimpl->setCtbPowerName(index, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Detector::getVoltageName(const defs::dacIndex i) const {
|
std::string Detector::getPowerName(const defs::dacIndex i) const {
|
||||||
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
|
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
|
||||||
throw RuntimeError("Named powers only for CTB");
|
throw RuntimeError("Named powers only for CTB");
|
||||||
return pimpl->getCtbVoltageName(i);
|
return pimpl->getCtbPowerName(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setSlowADCNames(const std::vector<std::string> names) {
|
void Detector::setSlowADCNames(const std::vector<std::string> names) {
|
||||||
|
@ -2039,21 +2039,21 @@ void DetectorImpl::setCtbSignalName(const int index, const std::string &name) {
|
|||||||
ctb_shm()->setSignalName(index, name);
|
ctb_shm()->setSignalName(index, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> DetectorImpl::getCtbVoltageNames() const {
|
std::vector<std::string> DetectorImpl::getCtbPowerNames() const {
|
||||||
return ctb_shm()->getVoltageNames();
|
return ctb_shm()->getPowerNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DetectorImpl::setCtbVoltageNames(const std::vector<std::string> &names) {
|
void DetectorImpl::setCtbPowerNames(const std::vector<std::string> &names) {
|
||||||
ctb_shm()->setVoltageNames(names);
|
ctb_shm()->setPowerNames(names);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string DetectorImpl::getCtbVoltageName(const defs::dacIndex i) const {
|
std::string DetectorImpl::getCtbPowerName(const defs::dacIndex i) const {
|
||||||
return ctb_shm()->getVoltageName(static_cast<int>(i - defs::V_POWER_A));
|
return ctb_shm()->getPowerName(static_cast<int>(i - defs::V_POWER_A));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DetectorImpl::setCtbVoltageName(const defs::dacIndex index,
|
void DetectorImpl::setCtbPowerName(const defs::dacIndex index,
|
||||||
const std::string &name) {
|
const std::string &name) {
|
||||||
ctb_shm()->setVoltageName(static_cast<int>(index - defs::V_POWER_A), name);
|
ctb_shm()->setPowerName(static_cast<int>(index - defs::V_POWER_A), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> DetectorImpl::getCtbSlowADCNames() const {
|
std::vector<std::string> DetectorImpl::getCtbSlowADCNames() const {
|
||||||
|
@ -84,7 +84,9 @@ class DetectorImpl : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
virtual ~DetectorImpl();
|
virtual ~DetectorImpl();
|
||||||
|
|
||||||
template <class CT> struct NonDeduced { using type = CT; };
|
template <class CT> struct NonDeduced {
|
||||||
|
using type = CT;
|
||||||
|
};
|
||||||
template <typename RT, typename... CT>
|
template <typename RT, typename... CT>
|
||||||
Result<RT> Parallel(RT (Module::*somefunc)(CT...),
|
Result<RT> Parallel(RT (Module::*somefunc)(CT...),
|
||||||
std::vector<int> positions,
|
std::vector<int> positions,
|
||||||
@ -342,10 +344,10 @@ class DetectorImpl : public virtual slsDetectorDefs {
|
|||||||
void setCtbSignalNames(const std::vector<std::string> &names);
|
void setCtbSignalNames(const std::vector<std::string> &names);
|
||||||
void setCtbSignalName(const int index, const std::string &name);
|
void setCtbSignalName(const int index, const std::string &name);
|
||||||
|
|
||||||
std::vector<std::string> getCtbVoltageNames() const;
|
std::vector<std::string> getCtbPowerNames() const;
|
||||||
std::string getCtbVoltageName(const defs::dacIndex i) const;
|
std::string getCtbPowerName(const defs::dacIndex i) const;
|
||||||
void setCtbVoltageNames(const std::vector<std::string> &names);
|
void setCtbPowerNames(const std::vector<std::string> &names);
|
||||||
void setCtbVoltageName(const defs::dacIndex index, const std::string &name);
|
void setCtbPowerName(const defs::dacIndex index, const std::string &name);
|
||||||
|
|
||||||
std::vector<std::string> getCtbSlowADCNames() const;
|
std::vector<std::string> getCtbSlowADCNames() const;
|
||||||
std::string getCtbSlowADCName(const defs::dacIndex i) const;
|
std::string getCtbSlowADCName(const defs::dacIndex i) const;
|
||||||
|
@ -261,15 +261,15 @@ TEST_CASE("signalindex", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("voltagelist", "[.cmd]") {
|
TEST_CASE("powerlist", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::CHIPTESTBOARD) {
|
if (det_type == defs::CHIPTESTBOARD) {
|
||||||
auto prev = det.getVoltageNames();
|
auto prev = det.getPowerNames();
|
||||||
|
|
||||||
REQUIRE_THROWS(proxy.Call("voltagelist", {"a", "s", "d"}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("powerlist", {"a", "s", "d"}, -1, PUT));
|
||||||
|
|
||||||
std::vector<std::string> names;
|
std::vector<std::string> names;
|
||||||
for (int iarg = 0; iarg != 5; ++iarg) {
|
for (int iarg = 0; iarg != 5; ++iarg) {
|
||||||
@ -277,87 +277,87 @@ TEST_CASE("voltagelist", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
REQUIRE_NOTHROW(proxy.Call("voltagelist", names, -1, PUT, oss));
|
REQUIRE_NOTHROW(proxy.Call("powerlist", names, -1, PUT, oss));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
REQUIRE_NOTHROW(proxy.Call("voltagelist", {}, -1, GET, oss));
|
REQUIRE_NOTHROW(proxy.Call("powerlist", {}, -1, GET, oss));
|
||||||
REQUIRE(oss.str() ==
|
REQUIRE(oss.str() ==
|
||||||
std::string("voltagelist ") + ToString(names) + '\n');
|
std::string("powerlist ") + ToString(names) + '\n');
|
||||||
}
|
}
|
||||||
det.setVoltageNames(prev);
|
det.setPowerNames(prev);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("voltagelist", {"a", "b"}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("powerlist", {"a", "b"}, -1, PUT));
|
||||||
REQUIRE_THROWS(proxy.Call("voltagelist", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("powerlist", {}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("voltagename", "[.cmd]") {
|
TEST_CASE("powername", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::CHIPTESTBOARD) {
|
if (det_type == defs::CHIPTESTBOARD) {
|
||||||
defs::dacIndex ind = static_cast<defs::dacIndex>(2 + defs::V_POWER_A);
|
defs::dacIndex ind = static_cast<defs::dacIndex>(2 + defs::V_POWER_A);
|
||||||
std::string str_voltage_index = "2";
|
std::string str_power_index = "2";
|
||||||
auto prev = det.getVoltageName(ind);
|
auto prev = det.getPowerName(ind);
|
||||||
|
|
||||||
// 1 arg throw
|
// 1 arg throw
|
||||||
REQUIRE_THROWS(proxy.Call("voltagename", {"2", "3", "bname"}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("powername", {"2", "3", "bname"}, -1, PUT));
|
||||||
// invalid index
|
// invalid index
|
||||||
REQUIRE_THROWS(proxy.Call("voltagename", {"5", "bname"}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("powername", {"5", "bname"}, -1, PUT));
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
REQUIRE_NOTHROW(proxy.Call(
|
REQUIRE_NOTHROW(proxy.Call("powername", {str_power_index, "bname"},
|
||||||
"voltagename", {str_voltage_index, "bname"}, -1, PUT, oss));
|
-1, PUT, oss));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
REQUIRE_NOTHROW(
|
REQUIRE_NOTHROW(
|
||||||
proxy.Call("voltagename", {str_voltage_index}, -1, GET, oss));
|
proxy.Call("powername", {str_power_index}, -1, GET, oss));
|
||||||
REQUIRE(oss.str() == std::string("voltagename ") +
|
REQUIRE(oss.str() ==
|
||||||
str_voltage_index + " bname\n");
|
std::string("powername ") + str_power_index + " bname\n");
|
||||||
}
|
}
|
||||||
det.setVoltageName(ind, prev);
|
det.setPowerName(ind, prev);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("voltagename", {"2", "b"}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("powername", {"2", "b"}, -1, PUT));
|
||||||
REQUIRE_THROWS(proxy.Call("voltagename", {"2"}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("powername", {"2"}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("voltageindex", "[.cmd]") {
|
TEST_CASE("powerindex", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::CHIPTESTBOARD) {
|
if (det_type == defs::CHIPTESTBOARD) {
|
||||||
defs::dacIndex ind = static_cast<defs::dacIndex>(2 + defs::V_POWER_A);
|
defs::dacIndex ind = static_cast<defs::dacIndex>(2 + defs::V_POWER_A);
|
||||||
std::string str_voltage_index = "2";
|
std::string str_power_index = "2";
|
||||||
|
|
||||||
// 1 arg throw
|
// 1 arg throw
|
||||||
REQUIRE_THROWS(proxy.Call("voltageindex", {"2", "2"}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("powerindex", {"2", "2"}, -1, PUT));
|
||||||
// invalid index
|
// invalid index
|
||||||
REQUIRE_THROWS(proxy.Call("voltageindex", {"5"}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("powerindex", {"5"}, -1, PUT));
|
||||||
auto voltagename = det.getVoltageName(ind);
|
auto powername = det.getPowerName(ind);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
REQUIRE_NOTHROW(
|
REQUIRE_NOTHROW(
|
||||||
proxy.Call("voltageindex", {voltagename}, -1, GET, oss));
|
proxy.Call("powerindex", {powername}, -1, GET, oss));
|
||||||
REQUIRE(oss.str() ==
|
REQUIRE(oss.str() ==
|
||||||
std::string("voltageindex ") + str_voltage_index + '\n');
|
std::string("powerindex ") + str_power_index + '\n');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("voltageindex", {"2"}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("powerindex", {"2"}, -1, GET));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("voltagevalues", "[.cmd]") {
|
TEST_CASE("powervalues", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
REQUIRE_NOTHROW(proxy.Call("voltagevalues", {}, -1, GET));
|
REQUIRE_NOTHROW(proxy.Call("powervalues", {}, -1, GET));
|
||||||
REQUIRE_THROWS(proxy.Call("voltagevalues", {}, -1, PUT));
|
REQUIRE_THROWS(proxy.Call("powervalues", {}, -1, PUT));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("slowadcvalues", "[.cmd]") {
|
TEST_CASE("slowadcvalues", "[.cmd]") {
|
||||||
@ -733,7 +733,7 @@ TEST_CASE("v_limit", "[.cmd]") {
|
|||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
|
||||||
if (det_type == defs::CHIPTESTBOARD) {
|
if (det_type == defs::CHIPTESTBOARD) {
|
||||||
auto prev_val = det.getVoltage(defs::V_LIMIT);
|
auto prev_val = det.getPower(defs::V_LIMIT);
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("v_limit", {"1500"}, -1, PUT, oss);
|
proxy.Call("v_limit", {"1500"}, -1, PUT, oss);
|
||||||
@ -758,7 +758,7 @@ TEST_CASE("v_limit", "[.cmd]") {
|
|||||||
if (prev_val[i] == -100) {
|
if (prev_val[i] == -100) {
|
||||||
prev_val[i] = 0;
|
prev_val[i] = 0;
|
||||||
}
|
}
|
||||||
det.setVoltage(defs::V_LIMIT, prev_val[i], {i});
|
det.setPower(defs::V_LIMIT, prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("v_limit", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("v_limit", {}, -1, GET));
|
||||||
@ -1006,7 +1006,7 @@ TEST_CASE("v_a", "[.cmd]") {
|
|||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::CHIPTESTBOARD) {
|
if (det_type == defs::CHIPTESTBOARD) {
|
||||||
auto prev_val = det.getVoltage(defs::V_POWER_A);
|
auto prev_val = det.getPower(defs::V_POWER_A);
|
||||||
{
|
{
|
||||||
std::ostringstream oss1, oss2;
|
std::ostringstream oss1, oss2;
|
||||||
proxy.Call("v_a", {"700"}, -1, PUT, oss1);
|
proxy.Call("v_a", {"700"}, -1, PUT, oss1);
|
||||||
@ -1015,7 +1015,7 @@ TEST_CASE("v_a", "[.cmd]") {
|
|||||||
REQUIRE(oss2.str() == "v_a 700\n");
|
REQUIRE(oss2.str() == "v_a 700\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setVoltage(defs::V_POWER_A, prev_val[i], {i});
|
det.setPower(defs::V_POWER_A, prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("v_a", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("v_a", {}, -1, GET));
|
||||||
@ -1027,7 +1027,7 @@ TEST_CASE("v_b", "[.cmd]") {
|
|||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::CHIPTESTBOARD) {
|
if (det_type == defs::CHIPTESTBOARD) {
|
||||||
auto prev_val = det.getVoltage(defs::V_POWER_B);
|
auto prev_val = det.getPower(defs::V_POWER_B);
|
||||||
{
|
{
|
||||||
std::ostringstream oss1, oss2;
|
std::ostringstream oss1, oss2;
|
||||||
proxy.Call("v_b", {"700"}, -1, PUT, oss1);
|
proxy.Call("v_b", {"700"}, -1, PUT, oss1);
|
||||||
@ -1036,7 +1036,7 @@ TEST_CASE("v_b", "[.cmd]") {
|
|||||||
REQUIRE(oss2.str() == "v_b 700\n");
|
REQUIRE(oss2.str() == "v_b 700\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setVoltage(defs::V_POWER_B, prev_val[i], {i});
|
det.setPower(defs::V_POWER_B, prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("v_b", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("v_b", {}, -1, GET));
|
||||||
@ -1048,7 +1048,7 @@ TEST_CASE("v_c", "[.cmd]") {
|
|||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::CHIPTESTBOARD) {
|
if (det_type == defs::CHIPTESTBOARD) {
|
||||||
auto prev_val = det.getVoltage(defs::V_POWER_C);
|
auto prev_val = det.getPower(defs::V_POWER_C);
|
||||||
{
|
{
|
||||||
std::ostringstream oss1, oss2;
|
std::ostringstream oss1, oss2;
|
||||||
proxy.Call("v_c", {"700"}, -1, PUT, oss1);
|
proxy.Call("v_c", {"700"}, -1, PUT, oss1);
|
||||||
@ -1057,7 +1057,7 @@ TEST_CASE("v_c", "[.cmd]") {
|
|||||||
REQUIRE(oss2.str() == "v_c 700\n");
|
REQUIRE(oss2.str() == "v_c 700\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setVoltage(defs::V_POWER_C, prev_val[i], {i});
|
det.setPower(defs::V_POWER_C, prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("v_c", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("v_c", {}, -1, GET));
|
||||||
@ -1069,7 +1069,7 @@ TEST_CASE("v_d", "[.cmd]") {
|
|||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
if (det_type == defs::CHIPTESTBOARD) {
|
if (det_type == defs::CHIPTESTBOARD) {
|
||||||
auto prev_val = det.getVoltage(defs::V_POWER_D);
|
auto prev_val = det.getPower(defs::V_POWER_D);
|
||||||
{
|
{
|
||||||
std::ostringstream oss1, oss2;
|
std::ostringstream oss1, oss2;
|
||||||
proxy.Call("v_d", {"700"}, -1, PUT, oss1);
|
proxy.Call("v_d", {"700"}, -1, PUT, oss1);
|
||||||
@ -1078,7 +1078,7 @@ TEST_CASE("v_d", "[.cmd]") {
|
|||||||
REQUIRE(oss2.str() == "v_d 700\n");
|
REQUIRE(oss2.str() == "v_d 700\n");
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setVoltage(defs::V_POWER_D, prev_val[i], {i});
|
det.setPower(defs::V_POWER_D, prev_val[i], {i});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
REQUIRE_THROWS(proxy.Call("v_d", {}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("v_d", {}, -1, GET));
|
||||||
|
@ -26,7 +26,7 @@ TEST_CASE("Default construction") {
|
|||||||
REQUIRE(adcnames[1] == "ADC1");
|
REQUIRE(adcnames[1] == "ADC1");
|
||||||
REQUIRE(adcnames[2] == "ADC2");
|
REQUIRE(adcnames[2] == "ADC2");
|
||||||
REQUIRE(adcnames[3] == "ADC3");
|
REQUIRE(adcnames[3] == "ADC3");
|
||||||
auto powernames = c.getVoltageNames();
|
auto powernames = c.getPowerNames();
|
||||||
REQUIRE(powernames.size() == 5);
|
REQUIRE(powernames.size() == 5);
|
||||||
REQUIRE(powernames[0] == "VA");
|
REQUIRE(powernames[0] == "VA");
|
||||||
REQUIRE(powernames[1] == "VB");
|
REQUIRE(powernames[1] == "VB");
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <cstdint>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user