Skip to content

Commit

Permalink
Merge pull request #1131 from NREL-Sienna/jd/assertion_issue
Browse files Browse the repository at this point in the history
change error checking
  • Loading branch information
jd-lara authored Aug 20, 2024
2 parents 4218c87 + 7314623 commit 5b79ebb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/parameters/update_parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,18 @@ function _update_parameter_values!(
for name in component_names
# Pass indices in this way since JuMP DenseAxisArray don't support view()
value = round(state_values[name, state_data_index])
@assert 0.0 <= value <= 1.0
if !isfinite(value)
error(
"The value for the system state used in $(encode_key_as_string(get_attribute_key(attributes))) is not a finite value $(value) \
This is commonly caused by referencing a state value at a time when such decision hasn't been made. \
Consider reviewing your models' horizon and interval definitions",
)
end
if 0.0 > value || value > 1.0
error(
"The value for the system state used in $(encode_key_as_string(get_attribute_key(attributes))): $(value) is out of the [0, 1] range",
)
end
_set_param_value!(parameter_array, value, name, t)
end
end
Expand Down

0 comments on commit 5b79ebb

Please sign in to comment.