From 1554e2a012fc24341d3f77a6fa63fffb6100b476 Mon Sep 17 00:00:00 2001 From: detlefarend Date: Mon, 11 Nov 2024 12:37:56 +0100 Subject: [PATCH] BF: Basics of closed-loop control #1046 --- src/mlpro/bf/control/basics.py | 34 ++-------------------------------- 1 file changed, 2 insertions(+), 32 deletions(-) diff --git a/src/mlpro/bf/control/basics.py b/src/mlpro/bf/control/basics.py index 86ba0561c..7264d4a7a 100644 --- a/src/mlpro/bf/control/basics.py +++ b/src/mlpro/bf/control/basics.py @@ -904,37 +904,10 @@ def run( self, StreamWorkflow.run( self, p_range = p_range, p_wait = p_wait, p_inst = inst_dict) - # # 3 Add/replace the outcomes of the final task to the instance dict of the initial task - # so = self.get_so() - # so.lock( p_tid = ControlShared.C_TID_ADMIN ) - # setpoint = get_ctrl_data( p_inst = so._instances[ControlShared.C_TID_ADMIN], p_type = SetPoint, p_remove = False ) - - # del so._instances[ControlShared.C_TID_ADMIN] - # new_setpoint = setpoint.copy() - # new_setpoint.id = so.get_next_inst_id() - # new_setpoint.tstamp = so.get_tstamp() - # so._instances[ControlShared.C_TID_ADMIN] = { new_setpoint.id : (InstTypeNew, new_setpoint) } - - # for task in self._final_tasks: - # so._instances[ControlShared.C_TID_ADMIN].update(so._instances[task.id]) - - # so.unlock() - - - # # 4 Add the outcomes of the final task to the instance dict of a superior shared object - # if self._superior_so is not None: - # self._superior_so.lock( p_tid = self.get_tid() ) - - # for task in self._final_tasks: - # self._superior_so._instances[self.get_tid()].update( so._instances[task.id] ) - - # self._superior_so.unlock() - - ## ------------------------------------------------------------------------------------------------- - def _raise_event(self, p_event_id, p_event_object): + def _on_finished(self): - if p_event_id == self.C_EVENT_FINISHED: + if isinstance(self, Workflow): # 1 Add/replace the outcomes of the final task to the instance dict of the initial task so = self.get_so() @@ -952,7 +925,6 @@ def _raise_event(self, p_event_id, p_event_object): so.unlock() - # 2 Add the outcomes of the final task to the instance dict of a superior shared object if self._superior_so is not None: self._superior_so.lock( p_tid = self.get_tid() ) @@ -965,8 +937,6 @@ def _raise_event(self, p_event_id, p_event_object): self._superior_so.unlock() - super()._raise_event(p_event_id, p_event_object) -