Changeset 13456
- Timestamp:
- Sep 11, 2019 4:23:00 PM (3 months ago)
- Location:
- trunk
- Files:
-
- 21 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/dev-mo-2267 (added) merged: 13369,13371-13372,13376-13378,13386,13389,13398,13411,13424-13425,13442,13450-13451
- Property svn:mergeinfo changed
-
trunk/Compiler/ModelicaFlatTree/src/jastadd/FlatAPI/FlatAPI.jrag
r13357 r13456 35 35 import org.jmodelica.common.GUIDManager; 36 36 import org.jmodelica.util.streams.StreamGobbler; 37 import org.jmodelica.common.ast.prefixes.CausalityConnectorPrefix.CausalPortsEvaluator; 37 38 38 39 aspect FlatAPI { … … 3163 3164 3164 3165 syn boolean FAbstractVariable.isInput() = false; 3165 eq FVariable.isInput() = getCausalityConnectorPrefix().inputCausality();3166 3166 syn boolean FAbstractVariable.isOutput() = false; 3167 eq FVariable.isOutput() = getCausalityConnectorPrefix().outputCausality(); 3168 3167 eq FVariable.isInput() = getCausalityConnectorPrefix().inputCausality (this); 3168 eq FVariable.isOutput() = getCausalityConnectorPrefix().outputCausality(this); 3169 eq FFunctionVariable.isInput() = getCausalityConnectorPrefix().inputCausality (this); 3170 eq FFunctionVariable.isOutput() = getCausalityConnectorPrefix().outputCausality(this); 3171 3172 ASTNode implements CausalPortsEvaluator; 3173 syn boolean ASTNode.useCausalPorts() = myOptions().causal_ports.getValue(); 3169 3174 } 3170 3175 -
trunk/Compiler/ModelicaFlatTree/src/jastadd/FlatUtil.jrag
r13396 r13456 707 707 } 708 708 709 710 public abstract FAccess FAccess.copyAndAddSuffix(String suffix); 711 712 public FAccessString FAccessEmpty.copyAndAddSuffix(String suffix) { 713 throw new UnsupportedOperationException(); 714 } 715 716 public FAccessString FAccessString.copyAndAddSuffix(String suffix) { 717 String name = getName(); 718 String end = ""; 719 if (name.endsWith("'")) { 720 name = name.substring(0, name.length() - 1); 721 end = "'"; 722 } 723 return new FAccessString(name + suffix + end); 724 } 725 726 public FAccessFull FAccessFull.copyAndAddSuffix(String suffix) { 727 FAccessFull res = fullCopy(); 728 String name = res.getFAccessPart(0).getName(); 729 String end = ""; 730 if (name.endsWith("'")) { 731 name = name.substring(0, name.length() - 1); 732 end = "'"; 733 } 734 res.getFAccessPart(0).setName(name + suffix + end); 735 return res; 736 } 737 709 738 /** 710 739 * Create a copy of the name, with an FSubscript added to the last part. … … 1112 1141 syn boolean FFunctionCall.isPartialFunctionCall() = false; 1113 1142 eq FPartialFunctionCall.isPartialFunctionCall() = true; 1114 1115 syn boolean FFunctionVariable.isInput() = getCausalityConnectorPrefix().inputCausality();1116 syn boolean FFunctionVariable.isOutput() = getCausalityConnectorPrefix().outputCausality();1117 1143 1118 1144 /** -
trunk/Compiler/ModelicaFrontEnd/src/jastadd/flattening/Flattening.jrag
r13396 r13456 1238 1238 f.addFVariable(fv); 1239 1239 } 1240 if (fv.getCausalityConnectorPrefix().isStream() && useCausalPorts()) { 1241 FVariable inStream = fv.treeCopy(); 1242 FAccess inStreamAccess = createInStreamAccess(inStream.getFAccess()); 1243 inStream.setFAccess(inStreamAccess); 1244 inStream.setCausalityConnectorPrefix(CausalityConnectorPrefix.INSTREAM); 1245 fv.annotation().vendorNode().forPath("internal/instream").setValue(new FStringLitExp(inStreamAccess.name())); 1246 f.addFVariable(inStream); 1247 } 1240 1248 flattenMyType(f); 1241 1249 clearModificationLevel(oldLevels); 1242 1250 } 1251 } 1252 1253 inh FAccess InstAssignable.createInStreamAccess(FAccess streamAccess); 1254 eq InstClassDecl.getChild().createInStreamAccess(FAccess streamAccess) { 1255 FAccess result = streamAccess.copyAndAddSuffix("__instream_"); 1256 int i = 2; 1257 while (componentExists(new QualifiedName(result.name()))) { 1258 result = streamAccess.copyAndAddSuffix("__instream_" + i); 1259 i++; 1260 } 1261 return result; 1243 1262 } 1244 1263 -
trunk/Compiler/ModelicaFrontEnd/src/jastadd/flattening/FlatteningStatements.jrag
r12184 r13456 245 245 eq Root.getChild().breakCondName() = null; 246 246 247 public boolean Inst ClassDecl.componentExists(String name) {247 public boolean InstNode.componentExists(String name) { 248 248 for (InstComponentDecl decl : allInstComponentDecls()) { 249 249 if (decl.name().equals(name)) { 250 250 return true; 251 251 } 252 } 253 return false; 254 } 255 256 public boolean InstNode.componentExists(Iterator<String> qualifiedName) { 257 if (!qualifiedName.hasNext()) { 258 return true; 259 } 260 String name = qualifiedName.next(); 261 if (componentExists(name)) { 262 return memberInstComponent(name).targetOrNull().componentExists(qualifiedName); 252 263 } 253 264 return false; -
trunk/Compiler/ModelicaFrontEnd/src/jastadd/flattening/connections/Connections.jrag
r13357 r13456 82 82 protected FExp FInStream.expandInStreamExp() { 83 83 // Always create expression from the connection set where the variable is an inside connector. 84 String name = getFExp().asCommonAccess().name();85 ConnectionSet cs = myFClass().getConnectionSetManager().getStreamConnectionSet(name , false);84 FAccess name = getFExp().asCommonAccess().asFAccess(); 85 ConnectionSet cs = myFClass().getConnectionSetManager().getStreamConnectionSet(name.name(), false); 86 86 return cs.expandInStreamExp(name); 87 87 } … … 470 470 * @param name the name of the variable to generate name for 471 471 */ 472 public FExp expandInStreamExp( Stringname) {472 public FExp expandInStreamExp(FAccess name) { 473 473 throw new UnsupportedOperationException(); 474 474 } … … 537 537 public void generateEquations(Flattener f) { 538 538 ConnectionSetEntry fst = first(); 539 if (size() == 1 && fst.isInside() && fst.getVar().isTopLevelCausalOrConnector()) { 539 InstComponentDecl fstVar = fst.getVar(); 540 if (size() == 1 && fst.isInside() && fstVar.isTopLevelCausalOrConnector() 541 && (fstVar.isInput() || fstVar.isOutput() || fstVar.useCausalPorts())) { 540 542 return; 541 543 } … … 550 552 551 553 public class StreamConnectionSet extends ConnectionSet { 554 555 private static final String inStreamSuffix = "__instream_"; 552 556 553 557 private double nominal = Double.MAX_VALUE; … … 579 583 * @param name the name of the variable to generate name for 580 584 */ 581 public FExp expandInStreamExp(String name) { 585 @Override 586 public FExp expandInStreamExp(FAccess access) { 587 String name = access.name(); 582 588 ConnectionSetEntry e = getConnectionSetEntry(name, false); 583 FExp exp = expandInStreamExp(e, name, new FAccessExp(name)); 589 if (access.useCausalPorts()) { 590 AnnotationNode instreamAnnotation = access.myFV().annotation().vendorNode().forPath("internal/instream"); 591 if (instreamAnnotation.exists()) { 592 String instreamName = instreamAnnotation.ceval().stringValue(); 593 access = nameWithSubscripts(instreamName, name); 594 } 595 } 596 FExp exp = expandInStreamExp(e, name, new FAccessExp(access)); 584 597 exp.enableStreamsRewrite(); 585 598 return exp; 586 599 } 600 601 public FAccess nameWithSubscripts(String name, String access) { 602 String subscripts = (access.endsWith("]")) ? access.substring(access.lastIndexOf("[")) : ""; 603 return new FAccessString(name + subscripts); 604 } 587 605 588 606 /** -
trunk/Compiler/ModelicaFrontEnd/src/java/org/jmodelica/common/ast/prefixes/CausalityConnectorPrefix.java
r13357 r13456 22 22 } 23 23 24 public boolean i nputCausality() {25 return this == INPUT || this == FLOW || this == INSTREAM;24 public boolean isStream() { 25 return this == STREAM; 26 26 } 27 27 28 public boolean outputCausality() { 29 return this == OUTPUT || this == POTENTIAL || this == STREAM; 28 public interface CausalPortsEvaluator { 29 boolean useCausalPorts(); 30 } 31 32 /** 33 * We use a {@link CausalPortsEvaluator} here instead of an evaluated boolean 34 * to reduce the number of calls to useCausalPorts(). 35 * Replace with a Predicate when updating to Java 8. 36 */ 37 public boolean inputCausality(CausalPortsEvaluator evaluator) { 38 if (this == INPUT) { 39 return true; 40 } 41 if (this == FLOW || this == INSTREAM) { 42 return evaluator.useCausalPorts(); 43 } 44 return false; 45 } 46 47 public boolean outputCausality(CausalPortsEvaluator evaluator) { 48 if (this == OUTPUT) { 49 return true; 50 } 51 if (this == POTENTIAL || this == STREAM) { 52 return evaluator.useCausalPorts(); 53 } 54 return false; 30 55 } 31 56 -
trunk/Compiler/ModelicaFrontEnd/src/java/org/jmodelica/junit/TestTreeRunner.java
r12940 r13456 100 100 } 101 101 if (!(test instanceof TestTree)) { 102 String maybeSubTestName = test.getName(); 102 String uniqueName = nc.makeUnique(testName); 103 test.setName(uniqueName); 103 104 // TODO: Upgrade JUnit version, then use createTestDescription(String, String) instead 104 String descStr = String.format("%s(%s)", nc.makeUnique(testName), packageName);105 String descStr = String.format("%s(%s)", uniqueName, packageName); 105 106 chDesc = Description.createSuiteDescription(descStr); 106 caseDesc.put( maybeSubTestName, chDesc);107 caseDesc.put(uniqueName, chDesc); 107 108 if(outputFailing) { 108 109 if(name.equals(testFile.getName())) { //Top-level test 109 modelNames.put( maybeSubTestName, testName);110 modelNames.put(uniqueName, testName); 110 111 } else { 111 modelNames.put( maybeSubTestName, String.format("%s.%s", name, testName));112 modelNames.put(uniqueName, String.format("%s.%s", name, testName)); 112 113 } 113 114 } -
trunk/Compiler/ModelicaFrontEnd/src/java/org/jmodelica/util/collections/ListUtil.java
r13396 r13456 101 101 */ 102 102 @SafeVarargs 103 public static <T> ArrayList<T> concatenate(List< T>... lists) {103 public static <T> ArrayList<T> concatenate(List<? extends T>... lists) { 104 104 return buildList(lists); 105 105 } … … 112 112 */ 113 113 @SafeVarargs 114 public static <T> ArrayList<T> buildList(Collection< T>... collections) {114 public static <T> ArrayList<T> buildList(Collection<? extends T>... collections) { 115 115 int size = 0; 116 for (Collection< T> list : collections) {116 for (Collection<? extends T> list : collections) { 117 117 size += list.size(); 118 118 } 119 119 ArrayList<T> res = new ArrayList<T>(size); 120 for (Collection< T> list : collections) {120 for (Collection<? extends T> list : collections) { 121 121 res.addAll(list); 122 122 } -
trunk/Compiler/ModelicaFrontEnd/src/java/org/jmodelica/util/test/GenericTestTreeNode.java
r7909 r13456 20 20 public String getName(); 21 21 22 public void setName(String name); 23 22 24 } -
trunk/Compiler/ModelicaFrontEnd/src/java/org/jmodelica/util/test/TestTree.java
r12940 r13456 41 41 42 42 public TestTree exit() { 43 if (children.isEmpty() && parent != null) 43 if (children.isEmpty() && parent != null) { 44 44 parent.children.remove(parentIndex); 45 } 45 46 return parent; 46 47 } … … 54 55 return name; 55 56 } 57 58 @Override 59 public void setName(String name) { 60 this.name = name; 61 } 56 62 57 63 public int numChildren() { -
trunk/Compiler/ModelicaFrontEnd/test/modelica/ConnectTests.mo
r13103 r13456 316 316 a1[2].x = a2[2].x; 317 317 - a1[2].y - a2[2].y = 0.0; 318 a1[1].y = 0.0; 319 a1[2].y = 0.0; 320 a2[1].y = 0.0; 321 a2[2].y = 0.0; 318 322 end ConnectTests.ConnectTest7; 319 323 ")}))); … … 352 356 a[3].x = a[4].x; 353 357 - a[1].y - a[2].y - a[3].y - a[4].y = 0.0; 358 a[1].y = 0.0; 359 a[2].y = 0.0; 360 a[3].y = 0.0; 361 a[4].y = 0.0; 354 362 end ConnectTests.ConnectTest8; 355 363 ")}))); … … 380 388 a[1].x = a[2].x; 381 389 - a[1].y - a[2].y = 0.0; 390 a[1].y = 0.0; 391 a[2].y = 0.0; 382 392 end ConnectTests.ConnectTest9; 383 393 ")}))); … … 454 464 c1.b2.x = c2.b2.x; 455 465 - c1.b2.y - c2.b2.y = 0.0; 466 c1.b1.y = 0.0; 467 c1.b2.y = 0.0; 468 c2.b1.y = 0.0; 469 c2.b2.y = 0.0; 456 470 end ConnectTests.ConnectTest11; 457 471 ")}))); … … 549 563 b[3,2].a[2].x = b[3,3].a[2].x; 550 564 - b[1,1].a[1].y - b[1,1].a[2].y - b[1,2].a[1].y - b[1,2].a[2].y - b[1,3].a[1].y - b[1,3].a[2].y - b[1,4].a[1].y - b[2,1].a[1].y - b[2,1].a[2].y - b[2,2].a[1].y - b[2,2].a[2].y - b[2,3].a[1].y - b[2,3].a[2].y - b[2,4].a[1].y - b[3,1].a[2].y - b[3,2].a[2].y - b[3,3].a[2].y = 0.0; 565 b[1,1].a[1].y = 0.0; 566 b[1,1].a[2].y = 0.0; 567 b[1,2].a[1].y = 0.0; 568 b[1,2].a[2].y = 0.0; 569 b[1,3].a[1].y = 0.0; 570 b[1,3].a[2].y = 0.0; 571 b[1,4].a[1].y = 0.0; 572 b[1,4].a[2].y = 0.0; 573 b[2,1].a[1].y = 0.0; 574 b[2,1].a[2].y = 0.0; 575 b[2,2].a[1].y = 0.0; 576 b[2,2].a[2].y = 0.0; 577 b[2,3].a[1].y = 0.0; 578 b[2,3].a[2].y = 0.0; 579 b[2,4].a[1].y = 0.0; 580 b[2,4].a[2].y = 0.0; 581 b[3,1].a[1].y = 0.0; 582 b[3,1].a[2].y = 0.0; 583 b[3,2].a[1].y = 0.0; 584 b[3,2].a[2].y = 0.0; 585 b[3,3].a[1].y = 0.0; 586 b[3,3].a[2].y = 0.0; 587 b[3,4].a[1].y = 0.0; 588 b[3,4].a[2].y = 0.0; 551 589 end ConnectTests.ConnectTest12; 552 590 ")}))); … … 595 633 b[2].a[2].x = b[3].a[2].x; 596 634 - b[1].a[2].y - b[2].a[2].y - b[3].a[2].y = 0.0; 635 b[1].a[1].y = 0.0; 636 b[1].a[2].y = 0.0; 637 b[2].a[1].y = 0.0; 638 b[2].a[2].y = 0.0; 639 b[3].a[1].y = 0.0; 640 b[3].a[2].y = 0.0; 597 641 end ConnectTests.ConnectTest13; 598 642 ")}))); … … 670 714 b1[2,2].a[2].x = b2[2,2].a[2].x; 671 715 - b1[2,2].a[2].y - b2[2,2].a[2].y = 0.0; 716 b1[1,1].a[1].y = 0.0; 717 b1[1,1].a[2].y = 0.0; 718 b1[1,2].a[1].y = 0.0; 719 b1[1,2].a[2].y = 0.0; 720 b1[2,1].a[1].y = 0.0; 721 b1[2,1].a[2].y = 0.0; 722 b1[2,2].a[1].y = 0.0; 723 b1[2,2].a[2].y = 0.0; 724 b2[1,1].a[1].y = 0.0; 725 b2[1,1].a[2].y = 0.0; 726 b2[1,2].a[1].y = 0.0; 727 b2[1,2].a[2].y = 0.0; 728 b2[2,1].a[1].y = 0.0; 729 b2[2,1].a[2].y = 0.0; 730 b2[2,2].a[1].y = 0.0; 731 b2[2,2].a[2].y = 0.0; 672 732 end ConnectTests.ConnectTest14; 673 733 ")}))); … … 744 804 b[1,2,2].a[2].x = b[2,2,2].a[2].x; 745 805 - b[1,2,2].a[2].y - b[2,2,2].a[2].y = 0.0; 806 b[1,1,1].a[1].y = 0.0; 807 b[1,1,1].a[2].y = 0.0; 808 b[1,1,2].a[1].y = 0.0; 809 b[1,1,2].a[2].y = 0.0; 810 b[1,2,1].a[1].y = 0.0; 811 b[1,2,1].a[2].y = 0.0; 812 b[1,2,2].a[1].y = 0.0; 813 b[1,2,2].a[2].y = 0.0; 814 b[2,1,1].a[1].y = 0.0; 815 b[2,1,1].a[2].y = 0.0; 816 b[2,1,2].a[1].y = 0.0; 817 b[2,1,2].a[2].y = 0.0; 818 b[2,2,1].a[1].y = 0.0; 819 b[2,2,1].a[2].y = 0.0; 820 b[2,2,2].a[1].y = 0.0; 821 b[2,2,2].a[2].y = 0.0; 746 822 end ConnectTests.ConnectTest15; 747 823 ")}))); … … 1125 1201 a1.b[2].x = a2.b[2].x; 1126 1202 - a1.b[2].y - a2.b[2].y = 0.0; 1203 a1.b[1].y = 0.0; 1204 a1.b[2].y = 0.0; 1205 a2.b[1].y = 0.0; 1206 a2.b[2].y = 0.0; 1127 1207 end ConnectTests.ConnectTest26; 1128 1208 ")}))); … … 1570 1650 Real b.d.c2.y; 1571 1651 equation 1652 c1.y = 0.0; 1572 1653 b.c2.x = c1.x; 1573 1654 - b.c2.y - c1.y = 0.0; … … 2619 2700 end for; 2620 2701 2621 annotation(__JModelica(UnitTesting(tests={ 2622 TransformCanonicalTestCase( 2623 name="StreamTest6", 2624 description="Check that inStream() using out-of-bounds array access does not cause crash when used in inactive if branch", 2625 flatModel=" 2702 annotation(__JModelica(UnitTesting(tests={ 2703 TransformCanonicalTestCase( 2704 name="StreamTest6", 2705 description="Check that inStream() using out-of-bounds array access does not cause crash when used in inactive if branch", 2706 eliminate_alias_variables=false, 2707 variability_propagation=false, 2708 flatModel=" 2626 2709 fclass ConnectTests.StreamTest6 2627 2710 structural parameter Integer n = 2 /* 2 */; … … 2653 2736 - a[2].b + b[2].a.b = 0.0; 2654 2737 a[2].c = b[2].a.c; 2738 a[1].b = 0.0; 2739 a[2].b = 0.0; 2655 2740 end ConnectTests.StreamTest6; 2656 2741 ")}))); … … 2714 2799 name="Cardinality2", 2715 2800 description="cardinality(): basic test", 2801 eliminate_alias_variables=false, 2802 variability_propagation=false, 2716 2803 flatModel=" 2717 2804 fclass ConnectTests.Cardinality2 … … 3154 3241 name="TopLevelIO2", 3155 3242 description="", 3243 eliminate_alias_variables=false, 3244 variability_propagation=false, 3156 3245 flatModel=" 3157 3246 fclass ConnectTests.TopLevelIO2 … … 3163 3252 - c1.f + m.c2.f = 0.0; 3164 3253 c1.x = m.c2.x; 3254 c1.f = 0.0; 3165 3255 end ConnectTests.TopLevelIO2; 3166 3256 ")}))); -
trunk/Compiler/ModelicaFrontEnd/test/modelica/ExpandableConnectorArrays.mo
r13104 r13456 394 394 flow Real c5.b; 395 395 equation 396 c1.b = 0.0; 397 c2.b = 0.0; 398 c3.b = 0.0; 399 c4.b = 0.0; 400 c5.b = 0.0; 396 401 c1.a = ec1[1].x.a; 397 402 ec1[1].x.a = ec2[1].x.a; … … 652 657 flow Real c[4].f; 653 658 equation 659 c[1].f = 0.0; 660 c[2].f = 0.0; 661 c[3].f = 0.0; 662 c[4].f = 0.0; 654 663 - c[1].f - c[3].f - ec1[1].a.f - ec2[1].a.f - ec3[1].a.f = 0.0; 655 664 c[1].p = c[3].p; -
trunk/Compiler/ModelicaFrontEnd/test/modelica/ExpandableConnectors.mo
r13103 r13456 105 105 flow Real c5.b; 106 106 equation 107 c1.b = 0.0; 108 c2.b = 0.0; 109 c3.b = 0.0; 110 c4.b = 0.0; 111 c5.b = 0.0; 107 112 c1.a = c3.a; 108 113 c3.a = c5.a; … … 2710 2715 Real ec.x.c[2]; 2711 2716 equation 2717 c[1].a[1:1] = zeros(1); 2718 c[1].b = 0.0; 2712 2719 - c[1].a[1:1] - ec.x.a[1:1] = zeros(1); 2713 2720 - c[1].b - ec.x.b = 0.0; … … 2754 2761 Real ec.x[2].c[2]; 2755 2762 equation 2763 c[1].a[1:1] = zeros(1); 2764 c[1].b = 0.0; 2765 c[2].a[1:1] = zeros(1); 2766 c[2].b = 0.0; 2756 2767 - c[1].a[1:1] - ec.x[1].a[1:1] = zeros(1); 2757 2768 - c[1].b - ec.x[1].b = 0.0; … … 2806 2817 Real ec.x[2].c[2]; 2807 2818 equation 2819 c[1].a[1:1] = zeros(1); 2820 c[1].b = 0.0; 2821 c[2].a[1:1] = zeros(1); 2822 c[2].b = 0.0; 2823 c[3].a[1:1] = zeros(1); 2824 c[3].b = 0.0; 2808 2825 - c[2].a[1:1] - ec.x[1].a[1:1] = zeros(1); 2809 2826 - c[2].b - ec.x[1].b = 0.0; … … 2859 2876 Real ec.x[3].c[2]; 2860 2877 equation 2878 c1.a[1:1] = zeros(1); 2879 c1.b = 0.0; 2880 c2.a[1:1] = zeros(1); 2881 c2.b = 0.0; 2861 2882 - c1.a[1:1] - ec.x[1].a[1:1] = zeros(1); 2862 2883 - c1.b - ec.x[1].b = 0.0; … … 2913 2934 Real ec.x[2].b[3]; 2914 2935 equation 2936 c[1].a[1:2] = zeros(2); 2937 c[2].a[1:3] = zeros(3); 2915 2938 - c[1].a[1:2] - ec.x[1].a[1:2] = zeros(2); 2916 2939 c[1].b[1:2] = ec.x[1].b[1:2]; … … 2962 2985 Real ec.x[3].c; 2963 2986 equation 2987 c1.a = 0.0; 2988 c2.a = 0.0; 2964 2989 - c1.a - ec.x[1].a = 0.0; 2965 2990 c1.b = inStream(ec.x[1].b); -
trunk/Compiler/ModelicaFrontEnd/test/modelica/NameTests.mo
r13317 r13456 3813 3813 - b1.af.x - b2.af.x = 0.0; 3814 3814 b1.ap.x = b2.ap.x; 3815 b1.af.x = 0.0; 3816 b2.af.x = 0.0; 3815 3817 end NameTests.InheritFlowTest1; 3816 3818 ")}))); -
trunk/Compiler/ModelicaFrontEnd/test/modelica/OperatorRecordTests.mo
r13441 r13456 1498 1498 c2.x = c3.x; 1499 1499 OperatorRecordTests.Cplx.'-'.sub(OperatorRecordTests.Cplx.'-'.sub(OperatorRecordTests.Cplx.'-'.neg(c1.y), c2.y), c3.y) = OperatorRecordTests.Cplx.'0'(); 1500 c1.y = OperatorRecordTests.Cplx.'0'(); 1501 c2.y = OperatorRecordTests.Cplx.'0'(); 1502 c3.y = OperatorRecordTests.Cplx.'0'(); 1500 1503 1501 1504 public … … 1714 1717 potential OperatorRecordTests.Cplx c.x; 1715 1718 flow OperatorRecordTests.Cplx c.y; 1719 equation 1720 c.y = OperatorRecordTests.Cplx.'0'(); 1716 1721 1717 1722 public -
trunk/Compiler/ModelicaFrontEnd/test/modelica/OverconstrainedConnection.mo
r13103 r13456 335 335 potential Real c1.x; 336 336 flow Real c1.y; 337 equation 338 c1.y = 0.0; 337 339 end OverconstrainedConnection.OverconstrainedCorrect6; 338 340 ")}))); -
trunk/Compiler/ModelicaFrontEnd/test/modelica/RedeclareTests.mo
r13103 r13456 7245 7245 fclass RedeclareTests.Prefix.RedeclarePrefix9 7246 7246 flow Real c.x; 7247 equation 7248 c.x = 0.0; 7247 7249 end RedeclareTests.Prefix.RedeclarePrefix9; 7248 7250 ")}))); … … 7270 7272 equation 7271 7273 - c1.x - c2.x = 0.0; 7274 c1.x = 0.0; 7275 c2.x = 0.0; 7272 7276 end RedeclareTests.Prefix.RedeclarePrefix10; 7273 7277 ")}))); -
trunk/Compiler/ModelicaFrontEnd/test/modelica/StreamTests.mo
r13370 r13456 229 229 description="Using actualStream() on array of stream variables.", 230 230 eliminate_alias_variables=false, 231 variability_propagation=false, 231 232 flatModel=" 232 233 fclass StreamTests.StreamTest6 … … 235 236 stream Real d.b[2]; 236 237 potential Real d.c; 237 constant Real f[1] = 1; 238 constant Real f[2] = 2; 239 equation 240 1.0 = d.b[1]; 241 2.0 = d.b[2]; 238 Real f[1]; 239 Real f[2]; 240 equation 241 f[1] = d.b[1]; 242 f[2] = d.b[2]; 243 f[1] = 1; 244 f[2] = 2; 242 245 d.c = 0; 246 d.a = 0.0; 243 247 end StreamTests.StreamTest6; 244 248 ")}))); … … 270 274 description="", 271 275 eliminate_alias_variables=false, 276 variability_propagation=false, 272 277 flatModel=" 273 278 fclass StreamTests.StreamTest7 … … 286 291 g.b = f.e.b; 287 292 f.e.c = g.c; 293 g.a = 0.0; 288 294 end StreamTests.StreamTest7; 289 295 ")}))); … … 595 601 a.c.p = c.p; 596 602 c.s = a.c.s; 603 c.f = 0.0; 597 604 a.c.p = 2; 598 605 a.c.s = 1; … … 799 806 a2.c.p = c.p; 800 807 c.s = (_stream_positiveMax_1 * a1.c.s + _stream_positiveMax_2 * a2.c.s) / (_stream_positiveMax_1 + _stream_positiveMax_2); 808 c.f = 0.0; 801 809 a1.c.p = 4; 802 810 a1.c.f = time; … … 877 885 c1.s = (_stream_positiveMax_1 * a.c.s + _stream_positiveMax_2 * c2.s) / (_stream_positiveMax_1 + _stream_positiveMax_2); 878 886 c2.s = (_stream_positiveMax_3 * a.c.s + _stream_positiveMax_4 * c1.s) / (_stream_positiveMax_3 + _stream_positiveMax_4); 887 c1.f = 0.0; 888 c2.f = 0.0; 879 889 a.c.p = 2; 880 890 a.c.s = 1; … … 1076 1086 c1.s = (_stream_positiveMax_1 * a1.c.s + _stream_positiveMax_2 * a2.c.s + _stream_positiveMax_3 * c2.s) / (_stream_positiveMax_1 + _stream_positiveMax_2 + _stream_positiveMax_3); 1077 1087 c2.s = (_stream_positiveMax_4 * a1.c.s + _stream_positiveMax_5 * a2.c.s + _stream_positiveMax_6 * c1.s) / (_stream_positiveMax_4 + _stream_positiveMax_5 + _stream_positiveMax_6); 1088 c1.f = 0.0; 1089 c2.f = 0.0; 1078 1090 a1.c.p = 4; 1079 1091 a1.c.f = time; … … 1163 1175 c1.s = (_stream_positiveMax_1 * a2.c.s + _stream_positiveMax_2 * c2.s) / (_stream_positiveMax_1 + _stream_positiveMax_2); 1164 1176 c2.s = a2.c.s; 1177 c1.f = 0.0; 1178 c2.f = 0.0; 1165 1179 a1.c.p = 4; 1166 1180 a1.c.f = time + 1; … … 1228 1242 c1.s = a2.c.s; 1229 1243 c2.s = a2.c.s; 1244 c1.f = 0.0; 1245 c2.f = 0.0; 1230 1246 a1.c.p = 4; 1231 1247 a1.c.f = time + 1; … … 1285 1301 c1.s = c2.s; 1286 1302 c2.s = 0.0; 1303 c1.f = 0.0; 1304 c2.f = 0.0; 1287 1305 a1.c.p = 4; 1288 1306 a1.c.f = time + 1; … … 1944 1962 c1.s = (_stream_positiveMax_1 * a1.c.s + _stream_positiveMax_2 * a2.c.s + _stream_positiveMax_3 * c2.s) / (_stream_positiveMax_1 + _stream_positiveMax_2 + _stream_positiveMax_3); 1945 1963 c2.s = (_stream_positiveMax_4 * a1.c.s + _stream_positiveMax_5 * a2.c.s + _stream_positiveMax_6 * c1.s) / (_stream_positiveMax_4 + _stream_positiveMax_5 + _stream_positiveMax_6); 1964 c1.f = 0.0; 1965 c2.f = 0.0; 1946 1966 a1.c.p = 4; 1947 1967 a1.c.f = 1; … … 2081 2101 c1[2].s = (_stream_positiveMax_7 * a1[2].c.s + _stream_positiveMax_8 * a2[2].c.s + _stream_positiveMax_9 * c2[2].s) / (_stream_positiveMax_7 + _stream_positiveMax_8 + _stream_positiveMax_9); 2082 2102 c2[2].s = (_stream_positiveMax_10 * a1[2].c.s + _stream_positiveMax_11 * a2[2].c.s + _stream_positiveMax_12 * c1[2].s) / (_stream_positiveMax_10 + _stream_positiveMax_11 + _stream_positiveMax_12); 2103 c1[1].f = 0.0; 2104 c1[2].f = 0.0; 2105 c2[1].f = 0.0; 2106 c2[2].f = 0.0; 2083 2107 a1[1].c.p = 3; 2084 2108 a1[1].c.f = 1; -
trunk/Compiler/ModelicaMiddleEnd/module.options
r12631 r13456 64 64 65 65 ******************************************************************************* 66 BOOLEAN causal_ports compiler experimental false 67 68 "Treat top level connector variables as causal variables. Flow and instream 69 variables as inputs, potential and stream variables as outputs." 70 71 ******************************************************************************* -
trunk/Compiler/ModelicaMiddleEnd/src/jastadd/optimizations/AliasElimination.jrag
r12902 r13456 165 165 eq FVariable.canBeAlias() = !getFAccess().myDerFV(order() + 1).isDummyDerivativeVariable() 166 166 && !isPreVariable() && !isNonDummyDerivativeVariable() 167 && !isInput() && !isOutput() && !isIndependentParameter()167 && getCausalityConnectorPrefix().isNone() && !isIndependentParameter() 168 168 && !isInterface(); 169 169
Note: See TracChangeset
for help on using the changeset viewer.