Skip to content

Commit

Permalink
more fixes for #3430, handle both lists empty
Browse files Browse the repository at this point in the history
  • Loading branch information
adrpo committed Sep 4, 2015
1 parent d78c686 commit 6f0b7a7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Compiler/FrontEnd/ConnectUtil.mo
Expand Up @@ -2824,8 +2824,16 @@ protected
DAE.Exp outside_sum1, outside_sum2, inside_sum1, inside_sum2, res;
list<ConnectorElement> insideElements, outsideElements;
algorithm
(_, insideElements) := List.splitOnTrue(inInsideElements, function isZeroFlow(attr="min"));
(_, outsideElements) := List.splitOnTrue(inOutsideElements, function isZeroFlow(attr="max"));
insideElements := List.filterOnFalse(inInsideElements, function isZeroFlow(attr="min"));
outsideElements := List.filterOnFalse(inOutsideElements, function isZeroFlow(attr="max"));
// adrpo: TODO! FIXME! HACK!
// what happens if both these filtered lists are empty, what do we return?
// Test with model: ThermoPower.PowerPlants.SteamTurbineGroup.Tests.TestST3LRh_bypass
// as this seems to happen there! For now I unfilter the lists!
if listEmpty(outsideElements) and listEmpty(insideElements) then
insideElements := inInsideElements;
outsideElements := inOutsideElements;
end if;
if listEmpty(outsideElements) then
// No outside components.
inside_sum1 := sumMap(insideElements, sumInside1, inFlowThreshold);
Expand All @@ -2851,7 +2859,7 @@ protected function isZeroFlow
"Returns true if the given flow attribute of a connector is zero."
input ConnectorElement inElement;
input String attr;
output Boolean isZero;
output Boolean isZero = false;
protected
DAE.Type ty;
Option<DAE.Exp> attr_oexp;
Expand Down

0 comments on commit 6f0b7a7

Please sign in to comment.