FrequencyResponse

class sharpy.postproc.frequencyresponse.FrequencyResponse[source]

Frequency Response Calculator.

Computes the frequency response of a built linear system. The frequency will be calculated for the systems specified in the target_system list. The desired frequency_unit will be either w for radians/s or k for reduced frequency (if the system is scaled). The frequency_bounds setting will set the lower and upper bounds of the response, while num_freqs will specify the number of evaluations. The option frequency_spacing allows you to space the evaluations point following a log or linear spacing.

If compute_hinf is set, the H-infinity norm of the system is calculated.

This will be saved to a binary .h5 file as detailed in save_freq_resp().

Finally, the quick_plot option will plot some quick and dirty bode plots of the response. This requires access to matplotlib.

The settings that this solver accepts are given by a dictionary, with the following key-value pairs:

Name Type Description Default Options
folder str Output folder. ./output  
print_info bool Write output to screen. False  
target_system list(str) System or systems for which to find frequency response. ['aeroelastic'] aeroelastic, aerodynamic, structural
frequency_unit str Units of frequency, w for rad/s, k reduced. k w, k
frequency_bounds list(float) Lower and upper frequency bounds in the corresponding unit. [0.001, 1]  
frequency_spacing str Compute the frequency response in a linear or log grid. linear linear, log
num_freqs int Number of frequencies to evaluate. 50  
compute_hinf bool Compute Hinfinity norm of the system. False  
quick_plot bool Produce array of .png plots showing response. Requires matplotlib. False  
run(ss=None)[source]

Computes the frequency response of the linear state-space.

Parameters:ss (sharpy.linear.src.libss.ss (Optional)) – State-space object for which to compute the frequency response. If not given, the response for the previously assembled systems and specified in target_system will be performed.
save_freq_resp(wv, Yfreq, system_name=None, hinf=None)[source]

Saves the frequency response to a binary .h5 file.

If the system has not been scaled, the units of frequency are rad/s and the response is given in complex form. The response is saved in a [p, m, n_freq_eval] format, where p corresponds to the system’s outputs, n to the number of inputs and n_freq_eval to the number of frequency evaluations.

Parameters:
  • wv (np.ndarray) – Frequency array.
  • Y_freq (np.ndarray) – Frequency response data [p, m, n_freq_eval] matrix.
  • system_name (str (optional)) – State-space system name.
  • hinf (float (optional)) – H-infinity norm of the system.