Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
C_1 = Variable('C_1', 1.458E-6, "kg/(m*s*K^0.5)",
'Sutherland coefficient')
with SignomialsEnabled():
constraints = [
# Pressure-altitude relation
(p_atm/p_sl)**(1/5.257) == T_atm/T_sl,
# Ideal gas law
rho == p_atm/(R_atm/M_atm*T_atm),
#temperature equation
SignomialEquality(T_sl, T_atm + L_atm*alt['h']),
#constraint on mu
SignomialEquality((T_atm + T_s) * mu, C_1 * T_atm**1.5),
## TCS([(T_atm + T_s) * mu >= C_1 * T_atm**1.5])
]
#like to use a local subs here in the future
subs = None
return constraints
C_1 = Variable('C_1', 1.458E-6, "kg/(m*s*K^0.5)",
'Sutherland coefficient')
with SignomialsEnabled():
constraints = [
# Pressure-altitude relation
(p_atm/p_sl)**(1/5.257) == T_atm/T_sl,
# Ideal gas law
rho == p_atm/(R_atm/M_atm*T_atm),
#temperature equation
SignomialEquality(T_sl, T_atm + L_atm*alt['h']),
#constraint on mu
SignomialEquality((T_atm + T_s) * mu, C_1 * T_atm**1.5),
]
#like to use a local subs here in the future
substitutions = None
Model.__init__(self, None, constraints, substitutions)
TCS([W_start >= wing['W_{wing}']+ ht['W_{HT}'] + W_payload + W_fuel]),
TCS([W_end >= wing['W_{wing}']+ ht['W_{HT}'] + W_payload]),
W_avg == (W_start*W_end)**.5,
TCS([wingP['L'] >= W_avg + htP['L_{h}']]),
#lift coefficient constraints
wingP['C_{L}'] == 2*pi*alpha,
## htP['C_{L_{h}}'] <= 2.2*pi*alpha,
## htP['C_{L_{h}}'] >= 1.8*pi*alpha,
#arbitrary, sturctural model will remove the need for this constraint
ht['b_{h}'] <= .33*wing['b_{max}'],
#HT sizing constraints
#compute mrat, is a signomial equality
SignomialEquality(ht['m_{ratio}']*(1+2/wing['AR']), 1 + 2/ht['ARh']),
#tail volume coefficient
ht['V_{h}'] == ht['Sh']*ht['l_{h}']/(wing['S']*wing['MAC']),
#enforce max tail location is the end of the fuselage
ht['l_{h}'] <= fuse['l_{fuse}'],
#Stability constraint, is a signomial
## TCS([ht['SM_{min}'] + ht['\\Delta x_{CG}']/wing['MAC'] <= ht['V_{h}']*ht['m_{ratio}'] + wingP['c_{m_{w}}']/wing['C_{L_{max}}'] + ht['V_{h}']*ht['CL_{h_{max}}']/wing['C_{L_{max}}']]),
SignomialEquality(ht['SM_{min}'] + ht['\\Delta x_{CG}']/wing['MAC'], ht['V_{h}']*ht['m_{ratio}'] + wingP['c_{m_{w}}']/wing['C_{L_{max}}'] + ht['V_{h}']*ht['CL_{h_{max}}']/wing['C_{L_{max}}']),
# Trim condidtion for each flight segment
## TCS([wingP['x_{ac}']/wing['MAC'] <= wingP['c_{m_{w}}']/wingP['C_{L}'] + xcg/wing['MAC'] + ht['V_{h}']*(htP['C_{L_{h}}']/wingP['C_{L}'])]),
SignomialEquality(wingP['x_{ac}']/wing['MAC'], wingP['c_{m_{w}}']/wingP['C_{L}'] + xcg/wing['MAC'] + ht['V_{h}']*(htP['C_{L_{h}}']/wingP['C_{L}'])),
xcg == 15*units('m'),
C_1 = Variable('C_1', 1.458E-6, "kg/(m*s*K^0.5)",
'Sutherland coefficient')
with SignomialsEnabled():
constraints = [
# Pressure-altitude relation
(p_atm/p_sl)**(1/5.257) == T_atm/T_sl,
# Ideal gas law
rho == p_atm/(R_atm/M_atm*T_atm),
#temperature equation
SignomialEquality(T_sl, T_atm + L_atm*alt['h']),
#constraint on mu
SignomialEquality((T_atm + T_s) * mu, C_1 * T_atm**1.5),
]
#like to use a local subs here in the future
subs = None
return constraints
mu = Variable('\\mu', 'kg/(m*s)', 'Dynamic viscosity')
T_s = Variable('T_s', 110.4, "K", "Sutherland Temperature")
C_1 = Variable('C_1', 1.458E-6, "kg/(m*s*K^0.5)",
'Sutherland coefficient')
with SignomialsEnabled():
constraints = [
# Pressure-altitude relation
(p_atm/p_sl)**(1/5.257) == T_atm/T_sl,
# Ideal gas law
rho == p_atm/(R_atm/M_atm*T_atm),
#temperature equation
SignomialEquality(T_sl, T_atm + L_atm*alt['h']),
#constraint on mu
SignomialEquality((T_atm + T_s) * mu, C_1 * T_atm**1.5),
]
return constraints
#engine out CL computation
Avt == bvt**2/Svt,
Svt <= bvt*(croot + ctip)/2, # [SP]
# Tail geometry relationship
# TCS([dxtrail >= croot + dxlead]),
# Tail geometry constraint
# Fuselage length constrains the tail trailing edge
TCS([p >= 1 + 2*taper]),
TCS([2*q >= 1 + p]),
zmac == (bvt/3)*q/p,
## TCS([(2./3)*(1 + taper + taper**2)*croot/q >= cma]), # [SP]
SignomialEquality((2./3)*(1 + taper + taper**2)*croot/q, cma),
taper == ctip/croot,
# Define vertical tail geometry
Lvmax == 0.5*rho0*Vne**2*Svt*CLvmax,
#compute the max force
# TODO: Constrain taper by tip Reynolds number
taper >= 0.25,
#Enforce a minimum vertical tail volume
Vvt >= Vvtmin,
])
return constraints
mu = Variable('\\mu', 'kg/(m*s)', 'Dynamic viscosity')
T_s = Variable('T_s', 110.4, "K", "Sutherland Temperature")
C_1 = Variable('C_1', 1.458E-6, "kg/(m*s*K^0.5)",
'Sutherland coefficient')
with SignomialsEnabled():
constraints = [
# Pressure-altitude relation
(p_atm/p_sl)**(1/5.257) == T_atm/T_sl,
# Ideal gas law
rho == p_atm/(R_atm/M_atm*T_atm),
#temperature equation
SignomialEquality(T_sl, T_atm + L_atm*alt['h']),
#constraint on mu
SignomialEquality((T_atm + T_s) * mu, C_1 * T_atm**1.5),
]
#like to use a local subs here in the future
substitutions = None
Model.__init__(self, None, constraints, substitutions)
mu = Variable('\\mu', 'kg/(m*s)', 'Dynamic viscosity')
T_s = Variable('T_s', 110.4, "K", "Sutherland Temperature")
C_1 = Variable('C_1', 1.458E-6, "kg/(m*s*K^0.5)",
'Sutherland coefficient')
with SignomialsEnabled():
constraints = [
# Pressure-altitude relation
(p_atm/p_sl)**(1/5.257) == T_atm/T_sl,
# Ideal gas law
rho == p_atm/(R_atm/M_atm*T_atm),
#temperature equation
SignomialEquality(T_sl, T_atm + L_atm*alt['h']),
#constraint on mu
SignomialEquality((T_atm + T_s) * mu, C_1 * T_atm**1.5),
]
#like to use a local subs here in the future
substitutions = None
Model.__init__(self, None, constraints, substitutions)
mu = Variable('\\mu', 'kg/(m*s)', 'Dynamic viscosity')
T_s = Variable('T_s', 110.4, "K", "Sutherland Temperature")
C_1 = Variable('C_1', 1.458E-6, "kg/(m*s*K^0.5)",
'Sutherland coefficient')
with SignomialsEnabled():
constraints = [
# Pressure-altitude relation
(p_atm/p_sl)**(1/5.257) == T_atm/T_sl,
# Ideal gas law
rho == p_atm/(R_atm/M_atm*T_atm),
#temperature equation
SignomialEquality(T_sl, T_atm + L_atm*alt['h']),
#constraint on mu
SignomialEquality((T_atm + T_s) * mu, C_1 * T_atm**1.5),
]
#like to use a local subs here in the future
substitutions = None
Model.__init__(self, None, constraints, substitutions)
TCS([Dwing >= (.5*wing['S']*state.atm['\\rho']*state['V']**2)*(Cdw + wing['K']*CL**2)]),
Re == state['\\rho']*state['V']*wing['mac']/state['\\mu'],
1 >= (2.56*CL**5.88/(Re**1.54*wing['\\tau']**3.32*Cdw**2.62)
+ 3.8e-9*wing['\\tau']**6.23/(CL**0.92*Re**1.38*Cdw*9.57)
+ 2.2e-3*Re**0.14*wing['\\tau']**0.033/(CL**0.01*Cdw**0.73)
+ 6.14e-6*CL**6.53/(Re**0.99*wing['\\tau']**0.52*Cdw*5.19)
+ 1.19e4*CL**9.78*wing['\\tau']**1.76/(Re*Cdw**0.91)),
CL == CLaw*alpha,
alpha <= wing['\\alpha_{max,w}'],
])
with SignomialsEnabled():
constraints.extend([
SignomialEquality((wing['AR']/wing['\\eta'])**2*(1 + wing['\\tan(\\Lambda)']**2 - state['M']**2) + 8*pi*wing['AR']/CLaw
, (2*pi*wing['AR']/CLaw)**2),
])
return constraints