Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reviving H2, better cabin layout and double decker models #78

Merged
merged 16 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions example/cryo_input.toml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ name = "TASOPT Model with cryo fuel and HX"
floor_distance = "0 in" #Vertical distance between floors if double decker
seat_pitch = "30 in"
seat_width = "19 in"
seat_height = "45 in"
aisle_halfwidth = "10 in"

#Provided layout
Expand Down
2 changes: 1 addition & 1 deletion example/example_cryo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ summary(example_ac)
# 5) Plot figures
using PythonPlot
TASOPT.stickfig(example_ac)
plt.savefig("Example.png")
pyplot.savefig("Example.png")
1 change: 1 addition & 0 deletions example/example_regional.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
double_decker = false #if true, the fuselage has two passenger decks
seat_pitch = "30 in"
seat_width = "19 in"
seat_height = "45 in"
aisle_halfwidth = "10 in"

#Provided layout
Expand Down
2 changes: 1 addition & 1 deletion example/example_run.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ summary(example_ac)
# 5) Plot figures
using PythonPlot
TASOPT.stickfig(example_ac)
plt.savefig("Example.png")
pyplot.savefig("Example.png")
1 change: 1 addition & 0 deletions example/example_widebody.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
double_decker = false #if true, the fuselage has two passenger decks
seat_pitch = "30 in"
seat_width = "19 in"
seat_height = "45 in"
aisle_halfwidth = "10 in"

#Provided layout
Expand Down
1 change: 1 addition & 0 deletions src/IO/default_input.toml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
floor_distance = "0 in" #Vertical distance between floors if double decker
seat_pitch = "30 in"
seat_width = "19 in"
seat_height = "45 in"
aisle_halfwidth = "10 in"

#Provided layout
Expand Down
54 changes: 37 additions & 17 deletions src/IO/outputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ function stickfig(ac::aircraft; ax = nothing, label_fs = 16)
xseats0 = xtanks[1] + l/2 + 1.0 * ft_to_m #move seats backwards
elseif tank_placement == "rear"
xtanks = [parg[igxftankaft]]
xseats0 = parg[igxshell1 ]
xseats0 = fuselage.layout.x_pressure_shell_fwd
elseif tank_placement == "both"
xtanks = [parg[igxftank], parg[igxftankaft]]
xseats0 = xtanks[1] + l/2 + 1.0 * ft_to_m #move seats backwards
Expand Down Expand Up @@ -451,16 +451,24 @@ function stickfig(ac::aircraft; ax = nothing, label_fs = 16)
yshell[k] = sqrt(Rfuse^2 * max((1 - ((xshell[k]-xshellcenter)/(Rfuse/AR))^2), 0.0) )
end

pax = parg[igWpay]/parm[imWperpax]
if pari[iidoubledeck] == 0 #Only show seats in single deck arrangements
h_seat = fuselage.cabin.seat_height
pax = parg[igWpay]/parm[imWperpax]
Rfuse = fuselage.layout.radius
dRfuse = fuselage.layout.bubble_lower_downward_shift
wfb = fuselage.layout.bubble_center_y_offset
nfweb = fuselage.layout.n_webs

wcabin = find_cabin_width(fuselage.layout.radius, fuselage.layout.bubble_lower_downward_shift, fuselage.layout.bubble_center_y_offset, fuselage.layout.n_webs, parg[igfloordist]) #Find cabin width
_, xseats, seats_per_row = place_cabin_seats(pax, wcabin)
xseats = xseats .+ xseats0
rows = length(xseats)
θ = find_floor_angles(false, Rfuse, dRfuse, h_seat = h_seat) #Find the floor angle
wcabin = find_cabin_width(Rfuse, wfb, nfweb, θ, h_seat) #Cabin width
_, xseats, seats_per_row = place_cabin_seats(pax, wcabin)

println("Seats per row = $seats_per_row, Total rows = $rows")
yseats = arrange_seats(seats_per_row, wcabin)
xseats = xseats .+ xseats0
rows = length(xseats)

println("Seats per row = $seats_per_row, Total rows = $rows")
yseats = arrange_seats(seats_per_row, wcabin)
end
## Plot
if ax === nothing
# plt.style.use(["../miscellaneous/prash.mplstyle"]) # HACK
Expand Down Expand Up @@ -560,8 +568,9 @@ function stickfig(ac::aircraft; ax = nothing, label_fs = 16)

# Show seats

if pari[iidoubledeck] == 0 #Show seats in single deck case
ax.scatter(ones(length(yseats),1).*xseats, ones(1,rows).* yseats, color = "gray", alpha = 0.1, marker = "s", s=15, zorder = 21)

end
# diagnostic marks
# ax.scatter(parg[igxftank] - l/2, 0.0, color = "k", marker="o", zorder = 21)
# ax.scatter(parg[igxftank], 0.0, color = "b", marker="o", zorder = 21)
Expand Down Expand Up @@ -1401,14 +1410,24 @@ function high_res_airplane_plot(ac; ax = nothing, label_fs = 16, save_name = not
end

#Seats
pax = parg[igWpay]/parm[imWperpax]
wcabin = find_cabin_width(fuselage.layout.radius, fuselage.layout.bubble_lower_downward_shift, fuselage.layout.bubble_center_y_offset, fuselage.layout.n_webs, parg[igfloordist]) #Find cabin width
_, xseats, seats_per_row = place_cabin_seats(pax, wcabin)
xseats = xseats .+ xseats0
rows = length(xseats)
if pari[iidoubledeck] == 0 #Only show seats in single deck arrangements
h_seat = fuselage.cabin.seat_height
pax = parg[igWpay]/parm[imWperpax]
Rfuse = fuselage.layout.radius
dRfuse = fuselage.layout.bubble_lower_downward_shift
wfb = fuselage.layout.bubble_center_y_offset
nfweb = fuselage.layout.n_webs

println("Seats per row = $seats_per_row, Total rows = $rows")
yseats = arrange_seats(seats_per_row, wcabin)
θ = find_floor_angles(false, Rfuse, dRfuse, h_seat = h_seat) #Find the floor angle
wcabin = find_cabin_width(Rfuse, wfb, nfweb, θ, h_seat) #Cabin width
_, xseats, seats_per_row = place_cabin_seats(pax, wcabin)

xseats = xseats .+ xseats0
rows = length(xseats)

println("Seats per row = $seats_per_row, Total rows = $rows")
yseats = arrange_seats(seats_per_row, wcabin)
end

## Plot
if ax === nothing
Expand Down Expand Up @@ -1519,8 +1538,9 @@ function high_res_airplane_plot(ac; ax = nothing, label_fs = 16, save_name = not
ax.text(0.5*(parg[igxCGfwd ]+parg[igxCGaft ]), -1.0, "CG", fontsize=label_fs-2.0, ha="center", va="center", zorder = 21)

# Show seats
if pari[iidoubledeck] == 0 #Only show seats in single deck arrangements
ax.scatter(ones(length(yseats),1).*xseats, ones(1,rows).* yseats, color = "gray", alpha = 0.1, marker = "s", s=15, zorder = 21)

end
# diagnostic marks
# ax.scatter(parg[igxftank] - l/2, 0.0, color = "k", marker="o", zorder = 21)
# ax.scatter(parg[igxftank], 0.0, color = "b", marker="o", zorder = 21)
Expand Down
10 changes: 6 additions & 4 deletions src/IO/read_input.jl
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,13 @@ readgeom(x) = read_input(x, geom, dgeom)
pari[iidoubledeck] = readgeom("double_decker")

if pari[iidoubledeck] == 1 #If aircraft is a double decker
parg[igfloordist] = Distance(readgeom("floor_distance")) #read vertical distance between floors
fuselage.cabin.floor_distance = Distance(readgeom("floor_distance")) #read vertical distance between floors
end

parg[igseatpitch] = Distance(readgeom("seat_pitch"))
parg[igseatwidth] = Distance(readgeom("seat_width"))
parg[igaislehalfwidth] = Distance(readgeom("aisle_halfwidth"))
fuselage.cabin.seat_pitch = Distance(readgeom("seat_pitch"))
fuselage.cabin.seat_width = Distance(readgeom("seat_width"))
fuselage.cabin.seat_height = Distance(readgeom("seat_height"))
fuselage.cabin.aisle_halfwidth = Distance(readgeom("aisle_halfwidth"))
parg[igrMh] = readgeom("HT_load_fuse_bend_relief")
parg[igrMv] = readgeom("VT_load_fuse_bend_relief")
parg[igxlgnose] = Distance(readgeom("x_nose_landing_gear"))
Expand Down Expand Up @@ -351,6 +352,7 @@ readgeom(x) = read_input(x, geom, dgeom)
fuselage.layout.x_end_cylinder = Distance(readgeom("x_end_cylinder"))
fuselage.layout.x_cone_end = Distance(readgeom("x_cone_end"))
fuselage.layout.x_end = Distance(readgeom("x_end"))
fuselage.layout.l_cabin_cylinder = fuselage.layout.x_end_cylinder - fuselage.layout.x_start_cylinder

# ------ End fuse -------

Expand Down
13 changes: 13 additions & 0 deletions src/IO/save_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,7 @@ function reset_regression_test(fname, ac)
@printf(io,"fuse.weight_frac_skin_addl = %20.20f \n", ac.fuselage.weight_frac_skin_addl)
@printf(io,"fuse.layout.nose_radius = %20.20f \n", ac.fuselage.layout.nose_radius)
@printf(io,"fuse.layout.tail_radius = %20.20f \n", ac.fuselage.layout.tail_radius)
@printf(io,"fuse.layout.l_cabin_cylinder = %20.20f \n", ac.fuselage.layout.l_cabin_cylinder)
@printf(io,"fuse.layout.x_nose = %20.20f \n", ac.fuselage.layout.x_nose)
@printf(io,"fuse.layout.x_end = %20.20f \n", ac.fuselage.layout.x_end)
@printf(io,"fuse.layout.x_start_cylinder = %20.20f \n", ac.fuselage.layout.x_start_cylinder)
Expand Down Expand Up @@ -751,6 +752,18 @@ function reset_regression_test(fname, ac)
@printf(io,"fuse.HPE_sys.W = %20.20f \n", ac.fuselage.HPE_sys.W)
@printf(io,"fuse.added_payload.W = %20.20f \n", ac.fuselage.added_payload.W)

@printf(io, "fuse.cabin.seat_pitch = %20.20f \n", ac.fuselage.cabin.seat_pitch)
@printf(io, "fuse.cabin.seat_width = %20.20f \n", ac.fuselage.cabin.seat_width)
@printf(io, "fuse.cabin.seat_height = %20.20f \n", ac.fuselage.cabin.seat_height)
@printf(io, "fuse.cabin.aisle_halfwidth = %20.20f \n", ac.fuselage.cabin.aisle_halfwidth)
@printf(io, "fuse.cabin.floor_distance = %20.20f \n", ac.fuselage.cabin.floor_distance)
@printf(io, "fuse.cabin.cabin_width_main = %20.20f \n", ac.fuselage.cabin.cabin_width_main)
@printf(io, "fuse.cabin.cabin_width_top = %20.20f \n", ac.fuselage.cabin.cabin_width_top)
@printf(io, "fuse.cabin.seats_abreast_main = %d \n", ac.fuselage.cabin.seats_abreast_main)
@printf(io, "fuse.cabin.seats_abreast_top = %d \n", ac.fuselage.cabin.seats_abreast_top)
@printf(io, "fuse.cabin.floor_angle_main = %20.20f \n", ac.fuselage.cabin.floor_angle_main)
@printf(io, "fuse.cabin.floor_angle_top = %20.20f \n", ac.fuselage.cabin.floor_angle_top)

@printf(io, "# ------------------------------\n")
@printf(io, "# Flags - stored in pari array:\n")
@printf(io, "# ------------------------------\n")
Expand Down
153 changes: 0 additions & 153 deletions src/IO/size_cabin.jl

This file was deleted.

2 changes: 0 additions & 2 deletions src/TASOPT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ include(joinpath(__TASOPTroot__,"engine/PT.inc"))
include(joinpath(__TASOPTroot__,"IO/read_input.jl"))
include(joinpath(__TASOPTroot__,"IO/outputs.jl"))
include(joinpath(__TASOPTroot__,"IO/save_model.jl"))
#functionalities to be categorized: #TODO
include(joinpath(__TASOPTroot__,"IO/size_cabin.jl"))

include(joinpath(__TASOPTroot__,"IO/quicksave_load.jl"))
include(joinpath(__TASOPTroot__,"IO/par_array_opers.jl"))
Expand Down
6 changes: 3 additions & 3 deletions src/balance/balance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -796,14 +796,14 @@ function cabin_centroid(nftanks,fuse,xftankaft,lftank)
if nftanks == 1
if xftankaft == 0.0 #If tank is at the front
xcabin = 0.5 * (fuse.layout.x_start_cylinder + lftank + 2.0*ft_to_m + fuse.layout.x_pressure_shell_aft)
lcabin = fuse.layout.x_pressure_shell_aft - fuse.layout.x_end_cylinder + dx_cabin(fuse) #cabin length is smaller if there are fuel tanks
lcabin = fuse.layout.x_pressure_shell_aft - fuse.layout.x_end_cylinder + fuse.layout.l_cabin_cylinder #cabin length is smaller if there are fuel tanks
else #tank is at rear
xcabin = 0.5 * (fuse.layout.x_pressure_shell_fwd + fuse.layout.x_end_cylinder - (lftank + 2.0*ft_to_m))
lcabin = fuse.layout.x_start_cylinder - fuse.layout.x_pressure_shell_fwd + dx_cabin(fuse) #cabin length is smaller if there are fuel tanks
lcabin = fuse.layout.x_start_cylinder - fuse.layout.x_pressure_shell_fwd + fuse.layout.l_cabin_cylinder #cabin length is smaller if there are fuel tanks
end
elseif nftanks == 2
xcabin = 0.5 * (fuse.layout.x_pressure_shell_fwd + fuse.layout.x_pressure_shell_aft) #TODO noticed convergence issues if the average of the blends is used instead
lcabin = dx_cabin(fuse)
lcabin = fuse.layout.l_cabin_cylinder
elseif nftanks == 0
xcabin = 0.5 * (fuse.layout.x_pressure_shell_fwd + fuse.layout.x_pressure_shell_aft)
lcabin = fuse.layout.x_pressure_shell_aft - fuse.layout.x_pressure_shell_fwd
Expand Down
3 changes: 3 additions & 0 deletions src/misc/fuselage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ $TYPEDFIELDS
"""Fuselage Layout"""
layout::FuselageLayout = FuselageLayout()

"""Cabin Properties"""
cabin::Cabin = Cabin()

# Internal Structure
"""Fuselage Material"""
material::StructuralAlloy = StructuralAlloy("TASOPT-Al")
Expand Down
Loading