openmdao

Dymos: How to specify the values of a time-varying variable


In vehicle dynamics applications, certain time-varying variables may be provided by the user. Common examples are the displacement values applied to the wheels over time or the steering angles representing a particular maneuver (e.g., double lane change) over time.

Here is an example of the steering function used for a double lane change maneuver test.

enter image description here

How can I use this type of input to specify the values of a time-varying variable in Dymos? The input could be given by the user as either an analytical function or a set of values over time.


Solution

  • There are a few ways of doing this. The simplest way is to use OpenMDAOs MetaModelStructured component, to interpolate the given values as a function of time.

    Alternatively, you could provide these as time varying control inputs. If you specify opt=False for the control options, then dymos will use the values given at the input nodes and the optimizer will not override them.

    The trick is that it's difficult to know the time values at the control input bits nodes ahead of time. If you have a fixed time, then the easiest way with this approach is to use a polynomial control of a given order and then specify the control values at the LGL nodes in phase tau space (the beginning of the phase occurs at tau=-1 and the end is at tau=1. There are functions that compute the locations of the LGL nodes for a given order in the dymos utils sub package.