def main(): # ------------------------------------------------------------------ # Propulsor # ------------------------------------------------------------------ # build network net = Solar() net.number_of_engines = 1. net.nacelle_dia = 0.2 # Component 1 the Sun? sun = SUAVE.Components.Energy.Processes.Solar_Radiation() net.solar_flux = sun # Component 2 the solar panels panel = SUAVE.Components.Energy.Converters.Solar_Panel() panel.area = 100 * Units.m panel.efficiency = 0.18 panel.mass_properties.mass = panel.area * .600 net.solar_panel = panel # Component 3 the ESC esc = SUAVE.Components.Energy.Distributors.Electronic_Speed_Controller() esc.efficiency = 0.95 # Gundlach for brushless motors net.esc = esc # Component 5 the Propeller # Propeller design specs design_altitude = 0.0 * Units.km Velocity = 10.0 # freestream m/s RPM = 5887 Blades = 2.0 Radius = .4064 Hub_Radius = 0.05 Design_Cl = 0.7 Thrust = 0.0 #Specify either thrust or power to design for Power = 7500. #Specify either thrust or power to design for # Design the Propeller prop_attributes = Data() prop_attributes.number_blades = Blades prop_attributes.freestream_velocity = Velocity prop_attributes.angular_velocity = RPM * (2. * np.pi / 60.0) prop_attributes.tip_radius = Radius prop_attributes.hub_radius = Hub_Radius prop_attributes.design_Cl = Design_Cl prop_attributes.design_altitude = design_altitude prop_attributes.design_thrust = Thrust prop_attributes.design_power = Power prop_attributes = propeller_design(prop_attributes) # Create and attach this propeller prop = SUAVE.Components.Energy.Converters.Propeller() prop.prop_attributes = prop_attributes net.propeller = prop # Component 4 the Motor motor = SUAVE.Components.Energy.Converters.Motor() motor.resistance = 0.01 motor.no_load_current = 8.0 motor.speed_constant = 140. * (2. * np.pi / 60. ) # RPM/volt converted to rad/s motor.propeller_radius = prop.prop_attributes.tip_radius motor.propeller_Cp = prop.prop_attributes.Cp motor.gear_ratio = 1. motor.gearbox_efficiency = 1. motor.expected_current = 260. motor.mass_properties.mass = 2.0 net.motor = motor # Component 6 the Payload payload = SUAVE.Components.Energy.Peripherals.Payload() payload.power_draw = 0. #Watts payload.mass_properties.mass = 0. * Units.kg net.payload = payload # Component 7 the Avionics avionics = SUAVE.Components.Energy.Peripherals.Avionics() avionics.power_draw = 0. #Watts net.avionics = avionics # Component 8 the Battery bat = SUAVE.Components.Energy.Storages.Batteries.Constant_Mass.Lithium_Ion( ) batterymass = 50. #kg bat.type = 'Li-Ion' bat.resistance = 0.0 bat.energy_density = 250. initialize_from_mass(bat, batterymass) bat.current_energy = bat.max_energy net.battery = bat #Component 9 the system logic controller and MPPT logic = SUAVE.Components.Energy.Distributors.Solar_Logic() logic.system_voltage = 50.0 logic.MPPT_efficiency = 0.95 net.solar_logic = logic # Setup the conditions to run the network state = Data() state.conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics( ) state.numerics = SUAVE.Analyses.Mission.Segments.Conditions.Numerics() conditions = state.conditions numerics = state.numerics # Calculate atmospheric properties atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976() atmosphere_conditions = atmosphere.compute_values( prop_attributes.design_altitude) rho = atmosphere_conditions.density[0, :] a = atmosphere_conditions.speed_of_sound[0, :] mu = atmosphere_conditions.dynamic_viscosity[0, :] T = atmosphere_conditions.temperature[0, :] conditions.propulsion.throttle = np.array([[1.0], [1.0]]) conditions.freestream.velocity = np.array([[1.0], [1.0]]) conditions.freestream.density = np.array([rho, rho]) conditions.freestream.dynamic_viscosity = np.array([mu, mu]) conditions.freestream.speed_of_sound = np.array([a, a]) conditions.freestream.altitude = np.array([[design_altitude], [design_altitude]]) conditions.propulsion.battery_energy = bat.max_energy * np.ones_like( conditions.freestream.altitude) conditions.frames.body.inertial_rotations = np.zeros([2, 3]) conditions.frames.inertial.time = np.array([[0.0], [1.0]]) numerics.time.integrate = np.array([[0, 0], [0, 1]]) numerics.time.differentiate = np.array([[0, 0], [0, 1]]) conditions.frames.planet.start_time = time.strptime( "Sat, Jun 21 06:00:00 2014", "%a, %b %d %H:%M:%S %Y", ) conditions.frames.planet.latitude = np.array([[0.0], [0.0]]) conditions.frames.planet.longitude = np.array([[0.0], [0.0]]) conditions.freestream.temperature = np.array([T, T]) # Run the network and print the results results = net(state) F = results.thrust_force_vector # Truth results truth_F = [[522.40448791], [522.40448791]] truth_i = [[314.90485916], [314.90485916]] truth_rpm = [[6581.17653732], [6581.17653732]] truth_bat = [[36000000.], [35984254.75704217]] error = Data() error.Thrust = np.max(np.abs(F[:, 0] - truth_F)) error.RPM = np.max(np.abs(conditions.propulsion.rpm - truth_rpm)) error.Current = np.max(np.abs(conditions.propulsion.current - truth_i)) error.Battery = np.max(np.abs(bat.current_energy - truth_bat)) print error for k, v in error.items(): assert (np.abs(v) < 0.001) return
def vehicle_setup(): # ------------------------------------------------------------------ # Initialize the Vehicle # ------------------------------------------------------------------ vehicle = SUAVE.Vehicle() vehicle.tag = 'Solar' # ------------------------------------------------------------------ # Vehicle-level Properties # ------------------------------------------------------------------ # mass properties vehicle.mass_properties.takeoff = 200. * Units.kg vehicle.mass_properties.operating_empty = 200. * Units.kg vehicle.mass_properties.max_takeoff = 200. * Units.kg # basic parameters vehicle.reference_area = 80. vehicle.envelope.ultimate_load = 2.0 vehicle.envelope.limit_load = 1.5 vehicle.envelope.maximum_dynamic_pressure = 0.5*1.225*(40.**2.) #Max q # ------------------------------------------------------------------ # Main Wing # ------------------------------------------------------------------ wing = SUAVE.Components.Wings.Wing() wing.tag = 'main_wing' wing.areas.reference = vehicle.reference_area wing.spans.projected = 40.0 * Units.meter wing.aspect_ratio = (wing.spans.projected**2)/wing.areas.reference wing.sweeps.quarter_chord = 0.0 * Units.deg wing.symmetric = True wing.thickness_to_chord = 0.12 wing.taper = 1.0 wing.vertical = False wing.high_lift = True wing.dynamic_pressure_ratio = 1.0 wing.chords.mean_aerodynamic = wing.areas.reference/wing.spans.projected wing.chords.root = wing.areas.reference/wing.spans.projected wing.chords.tip = wing.areas.reference/wing.spans.projected wing.span_efficiency = 0.98 wing.twists.root = 0.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees wing.highlift = False wing.vertical = False wing.number_ribs = 26. wing.number_end_ribs = 2. wing.transition_x_upper = 0.6 wing.transition_x_lower = 1.0 wing.origin = [3.0,0.0,0.0] # meters wing.aerodynamic_center = [3.0,0.0,0.0] # meters # add to vehicle vehicle.append_component(wing) # ------------------------------------------------------------------ # Horizontal Stabilizer # ------------------------------------------------------------------ wing = SUAVE.Components.Wings.Wing() wing.tag = 'horizontal_stabilizer' wing.aspect_ratio = 20. wing.sweeps.quarter_chord = 0 * Units.deg wing.thickness_to_chord = 0.12 wing.taper = 1.0 wing.span_efficiency = 0.95 wing.areas.reference = vehicle.reference_area * .15 wing.areas.wetted = 2.0 * wing.areas.reference wing.areas.exposed = 0.8 * wing.areas.wetted wing.areas.affected = 0.6 * wing.areas.wetted wing.spans.projected = np.sqrt(wing.aspect_ratio*wing.areas.reference) wing.twists.root = 0.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees wing.vertical = False wing.symmetric = True wing.dynamic_pressure_ratio = 0.9 wing.number_ribs = 5.0 wing.chords.root = wing.areas.reference/wing.spans.projected wing.chords.tip = wing.areas.reference/wing.spans.projected wing.chords.mean_aerodynamic = wing.areas.reference/wing.spans.projected wing.origin = [10.,0.0,0.0] # meters wing.aerodynamic_center = [0.5,0.0,0.0] # meters # add to vehicle vehicle.append_component(wing) # ------------------------------------------------------------------ # Vertical Stabilizer # ------------------------------------------------------------------ wing = SUAVE.Components.Wings.Wing() wing.tag = 'vertical_stabilizer' wing.aspect_ratio = 20. wing.sweeps.quarter_chord = 0 * Units.deg wing.thickness_to_chord = 0.12 wing.taper = 1.0 wing.span_efficiency = 0.97 wing.areas.reference = vehicle.reference_area * 0.1 wing.spans.projected = np.sqrt(wing.aspect_ratio*wing.areas.reference) wing.chords.root = wing.areas.reference/wing.spans.projected wing.chords.tip = wing.areas.reference/wing.spans.projected wing.chords.mean_aerodynamic = wing.areas.reference/wing.spans.projected wing.areas.wetted = 2.0 * wing.areas.reference wing.areas.exposed = 0.8 * wing.areas.wetted wing.areas.affected = 0.6 * wing.areas.wetted wing.twists.root = 0.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees wing.origin = [10.,0.0,0.0] # meters wing.aerodynamic_center = [0.5,0.0,0.0] # meters wing.symmetric = True wing.vertical = True wing.t_tail = False wing.dynamic_pressure_ratio = 1.0 wing.number_ribs = 5. # add to vehicle vehicle.append_component(wing) #------------------------------------------------------------------ # Propulsor #------------------------------------------------------------------ # build network net = Solar() net.number_of_engines = 1. net.nacelle_diameter = 0.2 * Units.meters net.engine_length = 0.01 * Units.meters net.areas = Data() net.areas.wetted = 0.01*(2*np.pi*0.01/2.) # Component 1 the Sun? sun = SUAVE.Components.Energy.Processes.Solar_Radiation() net.solar_flux = sun # Component 2 the solar panels panel = SUAVE.Components.Energy.Converters.Solar_Panel() panel.area = vehicle.reference_area * 0.9 panel.efficiency = 0.25 panel.mass_properties.mass = panel.area*(0.60 * Units.kg) net.solar_panel = panel # Component 3 the ESC esc = SUAVE.Components.Energy.Distributors.Electronic_Speed_Controller() esc.efficiency = 0.95 # Gundlach for brushless motors net.esc = esc # Component 5 the Propeller # Design the Propeller prop_attributes = Data() prop_attributes.number_blades = 2.0 prop_attributes.freestream_velocity = 40.0 * Units['m/s']# freestream prop_attributes.angular_velocity = 150. * Units['rpm'] prop_attributes.tip_radius = 4.25 * Units.meters prop_attributes.hub_radius = 0.05 * Units.meters prop_attributes.design_Cl = 0.7 prop_attributes.design_altitude = 14.0 * Units.km prop_attributes.design_thrust = 0.0 prop_attributes.design_power = 3500.0 * Units.watts prop_attributes = propeller_design(prop_attributes) prop = SUAVE.Components.Energy.Converters.Propeller() prop.prop_attributes = prop_attributes net.propeller = prop # Component 4 the Motor motor = SUAVE.Components.Energy.Converters.Motor() motor.resistance = 0.008 motor.no_load_current = 4.5 * Units.ampere motor.speed_constant = 120. * Units['rpm'] # RPM/volt converted to (rad/s)/volt motor.propeller_radius = prop.prop_attributes.tip_radius motor.propeller_Cp = prop.prop_attributes.Cp motor.gear_ratio = 12. # Gear ratio motor.gearbox_efficiency = .98 # Gear box efficiency motor.expected_current = 160. # Expected current motor.mass_properties.mass = 2.0 * Units.kg net.motor = motor # Component 6 the Payload payload = SUAVE.Components.Energy.Peripherals.Payload() payload.power_draw = 50. * Units.watts payload.mass_properties.mass = 5.0 * Units.kg net.payload = payload # Component 7 the Avionics avionics = SUAVE.Components.Energy.Peripherals.Avionics() avionics.power_draw = 50. * Units.watts net.avionics = avionics # Component 8 the Battery bat = SUAVE.Components.Energy.Storages.Batteries.Constant_Mass.Lithium_Ion() bat.mass_properties.mass = 55.0 * Units.kg bat.specific_energy = 450. * Units.Wh/Units.kg bat.resistance = 0.05 initialize_from_mass(bat,bat.mass_properties.mass) net.battery = bat #Component 9 the system logic controller and MPPT logic = SUAVE.Components.Energy.Distributors.Solar_Logic() logic.system_voltage = 40.0 logic.MPPT_efficiency = 0.95 net.solar_logic = logic # add the solar network to the vehicle vehicle.append_component(net) return vehicle
def vehicle_setup(): # ------------------------------------------------------------------ # Initialize the Vehicle # ------------------------------------------------------------------ vehicle = SUAVE.Vehicle() vehicle.tag = 'Solar' # ------------------------------------------------------------------ # Vehicle-level Properties # ------------------------------------------------------------------ # mass properties vehicle.mass_properties.takeoff = 200. * Units.kg vehicle.mass_properties.operating_empty = 200. * Units.kg vehicle.mass_properties.max_takeoff = 200. * Units.kg # basic parameters vehicle.reference_area = 80. vehicle.envelope.ultimate_load = 2.0 vehicle.envelope.limit_load = 1.5 vehicle.envelope.maximum_dynamic_pressure = 0.5 * 1.225 * (40.**2.) #Max q # ------------------------------------------------------------------ # Main Wing # ------------------------------------------------------------------ wing = SUAVE.Components.Wings.Wing() wing.tag = 'main_wing' wing.areas.reference = vehicle.reference_area wing.spans.projected = 40.0 * Units.meter wing.aspect_ratio = (wing.spans.projected**2) / wing.areas.reference wing.sweeps.quarter_chord = 0.0 * Units.deg wing.symmetric = True wing.thickness_to_chord = 0.12 wing.taper = 1.0 wing.vertical = False wing.high_lift = True wing.dynamic_pressure_ratio = 1.0 wing.chords.mean_aerodynamic = wing.areas.reference / wing.spans.projected wing.chords.root = wing.areas.reference / wing.spans.projected wing.chords.tip = wing.areas.reference / wing.spans.projected wing.span_efficiency = 0.98 wing.twists.root = 0.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees wing.highlift = False wing.vertical = False wing.number_ribs = 26. wing.number_end_ribs = 2. wing.transition_x_upper = 0.6 wing.transition_x_lower = 1.0 wing.origin = [3.0, 0.0, 0.0] # meters wing.aerodynamic_center = [3.0, 0.0, 0.0] # meters # add to vehicle vehicle.append_component(wing) # ------------------------------------------------------------------ # Horizontal Stabilizer # ------------------------------------------------------------------ wing = SUAVE.Components.Wings.Wing() wing.tag = 'horizontal_stabilizer' wing.aspect_ratio = 20. wing.sweeps.quarter_chord = 0 * Units.deg wing.thickness_to_chord = 0.12 wing.taper = 1.0 wing.span_efficiency = 0.95 wing.areas.reference = vehicle.reference_area * .15 wing.areas.wetted = 2.0 * wing.areas.reference wing.areas.exposed = 0.8 * wing.areas.wetted wing.areas.affected = 0.6 * wing.areas.wetted wing.spans.projected = np.sqrt(wing.aspect_ratio * wing.areas.reference) wing.twists.root = 0.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees wing.vertical = False wing.symmetric = True wing.dynamic_pressure_ratio = 0.9 wing.number_ribs = 5.0 wing.chords.root = wing.areas.reference / wing.spans.projected wing.chords.tip = wing.areas.reference / wing.spans.projected wing.chords.mean_aerodynamic = wing.areas.reference / wing.spans.projected wing.origin = [10., 0.0, 0.0] # meters wing.aerodynamic_center = [0.5, 0.0, 0.0] # meters # add to vehicle vehicle.append_component(wing) # ------------------------------------------------------------------ # Vertical Stabilizer # ------------------------------------------------------------------ wing = SUAVE.Components.Wings.Wing() wing.tag = 'vertical_stabilizer' wing.aspect_ratio = 20. wing.sweeps.quarter_chord = 0 * Units.deg wing.thickness_to_chord = 0.12 wing.taper = 1.0 wing.span_efficiency = 0.97 wing.areas.reference = vehicle.reference_area * 0.1 wing.spans.projected = np.sqrt(wing.aspect_ratio * wing.areas.reference) wing.chords.root = wing.areas.reference / wing.spans.projected wing.chords.tip = wing.areas.reference / wing.spans.projected wing.chords.mean_aerodynamic = wing.areas.reference / wing.spans.projected wing.areas.wetted = 2.0 * wing.areas.reference wing.areas.exposed = 0.8 * wing.areas.wetted wing.areas.affected = 0.6 * wing.areas.wetted wing.twists.root = 0.0 * Units.degrees wing.twists.tip = 0.0 * Units.degrees wing.origin = [10., 0.0, 0.0] # meters wing.aerodynamic_center = [0.5, 0.0, 0.0] # meters wing.symmetric = True wing.vertical = True wing.t_tail = False wing.dynamic_pressure_ratio = 1.0 wing.number_ribs = 5. # add to vehicle vehicle.append_component(wing) #------------------------------------------------------------------ # Propulsor #------------------------------------------------------------------ # build network net = Solar() net.number_of_engines = 1. net.nacelle_diameter = 0.2 * Units.meters net.engine_length = 0.01 * Units.meters net.areas = Data() net.areas.wetted = 0.01 * (2 * np.pi * 0.01 / 2.) # Component 1 the Sun? sun = SUAVE.Components.Energy.Processes.Solar_Radiation() net.solar_flux = sun # Component 2 the solar panels panel = SUAVE.Components.Energy.Converters.Solar_Panel() panel.area = vehicle.reference_area * 0.9 panel.efficiency = 0.25 panel.mass_properties.mass = panel.area * (0.60 * Units.kg) net.solar_panel = panel # Component 3 the ESC esc = SUAVE.Components.Energy.Distributors.Electronic_Speed_Controller() esc.efficiency = 0.95 # Gundlach for brushless motors net.esc = esc # Component 5 the Propeller # Design the Propeller prop_attributes = Data() prop_attributes.number_blades = 2.0 prop_attributes.freestream_velocity = 40.0 * Units['m/s'] # freestream prop_attributes.angular_velocity = 150. * Units['rpm'] prop_attributes.tip_radius = 4.25 * Units.meters prop_attributes.hub_radius = 0.05 * Units.meters prop_attributes.design_Cl = 0.7 prop_attributes.design_altitude = 14.0 * Units.km prop_attributes.design_thrust = 0.0 prop_attributes.design_power = 3500.0 * Units.watts prop_attributes = propeller_design(prop_attributes) prop = SUAVE.Components.Energy.Converters.Propeller() prop.prop_attributes = prop_attributes net.propeller = prop # Component 4 the Motor motor = SUAVE.Components.Energy.Converters.Motor() motor.resistance = 0.008 motor.no_load_current = 4.5 * Units.ampere motor.speed_constant = 120. * Units[ 'rpm'] # RPM/volt converted to (rad/s)/volt motor.propeller_radius = prop.prop_attributes.tip_radius motor.propeller_Cp = prop.prop_attributes.Cp motor.gear_ratio = 12. # Gear ratio motor.gearbox_efficiency = .98 # Gear box efficiency motor.expected_current = 160. # Expected current motor.mass_properties.mass = 2.0 * Units.kg net.motor = motor # Component 6 the Payload payload = SUAVE.Components.Energy.Peripherals.Payload() payload.power_draw = 50. * Units.watts payload.mass_properties.mass = 5.0 * Units.kg net.payload = payload # Component 7 the Avionics avionics = SUAVE.Components.Energy.Peripherals.Avionics() avionics.power_draw = 50. * Units.watts net.avionics = avionics # Component 8 the Battery bat = SUAVE.Components.Energy.Storages.Batteries.Constant_Mass.Lithium_Ion( ) bat.mass_properties.mass = 55.0 * Units.kg bat.specific_energy = 450. * Units.Wh / Units.kg bat.resistance = 0.05 initialize_from_mass(bat, bat.mass_properties.mass) net.battery = bat #Component 9 the system logic controller and MPPT logic = SUAVE.Components.Energy.Distributors.Solar_Logic() logic.system_voltage = 40.0 logic.MPPT_efficiency = 0.95 net.solar_logic = logic # add the solar network to the vehicle vehicle.append_component(net) return vehicle
def main(): # ------------------------------------------------------------------ # Propulsor # ------------------------------------------------------------------ # build network net = Solar() net.number_of_engines = 1. net.nacelle_dia = 0.2 # Component 1 the Sun? sun = SUAVE.Components.Energy.Processes.Solar_Radiation() net.solar_flux = sun # Component 2 the solar panels panel = SUAVE.Components.Energy.Converters.Solar_Panel() panel.area = 100 * Units.m panel.efficiency = 0.18 panel.mass_properties.mass = panel.area*.600 net.solar_panel = panel # Component 3 the ESC esc = SUAVE.Components.Energy.Distributors.Electronic_Speed_Controller() esc.efficiency = 0.95 # Gundlach for brushless motors net.esc = esc # Component 5 the Propeller # Propeller design specs design_altitude = 0.0 * Units.km Velocity = 10.0 # freestream m/s RPM = 5887 Blades = 2.0 Radius = .4064 Hub_Radius = 0.05 Design_Cl = 0.7 Thrust = 0.0 #Specify either thrust or power to design for Power = 7500. #Specify either thrust or power to design for # Design the Propeller prop_attributes = Data() prop_attributes.number_blades = Blades prop_attributes.freestream_velocity = Velocity prop_attributes.angular_velocity = RPM*(2.*np.pi/60.0) prop_attributes.tip_radius = Radius prop_attributes.hub_radius = Hub_Radius prop_attributes.design_Cl = Design_Cl prop_attributes.design_altitude = design_altitude prop_attributes.design_thrust = Thrust prop_attributes.design_power = Power prop_attributes = propeller_design(prop_attributes) # Create and attach this propeller prop = SUAVE.Components.Energy.Converters.Propeller() prop.prop_attributes = prop_attributes net.propeller = prop # Component 4 the Motor motor = SUAVE.Components.Energy.Converters.Motor() motor.resistance = 0.01 motor.no_load_current = 8.0 motor.speed_constant = 140.*(2.*np.pi/60.) # RPM/volt converted to rad/s motor.propeller_radius = prop.prop_attributes.tip_radius #motor.propeller_Cp = prop.prop_attributes.Cp motor.gear_ratio = 1. motor.gearbox_efficiency = 1. motor.expected_current = 260. motor.mass_properties.mass = 2.0 net.motor = motor # Component 6 the Payload payload = SUAVE.Components.Energy.Peripherals.Payload() payload.power_draw = 0. #Watts payload.mass_properties.mass = 0. * Units.kg net.payload = payload # Component 7 the Avionics avionics = SUAVE.Components.Energy.Peripherals.Avionics() avionics.power_draw = 0. #Watts net.avionics = avionics # Component 8 the Battery bat = SUAVE.Components.Energy.Storages.Batteries.Constant_Mass.Lithium_Ion() batterymass = 50. #kg bat.type = 'Li-Ion' bat.resistance = 0.0 bat.energy_density = 250. initialize_from_mass(bat,batterymass) bat.current_energy = bat.max_energy net.battery = bat #Component 9 the system logic controller and MPPT logic = SUAVE.Components.Energy.Distributors.Solar_Logic() logic.system_voltage = 50.0 logic.MPPT_efficiency = 0.95 net.solar_logic = logic # Setup the conditions to run the network state = Data() state.conditions = SUAVE.Analyses.Mission.Segments.Conditions.Aerodynamics() state.numerics = SUAVE.Analyses.Mission.Segments.Conditions.Numerics() conditions = state.conditions numerics = state.numerics # Calculate atmospheric properties atmosphere = SUAVE.Analyses.Atmospheric.US_Standard_1976() atmosphere_conditions = atmosphere.compute_values(prop_attributes.design_altitude) rho = atmosphere_conditions.density[0,:] a = atmosphere_conditions.speed_of_sound[0,:] mu = atmosphere_conditions.dynamic_viscosity[0,:] T = atmosphere_conditions.temperature[0,:] conditions.propulsion.throttle = np.array([[1.0],[1.0]]) conditions.freestream.velocity = np.array([[1.0],[1.0]]) conditions.freestream.density = np.array([rho,rho]) conditions.freestream.dynamic_viscosity = np.array([mu, mu]) conditions.freestream.speed_of_sound = np.array([a, a]) conditions.freestream.altitude = np.array([[design_altitude], [design_altitude]]) conditions.propulsion.battery_energy = bat.max_energy*np.ones_like(conditions.freestream.altitude) conditions.frames.body.inertial_rotations = np.zeros([2,3]) conditions.frames.inertial.time = np.array([[0.0],[1.0]]) numerics.time.integrate = np.array([[0, 0],[0, 1]]) numerics.time.differentiate = np.array([[0, 0],[0, 1]]) conditions.frames.planet.start_time = time.strptime("Sat, Jun 21 06:00:00 2014", "%a, %b %d %H:%M:%S %Y",) conditions.frames.planet.latitude = np.array([[0.0],[0.0]]) conditions.frames.planet.longitude = np.array([[0.0],[0.0]]) conditions.freestream.temperature = np.array([T, T]) conditions.frames.body.transform_to_inertial = np.array([[[ 1., 0., 0.], [ 0., 1., 0.], [ 0., 0., 1.]], [[ 1., 0., 0.], [ 0., 1., 0.], [ 0., 0., 1.]]]) conditions.propulsion.propeller_power_coefficient = np.array([[1.], [1.]]) * prop.prop_attributes.Cp # Run the network and print the results results = net(state) F = results.thrust_force_vector # Truth results truth_F = [[ 545.35952329, 545.35952329]] truth_i = [[ 249.31622624], [ 249.31622624]] truth_rpm = [[ 6668.4094191], [ 6668.4094191]] truth_bat = [[ 36000000. ], [ 35987534.18868808]] error = Data() error.Thrust = np.max(np.abs(F[:,0]-truth_F)) error.RPM = np.max(np.abs(conditions.propulsion.rpm-truth_rpm)) error.Current = np.max(np.abs(conditions.propulsion.current-truth_i)) error.Battery = np.max(np.abs(bat.current_energy-truth_bat)) print(error) for k,v in list(error.items()): assert(np.abs(v)<1e-6) return