Skip to content

Commit

Permalink
- Some fixes to equation index of distributed systems
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@10117 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Oct 14, 2011
1 parent 6598124 commit f0d4f62
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 75 deletions.
32 changes: 27 additions & 5 deletions Compiler/BackEnd/BackendDAEUtil.mo
Expand Up @@ -6538,7 +6538,7 @@ algorithm
BackendDAE.DAE(systs,shared) := dae;
(systs,shared) := List.map1Fold(systs,func,a,shared);
// Filter out empty systems
// systs := List.select(systs,nonEmptySystem);
systs := filterEmptySystems(systs);
odae := BackendDAE.DAE(systs,shared);
end mapEqSystem1;

Expand Down Expand Up @@ -6566,7 +6566,7 @@ algorithm
BackendDAE.DAE(systs,shared) := dae;
(systs,(shared,extra)) := List.map1Fold(systs,func,a,(shared,initialExtra));
// Filter out empty systems
// systs := List.select(systs,nonEmptySystem);
systs := filterEmptySystems(systs);
odae := BackendDAE.DAE(systs,shared);
end mapEqSystemAndFold1;

Expand All @@ -6591,7 +6591,7 @@ algorithm
BackendDAE.DAE(systs,shared) := dae;
(systs,(shared,extra)) := List.mapFold(systs,func,(shared,initialExtra));
// Filter out empty systems
// systs := List.select(systs,nonEmptySystem);
systs := filterEmptySystems(systs);
odae := BackendDAE.DAE(systs,shared);
end mapEqSystemAndFold;

Expand All @@ -6615,7 +6615,7 @@ algorithm
BackendDAE.DAE(systs,shared) := dae;
extra := List.fold1(systs,func,shared,initialExtra);
// Filter out empty systems
// systs := List.select(systs,nonEmptySystem);
systs := filterEmptySystems(systs);
end foldEqSystem;

public function mapEqSystem
Expand All @@ -6636,7 +6636,7 @@ algorithm
BackendDAE.DAE(systs,shared) := dae;
(systs,shared) := List.mapFold(systs,func,shared);
// Filter out empty systems
// systs := List.select(systs,nonEmptySystem);
systs := filterEmptySystems(systs);
odae := BackendDAE.DAE(systs,shared);
end mapEqSystem;

Expand Down Expand Up @@ -6664,4 +6664,26 @@ algorithm
end match;
end setEqSystemMatching;

public function filterEmptySystems
"Filter out equation systems leaving at least one behind"
input BackendDAE.EqSystems systs;
output BackendDAE.EqSystems osysts;
algorithm
osysts := filterEmptySystems2(List.select(systs,nonEmptySystem),systs);
end filterEmptySystems;

protected function filterEmptySystems2
"Filter out equation systems leaving at least one behind"
input BackendDAE.EqSystems systs;
input BackendDAE.EqSystems full;
output BackendDAE.EqSystems olst;
algorithm
olst := match (systs,full)
local
BackendDAE.EqSystem syst;
case ({},syst::_) then {syst};
else systs;
end match;
end filterEmptySystems2;

end BackendDAEUtil;
2 changes: 1 addition & 1 deletion Compiler/BackEnd/BackendQSS.mo
Expand Up @@ -3177,7 +3177,7 @@ protected
BackendDAE.Shared shared;
algorithm
BackendDAE.DAE({syst},shared) := dlow;
out := SimCode.createEquations(false, false, false, false, false, syst, shared, comps, {});
out := SimCode.createEquations(false, false, false, false, false, syst, shared, 0, comps, {});
end generateEqFromBlt;

protected function isPositive
Expand Down

0 comments on commit f0d4f62

Please sign in to comment.