-
Notifications
You must be signed in to change notification settings - Fork 126
Sensitivity Computation #1108
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
Sensitivity Computation #1108
Conversation
…plot of the sensitivities of the AMBs present in the rotor (magnitude and phase)
… freedom upon which sensitivity will be computed. Adjustment of plots and the method used to calculate sensitivity.
…lidation (test_compute_sensitivity).
…s to the sensitivity plot.
…stment of the compute_sensitivity_at argument in the run_freq_response method.
…om the control package.
|
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #1108 +/- ##
==========================================
+ Coverage 81.67% 83.25% +1.58%
==========================================
Files 38 38
Lines 8310 8272 -38
==========================================
+ Hits 6787 6887 +100
+ Misses 1523 1385 -138
... and 3 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
…usive method for calculating sensitivity ("run_amb_sensitivity"), update of the "rotor_amb_example" method to include a more complex model, implementation of the "test_save_load_sensitivityresponse" test and update of the "test_compute_sensitivity" method.
|
Hi there!
|
…(in accordance with ISO 14839-3).
Pull Request Summary
This pull request is associated with the changes that enable ROSS to compute the sensitivities associated with magnetic bearings present in the rotor (as required by API 617).
Theoretical Background
The API STANDARD 617 document (produced by the American Petroleum Institute) requires that rotors supported by active magnetic bearings (AMBs) have their stability assessed based on a series of criteria. One of these criteria involves analyzing the sensitivity of the closed-loop control system that enables the AMB operation. Given the transfer functions of the controller$\mathrm{C(s)}$ and the plant $\mathrm{G(s)}$ (which in this case describes the relationship between the force applied by the AMB and the displacement of the shaft at the bearing location), it is possible to calculate the sensitivity $\mathrm{S(s)}$ as follows:
Since the closed-loop response is given by
it can be concluded that$\mathrm{S(s)} + \mathrm{T(s)} = 1$ . Therefore,
The block diagram below graphically represents the control system associated with the AMB. The force that the AMB applies to the shaft and the displacement of the shaft at the bearing location are represented by$F$ and $x$ , respectively.
According to the ROSS documentation, the frequency response obtained from the execution of the$F_w$ , represents an excitation to the control system, as shown in the figure below.
run_freq_responsemethod is computed based on the application of an excitation force at a given node of the shaft. This force,Therefore, since ROSS produces a frequency response that relates$x$ and $F_w$ , it can be said that this response represents, in the frequency domain, the transfer function $\mathbf{G_w(s)}$ , whose definition can be obtained based on the analysis of the block diagram introduced above.
where$\mathbf{W(s)}$ and $\mathbf{Y(s)}$ are the Laplace transforms of the disturbance and output, respectively.
Given the definition of$\mathbf{T(s)}$ previously presented, it follows that
Since the gains of the controller$\mathbf{C(s)}$ (in this case, a PID controller) are known, it is possible to obtain the magnitude and phase of the controller's frequency response (using the Python Control Systems package). Since the magnitude and phase of $\mathbf{G_w(s)}$ are provided by ROSS (from the execution of the $\mathbf{T(s)}$ as follows:
run_freq_responsemethod), it is possible to compute the magnitude and phase ofHaving obtained the magnitude and phase of$\mathbf{T(s)}$ , the sensitivity can finally be computed, given that $\mathrm{S(s)} = 1 - \mathrm{T(s)}$ .
Method employed in the computation of sensitivity
The proposed method for computing the sensitivity is presented below. As previously discussed, the computation of the sensitivity depends on the gains of the controller employed and the frequency response provided by ROSS, which represents the relationship between the output and a disturbance applied at the plant input.
In summary, the user executes the
run_amb_sensitivitymethod, passing thecompute_sensitivity_atargument, which indicates the degrees of freedom where the sensitivity should be calculated. Therun_amb_sensitivitythen calls thecompute_sensitivitymethod, which is responsible for actually computing the sensitivity values. Back in therun_amb_sensitivitymethod, an instance of theSensitivityResultsclass is created and returned to the user.The rotor used to validate the above method is depicted below and has two magnetic bearings, at nodes 12 and 27.
The script below enables the computation of sensitivity as well as its graphical representation.
Modified files
Summary of changes made
Update of the
run_amb_sensitivitymethodThis method computes the sensitivity associated with the magnetic bearings in the rotor. Esse método possui como parâmetro obrigatório somente o
compute_sensitivite_at, a dictionary containing the information required to compute the sensitivities of the magnetic bearings. Each key should be a bearing tag, and the corresponding value should be a dictionary defining the input and output degrees of freedom that determine the sensitivity computation, as shown in the example below.Since the sensitivity is computed based on the frequency response, one of the other two optional parameters of the method must be provided:
frequency_response_resultorspeed_range. Thefrequency_response_resultparameter consists of aFrequencyResponseResultstype object that represents the frequency response obtained by executing therun_freq_responsemethod. Thespeed_rangeparameter, on the other hand, consists of an array containing the frequencies at which the sensitivities will be evaluated. If only the speed_range is provided, therun_freq_responsemethod is invoked by therun_amb_sensitivitymethod and the frequency response is computed.This method returns a
SensitivityResultstype object, which contains the information listed below, regarding the sensitivity calculation.Implementation of the
SensitivityResultsclassThis class is responsible for storing the results from the sensitivity calculation (not only the sensitivity values themselves but also the degrees of freedom that were used as the basis for the computation and the maximum absolute sensitivity values for each bearing). The class also has a method, named
plot(), which returns a Plotly figure containing two subplots, in which the magnitude and phase of the sensitivity associated with each bearing are represented (as indicated below).Definition of the
compute_sensitivity()methodThis method computes the sensitivity for each magnetic bearing whose tag is present in the
compute_sensitivity_atdictionary, given the frequency response of the rotor.Creation of the
rotor_amb_examplemethodThis function returns an instance of a rotor model. This rotor is supported by two magnetic bearings, and has a central disk, as shown in the figure below. It provides a basic model for writing doctests. This method was used in defining the examples present in the description of the
run_amb_sensitivitymethod.Implementation of the
test_compute_sensitivitytest methodThis method, implemented in the
test_rotor_assembly.pymodule, performs a series of validations associated with sensitivity computation. The evaluated cases were as follows.Implementation of the
test_save_load_sensitivityresponseThis method, implemented in the
test_rotor_assembly.pymodule, performs validations related to writing and reading TOML files that store the information present in aSensitivityResultsobject.Addition of the Python Control Systems Library to
requirements.txtThe Python Control Systems Library was employed in the computation of the frequency response of the PID controllers associated with the magnetic bearings. Thus, the line below was added to the
requirements.txtfile.