Skip to content

Commit

Permalink
Restricting special inner outer rules for variables in state machines…
Browse files Browse the repository at this point in the history
… to output variables

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@23042 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
bernhard-thiele committed Oct 29, 2014
1 parent 182def4 commit 33fc8e5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
28 changes: 14 additions & 14 deletions Compiler/BackEnd/StateMachineFeatures.mo
Expand Up @@ -148,28 +148,28 @@ algorithm
then BackendDAE.DAE({syst}, shared);
end match;
names := List.map(BaseHashTable.hashTableKeyList(modes), ComponentReference.crefLastIdent);
print("BTH-stateMachineElab States: " + stringDelimitList(names, ",") + "\n");
print("BTH-stateMachineElab ModeTable:\n");
print("SMF-stateMachineElab States: " + stringDelimitList(names, ",") + "\n");
print("SMF-stateMachineElab ModeTable:\n");
BaseHashTable.dumpHashTable(modes);
nModes := BaseHashTable.hashTableCurrentSize(modes);

print("BTH-stateMachineElab: Incidence matrix:\n");
print("SMF-stateMachineElab: Incidence matrix:\n");
iTable := createIncidenceTable(modes, nModes);
printIncidenceTable(iTable, nModes);

print("BTH-stateMachineElab: Transitive closure:\n");
print("SMF-stateMachineElab: Transitive closure:\n");
transClosure := transitiveClosure(iTable, nModes);
printIncidenceTable(transClosure, nModes);

print("BTH-stateMachineElab: Initial States:\n");
print("SMF-stateMachineElab: Initial States:\n");
initialStates := extractInitialStates(modes);
print( stringDelimitList(List.map(initialStates, ComponentReference.printComponentRefStr), ", ") + "\n");

print("BTH-stateMachineElab: Flat Automata:\n");
print("SMF-stateMachineElab: Flat Automata:\n");
flatAutomata := extractFlatAutomata(initialStates, transClosure, nModes);
printFlatAutomata(flatAutomata);

print("BTH-stateMachineElab: Composition:\n");
print("SMF-stateMachineElab: Composition:\n");
//compositions := getComposition(flatAutomata, {});
compositions := getComposition(flatAutomata);
ss := List.map(compositions, dumpCompositionStr);
Expand Down Expand Up @@ -301,8 +301,8 @@ protected
algorithm
COMPOSITION(refined=subCref) := sub;
subCrefStripped := ComponentReference.crefStripLastIdent(subCref);
// print("BTH-isSuperModeOf: Unstripped: " + ComponentReference.printComponentRefStr(subCref) + "\n");
// print("BTH-isSuperModeOf: Stripped: " + ComponentReference.printComponentRefStr(subCrefStripped) + "\n");
// print("SMF-isSuperModeOf: Unstripped: " + ComponentReference.printComponentRefStr(subCref) + "\n");
// print("SMF-isSuperModeOf: Stripped: " + ComponentReference.printComponentRefStr(subCrefStripped) + "\n");
COMPOSITION(refined=cref) := super;
isSub := ComponentReference.crefEqual(cref, subCrefStripped);
end isSubMode;
Expand Down Expand Up @@ -591,13 +591,13 @@ algorithm
)),
_)
equation
print("BTH-extractStates: "+ BackendDump.dumpEqnsStr({inEq}) +"\n");
//print("SMF-extractStates: "+ BackendDump.dumpEqnsStr({inEq}) +"\n");
modes = extractState(name, expLst, inA);
then
(inEq, modes);
else
equation
print("BTH-extractStates: NO MATCH\n");
//print("SMF-extractStates: NO MATCH\n");
then
(inEq, HashTableSM.emptyHashTable());
end match;
Expand All @@ -621,7 +621,7 @@ algorithm
HashSet.HashSet edges1,edges2;
case ("initialState", {DAE.CREF(componentRef=cstate1)})
equation
//print("BTH-printEq2: "+anyString(cstate1)+"\n");
//print("SMF-printEq2: "+anyString(cstate1)+"\n");
mode1 = if BaseHashTable.hasKey(cstate1, inA)
then BaseHashTable.get(cstate1, inA)
else MODE(ComponentReference.crefLastIdent(cstate1), true, HashSet.emptyHashSet());
Expand All @@ -631,7 +631,7 @@ algorithm
then modes;
case ("transition", DAE.CREF(componentRef=cstate1)::DAE.CREF(componentRef=cstate2)::_)
equation
//print("BTH-printEq2: "+anyString(cstate1)+"\n");
//print("SMF-printEq2: "+anyString(cstate1)+"\n");
tmp = ComponentReference.crefDepth(cstate1);
//printArgs(expLst);
mode1 = if BaseHashTable.hasKey(cstate1, inA)
Expand Down Expand Up @@ -668,7 +668,7 @@ algorithm
then true;
case (x::xs)
equation
print("BTH-printArgs: "+anyString(x)+"\n");
print("SMF-printArgs: "+anyString(x)+"\n");
then printArgs(xs);
end match;
end printArgs;
Expand Down
8 changes: 4 additions & 4 deletions Compiler/FrontEnd/InstVar.mo
Expand Up @@ -232,8 +232,8 @@ algorithm
then
(cache,compenv,ih,store,dae,csets,ty,graph);

// is ONLY outer and is inside an instance of a State Machine state
case (cache,env,ih,store,ci_state,mod,pre,n,cl,attr,pf,dims,idxs,inst_dims,impl,comment,_,graph, csets, _)
// is ONLY outer output and is inside an instance of a State Machine state
case (cache,env,ih,store,ci_state,mod,pre,n,cl,attr as SCode.ATTR(direction=Absyn.OUTPUT()),pf,dims,idxs,inst_dims,impl,comment,_,graph, csets, _)
equation
// only outer!
io = SCode.prefixesInnerOuter(pf);
Expand Down Expand Up @@ -400,8 +400,8 @@ algorithm
then
(cache,compenv,ih,store,dae,csets,ty,graph);

// is inner outer and is inside an instance of a State Machine state!
case (cache,env,ih,store,ci_state,mod,pre,n,cl as SCode.CLASS(name=typeName),attr,pf,dims,idxs,inst_dims,impl,comment,_,graph, csets, _)
// is inner outer output and is inside an instance of a State Machine state!
case (cache,env,ih,store,ci_state,mod,pre,n,cl as SCode.CLASS(name=typeName),attr as SCode.ATTR(direction=Absyn.OUTPUT()) ,pf,dims,idxs,inst_dims,impl,comment,_,graph, csets, _)
equation
// both inner and outer
io = SCode.prefixesInnerOuter(pf);
Expand Down

0 comments on commit 33fc8e5

Please sign in to comment.