ross.TimeResponseResults
Contents
ross.TimeResponseResults#
- class ross.TimeResponseResults(rotor, t, yout, xout)#
Class used to store results and provide plots for Time Response Analysis.
This class takes the results from time response analysis and creates a plots given a force and a time. It’s possible to select through a time response for a single DoF, an orbit response for a single node or display orbit response for all nodes. The plot type options are:
1d: plot time response for given probes.
2d: plot orbit of a selected node of a rotor system.
3d: plot orbits for each node on the rotor system in a 3D view.
plot_1d: input probes. plot_2d: input a node. plot_3d: no need to input probes or node.
- Parameters:
- rotorRotor.object
The Rotor object
- tarray
Time values for the output.
- youtarray
System response.
- xoutarray
Time evolution of the state vector.
- Returns:
- figPlotly graph_objects.Figure()
The figure object with the plot.
Methods
- __init__(rotor, t, yout, xout)#
- data_time_response(probe, probe_units='rad', displacement_units='m', time_units='s')#
Return the time response given a list of probes in DataFrame format.
- Parameters:
- probelist
List with rs.Probe objects.
- probe_unitsstr, option
Units for probe orientation. Default is “rad”.
- displacement_unitsstr, optional
Displacement units. Default is ‘m’.
- time_unitsstr
Time units. Default is ‘s’.
- Returns:
- dfpd.DataFrame
DataFrame storing the time response measured by probes.
- classmethod load(file)#
Load results from a .toml file.
This function will load the simulation results from a .toml 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_1d(probe, probe_units='rad', displacement_units='m', time_units='s', fig=None, **kwargs)#
Plot time response.
This method plots the time response given a list of probes with their nodes and orientations.
- Parameters:
- probelist
List with rs.Probe objects.
- probe_unitsstr, option
Units for probe orientation. Default is “rad”.
- displacement_unitsstr, optional
Displacement units. Default is ‘m’.
- time_unitsstr
Time units. Default is ‘s’.
- 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.
- plot_2d(node, displacement_units='m', fig=None, **kwargs)#
Plot orbit response (2D).
This function will take a rotor object and plot its orbit response using Plotly.
- Parameters:
- node: int, optional
Selected node to plot orbit.
- displacement_unitsstr, optional
Displacement units. Default is ‘m’.
- 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.
- plot_3d(displacement_units='m', rotor_length_units='m', fig=None, **kwargs)#
Plot orbit response (3D).
This function will take a rotor object and plot its orbit response using Plotly.
- Parameters:
- displacement_unitsstr
Displacement units. Default is ‘m’.
- rotor_length_unitsstr
Rotor Length units. Default is ‘m’.
- 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. hoverlabel_align=”center”, …). *See Plotly Python Figure Reference for more information.
- Returns:
- figPlotly graph_objects.Figure()
The figure object with the plot.
- 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 file.
This function will save the simulation results to a .toml 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.
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)