コード例 #1
0
    def setup(self):
        #define design variables that are independent of flight condition or control states
        dvlist = [['ac|propulsion|engine|rating', 'eng1_rating', 260.0, 'kW'],
                  ['dv_prop1_diameter', 'prop1_diameter', 2.5, 'm'],
                  ['dv_motor1_rating', 'motor1_rating', 240.0, 'kW'],
                  ['dv_gen1_rating', 'gen1_rating', 250.0, 'kW'],
                  ['dv_batt1_weight', 'batt1_weight', 2000, 'kg']]
        self.add_subsystem('dvs',
                           DVLabel(dvlist),
                           promotes_inputs=["*"],
                           promotes_outputs=["*"])
        nn = self.options['num_nodes']
        #introduce model components
        self.add_subsystem('motor1',
                           SimpleMotor(efficiency=0.97, num_nodes=nn),
                           promotes_inputs=["throttle"])
        self.add_subsystem('hybrid_split',
                           PowerSplit(rule='fraction', num_nodes=nn))
        self.add_subsystem('gen1',
                           SimpleGenerator(efficiency=0.97, num_nodes=nn))
        self.add_subsystem('eng1',
                           SimpleTurboshaft(num_nodes=nn),
                           promotes_outputs=["fuel_flow"])
        self.add_subsystem('batt1', SimpleBattery(num_nodes=nn))
        self.add_subsystem('prop1',
                           SimplePropeller(num_nodes=nn),
                           promotes_inputs=["fltcond_*"],
                           promotes_outputs=["thrust"])

        #connect design variables to model component inputs
        self.connect('eng1_rating', 'eng1.shaft_power_rating')
        self.connect('prop1_diameter', 'prop1.diameter')
        self.connect('motor1_rating', 'motor1.elec_power_rating')
        self.connect('motor1_rating', 'prop1.power_rating')
        self.connect('gen1_rating', 'gen1.elec_power_rating')
        self.connect('batt1_weight', 'batt1.battery_weight')

        #connect components to each other
        self.connect('motor1.shaft_power_out', 'prop1.shaft_power_in')
        self.connect('eng1.shaft_power_out', 'gen1.shaft_power_in')
        self.connect('motor1.elec_load', 'hybrid_split.power_in')
        self.connect('hybrid_split.power_out_A', 'batt1.elec_load')
コード例 #2
0
    def setup(self):
        #define design variables that are independent of flight condition or control states
        dvlist = [
            ['ac|propulsion|engine|rating', 'eng_rating', 260.0, 'kW'],
            ['ac|propulsion|propeller|diameter', 'prop_diameter', 2.5, 'm'],
            ['ac|propulsion|motor|rating', 'motor_rating', 240.0, 'kW'],
            ['ac|propulsion|generator|rating', 'gen_rating', 250.0, 'kW'],
            ['ac|weights|W_battery', 'batt_weight', 2000, 'kg']
        ]
        self.add_subsystem('dvs',
                           DVLabel(dvlist),
                           promotes_inputs=["*"],
                           promotes_outputs=["*"])
        nn = self.options['num_nodes']
        e_b = self.options['specific_energy']
        #introduce model components
        self.add_subsystem('motor1', SimpleMotor(efficiency=0.97,
                                                 num_nodes=nn))
        self.add_subsystem('prop1',
                           SimplePropeller(num_nodes=nn),
                           promotes_inputs=["fltcond|*"])
        self.connect('motor1.shaft_power_out', 'prop1.shaft_power_in')

        self.add_subsystem('motor2', SimpleMotor(efficiency=0.97,
                                                 num_nodes=nn))
        self.add_subsystem('prop2',
                           SimplePropeller(num_nodes=nn),
                           promotes_inputs=["fltcond|*"])
        self.connect('motor2.shaft_power_out', 'prop2.shaft_power_in')

        addpower = AddSubtractComp(
            output_name='motors_elec_load',
            input_names=['motor1_elec_load', 'motor2_elec_load'],
            units='kW',
            vec_size=nn)
        addpower.add_equation(output_name='thrust',
                              input_names=['prop1_thrust', 'prop2_thrust'],
                              units='N',
                              vec_size=nn)
        self.add_subsystem('add_power',
                           subsys=addpower,
                           promotes_outputs=['*'])
        self.connect('motor1.elec_load', 'add_power.motor1_elec_load')
        self.connect('motor2.elec_load', 'add_power.motor2_elec_load')
        self.connect('prop1.thrust', 'add_power.prop1_thrust')
        self.connect('prop2.thrust', 'add_power.prop2_thrust')

        self.add_subsystem('hybrid_split',
                           PowerSplit(rule='fraction', num_nodes=nn))
        self.connect('motors_elec_load', 'hybrid_split.power_in')

        self.add_subsystem('eng1',
                           SimpleTurboshaft(num_nodes=nn,
                                            weight_inc=0.14 / 1000,
                                            weight_base=104),
                           promotes_outputs=["fuel_flow"])
        self.add_subsystem('gen1',
                           SimpleGenerator(efficiency=0.97, num_nodes=nn))

        self.connect('eng1.shaft_power_out', 'gen1.shaft_power_in')

        self.add_subsystem('batt1',
                           SimpleBattery(num_nodes=nn, specific_energy=e_b))
        self.connect('hybrid_split.power_out_A', 'batt1.elec_load')
        self.add_subsystem(
            'eng_gen_resid',
            AddSubtractComp(
                output_name='eng_gen_residual',
                input_names=['gen_power_available', 'gen_power_required'],
                vec_size=nn,
                units='kW',
                scaling_factors=[1, -1]))
        #need to use the optimizer to drive hybrid_split.power_out_B to the same value as gen1.elec_power_out
        self.connect('hybrid_split.power_out_B',
                     'eng_gen_resid.gen_power_required')
        self.connect('gen1.elec_power_out',
                     'eng_gen_resid.gen_power_available')
        addweights = AddSubtractComp(
            output_name='motors_weight',
            input_names=['motor1_weight', 'motor2_weight'],
            units='kg')
        addweights.add_equation(output_name='propellers_weight',
                                input_names=['prop1_weight', 'prop2_weight'],
                                units='kg')
        self.add_subsystem('add_weights',
                           subsys=addweights,
                           promotes_inputs=['*'],
                           promotes_outputs=['*'])
        relabel = [[
            'hybrid_split_A_in', 'battery_load',
            np.ones(nn) * 260.0, 'kW'
        ]]
        self.add_subsystem('relabel',
                           DVLabel(relabel),
                           promotes_outputs=["battery_load"])
        self.connect('hybrid_split.power_out_A', 'relabel.hybrid_split_A_in')

        self.connect('motor1.component_weight', 'motor1_weight')
        self.connect('motor2.component_weight', 'motor2_weight')
        self.connect('prop1.component_weight', 'prop1_weight')
        self.connect('prop2.component_weight', 'prop2_weight')

        #connect design variables to model component inputs
        self.connect('eng_rating', 'eng1.shaft_power_rating')
        self.connect('prop_diameter', ['prop1.diameter', 'prop2.diameter'])
        self.connect('motor_rating',
                     ['motor1.elec_power_rating', 'motor2.elec_power_rating'])
        self.connect('motor_rating',
                     ['prop1.power_rating', 'prop2.power_rating'])
        self.connect('gen_rating', 'gen1.elec_power_rating')
        self.connect('batt_weight', 'batt1.battery_weight')
コード例 #3
0
    def setup(self):
        nn = self.options['num_nodes']
        e_b = self.options['specific_energy']

        # define design variables that are independent of flight condition or control states
        dvlist = [
            ['ac|propulsion|engine|rating', 'eng_rating', 260.0, 'kW'],
            ['ac|propulsion|propeller|diameter', 'prop_diameter', 2.5, 'm'],
            ['ac|propulsion|motor|rating', 'motor_rating', 240.0, 'kW'],
            ['ac|propulsion|generator|rating', 'gen_rating', 250.0, 'kW'],
            ['ac|weights|W_battery', 'batt_weight', 2000, 'kg']
        ]
        self.add_subsystem('dvs',
                           DVLabel(dvlist),
                           promotes_inputs=["*"],
                           promotes_outputs=["*"])

        # introduce model components
        self.add_subsystem('motor1', SimpleMotor(efficiency=0.97,
                                                 num_nodes=nn))
        self.add_subsystem('prop1',
                           SimplePropeller(num_nodes=nn),
                           promotes_inputs=["fltcond|*"],
                           promotes_outputs=['thrust'])
        self.connect('motor1.shaft_power_out', 'prop1.shaft_power_in')

        self.add_subsystem('hybrid_split',
                           PowerSplit(rule='fraction', num_nodes=nn))
        self.connect('motor1.elec_load', 'hybrid_split.power_in')

        self.add_subsystem('eng1',
                           SimpleTurboshaft(num_nodes=nn,
                                            weight_inc=0.14 / 1000,
                                            weight_base=104),
                           promotes_outputs=["fuel_flow"])
        self.add_subsystem('gen1',
                           SimpleGenerator(efficiency=0.97, num_nodes=nn))

        self.connect('eng1.shaft_power_out', 'gen1.shaft_power_in')

        self.add_subsystem('batt1',
                           SimpleBattery(num_nodes=nn, specific_energy=e_b))
        self.connect('hybrid_split.power_out_A', 'batt1.elec_load')

        # need to use the optimizer to drive hybrid_split.power_out_B to the
        # same value as gen1.elec_power_out.
        # create a residual equation for power in vs power out from the generator
        self.add_subsystem(
            'eng_gen_resid',
            AddSubtractComp(
                output_name='eng_gen_residual',
                input_names=['gen_power_available', 'gen_power_required'],
                vec_size=nn,
                units='kW',
                scaling_factors=[1, -1]))
        self.connect('hybrid_split.power_out_B',
                     'eng_gen_resid.gen_power_required')
        self.connect('gen1.elec_power_out',
                     'eng_gen_resid.gen_power_available')

        # add the weights of all the motors and props
        # (forward-compatibility for twin series hybrid layout)
        addweights = AddSubtractComp(output_name='motors_weight',
                                     input_names=['motor1_weight'],
                                     units='kg')
        addweights.add_equation(output_name='propellers_weight',
                                input_names=['prop1_weight'],
                                units='kg')
        self.add_subsystem('add_weights',
                           subsys=addweights,
                           promotes_inputs=['*'],
                           promotes_outputs=['*'])

        self.connect('motor1.component_weight', 'motor1_weight')
        self.connect('prop1.component_weight', 'prop1_weight')

        #connect design variables to model component inputs
        self.connect('eng_rating', 'eng1.shaft_power_rating')
        self.connect('prop_diameter', ['prop1.diameter'])
        self.connect('motor_rating', ['motor1.elec_power_rating'])
        self.connect('motor_rating', ['prop1.power_rating'])
        self.connect('gen_rating', 'gen1.elec_power_rating')
        self.connect('batt_weight', 'batt1.battery_weight')