Professional Documents
Culture Documents
Maxalcanceymaxautinomia
Maxalcanceymaxautinomia
Maxalcanceymaxautinomia
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
import pyomo
from pyomo.environ import *
import numpy as np
import math
m = ConcreteModel()
##############################################################################
#### Sets
##############################################################################
m.n = Param(initialize = 10, within = Integers)
m.N = Set(initialize = range(0,value(m.n+1)))
m.Ns = Set(initialize = range(0,value(m.n)))
t_0 = 0
x_0 = 0
p = 1.225
g = 9.81
masa = 5000
S = 21.55
CD_0 = 0.023
k = 0.073
CL_min= 0
CL_max = 1.4
angd_0 = 0
angd_f = 0.1
v_0 =200
v_f = 0
h_0 = 1000
h_f = 0
##############################################################################
#### Parámetros
##############################################################################
m.h = Var(m.N, within = NonNegativeReals, bounds = (h_f,h_0))
##############################################################################
#### Differential constraints
##############################################################################
m.step = Var(within = NonNegativeReals)
##############################################################################
#### Objective functional
##############################################################################
m.obj = Objective(expr = m.x[value(m.n)], sense = maximize)
##############################################################################
#### Boundary Constraints --------------------------------------------
##############################################################################
m.h_init_const = Constraint(expr = m.h[0] == h_0)
m.h_end_const = Constraint(expr = m.h[value(m.n)] == h_f)
##############################################################################
######-------------- Datos del Solver ----------------------------------
##############################################################################
solver = 'ipopt'
opt = SolverFactory(solver)
opt.options['halt_on_ampl_error'] = 'yes'
opt.options['max_iter'] =3000
solver_manager = SolverManagerFactory('serial')
results = solver_manager.solve(m, opt=opt, tee=True, timelimit=None)
##############################################################################
##### -----Post procesado, gráficas, txt, ....
##############################################################################
x = list(range(0,value(m.n)+1))
h = list(range(0,value(m.n)+1))
for i in m.N:
x[i] = value(m.x[i])
h[i] = value(m.h[i])
plt.figure(1)
plt.plot(x, h)
plt.grid(True)
plt.xlabel('Distancia')
plt.ylabel('Altura')
plt.show()
m = ConcreteModel()
###################################################################
#### Sets
###################################################################
m.n = Param(initialize = 20, within = Integers)
m.N = Set(initialize = range(0,value(m.n+1)))
m.Ns = Set(initialize = range(0,value(m.n)))
t_0 = 0
x_0 = 0
p = 1.225
g = 9.81
masa = 5000
S = 21.55
CD_0 = 0.023
k = 0.073
CL_min= 0
CL_max = 1.4
angd_0 = 0
angd_f = 0.1
v_0 =200
v_f = 0
h_0 = 1000
h_f = 0
###################################################################
#### Parámetros
###################################################################
m.h = Var(m.N, within = NonNegativeReals, bounds = (h_f,h_0))
###################################################################
#### Differential constraints
###################################################################
m.step = Var(within = NonNegativeReals)
###################################################################
#### Objective functional
###################################################################
m.obj = Objective(expr = m.step, sense = maximize)
###################################################################
#### Boundary Constraints ---------------------------------------
###################################################################
m.h_init_const = Constraint(expr = m.h[0] == h_0)
m.h_end_const = Constraint(expr = m.h[value(m.n)] == h_f)
###################################################################
######-------------- Datos del Solver -----------------------------
###################################################################
solver = 'ipopt'
opt = SolverFactory(solver)
opt.options['halt_on_ampl_error'] = 'yes'
opt.options['max_iter'] =3000
solver_manager = SolverManagerFactory('serial')
results = solver_manager.solve(m, opt=opt, tee=True, timelimit=None)
###################################################################
##### -----Post procesado, gráficas, txt, ....
###################################################################
x = list(range(0,value(m.n)+1))
h = list(range(0,value(m.n)+1))
for i in m.N:
x[i] = value(m.x[i])
h[i] = value(m.h[i])
plt.figure(1)
plt.plot(x, h)
plt.grid(True)
plt.xlabel('Distancia')
plt.ylabel('Altura')
plt.show()
3. Escribir en el programa de Pyomo las variables teóricas de velocidad y c L para cada una de
las actuaciones y compararlas con el resultado obtenido.
1
γ d ,mín = =2 √ c D 0 K=2 √ ( 0.023 ) ·(0.073)=0.082 radianes=4.7 °
E máx
Además, el c L óptimo:
c L, ópt =
√ √ cD0
K
=
0.023
0.073
=0.561309623
Por otro lado, para calcular la velocidad de descenso, primero se necesita conocer la velocidad
con respecto al aire correspondiente al vuelo con ángulo de planeo mínimo. Dado que L ≈ D:
u∞ ,γ =
mín
√ 2·W
ρ ∞ · S· c L, ópt √
=
2· m·g
ρ∞ · S· c L ,ópt
Así, la velocidad vertical de descenso con ángulo de descenso mínimo será:
ud ,γ =u∞ , γ · γ d ,mín =
mín mín
√ 2· m·g
ρ∞ · S· c L ,ópt
· γ d , mín=
√
2· 5000 · 9.81
1.225 · 21.55 · 0.5613
· ( 0.082 )=( 8 1.37 ) · ( 0.082 )=6.67 m/ s
CL = 0.5612096232482371
Voo = 81.22969739526016
du 3 2 ·W 2
= · ρ∞ · u2∞ · S· c D 0−K·
d
=0
d u∞ 2 ρ∞ · u2∞ · S
() √ () √
1/4 1/ 4
1 2W 1 2 · ( 5000 ) ·(9.81)
u∞ ,u = = =( 0.7598 ) · ( 81.37 )=61.82 8 m/s
dmín
3 ρ∞ · S· c L ,ópt 3 (1.225)·(21.55)·(0.5613)
2W 2 · ( 5000 ) ·(9.81)
c L= 2
= =0.9 81
ρ∞ · S· u∞ , u ( 1.225 ) · ( 21.55 ) ·(61.828 2)
dmín
Para los fines de este ejemplo se puede asumir que este coeficiente de sustentación es menor
que el máximo del avión. Así, el ángulo de planeo es:
2 2
c D c D 0+ k· c L 0.023+ 0.071· ( 0.9 81 )
γ d ,u = = = =0.0931 radian es=5 . 334 °
dmín
cL cL 0.981
CL = 0.5612096232482371
Voo = 81.22969739526016