""" `cuboid room object` Returns a `cuboidRoom` object containing the geometrical information of the room. # Arguments * `Lx::Float64` : x dimension of room * `Ly::Float64` : y dimension of room * `Lx::Float64` : z dimension of room * `T60::Float64`: desired T60 * `env::AcEnv` : acoustic enviroment By default all wall reflection coefficients are set to the same value. If you want to choose reflection coefficients use these arguments instead: * `Lx::Float64` : x dimension of room * `Ly::Float64` : y dimension of room * `Lx::Float64` : z dimension of room * `β::Array{Float64}`: 6 element Array containg reflection coefficients of the 6 walls Also by default the random displacement is set to `Rd = 1e-2`. The randomization of the image sources is saved in an internal variable of the `cuboidRoom` object in `Sr::Int64`. To change these default values type: * `CuboidRoom(Lx,Ly,Lz,T60,env; Rd = myRd, Sr = mySr)` * or `CuboidRoom(Lx,Ly,Lz,β; Rd = myRd, Sr = mySr)` """ immutable CuboidRoom <: AbstractGeometry Lx::Float64 #x dimension Ly::Float64 #y dimension Lz::Float64 #z dimension β::Array{Float64,1} #reflection coefficients Rd::Float64 #random displacement Sr::Int64 #seed random displacement function CuboidRoom(Lx::Float64,Ly::Float64,Lz::Float64, β::Array{Float64,1},Rd::Float64,Sr::Int64) if(any([Lx;Ly;Lz].< 0)) error("room dimensions L should be positive") end if(length(β)!= 6) error("length(β) must be 6") end if(Sr < 0) error("Sr must be positive") end new(Lx,Ly,Lz,β,Rd,Sr) end end CuboidRoom(Lx::Float64,Ly::Float64,Lz::Float64,β::Array{Float64,1}; Rd::Float64 = 1e-2, Sr::Int64 = rand(1:10000) ) = CuboidRoom(Lx,Ly,Lz,β,Rd,Sr) #random displacement T60 input function CuboidRoom(Lx::Float64,Ly::Float64,Lz::Float64,T60::Float64,env::AcEnv; Rd::Float64 = 1e-2, Sr::Int64 = rand(1:10000) ) β = get_β(Lx,Ly,Lz,T60,env) CuboidRoom(Lx,Ly,Lz,β,Rd,Sr) end #calculate β using Eyring equation function get_β(Lx::Float64,Ly::Float64,Lz::Float64,T60::Float64, env::AcEnv) if(T60 < 0) error("T60 should be positive") end S = 2*( Lx*Ly+Lx*Lz+Ly*Lz ) # Total surface area V = prod([Lx;Ly;Lz]) α = 1-exp(-(24*V*log(10))/(env.c*T60*S)) # Absorption coefficient β =-sqrt(abs(1-α)).*ones(6) # Reflection coefficient return β end fun_name(f::CuboidRoom) = "cuboid room" fun_dim(f::CuboidRoom) = @sprintf("Lx x Ly x Lz = %.2f x %.2f x %.2f", f.Lx, f.Ly, f.Lz) fun_β(f::CuboidRoom) = @sprintf("frequency independent \n\n | βx1 | βx2 | βy1 | βy2 | βz1 | βz2 | \n | % 01.2f| % 01.2f| % 01.2f| % 01.2f| % 01.2f| % 01.2f|\n" , f.β[1],f.β[2],f.β[3],f.β[4],f.β[5],f.β[6]) fun_Rd(f::CuboidRoom) = "$(f.Rd) \n"