Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

Commit

Permalink
dont add A-Vars of statesets to BackendDAE
Browse files Browse the repository at this point in the history
  • Loading branch information
vwaurich authored and OpenModelica-Hudson committed Nov 21, 2016
1 parent 555ce77 commit 63b77e7
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions Compiler/SimCode/SimCodeUtil.mo
Original file line number Diff line number Diff line change
Expand Up @@ -3976,32 +3976,29 @@ algorithm
case (syst as BackendDAE.EQSYSTEM(orderedVars=vars, orderedEqs=eqns, matching=BackendDAE.MATCHING(comps=comps), stateSets=stateSets),
(equations, uniqueEqIndex, tempvars, numStateSets))
equation
(vars, equations, uniqueEqIndex, tempvars, numStateSets) =
createStateSetsSets(stateSets, vars, eqns, inShared, comps, equations, uniqueEqIndex, tempvars, numStateSets);
syst.orderedVars = vars;
(equations, uniqueEqIndex, tempvars, numStateSets) =
createStateSetsSets(stateSets, vars, eqns, comps, equations, uniqueEqIndex, tempvars, numStateSets);
then
(syst, (equations, uniqueEqIndex, tempvars, numStateSets));
(syst,(equations, uniqueEqIndex, tempvars, numStateSets));
end match;
end createStateSetsSystem;

protected function createStateSetsSets
input BackendDAE.StateSets iStateSets;
input BackendDAE.Variables iVars;
input BackendDAE.EquationArray iEqns;
input BackendDAE.Shared shared;
input BackendDAE.StrongComponents comps;
input list<SimCode.StateSet> iEquations;
input Integer iuniqueEqIndex;
input list<SimCodeVar.SimVar> itempvars;
input Integer iNumStateSets;
output BackendDAE.Variables oVars;
output list<SimCode.StateSet> oEquations;
output Integer ouniqueEqIndex;
output list<SimCodeVar.SimVar> otempvars;
output Integer oNumStateSets;
algorithm
(oVars, oEquations, ouniqueEqIndex, otempvars, oNumStateSets) :=
matchcontinue(iStateSets, iVars, iEqns, shared, comps, iEquations, iuniqueEqIndex, itempvars, iNumStateSets)
(oEquations, ouniqueEqIndex, otempvars, oNumStateSets) :=
matchcontinue(iStateSets, iVars, iEqns, comps, iEquations, iuniqueEqIndex, itempvars, iNumStateSets)
local
DAE.FunctionTree functree;
BackendDAE.StateSets sets;
Expand All @@ -4014,24 +4011,24 @@ algorithm
list<DAE.ComponentRef> crstates;
SimCode.JacobianMatrix jacobianMatrix;
list<SimCode.StateSet> simequations;
list<SimCodeVar.SimVar> tempvars;
list<SimCodeVar.SimVar> tempvars, simCodeAVars;
Integer uniqueEqIndex;
HashSet.HashSet hs;
array<Boolean> marked;
BackendDAE.ExtraInfo ei;
BackendDAE.Jacobian jacobian;
String errorMessage;

case({}, _, _, _, _, _, _, _, _) then (iVars, iEquations, iuniqueEqIndex, itempvars, iNumStateSets);
case({}, _, _, _, _, _, _, _) then (iEquations, iuniqueEqIndex, itempvars, iNumStateSets);

case(BackendDAE.STATESET(rang=rang, state=crset, crA=crA, varA=aVars, statescandidates=statevars, jacobian=jacobian)::sets, _, _,
_, _, _, _, _, _)
_, _, _, _, _)
equation
// get state names
crstates = List.map(statevars, BackendVariable.varCref);

// add vars for A
vars = BackendVariable.addVars(aVars, iVars);
// create vars for A
simCodeAVars = List.map2(aVars, dlowvarToSimvar, NONE(), iVars);

// get first a element for varinfo
crA = ComponentReference.subscriptCrefWithInt(crA, 1);
Expand All @@ -4041,12 +4038,12 @@ algorithm
nCandidates = listLength(statevars);

// create symbolic jacobian for simulation
(SOME(jacobianMatrix), uniqueEqIndex, tempvars) = createSymbolicSimulationJacobian(jacobian, iuniqueEqIndex, itempvars);
(SOME(jacobianMatrix), uniqueEqIndex, tempvars) = createSymbolicSimulationJacobian(jacobian, iuniqueEqIndex, listAppend(itempvars,simCodeAVars));

// next set
(vars, simequations, uniqueEqIndex, tempvars, numStateSets) = createStateSetsSets(sets, vars, iEqns, shared, comps, SimCode.SES_STATESET(iuniqueEqIndex, nCandidates, rang, crset, crstates, crA, jacobianMatrix)::iEquations, uniqueEqIndex, tempvars, iNumStateSets+1);
(simequations, uniqueEqIndex, tempvars, numStateSets) = createStateSetsSets(sets, iVars, iEqns, comps, SimCode.SES_STATESET(iuniqueEqIndex, nCandidates, rang, crset, crstates, crA, jacobianMatrix)::iEquations, uniqueEqIndex, tempvars, iNumStateSets+1);
then
(vars, simequations, uniqueEqIndex, tempvars, numStateSets);
(simequations, uniqueEqIndex, tempvars, numStateSets);
else
equation
errorMessage = "function createStateSetsSets failed.";
Expand Down

0 comments on commit 63b77e7

Please sign in to comment.