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 |
---|---|
<phase path>.timeseries.time |
Current time value |
<phase path>.timeseries.time_phase |
Current phase elapsed time |
<phase path>.timeseries.states:<x> |
Value of state variable named x |
<phase path>.timeseries.controls:<u> |
Value of control variable named u |
<phase path>.timeseries.control_rates:<u>_rate |
Time derivative of control named u |
<phase path>.timeseries.control_rates:<u>_rate2 |
Second time derivative of control named u |
<phase path>.timeseries.polynomial_controls:<p> |
Value of polynomial control variable named u |
<phase path>.timeseries.polynomial_control_rates:<p>_rate |
Time derivative of polynomial control named u |
<phase path>.timeseries.polynomial_control_rates:<p>_rate2 |
Second time derivative of polynomial control named u |
<phase path>.timeseries.parameters:<d> |
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.
dymos.Phase.add_timeseries_output
add_timeseries_output(self, name, output_name=None, units=None, shape=None, timeseries='timeseries')
Add a variable to the timeseries outputs of the phase.
Arguments:
name: The name(s) of the variable to be used as a timeseries output. Must be one of 'time', 'time_phase', one of the states, controls, control rates, or parameters, in the phase, or the path to an output variable in the ODE.
output_name: 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.
units: 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.
shape: 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.
timeseries: The name of the timeseries to which the output is being added.
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.
dymos.Phase.add_timeseries
add_timeseries(self, name, transcription, subset='all')
Adds a new timeseries output upon which outputs can be provided.
Arguments:
name: A name for the timeseries output path.
transcription: A transcription object which provides a grid upon which the outputs of the timeseries are provided.
subset: The name of the node subset in the given transcription at which outputs are to be provided.