Skip to content
This repository has been archived by the owner on May 18, 2019. It is now read-only.

Commit

Permalink
[NF] Improve handling of Evaluate=true.
Browse files Browse the repository at this point in the history
- Also mark dependencies as structural for parameters that are
  structural due to Evaluate=true.

Belonging to [master]:
  - #2750
  - OpenModelica/OpenModelica-testsuite#1066
  • Loading branch information
perost authored and OpenModelica-Hudson committed Oct 30, 2018
1 parent ff431bd commit ad7bdaf
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions Compiler/NFFrontEnd/NFInst.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2937,7 +2937,7 @@ algorithm
// @adrpo: if Evaluate=true make the parameter a structural parameter
// only make it a structural parameter if is not constant, duh!, 1071 regressions :)
if c.attributes.variability == Variability.PARAMETER and Component.getEvaluateAnnotation(c) then
InstNode.updateComponent(Component.setVariability(Variability.STRUCTURAL_PARAMETER, c), node);
markStructuralParamsComp(c, node);
end if;

for dim in c.dimensions loop
Expand Down Expand Up @@ -3013,13 +3013,7 @@ algorithm
comp := InstNode.component(node);

if Component.variability(comp) == Variability.PARAMETER then
comp := Component.setVariability(Variability.STRUCTURAL_PARAMETER, comp);
InstNode.updateComponent(comp, node);

binding := Binding.untypedExp(Component.getBinding(comp));
if isSome(binding) then
markStructuralParamsExp(Util.getOption(binding));
end if;
markStructuralParamsComp(comp, node);
end if;
end if;
then
Expand All @@ -3029,6 +3023,22 @@ algorithm
end match;
end markStructuralParamsExp_traverser;

function markStructuralParamsComp
input Component component;
input InstNode node;
protected
Component comp;
Option<Expression> binding;
algorithm
comp := Component.setVariability(Variability.STRUCTURAL_PARAMETER, component);
InstNode.updateComponent(comp, node);

binding := Binding.untypedExp(Component.getBinding(comp));
if isSome(binding) then
markStructuralParamsExp(Util.getOption(binding));
end if;
end markStructuralParamsComp;

function markStructuralParamsExpSize
input Expression exp;
algorithm
Expand Down

3 comments on commit ad7bdaf

@casella
Copy link

@casella casella commented on ad7bdaf Nov 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit broke Modelica.Fluid.Examples.BranchingDynamicPipes, that previously made it further into code generation.

@perost, can you please fix that as well?

@perost
Copy link
Member Author

@perost perost commented on ad7bdaf Nov 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit broke Modelica.Fluid.Examples.BranchingDynamicPipes, that previously made it further into code generation.

@perost, can you please fix that as well?

That's because the constant evaluation of >= was defined as > (oops!). Pushing in a fix now.

@casella
Copy link

@casella casella commented on ad7bdaf Nov 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worked out nicely. BranchingDynamicPipes is back where it belonged, and two more MSL models simulate.

Please sign in to comment.