Skip to content

Commit

Permalink
- partitionIndependentBlocks now succeeds all the way to codegen. Wil…
Browse files Browse the repository at this point in the history
…l need to check if it produces the correct result, too

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@9870 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Sep 19, 2011
1 parent 3fddbae commit 70fdddd
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions Compiler/BackEnd/SimCode.mo
Expand Up @@ -2170,7 +2170,7 @@ algorithm
parameterEquations = BackendDAEUtil.foldEqSystem(dlow2,createParameterEquations,{});
removedEquations = BackendDAEUtil.foldEqSystem(dlow2,createRemovedEquations,{});
algorithmAndEquationAsserts = BackendDAEUtil.foldEqSystem(dlow2,createAlgorithmAndEquationAsserts,{});
discreteModelVars = extractDiscreteModelVars(dlow2);
discreteModelVars = BackendDAEUtil.foldEqSystem(dlow2,extractDiscreteModelVars,{});
makefileParams = createMakefileParams(externalFunctionIncludes,libs);
(delayedExps,maxDelayedExpIndex) = extractDelayedExpressions(dlow2);

Expand Down Expand Up @@ -2670,9 +2670,9 @@ algorithm
maxDelayedExpIndex = Util.listFold(Util.listMap(delayedExps, Util.tuple21), intMax, -1);
then
(delayedExps,maxDelayedExpIndex+1);
case (_)
else
equation
Debug.fprintln("failtrace", "- SimCode.extractDelayedExpressions failed");
Error.addMessage(Error.INTERNAL_ERROR, {"SimCode.extractDelayedExpressions failed"});
then
fail();
end matchcontinue;
Expand Down Expand Up @@ -3374,26 +3374,33 @@ algorithm
end traversingisVarDiscreteCrefFinder;

protected function extractDiscreteModelVars
input BackendDAE.BackendDAE dlow;
input BackendDAE.EqSystem syst;
input BackendDAE.Shared shared;
input list<DAE.ComponentRef> acc;
output list<DAE.ComponentRef> discreteModelVars;
algorithm
discreteModelVars := match (dlow)
discreteModelVars := matchcontinue (syst,shared,acc)
local
BackendDAE.Variables v;
BackendDAE.EquationArray e;
list<DAE.ComponentRef> vLst1,vLst2;

case (BackendDAE.DAE(eqs=BackendDAE.EQSYSTEM(orderedVars=v,orderedEqs=e)::{}))
case (BackendDAE.EQSYSTEM(orderedVars=v,orderedEqs=e),_,acc)
equation
// select all discrete vars.
// remove those vars that are solved in when equations
//vLst = Util.listSelect2(vLst, dlow, mT, varNotSolvedInWhen);
// replace var with cref
vLst1 = BackendEquation.traverseBackendDAEEqns(e,traversingisVarDiscreteCrefFinder2,{});
vLst2 = BackendVariable.traverseBackendDAEVars(v,traversingisVarDiscreteCrefFinder,{});
vLst2 = listAppend(vLst2,acc);
vLst2 = Util.listUnionComp(vLst1, vLst2, ComponentReference.crefEqual);
then vLst2;
end match;
else
equation
Error.addMessage(Error.INTERNAL_ERROR,{"SimCode.extractDiscreteModelVars failed"});
then fail();
end matchcontinue;
end extractDiscreteModelVars;

protected function traversingisVarDiscreteCrefFinder2
Expand Down

0 comments on commit 70fdddd

Please sign in to comment.