Skip to content

Commit

Permalink
fix storage
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-lara committed Jan 6, 2025
1 parent d26cc0d commit 621eabf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
18 changes: 9 additions & 9 deletions src/add_constraints.jl
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ function _add_constraints_cyclingcharge!(
# param_value
# )
#else
E_max = PSY.get_state_of_charge_limits(storage).max
E_max = PSY.get_storage_level_limits(storage).max
cycles_per_day = PSY.get_cycle_limits(storage)
cycles_in_horizon =
cycles_per_day * fraction_of_hour * length(time_steps) / HOURS_IN_DAY
Expand Down Expand Up @@ -967,7 +967,7 @@ function _add_constraints_cyclingcharge_withreserves!(
) <= param_value
)
else
E_max = PSY.get_state_of_charge_limits(storage).max
E_max = PSY.get_storage_level_limits(storage).max
cycles_per_day = PSY.get_cycle_limits(storage)
cycles_in_horizon =
cycles_per_day * fraction_of_hour * length(time_steps) / HOURS_IN_DAY
Expand Down Expand Up @@ -1005,7 +1005,7 @@ function _add_constraints_cyclingcharge_decisionmodel!(
ci_name = PSY.get_name(device)
storage = PSY.get_storage(device)
efficiency = PSY.get_efficiency(storage)
E_max = PSY.get_state_of_charge_limits(storage).max
E_max = PSY.get_storage_level_limits(storage).max
cycles_per_day = PSY.get_cycle_limits(storage)
cycles_in_horizon =
cycles_per_day * fraction_of_hour * length(time_steps) / HOURS_IN_DAY
Expand Down Expand Up @@ -1069,7 +1069,7 @@ function _add_constraints_cyclingdischarge!(
# sum(discharge_var[ci_name, :]) <= param_value
# )
#else
E_max = PSY.get_state_of_charge_limits(storage).max
E_max = PSY.get_storage_level_limits(storage).max
cycles_per_day = PSY.get_cycle_limits(storage)
cycles_in_horizon =
cycles_per_day * fraction_of_hour * length(time_steps) / HOURS_IN_DAY
Expand Down Expand Up @@ -1132,7 +1132,7 @@ function _add_constraints_cyclingdischarge_withreserves!(
) <= param_value
)
else
E_max = PSY.get_state_of_charge_limits(storage).max
E_max = PSY.get_storage_level_limits(storage).max
cycles_per_day = PSY.get_cycle_limits(storage)
cycles_in_horizon =
cycles_per_day * fraction_of_hour * length(time_steps) / HOURS_IN_DAY
Expand Down Expand Up @@ -1171,7 +1171,7 @@ function _add_constraints_cyclingdischarge_decisionmodel!(
storage = PSY.get_storage(device)
efficiency = PSY.get_efficiency(storage)

E_max = PSY.get_state_of_charge_limits(storage).max
E_max = PSY.get_storage_level_limits(storage).max
cycles_per_day = PSY.get_cycle_limits(storage)
cycles_in_horizon =
cycles_per_day * fraction_of_hour * length(time_steps) / HOURS_IN_DAY
Expand Down Expand Up @@ -2818,7 +2818,7 @@ function add_constraints!(
for dev in devices
n = PSY.get_name(dev)
storage = PSY.get_storage(dev)
e_max_ds = PSY.get_state_of_charge_limits(storage).max
e_max_ds = PSY.get_storage_level_limits(storage).max
for t in time_steps
assignment_constraint[n, t] =
JuMP.@constraint(jm, k_variable[n, t] == primal_var[n, t] - e_max_ds)
Expand Down Expand Up @@ -3334,7 +3334,7 @@ function add_constraints!(
for dev in devices
name = PSY.get_name(dev)
storage = PSY.get_storage(dev)
_, E_max = PSY.get_state_of_charge_limits(storage)
_, E_max = PSY.get_storage_level_limits(storage)
η_ch = storage.efficiency.in * Δt_RT
assignment_constraint[name] = JuMP.@constraint(
jm,
Expand Down Expand Up @@ -3371,7 +3371,7 @@ function add_constraints!(
for dev in devices
name = PSY.get_name(dev)
storage = PSY.get_storage(dev)
_, E_max = PSY.get_state_of_charge_limits(storage)
_, E_max = PSY.get_storage_level_limits(storage)
η_ch = storage.efficiency.in * Δt_RT
assignment_constraint[name] = JuMP.@constraint(
jm,
Expand Down
16 changes: 8 additions & 8 deletions src/feedforwards.jl
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function PSI.add_feedforward_constraints!(
) <= param_value
)
else
E_max = PSY.get_state_of_charge_limits(storage).max
E_max = PSY.get_storage_level_limits(storage).max
cycles_per_day = PSY.get_cycle_limits(storage)
cycles_in_horizon =
cycles_per_day * fraction_of_hour * length(time_steps) / HOURS_IN_DAY
Expand Down Expand Up @@ -197,20 +197,20 @@ function PSI.add_feedforward_constraints!(
ci_name = PSY.get_name(device)
storage = PSY.get_storage(device)
efficiency = PSY.get_efficiency(storage)
E_max = PSY.get_state_of_charge_limits(storage).max
E_max = PSY.get_storage_level_limits(storage).max
cycles_per_day = PSY.get_cycle_limits(storage)
cycles_in_horizon =
cycles_per_day * fraction_of_hour * length(time_steps) / HOURS_IN_DAY
if PSI.built_for_recurrent_solves(container)
param_value =
PSI.get_parameter_array(container, CyclingChargeLimitParameter(), D)[ci_name]
PSI.get_parameter_array(container, CyclingChargeLimitParameter(), D)[ci_name, time_steps[end]]
con_cycling_ch[ci_name] = JuMP.@constraint(
PSI.get_jump_model(container),
efficiency.in * fraction_of_hour * sum(charge_var[ci_name, :]) <=
param_value
)
else
E_max = PSY.get_state_of_charge_limits(storage).max
E_max = PSY.get_storage_level_limits(storage).max
cycles_per_day = PSY.get_cycle_limits(storage)
cycles_in_horizon =
cycles_per_day * fraction_of_hour * length(time_steps) / HOURS_IN_DAY
Expand Down Expand Up @@ -266,7 +266,7 @@ function PSI.add_feedforward_constraints!(
) <= param_value
)
else
E_max = PSY.get_state_of_charge_limits(storage).max
E_max = PSY.get_storage_level_limits(storage).max
cycles_per_day = PSY.get_cycle_limits(storage)
cycles_in_horizon =
cycles_per_day * fraction_of_hour * length(time_steps) / HOURS_IN_DAY
Expand Down Expand Up @@ -301,21 +301,21 @@ function PSI.add_feedforward_constraints!(
ci_name = PSY.get_name(device)
storage = PSY.get_storage(device)
efficiency = PSY.get_efficiency(storage)
E_max = PSY.get_state_of_charge_limits(storage).max
E_max = PSY.get_storage_level_limits(storage).max
cycles_per_day = PSY.get_cycle_limits(storage)
cycles_in_horizon =
cycles_per_day * fraction_of_hour * length(time_steps) / HOURS_IN_DAY
if PSI.built_for_recurrent_solves(container)
param_value =
PSI.get_parameter_array(container, CyclingDischargeLimitParameter(), D)[ci_name]
PSI.get_parameter_array(container, CyclingDischargeLimitParameter(), D)[ci_name, time_steps[end]]
con_cycling_ds[ci_name] = JuMP.@constraint(
PSI.get_jump_model(container),
(1.0 / efficiency.out) *
fraction_of_hour *
sum(discharge_var[ci_name, :]) <= param_value
)
else
E_max = PSY.get_state_of_charge_limits(storage).max
E_max = PSY.get_storage_level_limits(storage).max
cycles_per_day = PSY.get_cycle_limits(storage)
cycles_in_horizon =
cycles_per_day * fraction_of_hour * length(time_steps) / HOURS_IN_DAY
Expand Down

0 comments on commit 621eabf

Please sign in to comment.