Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add feedback control using a PID controller for magnetic bearings #1126

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Changes in integrate_system for pid controller
mcarolalb committed Aug 28, 2024
commit 30a64631190c3b37891c58ed8e4bc103303c9eb4
22 changes: 20 additions & 2 deletions ross/rotor_assembly.py
Original file line number Diff line number Diff line change
@@ -2201,6 +2201,19 @@ def integrate_system(self, speed, F, t, **kwargs):
K2 = get_array[0](kwargs.get("Ksdt", self.Ksdt()))
F = get_array[1](F.T).T

# Check if there is any magnetic bearing
magnetic_bearings = [
brg
for brg in self.bearing_elements
if isinstance(brg, MagneticBearingElement)
]
if len(magnetic_bearings):
magnetic_force = lambda time_step, disp_resp: self.magnetic_bearing_controller(
magnetic_bearings, time_step, disp_resp
)
else:
magnetic_force = lambda time_step, disp_resp: 0

# Consider any additional RHS function (extra forces)
add_to_RHS = kwargs.get("add_to_RHS")

@@ -2214,6 +2227,9 @@ def integrate_system(self, speed, F, t, **kwargs):
disp_resp=get_array[2](curr_state.get("y")),
velc_resp=get_array[2](curr_state.get("ydot")),
accl_resp=get_array[2](curr_state.get("y2dot")),
) + magnetic_force(
time_step=curr_state.get("dt"),
disp_resp=get_array[2](curr_state.get("y")),
)
)

@@ -2231,9 +2247,11 @@ def integrate_system(self, speed, F, t, **kwargs):
raise Warning(
"The bearing coefficients vary with speed. Therefore, C and K matrices are not being replaced by the matrices defined as input arguments."
)

ignore_elements = [*magnetic_bearings, *brgs_with_var_coeffs]

C0 = self.C(speed_ref, ignore=brgs_with_var_coeffs)
K0 = self.K(speed_ref, ignore=brgs_with_var_coeffs)
C0 = self.C(speed_ref, ignore=ignore_elements)
K0 = self.K(speed_ref, ignore=ignore_elements)

def rotor_system(step, **current_state):
Cb, Kb = assemble_C_K_matrices(