Transform predetermined variables before simplifying equations

Equation simplification takes leads/lags into account, so those need to be
correct upon entry of the procedure.
fix-tolerance-parameters
Sébastien Villemot 2022-02-17 12:57:54 +01:00
parent c03f4a559a
commit cb78300e95
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
1 changed files with 5 additions and 4 deletions

View File

@ -376,20 +376,21 @@ ModFile::transformPass(bool nostrict, bool stochastic, bool compute_xrefs, bool
const string &exclude_eqs, const string &include_eqs)
{
/* Save the original model (must be done before any model transformations by preprocessor)
except predetermined variables (which must be handled before the call to
setLeadsLagsOrig(), see #47, and also before equation simplification,
since the latter uses leads/lags, see #83)
except substituting out variables which we know are constant (they
appear in an equation of the form: X = constant)
except adl operators which we always want expanded
except predetermined variables (which must be handled before the call to
setLeadsLagsOrig(), see preprocessor#47)
except diff operators with a lead which have been expanded by
DataTree:AddDiff()
*/
dynamic_model.includeExcludeEquations(exclude_eqs, true);
dynamic_model.includeExcludeEquations(include_eqs, false);
dynamic_model.simplifyEquations();
dynamic_model.substituteAdl();
if (symbol_table.predeterminedNbr() > 0)
dynamic_model.transformPredeterminedVariables();
dynamic_model.simplifyEquations();
dynamic_model.substituteAdl();
dynamic_model.setLeadsLagsOrig();
original_model = dynamic_model;
dynamic_model.expandEqTags();