Skip to content

Commit

Permalink
Merge pull request #716 from ProjectTorreyPines/bop_setup_from_dd
Browse files Browse the repository at this point in the history
setup ActorThermalPlant from dd.bop
  • Loading branch information
TimSlendebroek authored Sep 23, 2024
2 parents 8eedf93 + 0acd217 commit 72094db
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
11 changes: 10 additions & 1 deletion src/actors/balance_plant/balance_of_plant_actor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,18 @@ function ActorBalanceOfPlant(dd::IMAS.dd, par::FUSEparameters__ActorBalanceOfPla
# set the time
@ddtime(dd.balance_of_plant.time = dd.global_time)

# set the heat sources
bop = dd.balance_of_plant
breeder_heat_load = isempty(dd.blanket.module) ? 0.0 : sum(bmod.time_slice[].power_thermal_extracted for bmod in dd.blanket.module)
@ddtime(bop.power_plant.breeder_heat_load = breeder_heat_load)
divertor_heat_load = isempty(dd.divertors.divertor) ? 0.0 : sum((@ddtime(div.power_incident.data)) for div in dd.divertors.divertor)
@ddtime(bop.power_plant.divertor_heat_load = divertor_heat_load)
wall_heat_load = abs(IMAS.radiation_losses(dd.core_sources))
@ddtime(bop.power_plant.wall_heat_load = wall_heat_load)

# setup actors
thermal_plant_actor = ActorThermalPlant(dd, act.ActorThermalPlant; par.do_plot)
power_needs_actor = ActorPowerNeeds(dd, act.ActorPowerNeeds)

return ActorBalanceOfPlant(dd, par, act, thermal_plant_actor, power_needs_actor)
end

Expand Down
29 changes: 10 additions & 19 deletions src/actors/balance_plant/thermal_plant_actor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,15 @@ function _step(actor::ActorThermalPlant)

bop = dd.balance_of_plant

# if use_actor_u is true then the actor will use the loading values in Actor.u instead of from dd
use_actor_u = false

if use_actor_u
breeder_heat_load = actor.u[1]
divertor_heat_load = actor.u[2]
wall_heat_load = actor.u[3]
else
blankets = IMAS.get_build_layers(dd.build.layer; type=_blanket_)
if isempty(blankets) # don't calculate anything in absence of a blanket
empty!(dd.balance_of_plant)
bop.power_plant.power_cycle_type = string(actor.power_cycle_type)
@warn "No blanket present for ActorThermalPlant to do anything"
return actor
end
breeder_heat_load = isempty(dd.blanket.module) ? 0.0 : sum(bmod.time_slice[].power_thermal_extracted for bmod in dd.blanket.module)
divertor_heat_load = isempty(dd.divertors.divertor) ? 0.0 : sum((@ddtime(div.power_incident.data)) for div in dd.divertors.divertor)
wall_heat_load = abs(IMAS.radiation_losses(dd.core_sources))
actor.u = [breeder_heat_load, divertor_heat_load, wall_heat_load]
breeder_heat_load = @ddtime(bop.power_plant.breeder_heat_load)
divertor_heat_load = @ddtime(bop.power_plant.divertor_heat_load)
wall_heat_load = @ddtime(bop.power_plant.wall_heat_load)

if isempty(breeder_heat_load == 0) # don't calculate anything in absence of a blanket
empty!(dd.balance_of_plant)
bop.power_plant.power_cycle_type = string(actor.power_cycle_type)
@warn "No blanket present for ActorThermalPlant to do anything"
return actor
end

# fixed cycle efficiency
Expand All @@ -115,6 +105,7 @@ function _step(actor::ActorThermalPlant)
end

# Buidling the TSM System
actor.u = [breeder_heat_load, divertor_heat_load, wall_heat_load]
if !actor.buildstatus
@debug "Rebuilding ActorThermalPlant"

Expand Down
1 change: 0 additions & 1 deletion src/cases/D3D.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ function case_parameters(::Type{Val{:D3D}}; scenario::Union{Symbol,AbstractStrin

act.ActorWholeFacility.update_build = false
act.ActorFluxMatcher.evolve_pedestal = false
act.ActorFluxMatcher.verbose = true
act.ActorStabilityLimits.raise_on_breach = false

if use_scenario_sources
Expand Down

0 comments on commit 72094db

Please sign in to comment.