Opened 13 years ago
Closed 13 years ago
#1946 closed defect (fixed)
Finding the dimension of the component with unknown dimension from the parameter binding fails
| Reported by: | Adrian Pop | Owned by: | Adrian Pop | 
|---|---|---|---|
| Priority: | high | Milestone: | 1.9.0 | 
| Component: | Frontend | Version: | trunk | 
| Keywords: | Cc: | Martin Sjölund, Per Östlund | 
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 by , 13 years ago
| Owner: | changed from to | 
|---|---|
| Status: | new → accepted | 
comment:2 by , 13 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | accepted → closed | 
comment:3 by , 13 years ago
| Resolution: | fixed | 
|---|---|
| Status: | closed → reopened | 
comment:4 by , 13 years ago
comment:6 by , 13 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | reopened → closed | 
  Note:
 See   TracTickets
 for help on using tickets.
    
Fixed in r14047.