0% found this document useful (0 votes)
25 views6 pages

Maxalcanceymaxautinomia

The document describes solving two trajectory optimization problems for gliders using Pyomo. The first problem aims to maximize range by minimizing descent angle and optimizing lift coefficient. The second problem aims to maximize flight time by solving the differential equations governing the glider's motion.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views6 pages

Maxalcanceymaxautinomia

The document describes solving two trajectory optimization problems for gliders using Pyomo. The first problem aims to maximize range by minimizing descent angle and optimizing lift coefficient. The second problem aims to maximize flight time by solving the differential equations governing the glider's motion.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

1. Resolver numéricmente la actuación de máximo alcance utilizando Pyomo.

#!/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))

m.x = Var(m.N, initialize = x_0, within = NonNegativeReals)


m.v = Var(m.N, within = NonNegativeReals, bounds = (v_f, v_0))

m.ang_d = Var(m.N, within = NonNegativeReals, bounds = (angd_0, angd_f))


m.CL = Var(m.N, within = NonNegativeReals, bounds = (CL_min, CL_max))

##############################################################################
#### Differential constraints
##############################################################################
m.step = Var(within = NonNegativeReals)

def x_def1(model, i):


return m.x[i+1] - m.x[i] == (((m.v[i+1]*cos(m.ang_d[i+1])) +
(m.v[i]*cos(m.ang_d[i]))) * m.step)/2;
m.x_const1 = Constraint(m.Ns, rule = x_def1)

def x_def2(model, i):


return m.h[i+1] - m.h[i] == (((-m.v[i+1]*sin(m.ang_d[i+1])) + (-
m.v[i]*sin(m.ang_d[i]))) * m.step)/2;
m.x_const2 = Constraint(m.Ns, rule = x_def2)
def x_def3(model, i):
return masa*g*sin(m.ang_d[i]) == 0.5*p*S*(CD_0 + k*(m.CL[i])**2) *
m.v[i]**2
m.x_const3 = Constraint(m.N, rule = x_def3)

def x_def4(model, i):


return masa*g*cos(m.ang_d[i]) == 0.5*p*S* m.CL[i] * m.v[i]**2
m.x_const4 = Constraint(m.N, rule = x_def4)

##############################################################################
#### 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)

m.x_init_const = Constraint(expr = m.x[0] == x_0)

##############################################################################
######-------------- 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])

import matplotlib.pyplot as plt


#pylab inline

plt.figure(1)
plt.plot(x, h)
plt.grid(True)
plt.xlabel('Distancia')
plt.ylabel('Altura')
plt.show()

print('Objetivo:', value(m.obj), ‘m’)


print('Valor CL:', value(m.CL[m.n]))
print('Valor velocidad con respecto al aire:', value(m.v[m.n]), ‘m/s’)
x = distancia = 12202.383114084501

2. Resolver numéricamente la actuación de máxima autonomía utilizando Pyomo.


import pyomo
from pyomo.environ import *
import numpy as np
import math

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))

m.x = Var(m.N, initialize = x_0, within = NonNegativeReals)


m.v = Var(m.N, within = NonNegativeReals, bounds = (v_f, v_0))

m.ang_d = Var(m.N, within = NonNegativeReals, bounds = (angd_0, angd_f))


m.CL = Var(m.N, within = NonNegativeReals, bounds = (CL_min, CL_max))

###################################################################
#### Differential constraints
###################################################################
m.step = Var(within = NonNegativeReals)

def x_def1(model, i):


return m.x[i+1] - m.x[i] == (((m.v[i+1]*cos(m.ang_d[i+1])) +
(m.v[i]*cos(m.ang_d[i]))) * m.step)/2;
m.x_const1 = Constraint(m.Ns, rule = x_def1)

def x_def2(model, i):


return m.h[i+1] - m.h[i] == (((-m.v[i+1]*sin(m.ang_d[i+1])) + (-
m.v[i]*sin(m.ang_d[i]))) * m.step)/2;
m.x_const2 = Constraint(m.Ns, rule = x_def2)

def x_def3(model, i):


return masa*g*sin(m.ang_d[i]) == 0.5*p*S*(CD_0 + k*(m.CL[i])**2)*m.v[i]**2
m.x_const3 = Constraint(m.N, rule = x_def3)

def x_def4(model, i):


return masa*g*cos(m.ang_d[i]) == 0.5*p*S*m.CL[i]*m.v[i]**2
m.x_const4 = Constraint(m.N, rule = x_def4)

###################################################################
#### 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)

m.x_init_const = Constraint(expr = m.x[0] == x_0)

###################################################################
######-------------- 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])

import matplotlib.pyplot as plt


#pylab inline

plt.figure(1)
plt.plot(x, h)
plt.grid(True)
plt.xlabel('Distancia')
plt.ylabel('Altura')
plt.show()

print('Valor objetivo:', value(m.obj), 'segundos')


print('Valor CL del planeador:', value(m.CL[m.n]))
print('Valor de la velocidad con respecto al aire del planeador:',
value(m.v[m.n]), 'm/s')

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.

 Para máximo alcance:


Para máximo alcance, el ángulo de descenso (γ d ) es mínimo y, por lo tanto, se debe cumplir
que la eficiencia aerodinámica sea máxima, así que considerando que se tiene lo siguiente:

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

Los resultados obtenidos por pyomo:

CL = 0.5612096232482371

Voo = 81.22969739526016

 Para máxima autonomía:

En el caso de máxima autonomía, se buscará la velocidad de descenso mínima.

Sabiendo que la velocidad de descenso se puede expresar de la siguiente forma:

du 3 2 ·W 2
= · ρ∞ · u2∞ · S· c D 0−K·
d
=0
d u∞ 2 ρ∞ · u2∞ · S

Despejando u∞ de la anterior expresión, se obtiene la velocidad de descenso mínima:

() √ () √
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)

Para calcular el ángulo de descenso correspondiente hay que determinar la eficiencia


aerodinámica en esta condición de vuelo:

Para calcular el ángulo de descenso correspondiente hay que determinar la eficiencia


aerodinámica en esta condición de vuelo. El coeficiente de sustentación ahora es:

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

Los resultados obtenidos por pyomo:

CL = 0.5612096232482371

Voo = 81.22969739526016

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy