def setUpClass(cls): cls.n = 10 cls.p = Problem(model=Group()) ivc = cls.p.model.add_subsystem('ivc', IndepVarComp(), promotes_outputs=['*']) ivc.add_output('alt', val=3000 * np.ones(cls.n), units='m', desc='altitude above MSL') ivc.add_output('TAS', val=250.0 * np.ones(cls.n), units='m/s', desc='true airspeed') # ivc.add_output('TAS_rate', val=np.zeros(cls.n), units='m/s**2', desc='acceleration') ivc.add_output('gam', val=np.zeros(cls.n), units='rad', desc='flight path angle') # ivc.add_output('gam_rate', val=np.zeros(cls.n), units='rad/s', # desc='flight path angle rate') ivc.add_output('S', val=427.8 * np.ones(cls.n), units='m**2', desc='reference area') ivc.add_output('mach', val=0.8 * np.ones(cls.n), units=None, desc='mach number') ivc.add_output('W_total', val=200000 * 9.80665 * np.ones(cls.n), units='N', desc='aircraft total weight') ivc.add_output('q', val=0.5 * 250.0**2 * np.ones(cls.n), units='Pa', desc='dynamic pressure') cls.p.model.add_subsystem( 'flight_equilibrium', subsys=SteadyFlightEquilibriumGroup(num_nodes=cls.n), promotes_inputs=['aero.*'], promotes_outputs=['aero.*']) cls.p.model.connect('alt', ('aero.alt')) # cls.p.model.connect('TAS', 'aero.TAS') # cls.p.model.connect('TAS_rate', 'flight_equilibrium.TAS_rate') cls.p.model.connect('gam', 'flight_equilibrium.gam') # cls.p.model.connect('gam_rate', 'flight_equilibrium.gam_rate') cls.p.model.connect('S', ('aero.S', 'flight_equilibrium.S')) cls.p.model.connect('mach', 'aero.mach') cls.p.model.connect('W_total', 'flight_equilibrium.W_total') cls.p.model.connect('q', ('aero.q', 'flight_equilibrium.q')) cls.p.setup(check=True, force_alloc_complex=True) cls.p.run_model()
def setup(self): nn = self.options['num_nodes'] self.add_subsystem(name='mass_comp', subsys=MassComp(num_nodes=nn)) self.connect('mass_comp.W_total', 'flight_equilibrium.W_total') self.add_subsystem(name='atmos', subsys=USatm1976Comp(num_nodes=nn)) self.connect('atmos.pres', 'propulsion.pres') self.connect('atmos.sos', 'tas_comp.sos') self.connect('atmos.rho', 'q_comp.rho') self.add_subsystem(name='tas_comp', subsys=TrueAirspeedComp(num_nodes=nn)) self.connect('tas_comp.TAS', ('gam_comp.TAS', 'q_comp.TAS', 'range_rate_comp.TAS')) self.add_subsystem(name='gam_comp', subsys=SteadyFlightPathAngleComp(num_nodes=nn)) self.connect('gam_comp.gam', ('flight_equilibrium.gam', 'range_rate_comp.gam')) self.add_subsystem(name='q_comp', subsys=DynamicPressureComp(num_nodes=nn)) self.connect('q_comp.q', ('aero.q', 'flight_equilibrium.q', 'propulsion.q')) self.add_subsystem(name='flight_equilibrium', subsys=SteadyFlightEquilibriumGroup(num_nodes=nn), promotes_inputs=['aero.*'], promotes_outputs=['aero.*']) self.connect('flight_equilibrium.CT', 'propulsion.CT') self.add_subsystem(name='propulsion', subsys=PropulsionGroup(num_nodes=nn)) self.add_subsystem(name='range_rate_comp', subsys=RangeRateComp(num_nodes=nn))