Skip to content

Commit

Permalink
- added a testfunction to check the ODE-system in HpcOmTaskGraph.mo
Browse files Browse the repository at this point in the history
- changed pdf for the metaprogramming doc (see revision 16543)

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@16544 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Volker Waurich committed Jul 4, 2013
1 parent a384b45 commit a261bea
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
4 changes: 1 addition & 3 deletions Compiler/BackEnd/HpcOmSimCode.mo
Expand Up @@ -197,9 +197,7 @@ algorithm

// equation generation for euler, dassl2, rungekutta
(uniqueEqIndex, odeEquations, algebraicEquations, allEquations, tempvars) = SimCodeUtil.createEquationsForSystems(systs, shared, uniqueEqIndex, {}, {}, {}, tempvars);
//print("from "+&intString(listLength(allEquations))+&" we have "+&intString(listLength(List.flatten(odeEquations)))+& " ode eqs and "+&intString(listLength(List.flatten(algebraicEquations)))+&" algebraic eqs\n");
//print("correct odeNum: "+&intString(listLength(List.flatten(odeEquations)))+&"\n");
//print("my odeNumn: "+&intString(arrayLength(taskGraphOde))+&"\n");
HpcOmTaskGraph.checkOdeSystemSize(taskGraphOde,odeEquations);
// modelInfo = SimCodeUtil.addTempVars(tempvars, modelInfo);
//
// // Assertions and crap
Expand Down
43 changes: 42 additions & 1 deletion Compiler/BackEnd/HpcOmTaskGraph.mo
Expand Up @@ -306,7 +306,7 @@ algorithm
end taskGraphAppend;


protected function updateTaskGraphSystem "map function to add the indices in the taskGraph system the number of vars of the previous system.
protected function updateTaskGraphSystem "map function to add the indices in the taskGraph system to the number of nodes of the previous system.
author:Waurich TUD 2013-07"
input list<Integer> graphRowIn;
input Integer idxOffset;
Expand Down Expand Up @@ -2768,4 +2768,45 @@ algorithm
end getODEcRef;


// testfunctions
//------------------------------------------
//------------------------------------------

public function checkOdeSystemSize " compares the size of the ode-taskgraph with the number of ode-equations in the simCode.
author:Waurich TUD 2013-07"
input TaskGraph taskGraphOdeIn;
input list<list<SimCode.SimEqSystem>> odeEqsIn;
algorithm
_ := matchcontinue(taskGraphOdeIn,odeEqsIn)
local
Integer actualSize;
Integer targetSize;
case(_,_)
equation
targetSize = listLength(List.flatten(odeEqsIn));
actualSize = arrayLength(taskGraphOdeIn);
true = intEq(targetSize,actualSize);
print("the ODE-system size is correct\n");
then
();
case(_,_)
equation
targetSize = listLength(List.flatten(odeEqsIn));
actualSize = arrayLength(taskGraphOdeIn);
true = intEq(targetSize,1) and intEq(actualSize,0);
// there is a dummyDER in the simcode
print("the ODE-system size is correct\n");
then
();
else
equation
targetSize = listLength(List.flatten(odeEqsIn));
actualSize = arrayLength(taskGraphOdeIn);
print("the size should be "+&intString(targetSize)+&" but it is "+&intString(actualSize)+&" !\n");
print("the ODE-system is NOT correct\n");
then
();
end matchcontinue;
end checkOdeSystemSize;

end HpcOmTaskGraph;

0 comments on commit a261bea

Please sign in to comment.