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: sizing_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: revenue_N_passengers,#Number of passengers RevenueMission.time_on_ground.charger_power: generic_data["charger_power"], #Charger power
weight_fraction = c["weight_fraction"] N = c["N"] B = c["B"] s = c["s"] t_c = c["t_c"] Cl_mean_max = c["Cl_{mean_{max}}"] Aircraft = OnDemandAircraft(N=N,L_D_cruise=L_D_cruise,eta_cruise=eta_cruise,C_m=C_m, Cl_mean_max=Cl_mean_max,weight_fraction=weight_fraction,s=s,n=n,eta_electric=eta_electric, cost_per_weight=vehicle_cost_per_weight,cost_per_C=battery_cost_per_C, autonomousEnabled=autonomousEnabled) SizingMission = OnDemandSizingMission(Aircraft,mission_range=sizing_mission_range, V_cruise=V_cruise,N_passengers=sizing_N_passengers,t_hover=sizing_t_hover, reserve_type=reserve_type,mission_type=sizing_mission_type,loiter_type=loiter_type, tailRotor_power_fraction_hover=tailRotor_power_fraction_hover, tailRotor_power_fraction_levelFlight=tailRotor_power_fraction_levelFlight) 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)
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
Aircraft = OnDemandAircraft(autonomousEnabled=time_frame_data[time_frame]["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: time_frame_data[time_frame]["vehicle_cost_per_weight"], #vehicle cost per unit empty weight Aircraft.battery.C_m: time_frame_data[time_frame]["C_m"], #battery energy density Aircraft.battery.cost_per_C: time_frame_data[time_frame]["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=time_frame_data[time_frame]["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=time_frame_data[time_frame]["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
L_D_cruise=L_D_cruise, eta_cruise=eta_cruise, C_m=C_m, Cl_mean_max=Cl_mean_max, weight_fraction=weight_fraction, n=n, eta_electric=eta_electric, cost_per_weight=vehicle_cost_per_weight, cost_per_C=battery_cost_per_C, autonomousEnabled=autonomousEnabled) SizingMission = OnDemandSizingMission( Aircraft, mission_range=sizing_mission_range, V_cruise=V_cruise, N_passengers=sizing_N_passengers, t_hover=sizing_t_hover, reserve_type=reserve_type, mission_type=sizing_mission_type, loiter_type=loiter_type) 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)