Dymos: How to impose a constraint on a static output variable of ODE group at the phase level

27 views Asked by At

In my ODE system, I have a component to compute some quantity of interest based on the design variables, e.g., the weight of a device based on its dimensions (the dimensions are posed as design variables in optimization). I can add a constraint on this quantity at the system level using add_constraint, e.g.,

class ODESystem(om.Group):
...
def setup(self):
...
     self.add_subsystem(name='weight', subsys=Weight(), promotes_output=['W'])
     self.add_constraint('W', upper=4.0)

Alternatively, is there a way to add a constraint on this quantity at the phase level (in which the system participates) instead of at the system level? E.g.,

class ODESystem(om.Group):
...
def setup(self):
...
     self.add_subsystem(name='weight', subsys=Weight(), promotes_output=['W'])
...

phase = dm.Phase(ode_class=ODESystem ...)
# add constraint on 'W'

I tried add_boundary_constraint or add_path_constraint on 'W' but these failed because I guess they expect the quantity to have the same dimensions as the collocation nodes.

Note: Using add_boundary_constraint with an expression to compute the weight does work, but I'd like to keep the weight computation component as part of the ODESystem.

0

There are 0 answers