ross.stochastic.ST_TimeResponseResults
Contents
ross.stochastic.ST_TimeResponseResults#
- class ross.stochastic.ST_TimeResponseResults(t, yout, xout, number_dof, nodes, link_nodes, nodes_pos)#
Store stochastic results and provide plots for Time Response and Orbit Response.
- Parameters:
- t1-dimensional array
Time array.
- youtarray
System response.
- xoutarray
Time evolution of the state vector.
- nodes: array
list with nodes from a rotor model.
- link_nodes: array
list with nodes created with “n_link” from a rotor model.
- nodes_pos: array
Rotor nodes axial positions.
- number_dofint
Number of degrees of freedom per shaft element’s node
- Returns:
- figPlotly graph_objects.Figure()
The figure object with the plot.
Methods
- __init__(t, yout, xout, number_dof, nodes, link_nodes, nodes_pos)#
- 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.stochastic as srs
>>> # Running an example >>> rotors = srs.st_rotor_example() >>> freq_range = np.linspace(0, 500, 31) >>> n = 3 >>> m = np.random.uniform(0.001, 0.002, 10) >>> p = 0.0 >>> results = rotors.run_unbalance_response(n, m, p, freq_range)
>>> # create path for a temporary file >>> file = Path(tempdir) / 'results.toml' >>> results.save(file)
>>> # Loading file >>> results2 = srs.ST_ForcedResponseResults.load(file) >>> results2.forced_resp.all() == results.forced_resp.all() True
- plot_1d(probe, percentile=[], conf_interval=[], probe_units='rad', displacement_units='m', time_units='s', fig=None, **kwargs)#
Plot stochastic time response.
This method plots the time response given a tuple of probes with their nodes and orientations.
- Parameters:
- probelist of tuples
List with tuples (node, orientation angle, tag). node : int
indicate the node where the probe is located.
- orientationfloat
probe orientation angle about the shaft. The 0 refers to +X direction.
- tagstr, optional
probe tag to be displayed at the legend.
- percentilelist, optional
Sequence of percentiles to compute, which must be between 0 and 100 inclusive.
- conf_intervallist, optional
Sequence of confidence intervals to compute, which must be between 0 and 100 inclusive.
- 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, percentile=[], conf_interval=[], displacement_units='m', fig=None, **kwargs)#
Plot orbit response (2D).
This function plots orbits for a given node on the rotor system in a 2D view.
- Parameters:
- nodeint
Select the node to display the respective orbit response.
- percentilelist, optional
Sequence of percentiles to compute, which must be between 0 and 100 inclusive.
- conf_intervallist, optional
Sequence of confidence intervals to compute, which must be between 0 and 100 inclusive.
- 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(percentile=[], conf_interval=[], displacement_units='m', rotor_length_units='m', fig=None, **kwargs)#
Plot orbit response (3D).
This function plots orbits for each node on the rotor system in a 3D view.
- Parameters:
- percentilelist, optional
Sequence of percentiles to compute, which must be between 0 and 100 inclusive.
- conf_intervallist, optional
Sequence of confidence intervals to compute, which must be between 0 and 100 inclusive.
- 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 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 stochastic unbalance response >>> from tempfile import tempdir >>> from pathlib import Path >>> import ross.stochastic as srs
>>> # Running an example >>> rotors = srs.st_rotor_example() >>> freq_range = np.linspace(0, 500, 31) >>> n = 3 >>> m = np.random.uniform(0.001, 0.002, 10) >>> p = 0.0 >>> results = rotors.run_unbalance_response(n, m, p, freq_range)
>>> # create path for a temporary file >>> file = Path(tempdir) / 'results.toml' >>> results.save(file)