Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #178 from suavecode/feature-missions
Feature missions
- Loading branch information
Showing
24 changed files
with
1,039 additions
and
32 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
trunk/SUAVE/Analyses/Mission/Segments/Climb/Constant_Dynamic_Pressure_Constant_Angle.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Constant_Dynamic_Pressure_Constant_Angle.py | ||
# | ||
# Created: Jun 2017, E. Botero | ||
# Modified: | ||
|
||
# ---------------------------------------------------------------------- | ||
# Imports | ||
# ---------------------------------------------------------------------- | ||
|
||
# SUAVE imports | ||
from SUAVE.Methods.Missions import Segments as Methods | ||
|
||
from Unknown_Throttle import Unknown_Throttle | ||
|
||
# Units | ||
from SUAVE.Core import Units | ||
|
||
# ---------------------------------------------------------------------- | ||
# Segment | ||
# ---------------------------------------------------------------------- | ||
|
||
class Constant_Dynamic_Pressure_Constant_Angle(Unknown_Throttle): | ||
|
||
def __defaults__(self): | ||
|
||
# -------------------------------------------------------------- | ||
# User inputs | ||
# -------------------------------------------------------------- | ||
self.altitude_start = None # Optional | ||
self.altitude_end = 10. * Units.km | ||
self.climb_angle = 3. * Units.degrees | ||
self.dynamic_pressure = 1600 * Units.pascals | ||
|
||
# -------------------------------------------------------------- | ||
# State | ||
# -------------------------------------------------------------- | ||
|
||
# initials and unknowns | ||
ones_row = self.state.ones_row | ||
self.state.unknowns.altitudes = ones_row(1) * 0.0 | ||
self.state.residuals.forces = ones_row(3) * 0.0 | ||
|
||
# -------------------------------------------------------------- | ||
# The Solving Process | ||
# -------------------------------------------------------------- | ||
initialize = self.process.initialize | ||
initialize.conditions = Methods.Climb.Constant_Dynamic_Pressure_Constant_Angle.initialize_conditions_unpack_unknowns | ||
|
||
# Unpack Unknowns | ||
iterate = self.process.iterate | ||
iterate.unknowns.mission = Methods.Climb.Constant_Dynamic_Pressure_Constant_Angle.initialize_conditions_unpack_unknowns | ||
|
||
iterate.conditions.differentials = Methods.Climb.Optimized.update_differentials | ||
|
||
# Solve Residuals | ||
iterate.residuals.total_forces = Methods.Climb.Constant_Dynamic_Pressure_Constant_Angle.residual_total_forces | ||
|
||
return | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
trunk/SUAVE/Analyses/Mission/Segments/Climb/Constant_Mach_Linear_Altitude.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Constant_Mach_Linear_Altitude.py | ||
# | ||
# Created: June 2017, E. Botero | ||
# Modified: | ||
|
||
# ---------------------------------------------------------------------- | ||
# Imports | ||
# ---------------------------------------------------------------------- | ||
|
||
# SUAVE imports | ||
from SUAVE.Analyses.Mission.Segments.Cruise import Constant_Speed_Linear_Altitude | ||
|
||
from SUAVE.Methods.Missions import Segments as Methods | ||
|
||
# Units | ||
from SUAVE.Core import Units | ||
|
||
# ---------------------------------------------------------------------- | ||
# Segment | ||
# ---------------------------------------------------------------------- | ||
|
||
class Constant_Mach_Linear_Altitude(Constant_Speed_Linear_Altitude): | ||
|
||
def __defaults__(self): | ||
|
||
# -------------------------------------------------------------- | ||
# User inputs | ||
# -------------------------------------------------------------- | ||
self.altitude = None | ||
self.mach = 0.5 | ||
self.distance = 10. * Units.km | ||
self.altitude_start = None | ||
self.altitude_end = None | ||
|
||
|
||
# -------------------------------------------------------------- | ||
# The Solving Process | ||
# -------------------------------------------------------------- | ||
|
||
# only need to change one setup step from constant_speed_constant_altitude | ||
initialize = self.process.initialize | ||
initialize.conditions = Methods.Cruise.Constant_Mach_Linear_Altitude.initialize_conditions | ||
|
||
|
||
return | ||
|
125 changes: 125 additions & 0 deletions
125
trunk/SUAVE/Analyses/Mission/Segments/Climb/Constant_Speed_Linear_Altitude.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
# Constant_Speed_Linear_Altitude.py | ||
# | ||
# Created: | ||
# Modified: Jun 2017, E. Botero | ||
|
||
# ---------------------------------------------------------------------- | ||
# Imports | ||
# ---------------------------------------------------------------------- | ||
|
||
# SUAVE imports | ||
from SUAVE.Analyses.Mission.Segments import Aerodynamic | ||
from SUAVE.Analyses.Mission.Segments import Conditions | ||
|
||
from SUAVE.Methods.Missions import Segments as Methods | ||
|
||
from SUAVE.Analyses import Process | ||
|
||
# Units | ||
from SUAVE.Core import Units | ||
|
||
|
||
# ---------------------------------------------------------------------- | ||
# Segment | ||
# ---------------------------------------------------------------------- | ||
|
||
class Constant_Speed_Linear_Altitude(Aerodynamic): | ||
|
||
def __defaults__(self): | ||
|
||
# -------------------------------------------------------------- | ||
# User inputs | ||
# -------------------------------------------------------------- | ||
self.altitude = None | ||
self.air_speed = 10. * Units['km/hr'] | ||
self.distance = 10. * Units.km | ||
self.altitude_start = None | ||
self.altitude_end = None | ||
|
||
|
||
# -------------------------------------------------------------- | ||
# State | ||
# -------------------------------------------------------------- | ||
|
||
# conditions | ||
self.state.conditions.update( Conditions.Aerodynamics() ) | ||
|
||
# initials and unknowns | ||
ones_row = self.state.ones_row | ||
self.state.unknowns.throttle = ones_row(1) * 0.5 | ||
self.state.unknowns.body_angle = ones_row(1) * 0.0 | ||
self.state.residuals.forces = ones_row(2) * 0.0 | ||
|
||
|
||
# -------------------------------------------------------------- | ||
# The Solving Process | ||
# -------------------------------------------------------------- | ||
|
||
# -------------------------------------------------------------- | ||
# Initialize - before iteration | ||
# -------------------------------------------------------------- | ||
initialize = self.process.initialize | ||
initialize.clear() | ||
|
||
initialize.expand_state = Methods.expand_state | ||
initialize.differentials = Methods.Common.Numerics.initialize_differentials_dimensionless | ||
initialize.conditions = Methods.Cruise.Constant_Speed_Linear_Altitude.initialize_conditions | ||
|
||
# -------------------------------------------------------------- | ||
# Converge - starts iteration | ||
# -------------------------------------------------------------- | ||
converge = self.process.converge | ||
converge.clear() | ||
|
||
converge.converge_root = Methods.converge_root | ||
|
||
# -------------------------------------------------------------- | ||
# Iterate - this is iterated | ||
# -------------------------------------------------------------- | ||
iterate = self.process.iterate | ||
iterate.clear() | ||
|
||
# Update Initials | ||
iterate.initials = Process() | ||
iterate.initials.time = Methods.Common.Frames.initialize_time | ||
iterate.initials.weights = Methods.Common.Weights.initialize_weights | ||
iterate.initials.inertial_position = Methods.Common.Frames.initialize_inertial_position | ||
iterate.initials.planet_position = Methods.Common.Frames.initialize_planet_position | ||
|
||
|
||
# Unpack Unknowns | ||
iterate.unpack_unknowns = Methods.Cruise.Common.unpack_unknowns | ||
|
||
# Update Conditions | ||
iterate.conditions = Process() | ||
iterate.conditions.differentials = Methods.Common.Numerics.update_differentials_time | ||
iterate.conditions.altitude = Methods.Common.Aerodynamics.update_altitude | ||
iterate.conditions.atmosphere = Methods.Common.Aerodynamics.update_atmosphere | ||
iterate.conditions.gravity = Methods.Common.Weights.update_gravity | ||
iterate.conditions.freestream = Methods.Common.Aerodynamics.update_freestream | ||
iterate.conditions.orientations = Methods.Common.Frames.update_orientations | ||
iterate.conditions.aerodynamics = Methods.Common.Aerodynamics.update_aerodynamics | ||
iterate.conditions.stability = Methods.Common.Aerodynamics.update_stability | ||
iterate.conditions.propulsion = Methods.Common.Energy.update_thrust | ||
iterate.conditions.weights = Methods.Common.Weights.update_weights | ||
iterate.conditions.forces = Methods.Common.Frames.update_forces | ||
iterate.conditions.planet_position = Methods.Common.Frames.update_planet_position | ||
|
||
# Solve Residuals | ||
iterate.residuals = Process() | ||
iterate.residuals.total_forces = Methods.Cruise.Common.residual_total_forces | ||
|
||
# -------------------------------------------------------------- | ||
# Finalize - after iteration | ||
# -------------------------------------------------------------- | ||
finalize = self.process.finalize | ||
finalize.clear() | ||
|
||
# Post Processing | ||
finalize.post_process = Process() | ||
finalize.post_process.inertial_position = Methods.Common.Frames.integrate_inertial_horizontal_position | ||
finalize.post_process.stability = Methods.Common.Aerodynamics.update_stability | ||
|
||
|
||
return | ||
|
Oops, something went wrong.