From 44856e9634ce8758dfa9cdfa9043071de4ff1f54 Mon Sep 17 00:00:00 2001 From: detlefarend Date: Mon, 2 Sep 2024 12:15:24 +0200 Subject: [PATCH] BF: Basics of closed-loop control #1046 --- src/mlpro/bf/control/controllers/__init__.py | 1 - .../bf/control/controllers/pid_controller.py | 59 -------------- test/howtos/bf/control/.gitkeep | 0 ...f_control_101_pid_controller_standalone.py | 80 ------------------- ..._bf_control_102_pid_controller_embedded.py | 80 ------------------- ..._bf_control_103_pid_controller_cascaded.py | 80 ------------------- 6 files changed, 300 deletions(-) delete mode 100644 src/mlpro/bf/control/controllers/pid_controller.py create mode 100644 test/howtos/bf/control/.gitkeep delete mode 100644 test/howtos/bf/howto_bf_control_101_pid_controller_standalone.py delete mode 100644 test/howtos/bf/howto_bf_control_102_pid_controller_embedded.py delete mode 100644 test/howtos/bf/howto_bf_control_103_pid_controller_cascaded.py diff --git a/src/mlpro/bf/control/controllers/__init__.py b/src/mlpro/bf/control/controllers/__init__.py index 5127cbf38..e69de29bb 100644 --- a/src/mlpro/bf/control/controllers/__init__.py +++ b/src/mlpro/bf/control/controllers/__init__.py @@ -1 +0,0 @@ -from mlpro.bf.control.controllers.pid_controller import PIDController \ No newline at end of file diff --git a/src/mlpro/bf/control/controllers/pid_controller.py b/src/mlpro/bf/control/controllers/pid_controller.py deleted file mode 100644 index 88c13f3fd..000000000 --- a/src/mlpro/bf/control/controllers/pid_controller.py +++ /dev/null @@ -1,59 +0,0 @@ -## ------------------------------------------------------------------------------------------------- -## -- Project : MLPro - The integrative middleware framework for standardized machine learning -## -- Package : mlpro.bf.control.controller -## -- Module : pid_controller.py -## ------------------------------------------------------------------------------------------------- -## -- History : -## -- yyyy-mm-dd Ver. Auth. Description -## -- 2024-09-01 0.0.0 DA Creation -## ------------------------------------------------------------------------------------------------- - -""" -Ver. 0.0.0 (2024-09-01) - -This module provides an implementation of a PID controller. - -Learn more: - -https://en.wikipedia.org/wiki/Proportional%E2%80%93integral%E2%80%93derivative_controller - -""" - -from mlpro.bf.systems import Action -from mlpro.bf.control.basics import CTRLError, Controller - - - - -## ------------------------------------------------------------------------------------------------- -## ------------------------------------------------------------------------------------------------- -class PIDController (Controller): - """ - PID controller. - """ - -## ------------------------------------------------------------------------------------------------- - def set_parameter(self, **p_param): - """ - Sets/changes the parameters of the PID controller. - - Parameters - ---------- - p_par1 : type1 - Description 1 - p_par2 : type2 - Description 2 - p_par3 : type3 - Description 3 - """ - - raise NotImplementedError - - -## ------------------------------------------------------------------------------------------------- - def compute_action(self, p_ctrl_error: CTRLError) -> Action: - """ - ... - """ - - raise NotImplementedError diff --git a/test/howtos/bf/control/.gitkeep b/test/howtos/bf/control/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/test/howtos/bf/howto_bf_control_101_pid_controller_standalone.py b/test/howtos/bf/howto_bf_control_101_pid_controller_standalone.py deleted file mode 100644 index b8c0d84e4..000000000 --- a/test/howtos/bf/howto_bf_control_101_pid_controller_standalone.py +++ /dev/null @@ -1,80 +0,0 @@ -## ------------------------------------------------------------------------------------------------- -## -- Project : MLPro - The integrative middleware framework for standardized machine learning -## -- Package : test/howtos/bf -## -- Module : howto_bf_control_101_pid_controller_standalone.py -## ------------------------------------------------------------------------------------------------- -## -- History : -## -- yyyy-mm-dd Ver. Auth. Description -## -- 2024-09-01 0.0.0 DA Creation -## ------------------------------------------------------------------------------------------------- - -""" -Ver. 0.0.0 (2024-09-01) - -This module demonstrates ... - -You will learn: - -1) How to ... - -2) How to ... - -3) How to ... - -""" - - -from mlpro.bf.various import Log - - - -## ------------------------------------------------------------------------------------------------- -## ------------------------------------------------------------------------------------------------- -class MyDemo (Log): - """ - This class demonstrates how to ... - """ - - # needed for proper logging (see class mlpro.bf.various.Log) - C_TYPE = 'Demo' - C_NAME = 'Parallel Algorithm' - -## ------------------------------------------------------------------------------------------------- - def __init__( self, - p_logging=Log.C_LOG_ALL ): - - super().__init__( p_logging=p_logging ) - - -## ------------------------------------------------------------------------------------------------- - def execute(self): - # Log something - self.log(Log.C_LOG_TYPE_I, 'Here we go...') - - - - - - -# 1 Preparation of demo/unit test mode -if __name__ == '__main__': - # 1.1 Parameters for demo mode - cycle_limit = 200 - logging = Log.C_LOG_ALL - visualize = True - -else: - # 1.2 Parameters for internal unit test - cycle_limit = 2 - logging = Log.C_LOG_NOTHING - visualize = False - - - -# 2 Instantiate the demo objects -demo = MyDemo( p_logging = logging ) - - - -# 3 Demo actions -demo.execute() diff --git a/test/howtos/bf/howto_bf_control_102_pid_controller_embedded.py b/test/howtos/bf/howto_bf_control_102_pid_controller_embedded.py deleted file mode 100644 index 6adb07a7a..000000000 --- a/test/howtos/bf/howto_bf_control_102_pid_controller_embedded.py +++ /dev/null @@ -1,80 +0,0 @@ -## ------------------------------------------------------------------------------------------------- -## -- Project : MLPro - The integrative middleware framework for standardized machine learning -## -- Package : test/howtos/bf -## -- Module : howto_bf_control_102_pid_controller_embedded.py -## ------------------------------------------------------------------------------------------------- -## -- History : -## -- yyyy-mm-dd Ver. Auth. Description -## -- 2024-09-01 0.0.0 DA Creation -## ------------------------------------------------------------------------------------------------- - -""" -Ver. 0.0.0 (2024-09-01) - -This module demonstrates ... - -You will learn: - -1) How to ... - -2) How to ... - -3) How to ... - -""" - - -from mlpro.bf.various import Log - - - -## ------------------------------------------------------------------------------------------------- -## ------------------------------------------------------------------------------------------------- -class MyDemo (Log): - """ - This class demonstrates how to ... - """ - - # needed for proper logging (see class mlpro.bf.various.Log) - C_TYPE = 'Demo' - C_NAME = 'Parallel Algorithm' - -## ------------------------------------------------------------------------------------------------- - def __init__( self, - p_logging=Log.C_LOG_ALL ): - - super().__init__( p_logging=p_logging ) - - -## ------------------------------------------------------------------------------------------------- - def execute(self): - # Log something - self.log(Log.C_LOG_TYPE_I, 'Here we go...') - - - - - - -# 1 Preparation of demo/unit test mode -if __name__ == '__main__': - # 1.1 Parameters for demo mode - cycle_limit = 200 - logging = Log.C_LOG_ALL - visualize = True - -else: - # 1.2 Parameters for internal unit test - cycle_limit = 2 - logging = Log.C_LOG_NOTHING - visualize = False - - - -# 2 Instantiate the demo objects -demo = MyDemo( p_logging = logging ) - - - -# 3 Demo actions -demo.execute() diff --git a/test/howtos/bf/howto_bf_control_103_pid_controller_cascaded.py b/test/howtos/bf/howto_bf_control_103_pid_controller_cascaded.py deleted file mode 100644 index b576e6655..000000000 --- a/test/howtos/bf/howto_bf_control_103_pid_controller_cascaded.py +++ /dev/null @@ -1,80 +0,0 @@ -## ------------------------------------------------------------------------------------------------- -## -- Project : MLPro - The integrative middleware framework for standardized machine learning -## -- Package : test/howtos/bf -## -- Module : howto_bf_control_103_pid_controller_cascaded.py -## ------------------------------------------------------------------------------------------------- -## -- History : -## -- yyyy-mm-dd Ver. Auth. Description -## -- 2024-09-01 0.0.0 DA Creation -## ------------------------------------------------------------------------------------------------- - -""" -Ver. 0.0.0 (2024-09-01) - -This module demonstrates ... - -You will learn: - -1) How to ... - -2) How to ... - -3) How to ... - -""" - - -from mlpro.bf.various import Log - - - -## ------------------------------------------------------------------------------------------------- -## ------------------------------------------------------------------------------------------------- -class MyDemo (Log): - """ - This class demonstrates how to ... - """ - - # needed for proper logging (see class mlpro.bf.various.Log) - C_TYPE = 'Demo' - C_NAME = 'Parallel Algorithm' - -## ------------------------------------------------------------------------------------------------- - def __init__( self, - p_logging=Log.C_LOG_ALL ): - - super().__init__( p_logging=p_logging ) - - -## ------------------------------------------------------------------------------------------------- - def execute(self): - # Log something - self.log(Log.C_LOG_TYPE_I, 'Here we go...') - - - - - - -# 1 Preparation of demo/unit test mode -if __name__ == '__main__': - # 1.1 Parameters for demo mode - cycle_limit = 200 - logging = Log.C_LOG_ALL - visualize = True - -else: - # 1.2 Parameters for internal unit test - cycle_limit = 2 - logging = Log.C_LOG_NOTHING - visualize = False - - - -# 2 Instantiate the demo objects -demo = MyDemo( p_logging = logging ) - - - -# 3 Demo actions -demo.execute()