Skip to content

Commit 5f0ad98

Browse files
lochelOpenModelica-Hudson
authored andcommitted
Split synchronous features into pre and post phase
This should allow to handle higher-index problems within clocked partitions.
1 parent 2099c8b commit 5f0ad98

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

Compiler/BackEnd/BackendDAEUtil.mo

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6802,6 +6802,12 @@ algorithm
68026802
dae := causalizeDAE(dae, NONE(), matchingAlgorithm, daeHandler, true);
68036803
execStat("matching and sorting (n="+String(daeSize(dae))+")");
68046804

6805+
// synchronous features post-phase
6806+
dae := SynchronousFeatures.synchronousFeatures(dae);
6807+
if Flags.isSet(Flags.OPT_DAE_DUMP) then
6808+
BackendDump.dumpBackendDAE(dae, "synchronousFeatures");
6809+
end if;
6810+
68056811
dae := BackendDAEOptimize.removeUnusedFunctions(dae);
68066812
execStat("remove unused functions");
68076813

Compiler/BackEnd/SynchronousFeatures.mo

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,34 @@ algorithm
8383
end match;
8484
end clockPartitioning;
8585

86+
public function synchronousFeatures
87+
input BackendDAE.BackendDAE inDAE;
88+
output BackendDAE.BackendDAE outDAE;
89+
protected
90+
BackendDAE.EqSystems systs, contSysts, clockedSysts;
91+
BackendDAE.Shared shared;
92+
algorithm
93+
(clockedSysts, contSysts) := List.splitOnTrue(inDAE.eqs, BackendDAEUtil.isClockedSyst);
94+
95+
if listLength(clockedSysts) > 0 then
96+
shared := inDAE.shared;
97+
98+
(clockedSysts, shared) := treatClockedStates(clockedSysts, shared);
99+
100+
systs := listAppend(contSysts, clockedSysts);
101+
outDAE := BackendDAE.DAE(systs, shared);
102+
103+
if Flags.isSet(Flags.DUMP_SYNCHRONOUS) then
104+
print("synchronous features post-phase: synchronousFeatures\n\n");
105+
BackendDump.dumpEqSystems(systs, "clock partitioning");
106+
BackendDump.dumpBasePartitions(shared.partitionsInfo.basePartitions, "Base clocks");
107+
BackendDump.dumpSubPartitions(shared.partitionsInfo.subPartitions, "Sub clocks");
108+
end if;
109+
else
110+
outDAE := inDAE;
111+
end if;
112+
end synchronousFeatures;
113+
86114
public function contPartitioning
87115
input BackendDAE.BackendDAE inDAE;
88116
output BackendDAE.BackendDAE outDAE;
@@ -124,15 +152,14 @@ algorithm
124152

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

127-
(clockedSysts, shared) := treatClockedStates(clockedSysts, shared);
128-
129155
unpartRemEqs := createBoolClockWhenClauses(shared, unpartRemEqs);
130156
shared.removedEqs := BackendEquation.addEquations(unpartRemEqs, shared.removedEqs);
131157

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

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

0 commit comments

Comments
 (0)