Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constraint analysis #504

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import SUAVE
import numpy as np
import matplotlib as plt
from SUAVE.Core import Data
from SUAVE.Methods.Propulsion.ConstraintAnalysis.Verification.Parameters import *
from SUAVE.Methods.Propulsion.ConstraintAnalysis.Verification.intersect import intersection

WS=np.linspace(20,20000,1)

def LandingConstraint():
WS_Landing = clmax_landing * rho_SL * LandingDistance / (2 * 0.5847 * FractionWeightLanding) # Check if clmax of landing is the same as this
i=2
return WS_Landing

def StallConstraint():
WS_Stall = 0.5 * rho_SL * V_stall ** 2 * clmax
return WS_Stall

def VmaxConstraint():
TW_Vmax = []
for x in WS:
TW_Vmax_i = (rho_SL * V_max ** 2 * cd0) / (2 * x) + 2 * K_aerodynamics * x / (rho_cruise * sigma_cruise * V_max ** 2)
TW_Vmax.append(TW_Vmax_i)
return TW_Vmax

def TakeoffConstraint():
TW_Takeoff = []
for x in WS:
TW_Takeoff_i=(mu - (mu + cdG/clR)*np.exp(0.6*rho_SL*g*cdG*S_TO/x))/(1-np.exp(0.6*rho_SL*g*cdG*S_TO/x))
TW_Takeoff.append(TW_Takeoff_i)
return TW_Takeoff

def ROCConstraint():
TW_ROC = []
for x in WS:
TW_ROC_i=ROC/np.sqrt(2*x/(rho_SL*np.sqrt(cd0/K_aerodynamics))) + 1/LD_max
TW_ROC.append(TW_ROC_i)
return TW_ROC

def CeilingConstraint():
TW_Ceiling = []
for x in WS:
TW_Ceiling_i=ROC_service_ceiling/(sigma_service_ceiling*np.sqrt(2*x/(rho_service_ceiling*np.sqrt(cd0/K_aerodynamics)))) + 1/(sigma_service_ceiling*LD_max)
TW_Ceiling.append(TW_Ceiling_i)
return TW_Ceiling

def ClimbGradientConstraint():
TW_ClimbGradient = []
for x in WS:
TW_ClimbGradient_i = NumberEngines/(NumberEngines-1)*(cV_ClimbGradient+2*np.sqrt(cd0/(np.pi*AspectRatio*Oswald)))
TW_ClimbGradient.append(TW_ClimbGradient_i)
return TW_ClimbGradient

def ManoueuvringConstraint():
TW_Manoeuvring = []
for x in WS:
TW_Manoeuvring_i = 0.5*rho_cruise*(V_cruise**2)*cd0/x + 2*x*(nmax**2)/(np.pi*AspectRatio*Oswald*rho_cruise*(V_cruise**2))
TW_Manoeuvring.append(TW_Manoeuvring_i)
return TW_Manoeuvring
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import SUAVE
import numpy as np
import matplotlib as plt
from SUAVE.Core import Data
from SUAVE.Methods.Propulsion.ConstraintAnalysis.Verification.Parameters import *
from SUAVE.Methods.Propulsion.ConstraintAnalysis.Verification.ConstraintAnalysisEquations import *

### EFFICIENCY AND POWER MANAGEMENT PARAMETERS

# Takeoff
eta_valve_TO = 0.99
eta_gasturbine_1_TO = 0.5
eta_gasturbine_2_TO = 0.4
eta_powermanagement_1_TO = 0.98
eta_powermanagement_2_TO = 0.98
eta_electricmotor_TO = 0.9
eta_propulsive_1_TO = 0.8
eta_propulsive_2_TO = 0.8
phi_TO=0.7
psi_TO=1
lambda_TO=0.1

# Climb
eta_valve_climb = 0.99
eta_gasturbine_1_climb = 0.5
eta_gasturbine_2_climb = 0.4
eta_powermanagement_1_climb = 0.98
eta_powermanagement_2_climb = 0.98
eta_electricmotor_climb = 0.9
eta_propulsive_1_climb = 0.8
eta_propulsive_2_climb = 0.8
phi_climb=0.7
psi_climb=1
lambda_climb=0.1

# Cruise
eta_valve_cruise = 0.99
eta_gasturbine_1_cruise = 0.5
eta_gasturbine_2_cruise = 0.4
eta_powermanagement_1_cruise = 0.98
eta_powermanagement_2_cruise = 0.98
eta_electricmotor_cruise = 0.9
eta_propulsive_1_cruise = 0.8
eta_propulsive_2_cruise = 0.8
phi_cruise=0.7
psi_cruise=1
lambda_cruise=0.1

# Descent
eta_valve_descent = 0.99
eta_gasturbine_1_descent = 0.5
eta_gasturbine_2_descent = 0.4
eta_powermanagement_1_descent = 0.98
eta_powermanagement_2_descent = 0.98
eta_electricmotor_descent = 0.9
eta_propulsive_1_descent = 0.8
eta_propulsive_2_descent = 0.8
phi_descent=0.7
psi_descent=1
lambda_descent=0.1

# Landing
eta_valve_landing = 0.99
eta_gasturbine_1_landing = 0.5
eta_gasturbine_2_landing = 0.4
eta_powermanagement_1_landing = 0.98
eta_powermanagement_2_landing = 0.98
eta_electricmotor_landing = 0.9
eta_propulsive_1_landing = 0.8
eta_propulsive_2_landing = 0.8
phi_landing=0.7
psi_landing=1
lambda_landing=0.1

def matrices_constraint_analysis():
# Matrices with no system failure
matrix_takeoff=np.array([-eta_valve_TO, 1, 1, 0, 0,0,0,0,0,0,0,0,0],[0, -eta_gasturbine_1_TO, 0, 1, 0,-eta_gasturbine_2_TO,0,0,0,0,0,0,0],[0, 0, 0, -eta_propulsive_1_TO, 1,0,0,0,0,0,0,0,0],[0, 0, -1, 0, 0,1,1,0,0,0,0,0,0],[0, 0, 0, 0, 0,0,-eta_powermanagement_1_TO,-eta_powermanagement_1_TO,1,0,0,0,0],[0, 0, 0, 0, 0,0,0,0,-eta_powermanagement_2_TO,1,1,0,0],[0, 0, 0, 0, 0,0,0,0,0,0,-eta_electricmotor_TO,1,0],[0, 0, 0, 0, 0,0,0,0,0,0,0,-eta_propulsive_2_TO,1],[0, 1-phi_TO, phi_TO, 0, 0,0,0,0,0,0,0,0,0],[0, 0, 0, 0, 0,0,1-psi_TO,psi_TO,0,0,0,0,0],[0, 0, 0, 0, 0,0,0,0,0,1-lambda_TO,lambda_TO,0,0],[0, 0, -eta_SOFC_TO, 0, 0,0,1,0,0,0,0,0,0],[0, 0, 0, 0, 1,0,0,0,0,0,0,0,1])
matrix_climb=np.array([-eta_valve_climb, 1, 1, 0, 0,0,0,0,0,0,0,0,0],[0, -eta_gasturbine_1_climb, 0, 1, 0,-eta_gasturbine_2_climb,0,0,0,0,0,0,0],[0, 0, 0, -eta_propulsive_1_climb, 1,0,0,0,0,0,0,0,0],[0, 0, -1, 0, 0,1,1,0,0,0,0,0,0],[0, 0, 0, 0, 0,0,-eta_powermanagement_1_climb,-eta_powermanagement_1_climb,1,0,0,0,0],[0, 0, 0, 0, 0,0,0,0,-eta_powermanagement_2_climb,1,1,0,0],[0, 0, 0, 0, 0,0,0,0,0,0,-eta_electricmotor_climb,1,0],[0, 0, 0, 0, 0,0,0,0,0,0,0,-eta_propulsive_2_climb,1],[0, 1-phi_climb, phi_climb, 0, 0,0,0,0,0,0,0,0,0],[0, 0, 0, 0, 0,0,1-psi_climb,psi_climb,0,0,0,0,0],[0, 0, 0, 0, 0,0,0,0,0,1-lambda_climb,lambda_climb,0,0],[0, 0, -eta_SOFC_climb, 0, 0,0,1,0,0,0,0,0,0],[0, 0, 0, 0, 1,0,0,0,0,0,0,0,1])
matrix_cruise=np.array([-eta_valve_cruise, 1, 1, 0, 0,0,0,0,0,0,0,0,0],[0, -eta_gasturbine_1_cruise, 0, 1, 0,-eta_gasturbine_2_cruise,0,0,0,0,0,0,0],[0, 0, 0, -eta_propulsive_1_cruise, 1,0,0,0,0,0,0,0,0],[0, 0, -1, 0, 0,1,1,0,0,0,0,0,0],[0, 0, 0, 0, 0,0,-eta_powermanagement_1_cruise,-eta_powermanagement_1_cruise,1,0,0,0,0],[0, 0, 0, 0, 0,0,0,0,-eta_powermanagement_2_cruise,1,1,0,0],[0, 0, 0, 0, 0,0,0,0,0,0,-eta_electricmotor_cruise,1,0],[0, 0, 0, 0, 0,0,0,0,0,0,0,-eta_propulsive_2_cruise,1],[0, 1-phi_cruise, phi_cruise, 0, 0,0,0,0,0,0,0,0,0],[0, 0, 0, 0, 0,0,1-psi_cruise,psi_cruise,0,0,0,0,0],[0, 0, 0, 0, 0,0,0,0,0,1-lambda_cruise,lambda_cruise,0,0],[0, 0, -eta_SOFC_cruise, 0, 0,0,1,0,0,0,0,0,0],[0, 0, 0, 0, 1,0,0,0,0,0,0,0,1])
matrix_descent=np.array([-eta_valve_descent, 1, 1, 0, 0,0,0,0,0,0,0,0,0],[0, -eta_gasturbine_1_descent, 0, 1, 0,-eta_gasturbine_2_descent,0,0,0,0,0,0,0],[0, 0, 0, -eta_propulsive_1_descent, 1,0,0,0,0,0,0,0,0],[0, 0, -1, 0, 0,1,1,0,0,0,0,0,0],[0, 0, 0, 0, 0,0,-eta_powermanagement_1_descent,-eta_powermanagement_1_descent,1,0,0,0,0],[0, 0, 0, 0, 0,0,0,0,-eta_powermanagement_2_descent,1,1,0,0],[0, 0, 0, 0, 0,0,0,0,0,0,-eta_electricmotor_descent,1,0],[0, 0, 0, 0, 0,0,0,0,0,0,0,-eta_propulsive_2_descent,1],[0, 1-phi_descent, phi_descent, 0, 0,0,0,0,0,0,0,0,0],[0, 0, 0, 0, 0,0,1-psi_descent,psi_descent,0,0,0,0,0],[0, 0, 0, 0, 0,0,0,0,0,1-lambda_descent,lambda_descent,0,0],[0, 0, -eta_SOFC_descent, 0, 0,0,1,0,0,0,0,0,0],[0, 0, 0, 0, 1,0,0,0,0,0,0,0,1])
matrix_landing=np.array([-eta_valve_landing, 1, 1, 0, 0,0,0,0,0,0,0,0,0],[0, -eta_gasturbine_1_landing, 0, 1, 0,-eta_gasturbine_2_landing,0,0,0,0,0,0,0],[0, 0, 0, -eta_propulsive_1_landing, 1,0,0,0,0,0,0,0,0],[0, 0, -1, 0, 0,1,1,0,0,0,0,0,0],[0, 0, 0, 0, 0,0,-eta_powermanagement_1_landing,-eta_powermanagement_1_landing,1,0,0,0,0],[0, 0, 0, 0, 0,0,0,0,-eta_powermanagement_2_landing,1,1,0,0],[0, 0, 0, 0, 0,0,0,0,0,0,-eta_electricmotor_landing,1,0],[0, 0, 0, 0, 0,0,0,0,0,0,0,-eta_propulsive_2_landing,1],[0, 1-phi_landing, phi_landing, 0, 0,0,0,0,0,0,0,0,0],[0, 0, 0, 0, 0,0,1-psi_landing,psi_landing,0,0,0,0,0],[0, 0, 0, 0, 0,0,0,0,0,1-lambda_landing,lambda_landing,0,0],[0, 0, -eta_SOFC_landing, 0, 0,0,1,0,0,0,0,0,0],[0, 0, 0, 0, 1,0,0,0,0,0,0,0,1])

# Matrices with system failure
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import SUAVE
import numpy as np
import matplotlib as plt
from SUAVE.Core import Data
from SUAVE.Methods.Propulsion.ConstraintAnalysis.Verification.Parameters import *
from SUAVE.Methods.Propulsion.ConstraintAnalysis.Verification.ConstraintAnalysisEquations import *

def plot_constraint_analysis():
# Run constraint analysis equations

WS_Landing = LandingConstraint()
WS_Stall = StallConstraint()
TW_Vmax = VmaxConstraint()
TW_Takeoff = TakeoffConstraint()
TW_ROC = ROCConstraint()
TW_Ceiling = CeilingConstraint()
TW_ClimbGradient = ClimbGradientConstraint()
TW_Manoeuvring = ManoueuvringConstraint()

# ----------------------------------------------------------------------
# Plot of the constraint analysis in a W/S-T/W chart
# ----------------------------------------------------------------------

WS = np.linspace(20, 20000, 1)

plt.pyplot.plot([WS_Stall, WS_Stall], [0, 1], label="Stall")
plt.pyplot.plot([WS_Landing, WS_Landing], [0, 1], label="Landing")
plt.pyplot.plot(WS, TW_Vmax, label="Max speed")
plt.pyplot.plot(WS, TW_Takeoff, label="Takeoff")
plt.pyplot.plot(WS, TW_ROC, label="ROC")
plt.pyplot.plot(WS, TW_Ceiling, label="Service ceiling")
plt.pyplot.plot(WS, TW_ClimbGradient, label="Climb gradient")
plt.pyplot.plot(WS, TW_Manoeuvring, label="Manoeuvring")
plt.pyplot.xlabel('W/S (N/m^2)')
plt.pyplot.ylabel('T/W')
plt.pyplot.title('Constraint analysis')
plt.pyplot.legend()
plt.pyplot.show()