# How to use the gpkit.constraints.sigeq.SignomialEquality function in gpkit

## To help you get started, we’ve selected a few gpkit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

convexengineering / SPaircraft / stand_alone_TASOPT_profile.py View on Github
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
convexengineering / SPaircraft / VT_simple_profile.py View on Github
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)
convexengineering / SPaircraft / basic_HT.py View on Github
TCS([W_start &gt;= wing['W_{wing}']+ ht['W_{HT}'] + W_payload + W_fuel]),
TCS([W_end &gt;= wing['W_{wing}']+ ht['W_{HT}'] + W_payload]),
W_avg == (W_start*W_end)**.5,
TCS([wingP['L'] &gt;= W_avg + htP['L_{h}']]),

#lift coefficient constraints
wingP['C_{L}'] == 2*pi*alpha,
##                    htP['C_{L_{h}}'] &lt;= 2.2*pi*alpha,
##                    htP['C_{L_{h}}'] &gt;= 1.8*pi*alpha,

#arbitrary, sturctural model will remove the need for this constraint
ht['b_{h}'] &lt;= .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}'] &lt;= fuse['l_{fuse}'],

#Stability constraint, is a signomial
##                    TCS([ht['SM_{min}'] + ht['\\Delta x_{CG}']/wing['MAC'] &lt;= 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'] &lt;= 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'),
convexengineering / SPaircraft / engine_flight_profile_integration.py View on Github
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
convexengineering / SPaircraft / new_d8_wing_imports.py View on Github
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
convexengineering / SPaircraft / TASOPT_VT_yaw_rate_and_EO_simple_profile.py View on Github
#engine out CL computation

Avt == bvt**2/Svt,

Svt &lt;= bvt*(croot + ctip)/2, # [SP]
# Tail geometry relationship

# TCS([dxtrail &gt;= croot + dxlead]),
# Tail geometry constraint

# Fuselage length constrains the tail trailing edge
TCS([p &gt;= 1 + 2*taper]),
TCS([2*q &gt;= 1 + p]),
zmac == (bvt/3)*q/p,
##                TCS([(2./3)*(1 + taper + taper**2)*croot/q &gt;= 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 &gt;= 0.25,

#Enforce a minimum vertical tail volume
Vvt &gt;= Vvtmin,
])

return constraints
convexengineering / SPaircraft / VT_yaw_rate_and_EO_simple_profile.py View on Github
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)
convexengineering / SPaircraft / VT_simple_profile.py View on Github
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)
convexengineering / SPaircraft / VT_simple_profile_int.py View on Github
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)
convexengineering / SPaircraft / new_d8_wing_imports.py View on Github
TCS([Dwing &gt;= (.5*wing['S']*state.atm['\\rho']*state['V']**2)*(Cdw + wing['K']*CL**2)]),

Re == state['\\rho']*state['V']*wing['mac']/state['\\mu'],
1 &gt;= (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 &lt;= 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

## gpkit

Package for defining and manipulating geometric programming models.

MIT