ross.CampbellResults
Contents
ross.CampbellResults#
- class ross.CampbellResults(speed_range, wd, log_dec, damping_ratio, whirl_values, modal_results, number_dof, run_modal, campbell_torsional=None)#
Class used to store results and provide plots for Campbell Diagram.
It’s possible to visualize multiples harmonics in a single plot to check other speeds which also excite a specific natural frequency.
- Parameters:
- speed_rangearray
Array with the speed range in rad/s.
- wdarray
Array with the damped natural frequencies
- log_decarray
Array with the Logarithmic decrement
- whirl_valuesarray
Array with the whirl values (0, 0.5 or 1)
- modal_resultsdict
Dictionary with the modal results for each speed in the speed range.
- numer_dofint
Number of degrees of freedom of model.
- run_modalcallable
Function that runs the modal analysis.
- campbell_torsionalCampbellResults, optional
If True, the Campbell Diagram includes torsional modes of separated analysis. Default is None, which means that torsional modes obtained in the separated analysis are not included.
- Returns:
- figPlotly graph_objects.Figure()
The figure object with the plot.
Methods
- __init__(speed_range, wd, log_dec, damping_ratio, whirl_values, modal_results, number_dof, run_modal, campbell_torsional=None)#
- classmethod load(file)#
Load results from a .toml or .json file.
This function will load the simulation results from a .toml or .json file. The file must have all the argument’s names and values that are needed to reinstantiate the class.
- Parameters:
- filestr, pathlib.Path
The name of the file the results will be loaded from.
Examples
>>> # Example running a stochastic unbalance response >>> from tempfile import tempdir >>> from pathlib import Path >>> import ross as rs >>> # Running an example >>> rotor = rs.rotor_example() >>> freq_range = np.linspace(0, 500, 31) >>> n = 3 >>> m = 0.01 >>> p = 0.0 >>> results = rotor.run_unbalance_response(n, m, p, freq_range) >>> # create path for a temporary file >>> file = Path(tempdir) / 'unb_resp.toml' >>> results.save(file) >>> # Loading file >>> results2 = rs.ForcedResponseResults.load(file) >>> abs(results2.forced_resp).all() == abs(results.forced_resp).all() True
- plot(harmonics=[1], frequency_units='RPM', speed_units='RPM', damping_parameter='log_dec', frequency_range=None, damping_range=None, fig=None, **kwargs)#
Create Campbell Diagram figure using Plotly.
- Parameters:
- harmonics: list, optional
List withe the harmonics to be plotted. The default is to plot 1x.
- frequency_unitsstr, optional
Frequency units. Default is “RPM”.
- speed_unitsstr, optional
Speed units. Default is “RPM”.
- damping_parameterstr, optional
Define which value to show for damping. We can use “log_dec” or “damping_ratio”. Default is “log_dec”.
- frequency_rangetuple, pint.Quantity(tuple), optional
Tuple with (min, max) values for the frequencies that will be plotted. Frequencies that are not within the range are filtered out and are not plotted. It is possible to use a pint Quantity (e.g. Q_((2000, 1000), “RPM”)). Default is None (no filter).
- damping_rangetuple, optional
Tuple with (min, max) values for the damping parameter that will be plotted. Damping values that are not within the range are filtered out and are not plotted. Default is None (no filter).
- figPlotly graph_objects.Figure()
The figure object with the plot.
- kwargsoptional
Additional key word arguments can be passed to change the plot layout only (e.g. width=1000, height=800, …). *See Plotly Python Figure Reference for more information.
- Returns:
- figPlotly graph_objects.Figure()
The figure object with the plot.
Examples
>>> import ross as rs >>> import numpy as np >>> Q_ = rs.Q_ >>> rotor = rs.rotor_example() >>> speed = np.linspace(0, 400, 101) >>> camp = rotor.run_campbell(speed) >>> fig = camp.plot( ... harmonics=[1, 2], ... damping_parameter="damping_ratio", ... frequency_range=Q_((2000, 10000), "RPM"), ... damping_range=(-0.1, 100), ... frequency_units="Hz", ... speed_units="RPM", ... )
- plot_with_mode_shape(harmonics=[1], frequency_units='RPM', speed_units='RPM', damping_parameter='log_dec', frequency_range=None, damping_range=None, animation=False, fig=None, **kwargs)#
- classmethod read_toml_data(data)#
Read and parse data stored in a .toml file.
The data passed to this method needs to be according to the format saved in the .toml file by the .save() method.
- Parameters:
- datadict
Dictionary obtained from toml.load().
- Returns:
- The result object.
- save(file)#
Save results in a .toml or .json file.
This function will save the simulation results to a .toml or .json file. The file will have all the argument’s names and values that are needed to reinstantiate the class.
- Parameters:
- filestr, pathlib.Path
The name of the file the results will be saved in. The format is determined by the file extension (.toml or .json).
Examples
>>> # Example running a unbalance response >>> from tempfile import tempdir >>> from pathlib import Path >>> import ross as rs
>>> # Running an example >>> rotor = rs.rotor_example() >>> speed = np.linspace(0, 1000, 101) >>> response = rotor.run_unbalance_response(node=3, ... unbalance_magnitude=0.001, ... unbalance_phase=0.0, ... frequency=speed)
>>> # create path for a temporary file >>> file = Path(tempdir) / 'unb_resp.toml' >>> response.save(file)
- sort_by_mode_type()#
Sort by mode type.
Sort the Campbell result arrays (wd, log_dec, damping_ratio, whirl_values) by mode type, so as to force the axial and torsional modes to be at the end of the arrays.