Skip to content

Commit

Permalink
BF: Basics of closed-loop control #1046
Browse files Browse the repository at this point in the history
  • Loading branch information
detlefarend committed Nov 11, 2024
1 parent b091432 commit 1554e2a
Showing 1 changed file with 2 additions and 32 deletions.
34 changes: 2 additions & 32 deletions src/mlpro/bf/control/basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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() )
Expand All @@ -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)




Expand Down

0 comments on commit 1554e2a

Please sign in to comment.