Skip to content

Commit

Permalink
[NF] Improve ConnectEquation.evaluateFlowDirection.
Browse files Browse the repository at this point in the history
- Simplify the min and max attribute expressions before evaluating the
  flow direction.
  • Loading branch information
perost committed Oct 8, 2019
1 parent 83d0207 commit be7c680
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions OMCompiler/Compiler/NFFrontEnd/NFConnectEquations.mo
Expand Up @@ -69,6 +69,7 @@ import Prefixes = NFPrefixes;
import NFComponent.Component;
import Ceval = NFCeval;
import MetaModelica.Dangerous.listReverseInPlace;
import SimplifyExp = NFSimplifyExp;

constant Expression EQ_ASSERT_STR =
Expression.STRING("Connected constants/parameters must be equal");
Expand Down Expand Up @@ -845,8 +846,8 @@ protected
Real min_val, max_val;
algorithm
flow_cls := InstNode.getClass(ComponentRef.node(flowCref));
omin := Class.lookupAttributeValue("min", flow_cls);
omax := Class.lookupAttributeValue("max", flow_cls);
omin := SimplifyExp.simplifyOpt(Class.lookupAttributeValue("min", flow_cls));
omax := SimplifyExp.simplifyOpt(Class.lookupAttributeValue("max", flow_cls));

direction := match (omin, omax)
// No attributes, flow direction can't be decided.
Expand Down

0 comments on commit be7c680

Please sign in to comment.