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

Rh/add vector to methods #1106

Merged
merged 6 commits into from
May 13, 2024
Merged
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
6 changes: 3 additions & 3 deletions src/feedforward/feedforward_constraints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/parameters/add_parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
18 changes: 15 additions & 3 deletions src/simulation/simulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -796,9 +796,21 @@ 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
write_result!(store, model_name, key, ix, _update_timestamp, state_values)
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))"
end
_update_timestamp += state_resolution
end
end
Expand Down
Loading