Skip to content

Commit

Permalink
- Fix testsuite
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@8593 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Apr 11, 2011
1 parent 9fd9b2e commit 81b7d98
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 77 deletions.
2 changes: 1 addition & 1 deletion Compiler/BackEnd/BackendDAEOptimize.mo
Expand Up @@ -1964,7 +1964,7 @@ protected function replacementsInEqns2
output array<DAE.Algorithm> outAlgs;
output BackendDAE.EventInfo outEinfo;
algorithm
(outEqns,outArreqns,outAlgs,inAlgs,outEinfo):=
(outEqns,outArreqns,outAlgs,outEinfo):=
match (inEqsLst,derExp,inCr,inEqns,inArreqns,inAlgs,inEinfo)
local
BackendDAE.EquationArray eqns,eqns1,eqns2;
Expand Down
148 changes: 74 additions & 74 deletions Compiler/BackEnd/BackendQSS.mo
Expand Up @@ -69,8 +69,8 @@ uniontype QSSinfo "- equation indices in static blocks and DEVS structure"
record QSSINFO
list<list<list<Integer>>> BLTblocks "BLT blocks in static functions";
DevsStruct DEVSstructure "DEVS structure of the model";
list<list<SimCode.SimEqSystem>> eqs;
list<BackendDAE.Var> outVarLst;
list<list<SimCode.SimEqSystem>> eqs;
list<BackendDAE.Var> outVarLst;
end QSSINFO;
end QSSinfo;

Expand Down Expand Up @@ -105,9 +105,9 @@ algorithm
array<list<list<Integer>>> DEVS_struct_outLinks, DEVS_struct_outVars, DEVS_struct_inLinks, DEVS_struct_inVars;

list<list<Integer>> DEVS_blocks_outVars, DEVS_blocks_inVars;
list<list<SimCode.SimEqSystem>> eqs;
list<list<SimCode.SimEqSystem>> eqs;
BackendDAE.Variables orderedVars;
list<BackendDAE.Var> varlst;
list<BackendDAE.Var> varlst;
case (dlow, ass1, ass2, m, mt, comps)
equation

Expand Down Expand Up @@ -152,7 +152,7 @@ algorithm

dumpDEVSstructs(DEVS_structure);

eqs = Util.listMap3(stateEq_blt, generateEqFromBlt,dlow,ass1,ass2);
eqs = Util.listMap3(stateEq_blt, generateEqFromBlt,dlow,ass1,ass2);
orderedVars = BackendVariable.daeVars(dlow);
varlst = BackendDAEUtil.varList(orderedVars);

Expand Down Expand Up @@ -2056,101 +2056,101 @@ end constructTrivialList;
////////////////////////////////////////////////////////////////////////////////////////////////////

protected function generateEqFromBlt
input list<list<Integer>> blt;
input BackendDAE.BackendDAE dlow;
input array<Integer> ass1, ass2;
output list<SimCode.SimEqSystem> out;
input list<list<Integer>> blt;
input BackendDAE.BackendDAE dlow;
input array<Integer> ass1, ass2;
output list<SimCode.SimEqSystem> out;
algorithm
out :=
match (blt,dlow,ass1,ass2)
local
list<SimCode.SimEqSystem> out2;
case (_,_,_,_)
equation
out2 = SimCode.createEquations(false, false, false, false, false, dlow, ass1, ass2, blt, {});
then out2;
end match;
out :=
match (blt,dlow,ass1,ass2)
local
list<SimCode.SimEqSystem> out2;
case (_,_,_,_)
equation
out2 = SimCode.createEquations(false, false, false, false, false, dlow, ass1, ass2, blt, {});
then out2;
end match;
end generateEqFromBlt;


public function getInputs
input DevsStruct st;
input Integer index;
output list<Integer> vars;
input DevsStruct st;
input Integer index;
output list<Integer> vars;
algorithm
vars := match (st,index)
local
array<list<list<Integer>>> inVars "input variables for each DEVS block";
list<Integer> vars;
case (DEVS_STRUCT(inVars=inVars),_)
equation
vars = Util.listMap(Util.listFlatten(inVars[index]),intAbs);
then vars;
end match;
vars := match (st,index)
local
array<list<list<Integer>>> inVars "input variables for each DEVS block";
list<Integer> vars;
case (DEVS_STRUCT(inVars=inVars),_)
equation
vars = Util.listMap(Util.listFlatten(inVars[index]),intAbs);
then vars;
end match;
end getInputs;

public function getOutputs
input DevsStruct st;
input Integer index;
output list<Integer> vars;
input DevsStruct st;
input Integer index;
output list<Integer> vars;
algorithm
vars := match (st,index)
local
array<list<list<Integer>>> outVars "output variables for each DEVS block";
list<Integer> vars;
case (DEVS_STRUCT(outVars=outVars),_)
equation
vars = Util.listMap(Util.listFlatten(outVars[index]),intAbs);
then vars;
end match;
vars := match (st,index)
local
array<list<list<Integer>>> outVars "output variables for each DEVS block";
list<Integer> vars;
case (DEVS_STRUCT(outVars=outVars),_)
equation
vars = Util.listMap(Util.listFlatten(outVars[index]),intAbs);
then vars;
end match;
end getOutputs;

public function derPrefix
input BackendDAE.Var var;
output String prefix;
input BackendDAE.Var var;
output String prefix;
algorithm
prefix :=
matchcontinue (var)
case (_)
equation
true = BackendVariable.isStateVar(var);
then "$P$DER";
case (_)
then "";
end matchcontinue;
prefix :=
matchcontinue (var)
case (_)
equation
true = BackendVariable.isStateVar(var);
then "$P$DER";
case (_)
then "";
end matchcontinue;
end derPrefix;

public function numInputs
input QSSinfo qssInfo;
input Integer numBlock;
output Integer inputs;
input QSSinfo qssInfo;
input Integer numBlock;
output Integer inputs;
algorithm
inputs :=
match (qssInfo,numBlock)
local
array<list<list<Integer>>> inLinks "input connections for each DEVS block";
case (QSSINFO(DEVSstructure=DEVS_STRUCT(inLinks=inLinks)),_)
then listLength(inLinks[numBlock]);
end match;
inputs :=
match (qssInfo,numBlock)
local
array<list<list<Integer>>> inLinks "input connections for each DEVS block";
case (QSSINFO(DEVSstructure=DEVS_STRUCT(inLinks=inLinks)),_)
then listLength(inLinks[numBlock]);
end match;
end numInputs;

public function numOutputs
input QSSinfo qssInfo;
input Integer numBlock;
output Integer outputs;
input QSSinfo qssInfo;
input Integer numBlock;
output Integer outputs;
algorithm
inputs :=
match (qssInfo,numBlock)
local
array<list<list<Integer>>> outLinks "output connections for each DEVS block";
case (QSSINFO(DEVSstructure=DEVS_STRUCT(outLinks=outLinks)),_)
then listLength(outLinks[numBlock]);
end match;
outputs :=
match (qssInfo,numBlock)
local
array<list<list<Integer>>> outLinks "output connections for each DEVS block";
case (QSSINFO(DEVSstructure=DEVS_STRUCT(outLinks=outLinks)),_)
then listLength(outLinks[numBlock]);
end match;
end numOutputs;






Expand Down
4 changes: 4 additions & 0 deletions Compiler/FrontEnd/DAE.mo
Expand Up @@ -121,6 +121,10 @@ public uniontype SymbolicOperation
ComponentRef cr;
Exp exp;
end SOLVED;
record OP_INLINE
Exp before;
Exp after;
end OP_INLINE;
end SymbolicOperation;

public constant ElementSource emptyElementSource = SOURCE(Absyn.dummyInfo,{},{},{},{},{});
Expand Down
1 change: 1 addition & 0 deletions Compiler/susan_codegen/SimCode/SimCodeDump.tpl
Expand Up @@ -115,6 +115,7 @@ template dumpOperation(SymbolicOperation op, Info info)
match op
case SIMPLIFY(__) then '<%\n%> simplify: <%printExpStr(before)%> => <%printExpStr(after)%>'
case SUBSTITUTION(__) then '<%\n%> subst: <%printExpStr(source)%> => <%printExpStr(target)%>'
case op as OP_INLINE(__) then '<%\n%> inline: <%printExpStr(op.before)%> = <%printExpStr(op.after)%>'
case op as SOLVED(__) then '<%\n%> simple equation: <%crefStr(op.cr)%> = <%printExpStr(op.exp)%>'
case op as SOLVE(__) then
<<<%\n%>
Expand Down
6 changes: 5 additions & 1 deletion Compiler/susan_codegen/SimCode/SimCodeTV.mo
Expand Up @@ -1249,7 +1249,11 @@ package DAE
ComponentRef cr;
Exp exp;
end SOLVED;
end SymbolicOperation;
record OP_INLINE
Exp before;
Exp after;
end OP_INLINE;
end SymbolicOperation;
end DAE;


Expand Down
2 changes: 1 addition & 1 deletion c_runtime/simulation_result_mat.cpp
Expand Up @@ -279,7 +279,7 @@ long simulation_result_mat::flattenStrBuf(int dims,
// len = strlen(useComment ? src[i]->comment : src[i]->name);
// for (j = 0; j < len; ++j) {
// strncpy(ptr + i + j*dims,useComment ? &src[i]->comment[j] : &src[i]->name[j],1);
// }
// }
// }
for (i = 0; i < dims; ++i) {
strncpy(ptr,useComment ? src[i]->comment : src[i]->name,longest+1 /* ensures that we get \0 after the longest string*/);
Expand Down

0 comments on commit 81b7d98

Please sign in to comment.