Skip to content

Commit

Permalink
Merge pull request #25 from ngomezve/layout_dev
Browse files Browse the repository at this point in the history
Cabin layout and cryogenic fuel properties
  • Loading branch information
askprash committed Mar 27, 2024
2 parents b7f7f0e + 8906ba4 commit e70d62b
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 22 deletions.
5 changes: 1 addition & 4 deletions example/cryo_input.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,11 @@ name = "TASOPT Model with cryo fuel and HX"
prop_sys_arch = "TF" #Options are TF: Turbofan
# TE: Turbo-electric
[Fuel]
fuel_type = "LH2" # Choices are ... [TODO]
fuel_type = "LH2" # Choices are "Jet-A", "LH2" and "CH4"
fuel_in_wing = false # Is fuel stored in wings?
fuel_in_wingcen = false # Is fuel stored in wing center box?
fuel_usability_factor = 0.90 # fraction of max fuel volume that is usable

fuel_temp = 20.0
fuel_density = 70.0 #kg/m3

[Fuel.Storage]
tank_placement = "front" #Location of tank in fuselage. Choices are "front", "rear", or "both".
insulation_segment_base_thickness = [0.05,0.05,0.05] #m
Expand Down
7 changes: 6 additions & 1 deletion src/IO/default_input.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
prop_sys_arch = "TF" #Options are TF: Turbofan
# TE: Turbo-electric
[Fuel]
fuel_type = "Jet-A" # Choices are ... [TODO]
fuel_type = "Jet-A" # Choices are "Jet-A", "LH2" and "CH4"
fuel_in_wing = true # Is fuel stored in wings?
fuel_in_wingcen = true # Is fuel stored in wing center box?
fuel_usability_factor = 0.90 # fraction of max fuel volume that is usable
Expand Down Expand Up @@ -142,6 +142,11 @@
#Use provided layout (false) or recalculate it (true) for design pax keeping deltas
calculate_cabin_length = false

double_decker = false #if true, the fuselage has two passenger decks
seat_pitch = "30 in"
seat_width = "19 in"
aisle_halfwidth = "10 in"

#Provided layout
x_nose_tip = "0 ft"
x_pressure_shell_fwd = "17 ft"
Expand Down
26 changes: 20 additions & 6 deletions src/IO/read_input.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ using TOML
export read_aircraft_model, load_default_model

include("size_cabin.jl")
include("../fuel/fuel_properties.jl")
#using ..structures

"""
Expand Down Expand Up @@ -143,19 +144,22 @@ fueltype = readfuel("fuel_type")
#TODO this needs to be updated once I include Gas.jl into TASOPT
if uppercase(fueltype) == "LH2"
pari[iifuel] = 40

elseif uppercase(fueltype) == "CH4"
pari[iifuel] = 11
pari[iifuel] = 11

elseif uppercase(fueltype) == "JET-A"
pari[iifuel] = 24

pare[ieTft, :, :] .= readfuel("fuel_temp") #Temperature of fuel in fuel tank
pare[ieTfuel, :, :] .= readfuel("fuel_temp") #Initialize fuel temperature as temperature in tank
parg[igrhofuel] = readfuel("fuel_density")
else
error("Check fuel type")
end
pari[iifwing] = readfuel("fuel_in_wing")
pari[iifwcen] = readfuel("fuel_in_wingcen")
parg[igrWfmax] = readfuel("fuel_usability_factor")
pare[ieTft, :, :] .= readfuel("fuel_temp") #Temperature of fuel in fuel tank
pare[ieTfuel, :, :] .= readfuel("fuel_temp") #Initialize fuel temperature as temperature in tank
parg[igrhofuel] = readfuel("fuel_density")

#Fuel storage options
fuse_tank = fuselage_tank() #Initialize struct for fuselage fuel tank params
Expand Down Expand Up @@ -184,6 +188,12 @@ if pari[iifwing] == 0 #If fuel is stored in fuselage
elseif (fuse_tank.placement == "both")
pari[iinftanks] = 2
end

#Calculate fuel temperature and density as a function of pressure
Tfuel, ρfuel = cryo_fuel_properties(uppercase(fueltype), fuse_tank.ptank)
pare[ieTft, :, :] .= Tfuel #Temperature of fuel in fuel tank
pare[ieTfuel, :, :] .= Tfuel #Initialize fuel temperature as temperature in tank
parg[igrhofuel] = ρfuel
end

# Setup mission variables
Expand Down Expand Up @@ -306,10 +316,14 @@ readgeom(x) = read_input(x, geom, dgeom)
#after loading the wing and stabilizer positions
calculate_cabin = readgeom("calculate_cabin_length")

parg[igseatpitch] = Distance(readgeom("seat_pitch"))
parg[igseatwidth] = Distance(readgeom("seat_width"))
parg[igaislehalfwidth] = Distance(readgeom("aisle_halfwidth"))

parg[igRfuse] = Distance(readgeom("radius"))
parg[igdRfuse] = Distance(readgeom("dRadius"))
parg[igwfb] = Distance(readgeom("y_offset"))
parg[ighfloor] = Distance(readgeom("floor_depth"))
parg[ighfloor] = Distance(readgeom("floor_depth"))
parg[ignfweb] = readgeom("Nwebs")

parg[iganose] = readgeom("a_nose")
Expand Down Expand Up @@ -866,4 +880,4 @@ end
function load_default_model()
println("Loading default aircraft model")
read_aircraft_model()
end
end
7 changes: 3 additions & 4 deletions src/IO/size_cabin.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ length.
- `xseats::Vector{Float64}`: longitudinal coordinate of each row of seats, measured from front of cabin (m).
- `seats_per_row::Float64`: number of seats per row.
"""
function place_cabin_seats(pax, Rfuse)
seat_pitch = 30.0 * in_to_m
seat_width = 19.0 * in_to_m
aisle_halfwidth = 10.0 * in_to_m # per CFR § 25.815
function place_cabin_seats(pax, Rfuse, seat_pitch = 30.0*in_to_m,
seat_width = 19.0*in_to_m, aisle_halfwidth = 10.0*in_to_m)

cabin_offset = 10 * ft_to_m #Distance to the front and back of seats
#TODO the hardcoded 10 ft is not elegant

Expand Down
25 changes: 25 additions & 0 deletions src/fuel/fuel_properties.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""
cryo_fuel_properties(fuel::String, p::Float64)
Calculates the temperature and density of a cryogenic fuel inside a tank, using fits to data from NIST.
!!! details "🔃 Inputs and Outputs"
**Inputs:**
- `fuel::String`: name of the fuel.
- `p::String`: tank pressure (Pa).
**Outputs:**
- `Tfuel::Float64`: fuel evaporation temperature (K)
- `ρfuel::String`: density of fuel (kg/m^3).
"""
function cryo_fuel_properties(fuel::String, p::Float64)
x = p / 101325 #pressure in atm

#Fits to NIST data at p = [0.5,1,1.5,2,2.5,3,4,5,10] atm
if fuel == "LH2"
Tfuel = 20.3839 * x^0.182022
ρfuel = -2.88304E-02*x^3 + 4.93319E-01*x^2 - 4.61334E+00*x + 7.51570E+01
elseif fuel == "CH4"
Tfuel = 111.69030 * x^0.12093
ρfuel = -1.49198E-01*x^3 + 2.85956E+00*x^2 - 2.20464E+01*x + 4.42724E+02
end
return Tfuel, ρfuel
end
11 changes: 8 additions & 3 deletions src/misc/index.inc
Original file line number Diff line number Diff line change
Expand Up @@ -374,13 +374,18 @@
const igTfuel = 301

const igxftankaft = 302
const igdxcabin = 303
const igdxcabin = 303
const igdxeng2wbox = 304

const igxWfuel = 305
const igmdotboiloff = 306

const igtotal = 306
const igseatpitch = 306
const igseatwidth = 307
const igaislehalfwidth = 308

const igmdotboiloff = 309

const igtotal = 309

# indices for turbo-electric systems - really just the electrical machines
const ite_ratSM = 1
Expand Down
7 changes: 5 additions & 2 deletions src/structures/update_fuse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,11 @@ It sizes the cabin for the design number of passengers.
"""
function update_fuse_for_pax!(pari, parg, parm, fuse_tank)

despax = parm[imWpay,1]/parm[imWperpax,1] #design number of passengers
seat_pitch = parg[igseatpitch]
seat_width = parg[igseatwidth]
aisle_halfwidth = parg[igaislehalfwidth]

maxpax = parg[igWpaymax]/parm[imWperpax,1] #maximum number of passengers
#Useful relative distances to conserve
dxeng2wbox = parg[igdxeng2wbox] #Distance from engine to wingbox
dxcyl2shellaft = parg[igxshell2] - parg[igxblend2] #Distance from blend2 to shell2
Expand All @@ -84,7 +87,7 @@ function update_fuse_for_pax!(pari, parg, parm, fuse_tank)
wbox_cabin_frac = (parg[igxwbox]- parg[igxblend1] )/(parg[igxblend2] - parg[igxblend1])

#Find new cabin length
lcyl, _, _ = place_cabin_seats(despax, parg[igRfuse]) #Size for design pax count
lcyl, _, _ = place_cabin_seats(maxpax, parg[igRfuse], seat_pitch, seat_width, aisle_halfwidth) #Size for max pax count

#When there is a fuel tank at the back of the fuselage, there is no offset between the end of the seat rows
#and the start of the tank. For this reason, leave a 5ft offset at back
Expand Down
3 changes: 3 additions & 0 deletions test/default_sized.jl
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@ parg[302] = 0.00000000000000000000 # igxftankaft
parg[303] = 23.4696 # igdxcabin
parg[304] = 1.52399999999999 # igdxeng2wbox
parg[305] = 4.0885967681724094e6 #igxWfuel
parg[306] = 0.762 #igseatpitch
parg[307] = 0.4826 #igseatwidth
parg[308] = 0.254 #igaislehalfwidth

# --------------------------------
# Mission - stored in parm array:
Expand Down
4 changes: 3 additions & 1 deletion test/regional_sized.jl
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,9 @@ parg[302] = 0.00000000000000000000
parg[303] = 24.99360000000000070486
parg[304] = 2.43839999999999790248
parg[305] = 1555504.53431817726232111454
parg[306] = 0.00000000000000000000
parg[306] = 0.762 #igseatpitch
parg[307] = 0.4826 #igseatwidth
parg[308] = 0.254 #igaislehalfwidth
# --------------------------------
# Mission - stored in parm array:
# --------------------------------
Expand Down
4 changes: 3 additions & 1 deletion test/wide_sized.jl
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,9 @@ parg[302] = 0.00000000000000000000
parg[303] = 39.92880000000000251248
parg[304] = 3.65759999999999863007
parg[305] = 51085067.57496136426925659180
parg[306] = 0.00000000000000000000
parg[306] = 0.762 #igseatpitch
parg[307] = 0.4826 #igseatwidth
parg[308] = 0.254 #igaislehalfwidth
# --------------------------------
# Mission - stored in parm array:
# --------------------------------
Expand Down

0 comments on commit e70d62b

Please sign in to comment.