Skip to content

Commit

Permalink
Model update
Browse files Browse the repository at this point in the history
Moved constructor outside so that default interface can be used in a model, maybe the code is better this way because more readable.
  • Loading branch information
wallytutor committed Apr 4, 2024
1 parent 0789bd9 commit a0938ef
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 75 deletions.
27 changes: 18 additions & 9 deletions script/process-balances.jl
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ struct CooledCrusherUnits

# Premix meal that is not iterated upon.
meal_stream = clinker_stream
meal_stream += crusher_air_stream
meal_stream += parasite_air_stream

# Run iterative procedure till steady-state.
Expand Down Expand Up @@ -315,7 +314,7 @@ struct CooledCrusherUnits

# Add crushing energy and cool down system.
# TODO T_out_crush can be actually *computed*!
crusher, T_out_cool, T_out_crush = cooled_crushing(
mid_crusher, T_out_cool, T_out_crush = cooled_crushing(
product = product,
coolant = cooling_stream,
power = milling_power,
Expand All @@ -324,6 +323,16 @@ struct CooledCrusherUnits
glob_htc = htc_cru
)

# Mix crusher product with *dilution air*
crusher = CooledCrushingMill(
mid_crusher.rawmeal,
mid_crusher.product + crusher_air_stream,
mid_crusher.coolant,
mid_crusher.power,
mid_crusher.loss,
mid_crusher.globalhtc
)

# Loose some heat in vertical pipeline.
rets = transport_pipe(crusher.product, T_in_sep, T_env, htc_sep)
transport_sep, T_in_sep = rets
Expand Down Expand Up @@ -526,8 +535,8 @@ begin
end

let # Crushing air inlet.
p0 = Luxor.Point(-150, -50)
p1 = Luxor.Point(-150, 0)
p0 = Luxor.Point(110, -40)
p1 = Luxor.Point(110, 0)
Luxor.sethue(colorair)
Luxor.arrow(p0, p1)
Luxor.move(p0)
Expand Down Expand Up @@ -637,8 +646,8 @@ begin
radius = 2
Luxor.sethue("black")
Luxor.circle(Luxor.Point(-200, 0), radius; action = :fill)
Luxor.circle(Luxor.Point(-150, 0), radius; action = :fill)
Luxor.circle(Luxor.Point(-100, 0), radius; action = :fill)
Luxor.circle(Luxor.Point(110, 0), radius; action = :fill)
Luxor.circle(Luxor.Point(125, -70), radius; action = :fill)
Luxor.circle(Luxor.Point(230, -100), radius; action = :fill)
end
Expand Down Expand Up @@ -713,7 +722,7 @@ begin
Luxor.Point(96, -70); valign, halign = :right)

Luxor.text("$(q_cru_air) Nm³/h (3)",
Luxor.Point(-150, -60); valign, halign = :center)
Luxor.Point(100, -45); valign, halign = :right)

Luxor.text("$(q_par_air) Nm³/h (2)",
Luxor.Point(-269, -50); valign, halign = :right)
Expand Down Expand Up @@ -803,16 +812,16 @@ end
begin
@info "Reference measured data"

const ϕ = 31.5
const ϕ = 77.64
const ηseparator = 47.65

const T_env = 5.0
const T_out_cool = 93.0
const T_out_cool = 75.0
const T_in_sep = 73.0
const T_out_rec = 39.0

const q̇_tot_air = 3600.0
const q̇_cru_air = 1881
const q̇_cru_air = 1881.0
const q̇_sep_air = 431.0

const ṁ_clinker = 820.0
Expand Down
134 changes: 68 additions & 66 deletions src/DryFlowsheet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -256,85 +256,87 @@ struct CooledCrushingMill
"Global heat transfer coefficient [W/K]."
globalhtc::Union{Nothing, Float64}

function CooledCrushingMill(;
product,
coolant,
power,
model,
verbose = true,
kwargs...
)
##########
# INITIAL
##########

Δq = 0.0
loss = EnergyStream(Δq)
meal = product
ghtc = nothing

##########
# MODEL
##########
end

if model == :TARGET_COOLANT_TEMP
# Compute enthalpy change in cooling stream.
Δq = exchanged_heat(coolant, kwargs[:temp_out])
function CooledCrushingMill(;
product,
coolant,
power,
model,
verbose = true,
kwargs...
)
##########
# INITIAL
##########

Δq = 0.0
loss = EnergyStream(Δq)
meal = product
ghtc = nothing

##########
# MODEL
##########

if model == :TARGET_COOLANT_TEMP
# Compute enthalpy change in cooling stream.
Δq = exchanged_heat(coolant, kwargs[:temp_out])

# Stream of energy to correct system temperature.
loss = EnergyStream(Δq)

# Stream of energy to correct system temperature.
loss = EnergyStream(Δq)
# Correct energy in both streams.
product += power - loss
coolant += loss
end

# Correct energy in both streams.
product += power - loss
coolant += loss
end
if model == :USING_GLOBAL_HTC
# Compute enthalpy change with coolant.
T∞ = 0.5*(kwargs[:temp_out] + coolant.T)
T₂ = 0.5*(kwargs[:temp_cru] + product.T)
ghtc = kwargs[:glob_htc]

if model == :USING_GLOBAL_HTC
# Compute enthalpy change with coolant.
T∞ = 0.5*(kwargs[:temp_out] + coolant.T)
T₂ = 0.5*(kwargs[:temp_cru] + product.T)
ghtc = kwargs[:glob_htc]

# TODO add losses to environment through shell like in:
# 10.45*(T_ext - 0.5*(kwargs[:temp_env] + coolant.T))

# The value must be the absolute intake by the coolant
# thus a minus sign in front of it.
Δq = -ghtc * (T∞ - T₂)
# TODO add losses to environment through shell like in:
# 10.45*(T_ext - 0.5*(kwargs[:temp_env] + coolant.T))

# The value must be the absolute intake by the coolant
# thus a minus sign in front of it.
Δq = -ghtc * (T∞ - T₂)

# Stream of energy to correct system temperature.
loss = EnergyStream(Δq)
# Stream of energy to correct system temperature.
loss = EnergyStream(Δq)

# Correct energy in both streams.
product += power - loss
coolant += loss
end
# Correct energy in both streams.
product += power - loss
coolant += loss
end

##########
# POST
##########
##########
# POST
##########

verbose && begin
rounder(v) = round(v; digits = 1)
Q = rounder(ustrip(uconvert(u"kW", power.* u"W")))
p = rounder(ustrip(uconvert(u"kW", Δq * u"W")))
T = rounder(ustrip(uconvert(u"°C", product.T * u"K")))
verbose && begin
rounder(v) = round(v; digits = 1)
Q = rounder(ustrip(uconvert(u"kW", power.* u"W")))
p = rounder(ustrip(uconvert(u"kW", Δq * u"W")))
T = rounder(ustrip(uconvert(u"°C", product.T * u"K")))

@info """
CooledCrushingMill with model $(model)
@info """
CooledCrushingMill with model $(model)
Power applied to product stream...: $(Q) kW
Heat extracted by cooling system..: $(p) kW
Product stream final temperature..: $(T) °C
"""
end
Power applied to product stream...: $(Q) kW
Heat extracted by cooling system..: $(p) kW
Product stream final temperature..: $(T) °C
"""
end

##########
# NEW
##########
##########
# NEW
##########

return new(meal, product, coolant, power, loss, ghtc)
end
return CooledCrushingMill(meal, product, coolant, power, loss, ghtc)
end

#############################################################################
Expand Down

0 comments on commit a0938ef

Please sign in to comment.