Skip to content

Commit

Permalink
Merge pull request #26 from ngomezve/structures_dev
Browse files Browse the repository at this point in the history
Double decker cabin + Test improvements
  • Loading branch information
askprash committed Mar 29, 2024
2 parents e70d62b + 07a1be3 commit dfea4bc
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 29 deletions.
5 changes: 5 additions & 0 deletions example/cryo_input.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ name = "TASOPT Model with cryo fuel and HX"
#Use provided layout (false) or recalculate it (true) for design pax keeping deltas
calculate_cabin_length = true

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
1 change: 1 addition & 0 deletions src/IO/read_input.jl
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ readgeom(x) = read_input(x, geom, dgeom)
#Boolean to check if cabin length has to be recalculated; if true, this is done
#after loading the wing and stabilizer positions
calculate_cabin = readgeom("calculate_cabin_length")
pari[iidoubledeck] = readgeom("double_decker")

parg[igseatpitch] = Distance(readgeom("seat_pitch"))
parg[igseatwidth] = Distance(readgeom("seat_width"))
Expand Down
3 changes: 2 additions & 1 deletion src/misc/index.inc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
iiaircraftclass = 15 # 737 = 737 size aircraft; 777 = 777 size aircraft
iinftanks = 16 # number of fuel tanks in fuselage
iiengmodel = 17 #engine model
iitotal = 17
iidoubledeck = 18 #double decker flag
iitotal = 18

#---- indices for missions to be examined
#- (different Ranges Payloads ...)
Expand Down
8 changes: 7 additions & 1 deletion src/sizing/wsize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ function wsize(ac; itermax=35,
Wppinsul = parg[igWppinsul]
Wppfloor = parg[igWppfloor]

if pari[iidoubledeck] == 1
ndecks = 2
else
ndecks = 1
end

# fuselage-bending inertial relief factors
rMh = parg[igrMh]
rMv = parg[igrMv]
Expand Down Expand Up @@ -663,7 +669,7 @@ function wsize(ac; itermax=35,
ifwing, nftanks, xblend1, xblend2,
Waftfuel, Wftank_single, ltank, xftank_fuse, tank_placement,
fstring, fframe, ffadd, Δp,
Wpwindow, Wppinsul, Wppfloor,
Wpwindow, Wppinsul, Wppfloor, ndecks,
Whtail, Wvtail, rMh, rMv, Lhmax, Lvmax,
bv, λv, nvtail,
Rfuse, dRfuse, wfb, nfweb, λc,
Expand Down
18 changes: 9 additions & 9 deletions src/structures/fuseW.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
fusew(gee, Nland, Wfix, Wpay, Wpadd, Wseat, Wapu, Weng, Waftfuel,
fstring, fframe, ffadd, deltap,
Wpwindow, Wppinsul, Wppfloor,
Wpwindow, Wppinsul, Wppfloor, ndecks,
Whtail, Wvtail, rMh, rMv, Lhmax, Lvmax,
bv, lambdav, nvtail,
Rfuse, dRfuse, wfb, nfweb, lambdac,
Expand All @@ -18,7 +18,7 @@ It takes inputs related to geometry, fixed weights, material properties, and mor
!!! details "🔃 Inputs and Outputs"
**Inputs:**
- `Nland::Integer`: Number of landing gear components.
- `Nland::Float64`: load factor for floor beam structural sizing.
Fixed weights of various components:
- `Wfix::Float64`: Fixed weight of the structure.
- `Wpay::Float64`: Fixed weight of payload.
Expand All @@ -39,7 +39,7 @@ It takes inputs related to geometry, fixed weights, material properties, and mor
Weights of window, insulation, and floor:
- `Wpwindow::Float64`: Weight of windows.
- `Wppinsul::Float64`: Weight of insulation.
- `Wppfloor::Float64`: Weight of floor.
- `Wppfloor::Float64`: Weight of floor per unit area.
Vertical tail parameters:
- `Whtail::Float64`: Weight of horizontal tail components.
Expand Down Expand Up @@ -124,7 +124,7 @@ function fusew(Nland,Wfix,Wpay,Wpadd,Wseat,Wapu,Weng,
ifwing, nftanks, xblend1, xblend2,
Waftfuel, Wftank, ltank, xftankaft, tank_placement,
fstring,fframe,ffadd,deltap,
Wpwindow,Wppinsul,Wppfloor,
Wpwindow,Wppinsul,Wppfloor, ndecks,
Whtail,Wvtail,rMh,rMv,Lhmax,Lvmax,
bv,lambdav,nvtail,
Rfuse,dRfuse,wfb,nfweb,lambdac,
Expand Down Expand Up @@ -214,7 +214,7 @@ function fusew(Nland,Wfix,Wpay,Wpadd,Wseat,Wapu,Weng,
end
lcabin = xshell2 - xshell1 - nftanks * (ltank + 2.0*ft_to_m) #cabin length is smaller if there are fuel tanks

Wwindow = Wpwindow * lcabin
Wwindow = ndecks * Wpwindow * lcabin
xWwindow = Wwindow * xcabin

#--------------------------------------------------------------------
Expand All @@ -231,7 +231,7 @@ function fusew(Nland,Wfix,Wpay,Wpadd,Wseat,Wapu,Weng,

#--------------------------------------------------------------------
#--- floor structural sizing
P = (Wpay+Wseat) * Nland
P = (Wpay+Wseat) * Nland / ndecks #Total load is distributed across all decks
wfloor1 = wfb + Rfuse

if (wfb == 0.0)
Expand All @@ -248,7 +248,7 @@ function fusew(Nland,Wfix,Wpay,Wpadd,Wseat,Wapu,Weng,
Afcap = 2.0*Mmax/(sigfloor*hfloor)

Vfloor = (Afcap + Afweb) * 2.0*wfloor1
Wfloor = rhofloor*gee*Vfloor + 2.0*wfloor1*lfloor*Wppfloor
Wfloor = ndecks * (rhofloor*gee*Vfloor + 2.0*wfloor1*lfloor*Wppfloor)
xWfloor = Wfloor * 0.5*(xshell1 + xshell2)

#--- average floor-beam cap thickness ("smeared" over entire floor)
Expand Down Expand Up @@ -276,8 +276,8 @@ function fusew(Nland,Wfix,Wpay,Wpadd,Wseat,Wapu,Weng,
#--------------------------------------------------------------------
#--- lumped tail weight and location
# (Weng=0 if there are no tail-mounted engines)
Wtail = Whtail + Wvtail + Wcone + Wapu + Waftfuel + Wftank + Weng #TODO: this does not account for weight penalty when
#nftanks != 2
Wtail = Whtail + Wvtail + Wcone + Wapu + Waftfuel + Wftank + Weng

xtail = ( xhtail*Whtail +
xvtail*Wvtail +
xWcone +
Expand Down
12 changes: 10 additions & 2 deletions src/structures/update_fuse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,15 @@ function update_fuse_for_pax!(pari, parg, parm, fuse_tank)
seat_width = parg[igseatwidth]
aisle_halfwidth = parg[igaislehalfwidth]

maxpax = parg[igWpaymax]/parm[imWperpax,1] #maximum number of passengers
if pari[iidoubledeck] == 1 #if the aircraft is a double decker
#passenger count to size cabin is half of the maximum
paxsize = ceil(parg[igWpaymax]/parm[imWperpax,1] / 2)
else
paxsize = parg[igWpaymax]/parm[imWperpax,1] #maximum number of passengers
end
#TODO this double deck model assumes that both decks have a width equal to the fuselage diameter;
#in reality, at least one deck must be narrower

#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 @@ -87,7 +95,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(maxpax, parg[igRfuse], seat_pitch, seat_width, aisle_halfwidth) #Size for max pax count
lcyl, _, _ = place_cabin_seats(paxsize, 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
18 changes: 9 additions & 9 deletions test/unit_test_PEMFC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@

V_LT, α_LT = TASOPT.engine.LT_PEMFC_voltage(u_LT)

@test V_LT == 0.7102709836153386
@test α_LT == 0.13026800553988963
@test V_LT 0.7102709836153386
@test α_LT 0.13026800553988963

u_HT = TASOPT.engine.PEMFC_inputs(1e4, 453.15, 3e5, 3e5, 0.1, 0.1, 3.0, 3.0, 100e-6, 250e-6, 250e-6, "HT-PEMFC")
V_HT= TASOPT.engine.HT_PEMFC_voltage(u_HT)

@test V_HT == 0.7532410548758377
@test V_HT 0.7532410548758377

Pdes = 1e6
Vdes = 200

n_cells, A_cell, Q = TASOPT.engine.PEMsize(Pdes, Vdes, u_HT)

@test n_cells == 265.5192500533146
@test A_cell == 0.5
@test Q == 664805.6978342824
@test n_cells 265.5192500533146
@test A_cell 0.5
@test Q 664805.6978342824

V_stack, Q_od = TASOPT.engine.PEMoper(5e5, n_cells, A_cell, u_HT)

@test V_stack == 237.6830551160271
@test Q_od == 200430.95710865577
@test V_stack 237.6830551160271
@test Q_od 200430.95710865577

W_FC = TASOPT.engine.PEMstackweight(9.81, u_HT, n_cells, A_cell, 4.0)

@test W_FC == 7032.808376162144
@test W_FC 7032.808376162144
end
4 changes: 2 additions & 2 deletions test/unit_test_heat_exchanger.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
[731.5888605437423, 665.8848846504773,
1432.2702748284166, 62.03322510460286, 8.000169398096878, 0.004760508726403918, 1.0189779296746375]

@test size_out == size_out_check
@test size_out size_out_check

#---------------------------------
# hxweight()
Expand Down Expand Up @@ -107,7 +107,7 @@

oper_out_check = [740.2021082199583, 592.0660985817696, 1735.5864305141572, 0.6521309311700579]

@test oper_out == oper_out_check
@test oper_out oper_out_check

#---------------------------------
# hxoptim!()
Expand Down
6 changes: 3 additions & 3 deletions test/unit_test_io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
ac_quick_nopay_reread = quickload_aircraft(filepath_quick_nopay)
size_aircraft!(ac_quick_nopay_reread, Ldebug=false, printiter=false, saveOD=false)
@test ac_quick_nopay_reread.parg[igWMTO] ac_nopay.parg[igWMTO]

rm(filepath_quick_nopay)

#C: outputs to .csv
using CSV
Expand Down Expand Up @@ -85,8 +85,8 @@
@test size(csv1,1) == 4 #4 rows w default indices
@test size(csv2,1) == 1 #1 row with addl indices

@test length(csv1[1]) == 71 # = indices in default_output_indices
@test length(csv2[1]) == 96 # = indices in output_indices_wGeom
@test length(csv1[1]) == 72 # = indices in default_output_indices
@test length(csv2[1]) == 97 # = indices in output_indices_wGeom

#test the nested vector Structures
#a: row 1 in both csvs matches the design cruise point/mission
Expand Down
5 changes: 3 additions & 2 deletions test/unit_test_structures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
ifwing, nftanks, xblend1, xblend2,
Waftfuel, Wftank, ltank, xftankaft, tank_placement,
fstring, fframe, ffadd, deltap,
Wpwindow, Wppinsul, Wppfloor,
Wpwindow, Wppinsul, Wppfloor, ndecks,
Whtail, Wvtail, rMh, rMv, Lhmax, Lvmax,
bv, lambdav, nvtail,
Rfuse, dRfuse, wfb, nfweb, lambdac,
Expand Down Expand Up @@ -34,6 +34,7 @@
435.00000000000000,
22.000000000000000,
60.000000000000000,
1,
11637.065832885963,
7847.1938058748428,
0.40000000000000002,
Expand Down Expand Up @@ -75,7 +76,7 @@
ifwing, nftanks, xblend1, xblend2,
Waftfuel, Wftank, ltank, xftankaft,tank_placement,
fstring, fframe, ffadd, deltap,
Wpwindow, Wppinsul, Wppfloor,
Wpwindow, Wppinsul, Wppfloor, ndecks,
Whtail, Wvtail, rMh, rMv, Lhmax, Lvmax,
bv, lambdav, nvtail,
Rfuse, dRfuse, wfb, nfweb, lambdac,
Expand Down

0 comments on commit dfea4bc

Please sign in to comment.