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

DNMY this is a performance test #1146

Closed
wants to merge 21 commits into from
Closed
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
3 changes: 1 addition & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,13 @@ DocStringExtensions = "~v0.9"
HDF5 = "~0.17"
InfrastructureSystems = "2"
InteractiveUtils = "1"
JSON = "0.21"
JSON3 = "1"
JuMP = "1"
LinearAlgebra = "1"
Logging = "1"
MathOptInterface = "1"
PowerModels = "^0.21"
PowerNetworkMatrices = "^0.11"
PowerNetworkMatrices = "^0.11.1"
PowerSystems = "4"
PrettyTables = "2"
ProgressMeter = "^1.5"
Expand Down
6 changes: 4 additions & 2 deletions src/PowerSimulations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,6 @@ import TimeSeries

# I/O Imports
import DataFrames
import JSON
import CSV
import HDF5
import PrettyTables
Expand Down Expand Up @@ -513,7 +512,6 @@ include("feedforward/feedforward_arguments.jl")
include("feedforward/feedforward_constraints.jl")

include("parameters/add_parameters.jl")
include("parameters/update_parameters.jl")

include("simulation/optimization_output_cache.jl")
include("simulation/optimization_output_caches.jl")
Expand All @@ -534,6 +532,10 @@ include("simulation/simulation_internal.jl")
include("simulation/simulation.jl")
include("simulation/simulation_results_export.jl")
include("simulation/simulation_results.jl")
include("operation/operation_model_simulation_interface.jl")
include("parameters/update_container_parameter_values.jl")
include("parameters/update_cost_parameters.jl")
include("parameters/update_parameters.jl")

include("devices_models/devices/common/objective_function/common.jl")
include("devices_models/devices/common/objective_function/linear_curve.jl")
Expand Down
16 changes: 0 additions & 16 deletions src/operation/decision_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -560,19 +560,3 @@ function solve!(
end
return get_run_status(model)
end

function update_parameters!(
model::DecisionModel,
decision_states::DatasetContainer{InMemoryDataset},
)
cost_function_unsynch(get_optimization_container(model))
for key in keys(get_parameters(model))
update_parameter_values!(model, key, decision_states)
end
if !is_synchronized(model)
update_objective_function!(get_optimization_container(model))
obj_func = get_objective_expression(get_optimization_container(model))
set_synchronized_status!(obj_func, true)
end
return
end
24 changes: 24 additions & 0 deletions src/operation/emulation_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,30 @@ function update_model!(
return
end

"""
Update parameter function an OperationModel
"""
function update_parameter_values!(
model::EmulationModel,
key::ParameterKey{T, U},
input::DatasetContainer{InMemoryDataset},
) where {T <: ParameterType, U <: PSY.Component}
# Enable again for detailed debugging
# TimerOutputs.@timeit RUN_SIMULATION_TIMER "$T $U Parameter Update" begin
optimization_container = get_optimization_container(model)
update_container_parameter_values!(optimization_container, model, key, input)
parameter_attributes = get_parameter_attributes(optimization_container, key)
IS.@record :execution ParameterUpdateEvent(
T,
U,
parameter_attributes,
get_current_timestamp(model),
get_name(model),
)
#end
return
end

function update_model!(model::EmulationModel)
update_model!(model, get_store(model), InterProblemChronology())
return
Expand Down
10 changes: 0 additions & 10 deletions src/operation/operation_model_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -441,16 +441,6 @@ function serialize_optimization_model(model::OperationModel)
return
end

function update_model!(model::OperationModel, source, ini_cond_chronology)
TimerOutputs.@timeit RUN_SIMULATION_TIMER "Parameter Updates" begin
update_parameters!(model, get_decision_states(source))
end
TimerOutputs.@timeit RUN_SIMULATION_TIMER "Ini Cond Updates" begin
update_initial_conditions!(model, source, ini_cond_chronology)
end
return
end

function instantiate_network_model(model::OperationModel)
template = get_template(model)
network_model = get_network_model(template)
Expand Down
31 changes: 31 additions & 0 deletions src/operation/operation_model_simulation_interface.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
function update_model!(model::OperationModel, source::SimulationState, ini_cond_chronology)
TimerOutputs.@timeit RUN_SIMULATION_TIMER "Parameter Updates" begin
update_parameters!(model, source)
end
TimerOutputs.@timeit RUN_SIMULATION_TIMER "Ini Cond Updates" begin
update_initial_conditions!(model, source, ini_cond_chronology)
end
return
end

function update_parameters!(model::EmulationModel, state::SimulationState)
data = get_decision_states(state)
update_parameters!(model, data)
return

Check warning on line 14 in src/operation/operation_model_simulation_interface.jl

View check run for this annotation

Codecov / codecov/patch

src/operation/operation_model_simulation_interface.jl#L11-L14

Added lines #L11 - L14 were not covered by tests
end

function update_parameters!(
model::DecisionModel,
simulation_state::SimulationState,
)
cost_function_unsynch(get_optimization_container(model))
for key in keys(get_parameters(model))
update_parameter_values!(model, key, simulation_state)
end
if !is_synchronized(model)
update_objective_function!(get_optimization_container(model))
obj_func = get_objective_expression(get_optimization_container(model))
set_synchronized_status!(obj_func, true)

Check warning on line 28 in src/operation/operation_model_simulation_interface.jl

View check run for this annotation

Codecov / codecov/patch

src/operation/operation_model_simulation_interface.jl#L26-L28

Added lines #L26 - L28 were not covered by tests
end
return
end
Loading
Loading