Skip to content

Commit

Permalink
fixed inconsistency in effect wcabin with hseat
Browse files Browse the repository at this point in the history
  • Loading branch information
ngomezve committed Jul 15, 2024
1 parent 31a239c commit edbf835
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src/IO/outputs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,10 @@ function stickfig(ac::aircraft; ax = nothing, label_fs = 16)
end

if pari[iidoubledeck] == 0 #Only show seats in single deck arrangements
h_seat = parg[igseatheight]
pax = parg[igWpay]/parm[imWperpax]
θ = find_floor_angles(false, parg[igRfuse], parg[igdRfuse], h_seat = parg[igseatheight]) #Find the floor angle
wcabin = find_cabin_width(parg[igRfuse], parg[igwfb], parg[ignfweb], θ) #Cabin width
wcabin = find_cabin_width(parg[igRfuse], parg[igwfb], parg[ignfweb], θ, h_seat) #Cabin width
_, xseats, seats_per_row = place_cabin_seats(pax, wcabin)

xseats = xseats .+ xseats0
Expand Down Expand Up @@ -1400,9 +1401,10 @@ function high_res_airplane_plot(ac; ax = nothing, label_fs = 16, save_name = not

#Seats
if pari[iidoubledeck] == 0 #Only show seats in single deck arrangements
h_seat = parg[igseatheight]
pax = parg[igWpay]/parm[imWperpax]
θ = find_floor_angles(false, parg[igRfuse], parg[igdRfuse], h_seat = parg[igseatheight]) #Find the floor angle
wcabin = find_cabin_width(parg[igRfuse], parg[igwfb], parg[ignfweb], θ) #Cabin width
wcabin = find_cabin_width(parg[igRfuse], parg[igwfb], parg[ignfweb], θ, h_seat) #Cabin width
_, xseats, seats_per_row = place_cabin_seats(pax, wcabin)

xseats = xseats .+ xseats0
Expand Down
15 changes: 9 additions & 6 deletions src/structures/size_cabin.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function aisle_flag(idx, layout)
end

"""
find_cabin_width(Rfuse::Float64, wfb::Float64, nfweb::Float64, θ::Float64)
find_cabin_width(Rfuse::Float64, wfb::Float64, nfweb::Float64, θ::Float64, h_seat::Float64)
This function can be used to calculate the width of the passenger cabin from the double-bubble parameters
and the floor angular position.
Expand All @@ -140,13 +140,16 @@ and the floor angular position.
- `wfb::Float64`: lateral shift of double bubble (m)
- `nfweb::Float64`: number of vertical webs in fuselage
- `θ::Float64`: angle of floor wrt upper bubble center (rad)
- `h_seat::Float64`: seat height (m)
**Outputs:**
- `w::Float64`: width of cabin (m).
"""
function find_cabin_width(Rfuse::Float64, wfb::Float64, nfweb::Float64, θ::Float64)
function find_cabin_width(Rfuse::Float64, wfb::Float64, nfweb::Float64, θ::Float64, h_seat::Float64)
#Use trigonometry to find cabin width
w = nfweb*2*wfb + 2*Rfuse*cos(θ)
θseat = asin((h_seat + Rfuse * sin(θ)) / Rfuse)
cosθ = min(cos(θ), cos(θseat)) #For the effective cabin width, take the minimum of the widths at the floor and at the seat height
w = nfweb*2*wfb + 2*Rfuse*cosθ
return w
end

Expand Down Expand Up @@ -183,7 +186,7 @@ function find_floor_angles(fdoubledecker::Bool, Rfuse::Float64, dRfuse::Float64;
θ1 = -asin(h_seat / (2*Rfuse)) #This angle maximizes the cabin width
return θ1
else #If it is a double decker with no lower bubble, the main cabin could be anywhere => Use provided angle
θ2 = asin((h_seat + d_floor + Rfuse * sin(θ1)) / Rfuse)
θ2 = asin((h_seat + d_floor) / Rfuse)
return θ1, θ2
end
end
Expand Down Expand Up @@ -232,8 +235,8 @@ function find_double_decker_cabin_length(x::Vector{Float64}, parg, parm)
end

#Find width of each cabin
w1 = find_cabin_width(Rfuse, wfb, nfweb, θ1)
w2 = find_cabin_width(Rfuse, wfb, nfweb, θ2)
w1 = find_cabin_width(Rfuse, wfb, nfweb, θ1, h_seat)
w2 = find_cabin_width(Rfuse, wfb, nfweb, θ2, h_seat)

#Find length of each cabin
l1, _, pax_per_row_main = place_cabin_seats(paxmain, w1, seat_pitch, seat_width, aisle_halfwidth)
Expand Down
2 changes: 1 addition & 1 deletion src/structures/update_fuse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function update_fuse_for_pax!(pari, parg, parm, fuse_tank)
else
θ = find_floor_angles(false, Rfuse, dRfuse, h_seat = h_seat) #Find the floor angle
paxsize = parg[igWpaymax]/parm[imWperpax,1] #maximum number of passengers
w = find_cabin_width(Rfuse, wfb, nfweb, θ) #Cabin width
w = find_cabin_width(Rfuse, wfb, nfweb, θ, h_seat) #Cabin width
lcyl, _, seats_per_row = place_cabin_seats(paxsize, w, seat_pitch, seat_width, aisle_halfwidth) #Cabin length
end

Expand Down

0 comments on commit edbf835

Please sign in to comment.