Atmospheric model dependent upon applied pressures
Opened this issue · 6 comments
@whoburg and @pgkirsch, we were getting some funny density readings (0.3 kg/m^3 @ 15000 ft) from this model. I think it was because T_atm
can be lower than than its supposed to be and rho
wanted to be lower to lower the weight.
#----------------------------------------------------
# Atmosphere model
gamma = Variable(r'\gamma', 1.4, '-', 'Heat capacity ratio of air')
p_sl = Variable('p_{sl}', 101325, 'Pa', 'Pressure at sea level')
T_sl = Variable('T_{sl}', 288.15, 'K', 'Temperature at sea level')
L_atm = Variable('L_{atm}', 0.0065, 'K/m', 'Temperature lapse rate')
T_atm = VectorVariable(NSeg, 'T_{atm}', 'K', 'Air temperature')
a_atm = VectorVariable(NSeg, 'a_{atm}', 'm/s', 'Speed of sound at altitude')
R_spec = Variable('R_{spec}', 287.058, 'J/kg/K', 'Specific gas constant of air')
TH = (g/R_spec/L_atm).value.magnitude # dimensionless
constraints.extend([T_sl >= T_atm + L_atm*h, # Temp decreases w/ altitude
rho == p_sl*T_atm**(TH-1)/R_spec/(T_sl**TH)])
# http://en.wikipedia.org/wiki/Density_of_air#Altitude
Output
\rho : [ 0.326 0.361 0.334 0.435 ... ] [kg/m**3] air density
h : [ 5e+03 6.94e+03 5e+03 1.5e+04 ... ] [ft] Altitude
T_{atm} : [ 211 216 212 226 ... ] [K] Air temperature
Yeah that model is not particularly robust -- it seems to be dependent on the objective function. Trying to fix this at some point in the not-too-distant future.
Oh ok. Didn't realize you were already aware of this.
Should that model have rho <= ...
just to make this weakness clearer?
sounds good to me
Interesting... this actually fixed the density except during the first cruise portion. Now if you compare h
to rho
you actually get meaning values except during the cruise portion (2nd leg).
\rho : [ 1.06 0.279 0.771 0.771 ... ] [kg/m**3] air density
h : [ 5e+03 5e+03 1.5e+04 1.5e+04 ... ] [ft] altitude
The underlying issue is that the atmospheric model constraints need to hold with equality, and we want to relax those equalities into inequalities, but the correct relaxation depends on applied pressures external to the atmosphere model.
Let's leave this open in hopes of coming up with better ways of dealing with these posynomial/signomial equality constraints. One approach is to try to derive the correct relaxation prior to solving. Another is to implement a real signomial equality algorithm with trust regions. I think the latter might make sense for atmosphere.