Skip to content
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
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SOLPS2ctrl"
uuid = "a531d12f-ac8a-43e8-b6d9-bd121431dd49"
version = "2.2.3"
authors = ["David Eldon <eldond@fusion.gat.com>"]
version = "2.2.2"

[deps]
Contour = "d38c429a-6771-53c6-b99e-75d170b6e991"
Expand All @@ -16,6 +16,7 @@ JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LsqFit = "2fda8390-95c7-5789-9bda-21331edee243"
PhysicalConstants = "5ad8b20f-a522-5ce9-bfc9-ddf1d5bda6ab"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
SOLPS2imas = "09becab6-0636-4c23-a92a-2b3723265c31"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
Expand All @@ -33,6 +34,7 @@ JSON = "0.21"
LinearAlgebra = "1"
LsqFit = "0.15.1"
PhysicalConstants = "0.2"
ProgressMeter = "1.11.0"
SOLPS2imas = "2.2"
Statistics = "1"
Unitful = "1"
Expand Down
1 change: 1 addition & 0 deletions src/SOLPS2ctrl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ using IMAS: IMAS
using SOLPS2imas: SOLPS2imas
using EFIT: EFIT
using Interpolations: Interpolations
using ProgressMeter

export find_files_in_allowed_folders, geqdsk_to_imas!, preparation

Expand Down
5 changes: 5 additions & 0 deletions src/controllers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ end
Float64,
(size(get_sys(plant).B, 2), size(target, 2)),
),
show_progress::Bool = false
) where {T, TE <: Discrete}

Generic function to run closed loop simulations with provided `plant`, actuator
Expand All @@ -483,6 +484,7 @@ adjustments to inputs and outputs of the plant model as explained in
control loop at an arbitrary point in the loop. `noise_plant_inp`, `noise_plant_out`,
and `noise_ctrl_out` allow addition of predefined noise waveforms at the input of plant,
output of plant, and the output of controller respectively.
If show_progress is set to true a progress bar will be shown.
"""
function run_closed_loop_sim(
plant::Plant,
Expand All @@ -506,6 +508,7 @@ function run_closed_loop_sim(
Float64,
(size(get_sys(plant).B, 2), size(target, 2)),
),
show_progress::Bool = false
)
# Take the plant, actuator, and controller by value
plant = deepcopy(plant)
Expand All @@ -519,6 +522,7 @@ function run_closed_loop_sim(
plant_out = zeros(Float64, (size(plant_sys.C, 1), length(target)))

# Closed loop simulation
prog = Progress(size(target,2); showspeed=true, enabled=show_progress)
for ii ∈ axes(target, 2)
# Actuation
plant_inp[:, ii] =
Expand All @@ -534,6 +538,7 @@ function run_closed_loop_sim(
ctrl(; ii, target, plant_inp, plant_out, act, inp_feedforward
) .+ noise_ctrl_out[:, ii+1]
end
next!(prog)
end
return Dict(
:plant => plant,
Expand Down
Loading