Changeset 705e5e7d in OpenModelica


Ignore:
Timestamp:
2020-10-21T18:53:49+02:00 (3 years ago)
Author:
Adrian Pop <adrian.pop@…>
Branches:
maintenance/v1.16
Children:
3ffedaa
Parents:
03c9561
git-author:
Andreas <38031952+AnHeuermann@…> (10/06/20 16:15:23)
git-committer:
Adrian Pop <adrian.pop@…> (10/21/20 18:53:49)
Message:

Exclude constants from FMI modelDescription dependecies (#6803)

  • They are not part of the modelDescription yet.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • OMCompiler/Compiler/SimCode/SimCodeUtil.mo

    rc0e8727d r705e5e7d  
    1354813548  BackendDAE.AdjacencyMatrix outAdjacencyMatrix;
    1354913549  array<Integer> match1,match2;
     13550  Boolean debug = false;
    1355013551algorithm
    1355113552  initialUnknownCrefs := List.map(initialUnknownList, getCrefFromSimVar); // extract cref from initialUnknownsList
    13552   //print ("\n FmiInitialUnknownsDependencyList :" + ComponentReference.printComponentRefListStr(initialUnknownCrefs));
     13553  if debug then
     13554    print ("\n FmiInitialUnknownsDependencyList :" + ComponentReference.printComponentRefListStr(initialUnknownCrefs));
     13555  end if;
    1355313556
    1355413557  //prepare initialization DAE
     
    1355713560
    1355813561  BackendDAE.DAE(currentSystem::{},shared) := tmpBDAE;
    13559   //BackendDump.dumpVariables(currentSystem.orderedVars,"orderedVariables");
    13560   //BackendDump.dumpEquationArray(currentSystem.orderedEqs,"orderedEquation");
     13562  if debug then
     13563    BackendDump.dumpVariables(currentSystem.orderedVars,"orderedVariables");
     13564    BackendDump.dumpEquationArray(currentSystem.orderedEqs,"orderedEquation");
     13565  end if;
    1356113566
    1356213567  // traverse the simulation DAE globalknownVars and update the initialization DAE with new equations and vars
     
    1359013595  tmpBDAE := BackendDAEUtil.causalizeDAE(tmpBDAE, NONE(), BackendDAEUtil.getMatchingAlgorithm(SOME(strMatchingAlgorithm)), BackendDAEUtil.getIndexReductionMethod(SOME(strIndexReductionMethod)), false);
    1359113596
    13592   //BackendDump.dumpBackendDAE(tmpBDAE, "Check Initilization DAE");
     13597  if debug then
     13598    BackendDump.dumpBackendDAE(tmpBDAE, "Check Initilization DAE");
     13599  end if;
    1359313600
    1359413601  orderedVars := BackendVariable.equationSystemsVarsLst(tmpBDAE.eqs); // extract ordered vars
     
    1360113608  (depVars, indepVars) := getDepAndIndepVarsForInitialUnknowns(BackendVariable.varList(tmpBDAE.shared.globalKnownVars), depVars, indepVars, initialUnknownCrefs, crefSimVarHT);
    1360213609
    13603   //BackendDump.dumpVarList(depVars, "depVars");
    13604   //BackendDump.dumpVarList(indepVars, "indepVars");
     13610  if debug then
     13611    BackendDump.dumpVarList(depVars, "depVars");
     13612    BackendDump.dumpVarList(indepVars, "indepVars");
     13613  end if;
    1360513614
    1360613615  // Calculate the dependecies of initialUnknowns
    1360713616  (sparsePattern, _) := SymbolicJacobian.generateSparsePattern(tmpBDAE, indepVars, depVars);
    13608   //dumpFmiInitialUnknownsDependencies(sparsePattern, "FmiInitialUnknownDependency");
     13617  if debug then
     13618    dumpFmiInitialUnknownsDependencies(sparsePattern, "FmiInitialUnknownDependency");
     13619  end if;
    1360913620
    1361013621  // collect all variables from sparsePattern
     
    1364013651protected
    1364113652  DAE.ComponentRef cref;
    13642   SimCodeVar.SimVar referenceVar, tmpreferenceVar;
    13643   SimCodeVar.Causality tmpcausality;
    13644   SimCodeVar.Causality default_causality = SimCodeVar.LOCAL();
    13645   SimCodeVar.Variability default_variability = SimCodeVar.CONTINUOUS();
    13646   SimCodeVar.Initial tmpinitial_;
     13653  SimCodeVar.SimVar referenceVar;
     13654  SimCodeVar.Variability variability;
     13655  Boolean isConst = false;
    1364713656algorithm
    1364813657  for var in inVar loop
     
    1365513664    try
    1365613665      referenceVar := BaseHashTable.get(cref, crefSimVarHT); // lookup in the SimVar to get causality and initial attribute
    13657       //print("\n referenceVar name:"+ ComponentReference.printComponentRefStr(referenceVar.name) + "\n variability : " + anyString(referenceVar.variability) + "\n causality : " + anyString(referenceVar.causality) + "\n initial :" + anyString(referenceVar.initial_) + "\n");
    13658       if isCausalityInputSimVar(referenceVar) or isInitialExactSimVar(referenceVar) then
     13666      // Ignore constant variables for now, they are not in the modelDescription.xml
     13667      isConst := match (referenceVar.variability)
     13668        case SOME(SimCodeVar.Variability.CONSTANT()) then true;
     13669        else false;
     13670      end match;
     13671      if not isConst and (isCausalityInputSimVar(referenceVar) or isInitialExactSimVar(referenceVar)) then
    1365913672        outindepVars := var :: outindepVars;
    1366013673      end if;
Note: See TracChangeset for help on using the changeset viewer.