Opened 7 years ago

Closed 7 years ago

#4863 closed defect (fixed)

Issue with linspace() not evaluated in NF

Reported by: Francesco Casella Owned by: Per Östlund
Priority: high Milestone: 2.0.0
Component: New Instantiation Version:
Keywords: Cc:

Description

Please check the ScalableTestSuite.Thermal.DistrictHeating.ScaledExperiments.HeatingSystem_N_5 model. It fails with this error:

ScalableTestSuite_ScalableTestSuite.Thermal.DistrictHeating.ScaledExperiments.HeatingSystem_N_5_08bnd.c:167:60: error: passing 'int' to parameter of incompatible type 'real_array_t' (aka 'struct base_array_s')
  data->simulationInfo->realParameter[5] = (1.0 + real_get(linspace(0.0, 1.348, ((modelica_integer) 5)), 4)) * (10000000.0);
                                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The NF produces this flat declaration

parameter Real Cu[1](quantity = "HeatCapacity", unit = "J/K") =
  (1.0 + linspace(0.0, 1.348, 5)[1]) * 10000000.0 "Heat capacity of heated units";

while the old FE gives

parameter Real Cu[1](quantity = "HeatCapacity", unit = "J/K") =
   10000000.0 "Heat capacity of heated units";

I'm not sure if the code generation should be extended to handle the raw expression involving linspace(), or if the NF should rather evaluate the constant expression and just pass that to the backend, as the old FE did.

Possibly related to #4861

Change History (3)

comment:1 by Francesco Casella, 7 years ago

Component: *unknown*New Instantiation
Milestone: Future2.0.0
Owner: changed from somebody to Per Östlund

comment:2 by Martin Sjölund, 7 years ago

OMC actually doesn't know anything about linspace except the definition (which uses inlining instead of a builtin function). The new FE needs to do the same or introduce handling of linspace everywhere.

comment:3 by Francesco Casella, 7 years ago

Resolution: fixed
Status: newclosed

Fixed sometime on May 8th, see simulation report.

Note: See TracTickets for help on using tickets.