Commit 542c5216 authored by Tjerk Vreeken's avatar Tjerk Vreeken

Revert "CollInt: Fix missing parameter check to include NaN"

This reverts commit 038975e7.

There are many models that have parameters that are not used. For
example, species transport in RTC-Tools Channel Flow might use a
"V_nominal" for linearization, but if there are no species this
parameter is never used.

We would rather like to check on parameters that are actually used, but
that would be an expensive check to always perform for every run. It is
probably better to put a check like that behind an optional flag for
performing such checks.
parent c7985d80
......@@ -227,13 +227,7 @@ class CollocatedIntegratedOptimizationProblem(OptimizationProblem, metaclass=ABC
for i, symbol in enumerate(self.dae_variables['parameters']):
variable = symbol.name()
try:
p_i = parameter_values[i] = parameters[variable]
if isinstance(p_i, (ca.MX, ca.DM)):
# Cannot use np.isnan on CasADi matrix types
if p_i.is_constant() and np.isnan(float(p_i)):
raise KeyError
elif np.isnan(p_i):
raise KeyError
parameter_values[i] = parameters[variable]
except KeyError:
raise Exception(
"No value specified for parameter {}".format(variable))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment