Changeset e62a382 in OpenModelica


Ignore:
Timestamp:
2020-10-21T18:53:49+02:00 (4 years ago)
Author:
Adrian Pop <adrian.pop@…>
Branches:
maintenance/v1.16
Children:
82316a99
Parents:
c850391
git-author:
Karim Abdelhak <karim.abdelhak@…> (10/08/20 13:27:03)
git-committer:
Adrian Pop <adrian.pop@…> (10/21/20 18:53:49)
Message:

[BE] remove empty initial equations

  • filter the initial equations for equations that do not have initial unknowns and remove them
  • needed for data reconciliation since there might be initial equations for state derivatives of states that got removed during data recon
Location:
OMCompiler/Compiler/BackEnd
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • OMCompiler/Compiler/BackEnd/BackendEquation.mo

    r315a2d2 re62a382  
    32373237end createResidualExp;
    32383238
     3239public function hasAnyUnknown
     3240  input BackendDAE.Equation eqn;
     3241  input BackendDAE.Variables vars;
     3242  output Boolean b;
     3243algorithm
     3244  b := not listEmpty(equationVars(eqn, vars));
     3245end hasAnyUnknown;
     3246
    32393247annotation(__OpenModelica_Interface="backend");
    32403248end BackendEquation;
  • OMCompiler/Compiler/BackEnd/Initialization.mo

    rc0e8727d re62a382  
    11691169  DoubleEnded.MutableList<BackendDAE.Var> dumpVars;
    11701170  DoubleEnded.MutableList<BackendDAE.Equation> removedEqns;
     1171  list<BackendDAE.Equation> filtered_initial_eqs;
    11711172algorithm
    11721173  // filter empty systems
     
    11781179      eqs := syst::eqs;
    11791180    else
    1180       DoubleEnded.push_list_back(removedEqns, BackendEquation.equationList(syst.orderedEqs));
     1181      filtered_initial_eqs := list(eqn for eqn guard(BackendEquation.hasAnyUnknown(eqn, inInitVars)) in BackendEquation.equationList(syst.orderedEqs));
     1182      DoubleEnded.push_list_back(removedEqns, filtered_initial_eqs);
    11811183      DoubleEnded.push_list_back(removedEqns, BackendEquation.equationList(syst.removedEqs));
    11821184    end if;
Note: See TracChangeset for help on using the changeset viewer.