Exemple #1
0
    def configure(self):
        
        # create Optimizer instance
        self.add('driver', SLSQPdriver())
        
        # Add components
        self.add('mech', mech_motion())
        self.add('wing', wing_motion())

        # Add components to workflow
        self.driver.workflow.add(['mech', 'wing'])
        
        # Add parameters to driver
        self.driver.add_parameter(('mech.mdef.front.Ri'), low = 5.e-3, high = 9.e-3)
        self.driver.add_parameter(('mech.mdef.front.Ro'), low = 20.e-3, high = 25.e-3)
        self.driver.add_parameter(('mech.mdef.front.theta_del'), low = np.radians(30), high = np.radians(180))
        
        # Make all connections
        self.connect('mech.mpos','wing.mpos')
        
        # Add constrains to inner optimizer
        self.driver.add_constraint('mech.mdef.front.Ri <= 1')

        # Outer optimization parameters
        self.driver.add_objective('-wing.Dymax')
Exemple #2
0
MechInit.fRo = MechInit.bRo = 24e-3
MechInit.fQB = MechInit.bQB = 67e-3
MechInit.fPA = MechInit.bPA = 65e-3
MechInit.ftheta_del = MechInit.btheta_del = np.radians(60)
MechInit.fBO = MechInit.bBO = 45e-3
MechInit.fAO = MechInit.bAO = 20e-3

MechInit.fz = 0
MechInit.bz = -65e-3

MechInit.run()      # Run defintion. Afterwards, mdef is filled.

"""
Calculate mechanism motion
"""
MechMotion = mech_motion()

MechMotion.mdef = MechInit.mdef
 
# Define running parameters
dt = 0.01
f = 2   #Hz
T = 1. / f

theta = np.linspace(0,2*np.pi, T/dt)
phi = np.ones(len(theta)) * np.radians(0)
 
MechMotion.phi = phi
MechMotion.theta = theta
 
MechMotion.run()