Changeset 705e5e7d in OpenModelica
- Timestamp:
- 2020-10-21T18:53:49+02:00 (3 years ago)
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
OMCompiler/Compiler/SimCode/SimCodeUtil.mo
rc0e8727d r705e5e7d 13548 13548 BackendDAE.AdjacencyMatrix outAdjacencyMatrix; 13549 13549 array<Integer> match1,match2; 13550 Boolean debug = false; 13550 13551 algorithm 13551 13552 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; 13553 13556 13554 13557 //prepare initialization DAE … … 13557 13560 13558 13561 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; 13561 13566 13562 13567 // traverse the simulation DAE globalknownVars and update the initialization DAE with new equations and vars … … 13590 13595 tmpBDAE := BackendDAEUtil.causalizeDAE(tmpBDAE, NONE(), BackendDAEUtil.getMatchingAlgorithm(SOME(strMatchingAlgorithm)), BackendDAEUtil.getIndexReductionMethod(SOME(strIndexReductionMethod)), false); 13591 13596 13592 //BackendDump.dumpBackendDAE(tmpBDAE, "Check Initilization DAE"); 13597 if debug then 13598 BackendDump.dumpBackendDAE(tmpBDAE, "Check Initilization DAE"); 13599 end if; 13593 13600 13594 13601 orderedVars := BackendVariable.equationSystemsVarsLst(tmpBDAE.eqs); // extract ordered vars … … 13601 13608 (depVars, indepVars) := getDepAndIndepVarsForInitialUnknowns(BackendVariable.varList(tmpBDAE.shared.globalKnownVars), depVars, indepVars, initialUnknownCrefs, crefSimVarHT); 13602 13609 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; 13605 13614 13606 13615 // Calculate the dependecies of initialUnknowns 13607 13616 (sparsePattern, _) := SymbolicJacobian.generateSparsePattern(tmpBDAE, indepVars, depVars); 13608 //dumpFmiInitialUnknownsDependencies(sparsePattern, "FmiInitialUnknownDependency"); 13617 if debug then 13618 dumpFmiInitialUnknownsDependencies(sparsePattern, "FmiInitialUnknownDependency"); 13619 end if; 13609 13620 13610 13621 // collect all variables from sparsePattern … … 13640 13651 protected 13641 13652 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; 13647 13656 algorithm 13648 13657 for var in inVar loop … … 13655 13664 try 13656 13665 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 13659 13672 outindepVars := var :: outindepVars; 13660 13673 end if;
Note: See TracChangeset
for help on using the changeset viewer.