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 Dec 3, 2024
1 parent 593002e commit 1b48f32
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/mlpro/bf/control/controllers/hunter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
## -- History :
## -- yyyy-mm-dd Ver. Auth. Description
## -- 2024-10-10 0.1.0 DA Initial implementation
## -- 2024-12-03 0.1.1 DA Bugfix
## -------------------------------------------------------------------------------------------------

"""
Ver. 0.1.0 (2024-10-10)
Ver. 0.1.1 (2024-12-03)
This module provides a simple demo system that just cumulates a percentage part of the incoming
action to the inner state.
Expand All @@ -33,4 +34,4 @@ class Hunter (Controller):

## -------------------------------------------------------------------------------------------------
def _compute_output(self, p_ctrl_error : ControlError, p_ctrl_var : ControlVariable ):
p_ctrl_var.values = np.array(p_ctrl_error.values) * (-1)
p_ctrl_var.values = np.array(p_ctrl_error.values)
5 changes: 3 additions & 2 deletions src/mlpro/bf/control/operators/comparator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
## -- 2024-11-10 0.5.0 DA Refactoring
## -- 2024-11-26 0.6.0 DA Method Comparator._run(): creation of ControlError only if
## -- both SetPoint and ControlledVariable are detected
## -- 2024-12-03 0.6.1 DA Bugfix in method Comparator.get_control_error()
## -------------------------------------------------------------------------------------------------

"""
Ver. 0.6.0 (2024-11-26)
Ver. 0.6.1 (2024-12-03)
This module provides an implementation of a comparator that determins the control error based on
setpoint and controlled variable (system state).
Expand Down Expand Up @@ -84,5 +85,5 @@ def get_control_error(self, p_setpoint: SetPoint, p_ctrlled_var: ControlledVaria

return ControlError( p_id = self.get_so().get_next_inst_id(),
p_value_space = p_ctrlled_var.value_space,
p_values = np.subtract( np.array(p_ctrlled_var.values), np.array(p_setpoint.values) ),
p_values = np.subtract( np.array(p_setpoint.values), np.array(p_ctrlled_var.values) ),
p_tstamp = self.get_so().get_tstamp() )

0 comments on commit 1b48f32

Please sign in to comment.