Defining a Constraint for a Component and Enforcing it in Openmdao

38 views Asked by At

I am new to openmdao and am trying to solve a problem with 2 disciplines (defined as explicit components). The first component gets a number of input values and create a number of outputs which are passed to the second component so these two components are connected. Now, I want to set a constraint on the second component to ensure that one of the output values of this component is bounded between -1 and 1 (the output value is the cosine of an angel calculated based on some design variables).

In the file related to the second component, I've added a function for the the constraint however during the calculations the constraint is not enforced. I've used

def add_constraint(self, outputs):
    self.add_constraint(outputs['cosGamma'], lower = -1, upper = 1)

In another attempt, I defined this constraint on the system level. In details, first a subsytem defining the constraint function was added to the system using self.add_subsystem which promotes gGamma as an output. This function calculates the cosine of an angel (Gamma) based on the system level variables. Then problem.model.add_constraint('gGamma', lower = -1, upper= 1) was used to put constraint on gGamma. Yet, the constraint is not enforced again.

I am wondering how this constraint can be enforced in this scenario.

0

There are 0 answers