Opened 11 years ago

Closed 11 years ago

#1946 closed defect (fixed)

Finding the dimension of the component with unknown dimension from the parameter binding fails

Reported by: adrpo Owned by: adrpo
Priority: high Milestone: 1.9.0
Component: Frontend Version: trunk
Keywords: Cc: sjoelund.se, perost

Description

This model:

package Modelica
  package Math  
    package Vectors
      function interpolate 
        input Real[:] x;
        input Real[size(x, 1)] y;
        input Real xi;
        input Integer iLast = 1;
        output Real yi;
        output Integer iNew = 1;
      protected
        Integer i;
        Integer nx = size(x, 1);
        Real x1;
        Real x2;
        Real y1;
        Real y2;
      algorithm
        assert(nx > 0, "The table vectors must have at least 1 entry.");
        if nx == 1 then
          yi := y[1];
        else
          i := min(max(iLast, 1), nx - 1);
          if xi >= x[i] then
            while i < nx and xi >= x[i] loop
              i := i + 1;
            end while;
            i := i - 1;
          else
            while i > 1 and xi < x[i] loop
              i := i - 1;
            end while;
          end if;
          x1 := x[i];
          x2 := x[i + 1];
          y1 := y[i];
          y2 := y[i + 1];
          assert(x2 > x1, "Abszissa table vector values must be increasing");
          yi := y1 + ((y2 - y1) * (xi - x1)) / (x2 - x1);
          iNew := i;
        end if;
      end interpolate;
    end Vectors;  
  end Math;
end Modelica;

model AbsIssues
  parameter Real[:, 2] pressure_drop = [0, 0; 1, 1];
  parameter Boolean anti_symmetric = true;
equation
  assert(not anti_symmetric or abs(pressure_drop[1, 1]) < 1e-12 and 
         abs(pressure_drop[1, 2]) < 1e-12, 
         "Error: To use TableLookupFlow must specify 0,0 in first row of data if anti_symmetric=true");
  assert(abs(Modelica.Math.Vectors.interpolate(pressure_drop[:, 1], pressure_drop[:, 2], 0, 1)) < 1e-06, 
         "Error: To use TableLookupFlow must specify data that goes through 0,0");
end AbsIssues;

has these issues:

Error processing file: AbsIssues.mo
[AbsIssues.mo:54:3-55:82:writable] Error: No matching function found for abs in component <NO COMPONENT>
candidates are .OpenModelica.Internal.intAbs<function>(Integer v) => Integer
 -.OpenModelica.Internal.realAbs<function>(Real v) => Real
Error: Error occurred while flattening model AbsIssues

Change History (6)

comment:1 Changed 11 years ago by adrpo

  • Owner changed from somebody to adrpo
  • Status changed from new to accepted

comment:2 Changed 11 years ago by adrpo

  • Resolution set to fixed
  • Status changed from accepted to closed

Fixed in r14047.

comment:3 Changed 11 years ago by adrpo

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:4 Changed 11 years ago by adrpo

Same as bug #1969. The fix in r14047 is wrong. I should do TSUB instead of allowing subtyping of Tuple vs. nonTuple.

comment:5 Changed 11 years ago by adrpo

Hopefully fixed in r14209.

comment:6 Changed 11 years ago by adrpo

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.