Chris
Chris

Reputation: 57

How to set the state, control, and parameter options in a dimensioned Dymos problems?

I have an ODE given in the form a1 where x, u, and d are vectors (e.g. a2) . I've formulated this system in OpenMDAO/Dymos using dimensioned inputs and outputs

self.add_input('x',shape(num_nodes,Nx))

for Nx states. See: https://openmdao.github.io/dymos/getting_started/defining_odes.html?highlight=dimensioned#dimensioned-inputs-and-outputs

My ODE and trajectory works well, however, I'm interested in having some information clarified:

(1) I see that when adding states, inputs, and parameters, I can supply unique box constraints via upper and lower (https://openmdao.github.io/dymos/features/phases/constraints.html?highlight=dimensioned#path-constraints). For example, state 1 can have bounds [0,1] while state 2 has bounds [-1,5]. My question is, does suppling ref and ref0 information work in this same way? I tested this (e.g. ref0 = [0,-1]), but I can't tell if it is actually doing anything?

(2) Can you specify the units of specific elements of the dimensioned problems? For example, state 1 is a temperature and state 2 in a voltage. It does not look like I can simply do:

self.add_input('x',shape=(num_nodes,2),units=['K','V'])

because this returns an error.

(3) Can you specify different optimization properties for individual pieces in the state, input, and dimension vectors? For example, say I want to optimize input 1 (opt=True) but not input 2 (opt=False). Ideally, I would expect

phase.add_parameter('u',opt=[True,False])

but this returns an error.

If this functionality is possible, could you direct me to where I could find more information. I have gone through the Dymos documentation but could not find much on the topic.

Upvotes: 0

Views: 247

Answers (1)

Justin Gray
Justin Gray

Reputation: 5710

  1. In general OpenMDAO You can have vector valued ref/ref0 for design variables. Dymos should, in theory, also support this. You can give a ref/ref0 the same size as your state and then Dymos will extend it out to the full num_nodes size for you. Unfortunately, as of Dymos V 1.30 it looks like this doesn't quite work. We've logged that bug here, and it should be fixed by V1.4.

  2. OpenMDAO does not allow mixed units within arrays. This was an intentional design choice related to details about how unit conversions are handled and how to keep them efficient (both in terms of memory and compute usage). Because OpenMDAO doesn't allow it, Dymos can't.

So you either need to split the state up into multiple variables, or work in nondimentional quantities.

  1. For parameters and controls this is fairly strait forward via OpenMDAO's APIs. If you want finer grained index control, just set opt=False for all of them. Dymos will expose them as inputs at the top of the phase/trajectory for you (you can use the N2 to find them). Then you can call the native OpenMDAO API add_design_var on those phase/trajectory level inputs with whatever indecies you want.

Doing this for states isn't a great idea. Without getting to far into the math... Dymos works really hard to keep a well defined (in the mathematical sense) optimization problem for you. For states that means carefully matching up the defect constraints with the design variables. You can't just turn off part of a state array without also addressing the corresponding defect constraints. Of course, if you mess with the defect constraints then you aren't getting valid physics any more. This is such a huge can of worms that you really just don't want to touch it.

Upvotes: 1

Related Questions