diff --git a/ohmpi/hardware_components/mb_2024_0_2.py b/ohmpi/hardware_components/mb_2024_0_2.py index 5f8f4fb115547d86a752cd7aa1e9986632f81c6d..7fde18bbc643acb1c466918bdcfe2ec0d78d377a 100644 --- a/ohmpi/hardware_components/mb_2024_0_2.py +++ b/ohmpi/hardware_components/mb_2024_0_2.py @@ -34,6 +34,7 @@ SPECS = {'rx': {'model': {'default': os.path.basename(__file__).rstrip('.py')}, 'r_shunt': {'min': 0., 'default': 2.}, 'activation_delay': {'default': 0.010}, # Max turn on time of OMRON G5LE-1 5VDC relays 'release_delay': {'default': 0.005}, # Max turn off time of OMRON G5LE-1 5VDC relays = 1ms + 'pwr_latency': {'default': 4.} }} # TODO: move low_battery spec in pwr @@ -76,6 +77,8 @@ class Tx(Tx_mb_2023): super().__init__(**kwargs) if not subclass_init: self.exec_logger.event(f'{self.model}\ttx_init\tbegin\t{datetime.datetime.utcnow()}') + self._pwr_latency = kwargs['pwr_latency'] + # Initialize LEDs self.pin4 = self.mcp_board.get_pin(4) # Ohmpi_run self.pin4.direction = Direction.OUTPUT @@ -104,7 +107,7 @@ class Tx(Tx_mb_2023): return self._pwr_state @pwr_state.setter - def pwr_state(self, state, latency=4.): + def pwr_state(self, state): """Switches pwr on or off. Parameters @@ -117,7 +120,7 @@ class Tx(Tx_mb_2023): self.pin3.value = True self.exec_logger.debug(f'Switching DPS on') self._pwr_state = 'on' - time.sleep(latency) # from pwr specs + time.sleep(self._pwr_latency) # from pwr specs elif state == 'off': self.pin2.value = False self.pin3.value = False diff --git a/ohmpi/hardware_components/pwr_dps5005.py b/ohmpi/hardware_components/pwr_dps5005.py index 691fc39668931c5d691ca3ea1eee1b744ff4ab35..04f077eea6e2445bc5bb249af3d64b0a123cb80a 100644 --- a/ohmpi/hardware_components/pwr_dps5005.py +++ b/ohmpi/hardware_components/pwr_dps5005.py @@ -14,6 +14,7 @@ SPECS = {'model': {'default': os.path.basename(__file__).rstrip('.py')}, 'current_max': {'default': 100.}, 'current_adjustable': {'default': False}, 'voltage_adjustable': {'default': True} + 'pwr_latency':{'default': .3} } # TODO: Complete this code... handle modbus connection @@ -41,6 +42,7 @@ class Pwr(PwrAbstract): 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()}') @@ -82,7 +84,7 @@ class Pwr(PwrAbstract): return self._pwr_state @pwr_state.setter - def pwr_state(self, state, latency=.3): + def pwr_state(self, state): """Switches pwr on or off. Parameters @@ -94,7 +96,7 @@ class Pwr(PwrAbstract): self.connection.write_register(0x09, 1) self._pwr_state = 'on' self.exec_logger.debug(f'{self.model} is on') - time.sleep(latency) # from pwr specs + time.sleep(self._pwr_latency) # from pwr specs elif state == 'off': self.connection.write_register(0x09, 0) diff --git a/ohmpi/hardware_system.py b/ohmpi/hardware_system.py index 991035c78c21bae764cc9e68278ab539a3d9b847..214b55d458efcf29daaaf29cd9e008c5d877f02e 100644 --- a/ohmpi/hardware_system.py +++ b/ohmpi/hardware_system.py @@ -436,6 +436,7 @@ class OhmPiHardware: self.tx.pwr.pwr_state = 'off' if switch_tx_pwr_off: self.tx.pwr_state = 'off' + def _vab_pulse(self, vab=None, duration=1., sampling_rate=None, polarity=1, append=False): """ Gets VMN and IAB from a single voltage pulse """