diff --git a/ohmpi/hardware_components/pwr_batt.py b/ohmpi/hardware_components/pwr_batt.py index c949675b8770aac86d834a82256157de9c453665..205762f2f056aafb75cd87097968d91837d003f9 100644 --- a/ohmpi/hardware_components/pwr_batt.py +++ b/ohmpi/hardware_components/pwr_batt.py @@ -1,16 +1,27 @@ from ohmpi.hardware_components.abstract_hardware_components import PwrAbstract import numpy as np import os +from ohmpi.utils import enforce_specs + +# hardware characteristics and limitations +SPECS = {'model': {'default': os.path.basename(__file__).rstrip('.py')}, + 'voltage': {'default': 12., 'max': 12., 'min': 12.}, + } class Pwr(PwrAbstract): def __init__(self, **kwargs): - kwargs.update({'model': os.path.basename(__file__).rstrip('.py')}) + if 'model' not in kwargs.keys(): + for key in SPECS.keys(): + kwargs = enforce_specs(kwargs, SPECS, key) + subclass_init = False + else: + subclass_init = True voltage = kwargs.pop('voltage', 12.) super().__init__(**kwargs) self.voltage_adjustable = False self._voltage = voltage - self._current_adjustable = False + self.current_adjustable = False self._current = np.nan self._state = 'on'