Commit 130878f0 authored by Arnaud WATLET's avatar Arnaud WATLET
Browse files

Tries enabling switch_pwr during injection for polarity 0 on pwr_batt and pwr_dps5005_fixed

Showing with 49 additions and 6 deletions
+49 -6
......@@ -26,6 +26,7 @@ class Pwr(PwrAbstract):
self.exec_logger.event(f'{self.model}\tpwr_init\tbegin\t{datetime.datetime.utcnow()}')
self._voltage = kwargs['voltage']
self._current = np.nan
self._switch_pwr_on_zero = True
# self._state = 'on'
if not subclass_init:
self.exec_logger.event(f'{self.model}\tpwr_init\tend\t{datetime.datetime.utcnow()}')
......@@ -37,12 +38,6 @@ class Pwr(PwrAbstract):
@current.setter
def current(self, value, **kwargs):
self.exec_logger.debug(f'Current cannot be set on {self.model}')
#
# def turn_off(self):
# self.exec_logger.debug(f'{self.model} cannot be turned off')
#
# def turn_on(self):
# self.exec_logger.debug(f'{self.model} is always on')
@property
def voltage(self):
......@@ -51,3 +46,9 @@ class Pwr(PwrAbstract):
@voltage.setter
def voltage(self, value):
PwrAbstract.voltage.fset(self, value)
# def voltage_pulse(self, voltage=0., length=None, polarity=1):
# self.voltage_pulse(voltage=voltage, length=length, polarity=polarity, switch_pwr=self._switch_pwr_on_zero)
def inject(self, polarity=1, injection_duration=None):
self.inject(polarity=polarity, injection_duration=injection_duration, switch_pwr=self._switch_pwr_on_zero)
from ohmpi.hardware_components.abstract_hardware_components import PwrAbstract
import numpy as np
import datetime
import os
import time
from ohmpi.utils import enforce_specs
from minimalmodbus import Instrument # noqa
from ohmpi.hardware_components.pwr_batt import Pwr as Pwr_batt
# hardware characteristics and limitations
SPECS = {'model': {'default': os.path.basename(__file__).rstrip('.py')},
'voltage': {'default': 12., 'max': 50., 'min': 0.},
'voltage_min': {'default': 0},
'voltage_max': {'default': 0},
'current_max': {'default': 60.},
'current_adjustable': {'default': False},
'voltage_adjustable': {'default': False},
'pwr_latency': {'default': .5}
}
class Pwr(Pwr_batt):
def __init__(self, **kwargs):
if 'model' not in kwargs.keys():
for key in SPECS.keys():
kwargs = enforce_specs(kwargs, SPECS, key)
subclass_init = False
else:
subclass_init = True
super().__init__(**kwargs)
if not subclass_init:
self.exec_logger.event(f'{self.model}\tpwr_init\tbegin\t{datetime.datetime.utcnow()}')
assert isinstance(self.connection, Instrument)
self._voltage = kwargs['voltage']
self._current_max = kwargs['current_max']
self.voltage_adjustable = False
self.current_adjustable = False
self._current = np.nan
self._pwr_state = 'off'
self._pwr_latency = kwargs['pwr_latency']
if not subclass_init:
self.exec_logger.event(f'{self.model}\tpwr_init\tend\t{datetime.datetime.utcnow()}')
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