/home/runner/work/kynema-fmb/kynema-fmb/kynema-fmb/src/interfaces/components/controller_builder.hpp Source File

Kynema-FMB API: /home/runner/work/kynema-fmb/kynema-fmb/kynema-fmb/src/interfaces/components/controller_builder.hpp Source File
Kynema-FMB API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
controller_builder.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <string>
5#include <string_view>
6
8
10
12public:
13 ControllerInput& Input() { return input; }
14
15 // Enable or disable the controller
16 ControllerBuilder& EnableController(bool enable = true) {
17 input.controller_enabled = enable;
18 return *this;
19 }
20
21 // Enable or disable pitch control
23 input.pitch_control_enabled = enable;
24 return *this;
25 }
26
27 // Enable or disable torque control
29 input.torque_control_enabled = enable;
30 return *this;
31 }
32
33 // Set time step (seconds)
34 ControllerBuilder& SetTimeStep(double time_step) {
35 input.time_step = time_step;
36 return *this;
37 }
38
39 // Set number of blades
41 input.n_blades = n_blades;
42 return *this;
43 }
44
45 // Enable or disable yaw control
46 ControllerBuilder& EnableYawControl(bool enable = true) {
47 input.yaw_control_enabled = enable;
48 return *this;
49 }
50
51 // Set initial yaw angle (radians)
53 input.yaw_angle = angle;
54 return *this;
55 }
56
57 // Set initial pitch angle (radians)
59 input.pitch_angle = angle;
60 return *this;
61 }
62
65 input.read_checkpoint = enable;
66 return *this;
67 }
68
70 ControllerBuilder& SetLibraryPath(std::string_view lib_path) {
71 input.shared_lib_path = std::string(lib_path);
72 return *this;
73 }
74
76 ControllerBuilder& SetFunctionName(std::string_view func_name) {
77 input.function_name = std::string(func_name);
78 return *this;
79 }
80
82 ControllerBuilder& SetInputFilePath(std::string_view inp_file_path) {
83 input.input_file_path = std::string(inp_file_path);
84 return *this;
85 }
86
88 ControllerBuilder& SetOutputFilePath(std::string_view sim_name) {
89 input.output_file_path = std::string(sim_name);
90 return *this;
91 }
92
93private:
94 ControllerInput input;
95};
96
97} // namespace kynema_fmb::interfaces::components
Definition controller_builder.hpp:11
ControllerBuilder & SetYawAngle(double angle)
Definition controller_builder.hpp:52
ControllerBuilder & SetFunctionName(std::string_view func_name)
Set function name for the controller.
Definition controller_builder.hpp:76
ControllerInput & Input()
Definition controller_builder.hpp:13
ControllerBuilder & EnablePitchControl(bool enable=true)
Definition controller_builder.hpp:22
ControllerBuilder & SetNumberOfBlades(size_t n_blades)
Definition controller_builder.hpp:40
ControllerBuilder & EnableTorqueControl(bool enable=true)
Definition controller_builder.hpp:28
ControllerBuilder & SetInputFilePath(std::string_view inp_file_path)
Set input file path for the controller.
Definition controller_builder.hpp:82
ControllerBuilder & EnableReadCheckpoint(bool enable=true)
Set flag to enable reading of checkpoint file for restart.
Definition controller_builder.hpp:64
ControllerBuilder & EnableYawControl(bool enable=true)
Definition controller_builder.hpp:46
ControllerBuilder & EnableController(bool enable=true)
Definition controller_builder.hpp:16
ControllerBuilder & SetTimeStep(double time_step)
Definition controller_builder.hpp:34
ControllerBuilder & SetOutputFilePath(std::string_view sim_name)
Set output file path for the controller.
Definition controller_builder.hpp:88
ControllerBuilder & SetLibraryPath(std::string_view lib_path)
Set library path for the controller.
Definition controller_builder.hpp:70
ControllerBuilder & SetPitchAngle(double angle)
Definition controller_builder.hpp:58
Definition aerodynamics.cpp:5
Configuration parameters for a DISCON-style turbine controller.
Definition controller_input.hpp:26
std::string input_file_path
Path to controller input file.
Definition controller_input.hpp:46
std::string output_file_path
Path to controller output file.
Definition controller_input.hpp:47
size_t n_blades
Number of blades.
Definition controller_input.hpp:39
bool torque_control_enabled
Flag to enable torque control.
Definition controller_input.hpp:29
bool read_checkpoint
Flag to enable restart reading.
Definition controller_input.hpp:31
double pitch_angle
Initial pitch angle (radians)
Definition controller_input.hpp:40
std::string function_name
Controller function name (default: "DISCON")
Definition controller_input.hpp:45
double time_step
Time step for controller simulation (s)
Definition controller_input.hpp:38
bool controller_enabled
Flag to enable controller.
Definition controller_input.hpp:27
std::string shared_lib_path
Path to controller shared library.
Definition controller_input.hpp:44
bool yaw_control_enabled
Flag to enable yaw control.
Definition controller_input.hpp:30
double yaw_angle
Initial yaw angle (radians)
Definition controller_input.hpp:41
bool pitch_control_enabled
Flag to enable pitch control.
Definition controller_input.hpp:28