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

change error checking #1131

Merged
merged 3 commits into from
Aug 20, 2024
Merged
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: 5 additions & 1 deletion src/parameters/update_parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,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
Loading