Commit 01d5d883 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 27 additions and 8 deletions
+27 -8
......@@ -129,6 +129,33 @@ class Tx(Tx_mb_2023):
self.exec_logger.debug(f'Switching DPS off')
self._pwr_state = 'off'
@property
def polarity(self):
return self._polarity
@polarity.setter
def polarity(self, polarity):
assert polarity in [-1, 0, 1]
self._polarity = polarity
if polarity == 1:
if self.pwr.voltage_adjustable:
self.pwr_state = 'on'
self.pin0.value = True
self.pin1.value = False
time.sleep(self._activation_delay)
elif polarity == -1:
if self.pwr.voltage_adjustable:
self.pwr_state = 'on'
self.pin0.value = False
self.pin1.value = True
time.sleep(self._activation_delay)
else:
if self.pwr.voltage_adjustable:
self.pwr_state = 'off'
self.pin0.value = False
self.pin1.value = False
time.sleep(self._release_delay)
class Rx(Rx_mb_2023):
def __init__(self, **kwargs):
......
......@@ -26,7 +26,6 @@ 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()}')
......@@ -46,9 +45,3 @@ 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)
......@@ -32,7 +32,6 @@ class Pwr(Pwr_batt):
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()}')
......
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