Skip to content

Commit

Permalink
With serial disable when finish experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
RobertoAldea committed Feb 19, 2024
1 parent 8bf1e56 commit fb09e98
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions code/cycler/src/wattrex_battery_cycler/mid/mid_pwr/mid_pwr.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,12 @@ def process_iteration(self) -> Tuple[CyclerDataExpStatusE, int]: #pylint: disabl
else:
# Before reading the next instruction,
# check if the actual instruction is running
log.debug(("Actual mode is instruction mode: "
f"{self.actual_inst.mode is self.local_status.pwr_mode}"))
log.debug(f"Actual instr id: {self.actual_inst.instr_id}")
if (self.actual_inst.instr_id is not None and
self.__last_mode is not CyclerDataPwrModeE.DISABLE):
status = CyclerDataExpStatusE.RUNNING
log.debug((f"Actual mode {self.local_status.pwr_mode} is instruction mode "
f"{self.actual_inst.mode}: {self.actual_inst.mode is self.local_status.pwr_mode}"))
log.debug(f"Actual instr id: {self.actual_inst.instr_id}")
if self.actual_inst.mode is self.local_status.pwr_mode:
#Check if the instruction limits has been reached
inst_finished = self.__instruction_limit()
Expand All @@ -252,6 +252,7 @@ def process_iteration(self) -> Tuple[CyclerDataExpStatusE, int]: #pylint: disabl
status = CyclerDataExpStatusE.RUNNING
else:
self.actual_inst.instr_id = None
self.pwr_dev.disable()
self.__last_mode = CyclerDataPwrModeE.DISABLE
status = CyclerDataExpStatusE.FINISHED
else:
Expand All @@ -265,6 +266,7 @@ def __instruction_limit(self) -> bool: #pylint: disable=too-many-branches
"""
res = False
## If the limit is not active, activate it
log.debug(f"Instr limit is: {self.actual_inst.limit_type}")
if not self.__limit_active:
if self.actual_inst.limit_type is CyclerDataPwrLimitE.TIME:
self.instr_init_time = int(time_ns()*1e-6)
Expand Down

0 comments on commit fb09e98

Please sign in to comment.