-
Notifications
You must be signed in to change notification settings - Fork 106
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
Evaluate how we update the speed during numerical integration #429
Comments
Hi there!
|
This comment was marked as duplicate.
This comment was marked as duplicate.
The state space matrix defined by the function def A(self, speed=0, frequency=None):
"""State space matrix for an instance of a rotor.
Parameters
----------
speed: float, optional
Rotor speed.
Default is 0.
frequency : float, optional
Excitation frequency. Default is rotor speed.
Returns
-------
A : np.ndarray
State space matrix for the rotor.
Examples
--------
>>> rotor = rotor_example()
>>> np.round(rotor.A()[50:56, :2])
array([[ 0., 10927.],
[-10924., -0.],
[ -174., 0.],
[ -0., -174.],
[ -0., 10723.],
[-10719., -0.]])
"""
if frequency is None:
frequency = speed
Z = np.zeros((self.ndof, self.ndof))
I = np.eye(self.ndof)
# fmt: off
A = np.vstack(
[np.hstack([Z, I]),
np.hstack([la.solve(-self.M(), self.K(frequency) + self.Kst()*speed), la.solve(-self.M(), (self.C(frequency) + self.G() * speed))])])
# fmt: on
return A According to the current method, the integration process first consists of building a linear system in time, using the def _lti(self, speed, frequency=None):
"""Continuous-time linear time invariant system.
This method is used to create a Continuous-time linear
time invariant system for the mdof system.
From this system we can obtain poles, impulse response,
generate a bode, etc.
Parameters
----------
speed: float
Rotor speed.
frequency: float, optional
Excitation frequency.
Default is rotor speed.
Returns
-------
sys : StateSpaceContinuous
Space State Continuos with A, B, C and D matrices
Example
-------
>>> rotor = rotor_example()
>>> A = rotor._lti(speed=0).A
>>> B = rotor._lti(speed=0).B
>>> C = rotor._lti(speed=0).C
>>> D = rotor._lti(speed=0).D
"""
Z = np.zeros((self.ndof, self.ndof))
I = np.eye(self.ndof)
# x' = Ax + Bu
B2 = I
if frequency is None:
frequency = speed
A = self.A(speed=speed, frequency=frequency)
# fmt: off
B = np.vstack([Z,
la.solve(self.M(), B2)])
# fmt: on
# y = Cx + Du
# Observation matrices
Cd = I
Cv = Z
Ca = Z
# fmt: off
C = np.hstack((Cd - Ca @ la.solve(self.M(), self.K(frequency)), Cv - Ca @ la.solve(self.M(), self.C(frequency))))
# fmt: on
D = Ca @ la.solve(self.M(), B2)
sys = signal.lti(A, B, C, D)
return sys In addition, this function is used to build the functions: The main advantage of the current method is its simplicity. This makes the code very clear and easy to understand, the problem is that it is not very flexible, which makes it impossible to take advantage of some structures already calculated in other analyses. For example, in the state space matrix |
Closing this since we already have #1021 to discuss this topic. |
Our space state matrix
A
has to be assembled every time we change the speed. This can be a problem for numerical integration.The text was updated successfully, but these errors were encountered: