From 9ea3a4dec514bec47e020a069afc29cd5c096621 Mon Sep 17 00:00:00 2001 From: rodrigomha Date: Tue, 7 May 2024 12:41:45 -0700 Subject: [PATCH 1/6] add union --- src/feedforward/feedforward_constraints.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/feedforward/feedforward_constraints.jl b/src/feedforward/feedforward_constraints.jl index 25292824ce..9c1db8837e 100644 --- a/src/feedforward/feedforward_constraints.jl +++ b/src/feedforward/feedforward_constraints.jl @@ -448,7 +448,7 @@ Constructs a equality constraint to a fix a variable in one model using the vari function add_feedforward_constraints!( container::OptimizationContainer, ::DeviceModel, - devices::IS.FlattenIteratorWrapper{T}, + devices::Union{Vector{T}, IS.FlattenIteratorWrapper{T}}, ff::FixValueFeedforward, ) where {T <: PSY.Component} time_steps = get_time_steps(container) @@ -461,9 +461,9 @@ function add_feedforward_constraints!( variable = get_variable(container, var) set_name, set_time = JuMP.axes(variable) IS.@assert_op set_name == [PSY.get_name(d) for d in devices] - IS.@assert_op set_time == time_steps + #IS.@assert_op set_time == time_steps - for t in time_steps, name in set_name + for t in set_time, name in set_name JuMP.fix(variable[name, t], param[name, t] * multiplier[name, t]; force = true) end end From 051a8e57fc82629183e079a049d2df0acdc4f597 Mon Sep 17 00:00:00 2001 From: Jose Daniel Lara Date: Tue, 7 May 2024 22:45:42 -0600 Subject: [PATCH 2/6] fix issue with fixvariable from aux variable --- src/parameters/add_parameters.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/parameters/add_parameters.jl b/src/parameters/add_parameters.jl index f2f9060532..cf7650f6dc 100644 --- a/src/parameters/add_parameters.jl +++ b/src/parameters/add_parameters.jl @@ -401,8 +401,7 @@ function _add_parameters!( D, key, names, - time_steps; - meta = get_service_name(model), + time_steps, ) jump_model = get_jump_model(container) From eae3e7c9d2fd32c7083f885ff2e75ae70a603f21 Mon Sep 17 00:00:00 2001 From: Jose Daniel Lara Date: Wed, 8 May 2024 16:56:46 -0600 Subject: [PATCH 3/6] use try catch --- src/simulation/simulation.jl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/simulation/simulation.jl b/src/simulation/simulation.jl index aa0a77754f..0087842147 100644 --- a/src/simulation/simulation.jl +++ b/src/simulation/simulation.jl @@ -798,7 +798,11 @@ function _write_state_to_store!(store::SimulationStore, sim::Simulation) while _update_timestamp <= state_update_time state_values = get_decision_state_value(sim_state, key, _update_timestamp) ix = get_last_recorded_row(em_store, key) + 1 - write_result!(store, model_name, key, ix, _update_timestamp, state_values) + try + write_result!(store, model_name, key, ix, _update_timestamp, state_values) + catch + @error "could not write result for $(PSI.encode_key_as_string(key))" + end _update_timestamp += state_resolution end end From 236b341dc78165a96bf3095ab40f18b757a7a21b Mon Sep 17 00:00:00 2001 From: Jose Daniel Lara Date: Wed, 8 May 2024 18:28:49 -0600 Subject: [PATCH 4/6] use try catch in the store write --- src/simulation/simulation.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/simulation/simulation.jl b/src/simulation/simulation.jl index 0087842147..e36081659a 100644 --- a/src/simulation/simulation.jl +++ b/src/simulation/simulation.jl @@ -796,9 +796,9 @@ function _write_state_to_store!(store::SimulationStore, sim::Simulation) if store_update_time < state_update_time _update_timestamp = max(store_update_time + state_resolution, sim_ini_time) while _update_timestamp <= state_update_time - state_values = get_decision_state_value(sim_state, key, _update_timestamp) - ix = get_last_recorded_row(em_store, key) + 1 try + state_values = get_decision_state_value(sim_state, key, _update_timestamp) + ix = get_last_recorded_row(em_store, key) + 1 write_result!(store, model_name, key, ix, _update_timestamp, state_values) catch @error "could not write result for $(PSI.encode_key_as_string(key))" From 2139ae79ec73d3809156b1cc9bb27eefbb9219b6 Mon Sep 17 00:00:00 2001 From: Jose Daniel Lara Date: Thu, 9 May 2024 12:46:13 -0600 Subject: [PATCH 5/6] Update src/simulation/simulation.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/simulation/simulation.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/simulation/simulation.jl b/src/simulation/simulation.jl index e36081659a..4c22a51153 100644 --- a/src/simulation/simulation.jl +++ b/src/simulation/simulation.jl @@ -797,7 +797,8 @@ function _write_state_to_store!(store::SimulationStore, sim::Simulation) _update_timestamp = max(store_update_time + state_resolution, sim_ini_time) while _update_timestamp <= state_update_time try - state_values = get_decision_state_value(sim_state, key, _update_timestamp) + state_values = + get_decision_state_value(sim_state, key, _update_timestamp) ix = get_last_recorded_row(em_store, key) + 1 write_result!(store, model_name, key, ix, _update_timestamp, state_values) catch From 3bb2747a7a8501b1c4230013ebf62f999d3b7704 Mon Sep 17 00:00:00 2001 From: Jose Daniel Lara Date: Thu, 9 May 2024 12:46:18 -0600 Subject: [PATCH 6/6] Update src/simulation/simulation.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/simulation/simulation.jl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/simulation/simulation.jl b/src/simulation/simulation.jl index 4c22a51153..21978bb2e8 100644 --- a/src/simulation/simulation.jl +++ b/src/simulation/simulation.jl @@ -800,7 +800,14 @@ function _write_state_to_store!(store::SimulationStore, sim::Simulation) state_values = get_decision_state_value(sim_state, key, _update_timestamp) ix = get_last_recorded_row(em_store, key) + 1 - write_result!(store, model_name, key, ix, _update_timestamp, state_values) + write_result!( + store, + model_name, + key, + ix, + _update_timestamp, + state_values, + ) catch @error "could not write result for $(PSI.encode_key_as_string(key))" end