我正在研究线性化模型,以便在Ampl中进行简单的轨迹分析和优化。基本前提是根据其基本参数优化行驶500公里的电动飞机的2D飞行路径。
用于此问题的简化力图可以在here中看到。 如here所示,可以简化此问题的方程以在每个点进行稳定飞行,因此可以通过牛顿求解器进行求解。
我正在尝试使用Ampl而不是OpenMDAO对此问题进行建模,但是我为必须隐式解决alpha问题感到困惑。为了进一步简化该问题,我将速度设置为最小阻力速度(空气密度的函数)。
但是,当我尝试对其进行编译时,我的Ampl代码似乎会生成语法和其他错误,该代码是:
#UNIVERSAL PARAMETERS
param P_s := 101300; # Ref pressure [Pa]
param R := 287; # Gas constannt
param T_0 :=250; # Ref temp for troposphere [K]
param g := 9.81; #Acc due to gravity
param H := R*T_0/g; # Scale height
#AIRCRAFT PARAMETERS
param c1 := -3.85; param c2 := 4.8923; param c3 :=0.6865; #Drag perameters
param c0 := 0.034;
param k := 0.069622;
param A;
param S := 90; #wing area
param m := 16000; #Mass of acc [kg]
param W := m*g; #Weight of acc
#AIRCRAFT CONSTRAINTS
param gamma_min := -0.52; param gamma_max := 0.52; #Gamma constraints =/- 30degrees
param alpha_min := -0.17; param alpha_max := 0.17; #Alpha constraints =/- 10degrees
#FLIGHT PARAMETERS
param h_0 := 100; #Coords of starting point
param r_0 := 0;
param h_n := 100; #Coords of end point
param r_n := 516000;
param n := 50; #Number of time points
var T >= 0; #Total time for flight
var h{0..n}; #coords of flightpath
# Control variables
var gamma {i in 1..n-1} >= gamma_min, <= gamma_max;
var rho {i in 1..n-1} = ((P_s)/(R*T_0))*exp(-h[i]/H); #Density as a function of height
var va {i in 1..n-1} = ((2*W)/(rho[i]*S)^0.5)*(k/(c0))^0.25; #Velocity FULLY DEFINED for every point
var alpha {i in 1..n-1} >= alpha_min, <= alpha_max; #Alpha that can only be solved implicitly
var cL {i in 1..n-1} = c1*alpha[i]^2+c2*alpha[i]+c3; #Lift Coeff APHA DEP
var cD {i in 1..n-1} = c0+k*cL[i]^2; #Drag Coefficient
var D {i in 1..n-1} = .5*cD[i]*rho[i]*S*va[i]^2; #Drag
var FT {i in 1..n-1} = ((W*sin(gamma[i])+D))/cos(alpha[i]); #Thrust equation
var L {i in 1..n-1} = .5*cL[i]*rho[i]*S*va[i]^2; #Lift EQ General ALPHA DEP
var L2 {i in 1..n-1} = W*cos(gamma[i])-FT*sin(alpha[i]); #Lift Balance EQ GAMMA and ALPHA DEP
var r{0..n} = (r[i+1] - r[i]) / (1/n) = va[i] cos (gamma[i]); #RANGE;
minimize P: sum {i in 1..n-1} FT[i]*r[i];
s.t. h_initial: h[0] = h_0;
s.t. r_initial: r[0] = r_0;
s.t. h_final: h[n] = h_n;
s.t. r_final: r[n] = r_n;
s.t. newtonian: L[i]-L2[i] <= 0.001 #my attempt at a basic newtonian solver for the implicit determination of alpha
solve;
对于此方法或一般方法背后的方法学方面的任何反馈,将不胜感激。