Skip to content

Commit

Permalink
Updating the QSS template and backend
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@14915 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
fbergero committed Jan 24, 2013
1 parent daabcac commit 799cb8d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
16 changes: 8 additions & 8 deletions Compiler/BackEnd/BackendQSS.mo
Expand Up @@ -70,18 +70,19 @@ end QSSinfo;

public function generateStructureCodeQSS
input BackendDAE.BackendDAE inBackendDAE;
input array<Integer> equationIndices;
/*input array<Integer> equationIndices;
input array<Integer> variableIndices;
input BackendDAE.IncidenceMatrix inIncidenceMatrix;
input BackendDAE.IncidenceMatrixT inIncidenceMatrixT;
input BackendDAE.StrongComponents strongComponents;
*/
input SimCode.SimCode simCode;

output QSSinfo QSSinfo_out;
output SimCode.SimCode simC;
algorithm
(QSSinfo_out,simC) :=
matchcontinue (inBackendDAE, equationIndices, variableIndices, inIncidenceMatrix, inIncidenceMatrixT, strongComponents,simCode)
matchcontinue (inBackendDAE, /*equationIndices, variableIndices, inIncidenceMatrix, inIncidenceMatrixT, strongComponents,*/ simCode)
local
BackendDAE.BackendDAE dlow;
list<BackendDAE.Var> allVarsList, stateVarsList,orderedVarsList,discVarsLst;
Expand All @@ -100,8 +101,7 @@ algorithm
SimCode.SimCode sc;
Integer offset;

case (dlow as BackendDAE.DAE({BackendDAE.EQSYSTEM(orderedEqs=eqsdae)},shared), ass1, ass2,
m, mt, comps,sc as SimCode.SIMCODE(odeEquations={eqs},sampleConditions=sampleConditions,zeroCrossings=zeroCrossings))
case (dlow as BackendDAE.DAE({BackendDAE.EQSYSTEM(orderedEqs=eqsdae)},shared), sc as SimCode.SIMCODE(odeEquations={eqs},sampleConditions=sampleConditions,zeroCrossings=zeroCrossings))
equation
print("\n ----------------------------\n");
print("BackEndQSS analysis initialized");
Expand All @@ -114,12 +114,12 @@ algorithm
(eqsindex,zc_exps) = getEquationsWithDiscont(zeroCrossings);
offset = listLength(disc);
disc = listAppend(disc, newDiscreteVariables(getEquations(eqsdae,eqsindex),0));
states = List.map(stateVarsList,BackendVariable.varCref);
algs = computeAlgs(eqs,states,{});
s = computeStateRef(List.map(states,ComponentReference.crefPrefixDer),eqs,{});
//states = List.map(stateVarsList,BackendVariable.varCref);
//algs = computeAlgs(eqs,states,{});
//s = computeStateRef(List.map(states,ComponentReference.crefPrefixDer),eqs,{});
sc = replaceDiscontsInOde(sc,zc_exps);
then
(QSSINFO(s,states,disc,algs,eqsdae,zc_exps,offset),sc);
(QSSINFO({},{},disc,{},eqsdae,zc_exps,0),sc);
else
equation
print("- Main function BackendQSS.generateStructureCodeQSS failed\n");
Expand Down
7 changes: 3 additions & 4 deletions Compiler/BackEnd/SimCodeMain.mo
Expand Up @@ -406,12 +406,11 @@ algorithm
equation
Tpl.tplNoret(CodegenAdevs.translateModel, simCode);
then ();
case (_,outIndexedBackendDAE as BackendDAE.DAE(eqs={
BackendDAE.EQSYSTEM(m=SOME(incidenceMatrix), mT=SOME(incidenceMatrixT), matching=BackendDAE.MATCHING(equationIndices, variableIndices,strongComponents))
}),"QSS")
case (_,outIndexedBackendDAE,"QSS")
/* as BackendDAE.DAE(eqs={ BackendDAE.EQSYSTEM( m=SOME(incidenceMatrix) ,mT=SOME(incidenceMatrixT), matching=BackendDAE.MATCHING(equationIndices, variableIndices,strongComponents)*/
equation
Debug.trace("Generating code for QSS solver\n");
(qssInfo,sc) = BackendQSS.generateStructureCodeQSS(outIndexedBackendDAE, equationIndices, variableIndices, incidenceMatrix, incidenceMatrixT, strongComponents,simCode);
(qssInfo,sc) = BackendQSS.generateStructureCodeQSS(outIndexedBackendDAE,simCode); //, equationIndices, variableIndices, incidenceMatrix, incidenceMatrixT, strongComponents,simCode);
Tpl.tplNoret2(CodegenQSS.translateModel, sc,qssInfo);
then ();
case (_,_,"C")
Expand Down

0 comments on commit 799cb8d

Please sign in to comment.