SizingMission.substitutions.update({SizingMission.fs0.topvar("T/A"):T_A}) RevenueMission = OnDemandRevenueMission(Aircraft,mission_range=revenue_mission_range, V_cruise=V_cruise,N_passengers=revenue_N_passengers,t_hover=revenue_t_hover, charger_power=charger_power,mission_type=revenue_mission_type, tailRotor_power_fraction_hover=tailRotor_power_fraction_hover, tailRotor_power_fraction_levelFlight=tailRotor_power_fraction_levelFlight) DeadheadMission = OnDemandDeadheadMission(Aircraft,mission_range=deadhead_mission_range, V_cruise=V_cruise,N_passengers=deadhead_N_passengers,t_hover=deadhead_t_hover, charger_power=charger_power,mission_type=deadhead_mission_type, tailRotor_power_fraction_hover=tailRotor_power_fraction_hover, tailRotor_power_fraction_levelFlight=tailRotor_power_fraction_levelFlight) MissionCost = OnDemandMissionCost(Aircraft,RevenueMission,DeadheadMission, pilot_wrap_rate=pilot_wrap_rate,mechanic_wrap_rate=mechanic_wrap_rate,MMH_FH=MMH_FH, deadhead_ratio=deadhead_ratio) problem = Model(MissionCost["cost_per_trip"], [Aircraft, SizingMission, RevenueMission, DeadheadMission, MissionCost]) solution = problem.solve(verbosity=0) configs[config][case]["solution"] = solution configs[config][case]["MTOW"] = solution("MTOW_OnDemandAircraft") configs[config][case]["W_{battery}"] = solution("W_OnDemandAircraft/Battery") configs[config][case]["cost_per_trip_per_passenger"] = solution("cost_per_trip_per_passenger_OnDemandMissionCost") #Noise computations (sizing mission) T_perRotor = solution("T_perRotor_OnDemandSizingMission")[0]
RevenueMission.V_cruise: c["V_{cruise}"],#cruising speed RevenueMission.t_hover: generic_data["revenue_mission"]["t_{hover}"],#hover time RevenueMission.passengers.N_passengers: revenue_N_passengers,#Number of passengers RevenueMission.time_on_ground.charger_power: generic_data["charger_power"], #Charger power }) DeadheadMission = OnDemandDeadheadMission(Aircraft,mission_type=generic_data["deadhead_mission"]["type"]) problem_subDict.update({ DeadheadMission.mission_range: generic_data["deadhead_mission"]["range"],#mission range DeadheadMission.V_cruise: c["V_{cruise}"],#cruising speed DeadheadMission.t_hover: generic_data["deadhead_mission"]["t_{hover}"],#hover time DeadheadMission.passengers.N_passengers: generic_data["deadhead_mission"]["N_{passengers}"],#Number of passengers DeadheadMission.time_on_ground.charger_power: generic_data["charger_power"], #Charger power }) MissionCost = OnDemandMissionCost(Aircraft,RevenueMission,DeadheadMission) problem_subDict.update({ MissionCost.revenue_mission_costs.operating_expenses.pilot_cost.wrap_rate: generic_data["pilot_wrap_rate"],#pilot wrap rate MissionCost.revenue_mission_costs.operating_expenses.maintenance_cost.wrap_rate: generic_data["mechanic_wrap_rate"], #mechanic wrap rate MissionCost.revenue_mission_costs.operating_expenses.maintenance_cost.MMH_FH: generic_data["MMH_FH"], #maintenance man-hours per flight hour MissionCost.deadhead_mission_costs.operating_expenses.pilot_cost.wrap_rate: generic_data["pilot_wrap_rate"],#pilot wrap rate MissionCost.deadhead_mission_costs.operating_expenses.maintenance_cost.wrap_rate: generic_data["mechanic_wrap_rate"], #mechanic wrap rate MissionCost.deadhead_mission_costs.operating_expenses.maintenance_cost.MMH_FH: generic_data["MMH_FH"], #maintenance man-hours per flight hour MissionCost.deadhead_ratio: generic_data["deadhead_ratio"], #deadhead ratio }) problem = Model(MissionCost["cost_per_trip"], [Aircraft, SizingMission, RevenueMission, DeadheadMission, MissionCost]) problem.substitutions.update(problem_subDict) solution = problem.solve(verbosity=0) configs[config]["solution"] = solution
def test(generic_data, configuration_data, config): configs = configuration_data.copy() c = configs[config] problem_subDict = {} Aircraft = OnDemandAircraft( autonomousEnabled=generic_data["autonomousEnabled"]) problem_subDict.update({ Aircraft.L_D_cruise: c["L/D"], #estimated L/D in cruise Aircraft.eta_cruise: generic_data["\eta_{cruise}"], #propulsive efficiency in cruise Aircraft.tailRotor_power_fraction_hover: c["tailRotor_power_fraction_hover"], Aircraft.tailRotor_power_fraction_levelFlight: c["tailRotor_power_fraction_levelFlight"], Aircraft.cost_per_weight: generic_data[ "vehicle_cost_per_weight"], #vehicle cost per unit empty weight Aircraft.battery.C_m: generic_data["C_m"], #battery energy density Aircraft.battery.cost_per_C: generic_data[ "battery_cost_per_C"], #battery cost per unit energy capacity Aircraft.rotors.N: c["N"], #number of propellers Aircraft.rotors.Cl_mean_max: c["Cl_{mean_{max}}"], #maximum allowed mean lift coefficient Aircraft.structure.weight_fraction: c["weight_fraction"], #empty weight fraction Aircraft.electricalSystem.eta: generic_data["\eta_{electric}"], #electrical system efficiency }) SizingMission = OnDemandSizingMission( Aircraft, mission_type=generic_data["sizing_mission"]["type"], reserve_type=generic_data["reserve_type"]) problem_subDict.update({ SizingMission.mission_range: generic_data["sizing_mission"]["range"], #mission range SizingMission.V_cruise: c["V_{cruise}"], #cruising speed SizingMission.t_hover: generic_data["sizing_mission"]["t_{hover}"], #hover time SizingMission.T_A: c["T/A"], #disk loading SizingMission.passengers.N_passengers: generic_data["sizing_mission"]["N_passengers"], #Number of passengers }) RevenueMission = OnDemandRevenueMission( Aircraft, mission_type=generic_data["revenue_mission"]["type"]) problem_subDict.update({ RevenueMission.mission_range: generic_data["revenue_mission"]["range"], #mission range RevenueMission.V_cruise: c["V_{cruise}"], #cruising speed RevenueMission.t_hover: generic_data["revenue_mission"]["t_{hover}"], #hover time RevenueMission.passengers.N_passengers: generic_data["revenue_mission"]["N_passengers"], #Number of passengers RevenueMission.time_on_ground.charger_power: generic_data["charger_power"], #Charger power }) DeadheadMission = OnDemandDeadheadMission( Aircraft, mission_type=generic_data["deadhead_mission"]["type"]) problem_subDict.update({ DeadheadMission.mission_range: generic_data["deadhead_mission"]["range"], #mission range DeadheadMission.V_cruise: c["V_{cruise}"], #cruising speed DeadheadMission.t_hover: generic_data["deadhead_mission"]["t_{hover}"], #hover time DeadheadMission.passengers.N_passengers: generic_data["deadhead_mission"] ["N_passengers"], #Number of passengers DeadheadMission.time_on_ground.charger_power: generic_data["charger_power"], #Charger power }) MissionCost = OnDemandMissionCost(Aircraft, RevenueMission, DeadheadMission) problem_subDict.update({ MissionCost.revenue_mission_costs.operating_expenses.pilot_cost.wrap_rate: generic_data["pilot_wrap_rate"], #pilot wrap rate MissionCost.revenue_mission_costs.operating_expenses.maintenance_cost.wrap_rate: generic_data["mechanic_wrap_rate"], #mechanic wrap rate MissionCost.revenue_mission_costs.operating_expenses.maintenance_cost.MMH_FH: generic_data["MMH_FH"], #maintenance man-hours per flight hour MissionCost.deadhead_mission_costs.operating_expenses.pilot_cost.wrap_rate: generic_data["pilot_wrap_rate"], #pilot wrap rate MissionCost.deadhead_mission_costs.operating_expenses.maintenance_cost.wrap_rate: generic_data["mechanic_wrap_rate"], #mechanic wrap rate MissionCost.deadhead_mission_costs.operating_expenses.maintenance_cost.MMH_FH: generic_data["MMH_FH"], #maintenance man-hours per flight hour MissionCost.deadhead_ratio: generic_data["deadhead_ratio"], #deadhead ratio #MissionCost.NdNr: 0.25, }) problem = Model(MissionCost["cost_per_trip"], [ Aircraft, SizingMission, RevenueMission, DeadheadMission, MissionCost ]) #problem = Model(Aircraft["TOGW"],[Aircraft, SizingMission]) problem.substitutions.update(problem_subDict) try: solution = problem.solve(verbosity=0) return solution except: return problem