Changeset 14054


Ignore:
Timestamp:
Nov 14, 2019 9:22:48 AM (3 weeks ago)
Author:
Jonathan Kämpe
Message:

#5875 Relaxed error for incorrect computation order in initial BLT to only apply to iteration variables.

Location:
branches/dev-jk-2612/Compiler/ModelicaMiddleEnd
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-jk-2612/Compiler/ModelicaMiddleEnd/src/jastadd/structural/BLT.jrag

    r13357 r14054  
    37543754        Collection<FVariable> allVariables = allVariables();
    37553755        Set<FVariable> memberVariables = new HashSet<FVariable>(allVariables);
    3756         for (FVariable var : allVariables) {
     3756        for (FVariable var : unsolvedVariables()) {
    37573757            FExp startExpression = var.startAttributeExp();
    37583758            if (startExpression == null) {
  • branches/dev-jk-2612/Compiler/ModelicaMiddleEnd/test/modelica/BlockCompositionTests.mo

    r12934 r14054  
    181181        end StartValueDependency2;
    182182       
     183        model StartValueDependency3
     184            parameter Real p1(fixed=false);
     185            parameter Real p2(fixed=false);
     186            Real x(start = p1);
     187            Real y(start = p2);
     188        initial equation
     189            p1 = y + 1;
     190            p2 = y + time;
     191        equation
     192            x * y = 10;
     193            x = y + time;
     194        annotation(__JModelica(UnitTesting(tests={
     195            ErrorTestCase(
     196                name="InitialParameters_StartValueDependency3",
     197                description="Test error given when start value of a variable depends on initial parameter which is computed in same block",
     198                errorMessage="
     199Error in flattened model, START_VALUE_DEPEND_ON_BLOCK_ERROR:
     200  The start value ('p2') for variable y depends on variables which are computed in the same block, this is not allowed!
     201Block which produced the error:
     202--- Torn system (Block 1) of 1 iteration variables and 3 solved variables ---
     203Torn variables:
     204  p2
     205  x
     206  p1
     207
     208Iteration variables:
     209  y (start=p2)
     210
     211Torn equations:
     212  p2 := y + time
     213  x := y + time
     214  p1 := y + 1
     215
     216Residual equations:
     217  x * y = 10
     218    Iteration variables: y
     219")})));
     220        end StartValueDependency3;
     221       
    183222    end InitialParameters;
    184223end BlockCompositionTests;
Note: See TracChangeset for help on using the changeset viewer.