Skip to content

Commit

Permalink
Split synchronous features into pre and post phase
Browse files Browse the repository at this point in the history
This should allow to handle higher-index problems within clocked
partitions.
  • Loading branch information
lochel authored and OpenModelica-Hudson committed Jan 31, 2017
1 parent 2099c8b commit 5f0ad98
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Compiler/BackEnd/BackendDAEUtil.mo
Expand Up @@ -6802,6 +6802,12 @@ algorithm
dae := causalizeDAE(dae, NONE(), matchingAlgorithm, daeHandler, true);
execStat("matching and sorting (n="+String(daeSize(dae))+")");

// synchronous features post-phase
dae := SynchronousFeatures.synchronousFeatures(dae);
if Flags.isSet(Flags.OPT_DAE_DUMP) then
BackendDump.dumpBackendDAE(dae, "synchronousFeatures");
end if;

dae := BackendDAEOptimize.removeUnusedFunctions(dae);
execStat("remove unused functions");

Expand Down
31 changes: 29 additions & 2 deletions Compiler/BackEnd/SynchronousFeatures.mo
Expand Up @@ -83,6 +83,34 @@ algorithm
end match;
end clockPartitioning;

public function synchronousFeatures
input BackendDAE.BackendDAE inDAE;
output BackendDAE.BackendDAE outDAE;
protected
BackendDAE.EqSystems systs, contSysts, clockedSysts;
BackendDAE.Shared shared;
algorithm
(clockedSysts, contSysts) := List.splitOnTrue(inDAE.eqs, BackendDAEUtil.isClockedSyst);

if listLength(clockedSysts) > 0 then
shared := inDAE.shared;

(clockedSysts, shared) := treatClockedStates(clockedSysts, shared);

systs := listAppend(contSysts, clockedSysts);
outDAE := BackendDAE.DAE(systs, shared);

if Flags.isSet(Flags.DUMP_SYNCHRONOUS) then
print("synchronous features post-phase: synchronousFeatures\n\n");
BackendDump.dumpEqSystems(systs, "clock partitioning");
BackendDump.dumpBasePartitions(shared.partitionsInfo.basePartitions, "Base clocks");
BackendDump.dumpSubPartitions(shared.partitionsInfo.subPartitions, "Sub clocks");
end if;
else
outDAE := inDAE;
end if;
end synchronousFeatures;

public function contPartitioning
input BackendDAE.BackendDAE inDAE;
output BackendDAE.BackendDAE outDAE;
Expand Down Expand Up @@ -124,15 +152,14 @@ algorithm

(clockedSysts, shared) := subClockPartitioning1(clockedSysts, shared, holdComps);

(clockedSysts, shared) := treatClockedStates(clockedSysts, shared);

unpartRemEqs := createBoolClockWhenClauses(shared, unpartRemEqs);
shared.removedEqs := BackendEquation.addEquations(unpartRemEqs, shared.removedEqs);

systs := listAppend(contSysts, clockedSysts);
outDAE := BackendDAE.DAE(systs, shared);

if Flags.isSet(Flags.DUMP_SYNCHRONOUS) then
print("synchronous features pre-phase: synchronousFeatures\n\n");
BackendDump.dumpEqSystems(systs, "clock partitioning");
BackendDump.dumpBasePartitions(shared.partitionsInfo.basePartitions, "Base clocks");
BackendDump.dumpSubPartitions(shared.partitionsInfo.subPartitions, "Sub clocks");
Expand Down

0 comments on commit 5f0ad98

Please sign in to comment.