Timeseries Outputs#
Different optimal control transcriptions work in different ways. The Radau Pseudospectral transcription keeps a contiguous vector of state values at all nodes. The Gauss Lobatto transcription keeps two separate continuous vectors; one at the discretization nodes and the other at the collocation nodes. Retrieving a timeseries values of output values is thus transcription dependent.
In order to make obtaining the timeseries output of a phase easier, each phase provides a timeseries component which collects and outputs the appropriate timeseries data. For the pseudospectral transcriptions, timeseries outputs are provided at all nodes. By default, the timeseries output will include the following variables for every problem.
Paths to timeseries outputs in Dymos#
Path |
Description |
---|---|
|
Current time value |
|
Current phase elapsed time |
|
Value of state variable named x |
|
Value of control variable named u |
|
Time derivative of control named u |
|
Second time derivative of control named u |
|
Value of polynomial control variable named u |
|
Time derivative of polynomial control named u |
|
Second time derivative of polynomial control named u |
|
Value of parameter named d |
Adding additional timeseries outputs#
In addition to these default values, any output of the ODE can be added to the timeseries output
using the add_timeseries_output
method on Phase. These outputs are available as
<phase path>.timeseries.<output name>
. A glob pattern can be used with add_timeseries_output
to add multiple outputs to the timeseries simultaneously. For instance, just passing ‘*’ as the variable
name will add all dynamic outputs of the ODE to the timeseries.
Dymos will ignore any ODE oututs that are not sized such that the first dimension is the same as the number of nodes in the ODE. That is, if the output variable doesn’t appear to be dynamic, it will not be included in the timeseries outputs.
- Phase.add_timeseries_output(name, output_name=None, units=unspecified, shape=unspecified, timeseries='timeseries', **kwargs)[source]
Add a variable to the timeseries outputs of the phase.
If name is given as an expression, this expression will be passed to an OpenMDAO ExecComp and the result computed and stored in the timeseries output under the variable name to the left of the equal sign.
- Parameters:
- namestr, or list of str
The name(s) of the variable to be used as a timeseries output, or a mathematical expression to be used as a timeseries output. If a name, it must be one of the integration variable, the phase-relative value of the integration variable (e.g. ‘time_phase’, one of the states, controls, control rates, or parameters, in the phase, the path to an output variable in the ODE, or a glob pattern matching some outputs in the ODE.
- output_namestr or None or list or dict
The name of the variable as listed in the phase timeseries outputs. By default this is the last element in name when split by dots. The user may override the constraint name if splitting the path causes name collisions.
- unitsstr or None or _unspecified
The units to express the timeseries output. If None, use the units associated with the target. If provided, must be compatible with the target units. If a list of names is provided, units can be a matching list or dictionary.
- shapetuple or _unspecified
The shape of the timeseries output variable. This must be provided (if not scalar) since Dymos doesn’t necessarily know the shape of ODE outputs until setup time.
- timeseriesstr or None
The name of the timeseries to which the output is being added.
- **kwargs
Additional arguments passed to the exec comp.
Interpolated Timeseries Outputs#
Sometimes a user may want to interpolate the results of a phase onto a different grid. This is particularly
useful in the context of tandem phases. Additional timeseries may be added to a phase using the add_timeseries
method. By default all timeseries will provide times, states, controls, and parameters on the specified output grid. Adding other variables is accomplished using the
timeseries
argument in the add_timeseries_output
method.
- Phase.add_timeseries(name, transcription, subset='all')[source]
Adds a new timeseries output upon which outputs can be provided.
- Parameters:
- namestr
A name for the timeseries output path.
- transcriptionstr
A transcription object which provides a grid upon which the outputs of the timeseries are provided.
- subsetstr
The name of the node subset in the given transcription at which outputs are to be provided.