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

Use extensions for proprietary actors #596

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 7 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ ClusterManagers = "34f1f09b-3a8b-5176-ab39-66d58a4d544e"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
EPEDNN = "e64856f0-3bb8-4376-b4b7-c03396503991"
FFMPEG = "c87230d0-a227-11e9-1b43-d7ebe4e7570a"
Expand All @@ -34,7 +33,7 @@ LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36"
MXHEquilibrium = "8efa4e5a-7b9a-4eec-876e-01d13d5b5d75"
Memoize = "c03570c3-d221-55d1-a50c-7939bbd78826"
Metaheuristics = "bcdb8e00-2c21-11e9-3065-2b553b22f898"
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
MillerExtendedHarmonic = "c82744c2-dc08-461a-8c37-87ab04d0f9b8"
NEO = "081d0416-0f87-42c0-8034-5895805e76d8"
NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
NNeutronics = "a9424c20-d414-11ec-167b-9106c24d956c"
Expand All @@ -56,12 +55,17 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
TEQUILA = "a60c9cbd-e72f-4185-96b6-b8fc312c4d37"
TGLFNN = "558c7b13-fd9f-4806-b461-592296cfa9d0"
TJLF = "12ecd31c-256b-4db5-a799-cd5afeb0bd7d"
ThermalSystemModels = "68b8b4ac-b179-4f07-8ae9-c1f1360acbca"
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
VacuumFields = "9d9223b5-c5da-4bf4-abee-2a8bb6775a49"
Weave = "44d3d7a6-8a23-5bf8-98c5-b353f8df5ec9"
YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"

[weakdeps]
ThermalSystemModels = "68b8b4ac-b179-4f07-8ae9-c1f1360acbca"

[extensions]
ThermalSystemModelsExt = "ThermalSystemModels"

[compat]
AbstractTrees = "0.4"
BoundaryPlasmaModels = "1"
Expand All @@ -70,7 +74,6 @@ CSV = "0.10"
ClusterManagers = "0.4"
DataFrames = "1"
DelimitedFiles = "1"
DifferentialEquations = "7"
EPEDNN = "1"
FFMPEG = "0.4"
FileIO = "1"
Expand All @@ -88,7 +91,6 @@ LoggingExtras = "1"
MXHEquilibrium = "1"
Memoize = "0.4"
Metaheuristics = "3"
ModelingToolkit = "9"
NEO = "1"
NLsolve = "4"
NNeutronics = "1"
Expand Down
13 changes: 13 additions & 0 deletions ext/ThermalSystemModelsExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module ThermalSystemModelsExt

# import FUSE namespace
import FUSE
for n in names(FUSE; all=true)
if Base.isidentifier(n) && n ∉ (Symbol(FUSE), :eval, :include)
@eval import FUSE: $n
end
end

include(joinpath("..","src", "actors", "balance_plant", "thermal_plant_actor_ext.jl"))

end
3 changes: 3 additions & 0 deletions proprietary_envs/GA/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[deps]
FUSE = "e64856f0-3bb8-4376-b4b7-c03396503992"
ThermalSystemModels = "68b8b4ac-b179-4f07-8ae9-c1f1360acbca"
7 changes: 5 additions & 2 deletions src/actors/balance_plant/balance_of_plant_actor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ Base.@kwdef mutable struct FUSEparameters__ActorBalanceOfPlant{T<:Real} <: Param
do_plot::Entry{Bool} = act_common_parameters(; do_plot=false)
end

ext = Base.get_extension(@__MODULE__, :ThermalSystemModelsExt)

mutable struct ActorBalanceOfPlant{D,P} <: CompoundAbstractActor{D,P}
dd::IMAS.dd{D}
par::FUSEparameters__ActorBalanceOfPlant{P}
act::ParametersAllActors
thermal_plant_actor::ActorThermalPlant{D}
thermal_plant_actor::Union{ActorNoOperation{D}, AbstractActorThermalPlant{D}}
power_needs_actor::ActorPowerNeeds{D}
end

Expand Down Expand Up @@ -47,7 +49,8 @@ function ActorBalanceOfPlant(dd::IMAS.dd, par::FUSEparameters__ActorBalanceOfPla
@ddtime(bop.power_plant.heat_load.wall = wall_heat_load)

# setup actors
thermal_plant_actor = ActorThermalPlant(dd, act.ActorThermalPlant; par.do_plot)
ext = Base.get_extension(@__MODULE__, :ThermalSystemModelsExt)
thermal_plant_actor = isnothing(ext) ? ActorNoOperation(dd, act.ActorNoOperation) : ext.ActorThermalPlant(dd, act.ActorThermalPlant)
power_needs_actor = ActorPowerNeeds(dd, act.ActorPowerNeeds)
return ActorBalanceOfPlant(dd, par, act, thermal_plant_actor, power_needs_actor)
end
Expand Down
Loading
Loading