Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Problem after Upgrade RC2 > RC3

Problem after Upgrade RC2 > RC3

Hello!

After an Update from RC2 to RC3 I have problems running a simulation which worked fine in the earlier version. The model is flattened without errors, but the build of the simulation executeable fails due to some type mismatch problem.

This is the flattened model:

Code:


fclass OIB_RL6.BEISPIELE.beispielTabellen
output Real GL1.result.value;
parameter Real GL1.x = 5.0 "Ausgabewert";
output Real GL2.result.value;
parameter Real GL2.x = 1.9 "Ausgabewert";
output Real GL3.result.value;
Real GL3.inPort.value;
parameter enumeration(index, exact, nearest, left, right, interpolate) TAB1.method_x = OIB_RL6.Datentypen.table_lookup_method.interpolate "Optionen: nearest, left, right, interpolate";
parameter enumeration(index, exact, nearest, left, right, interpolate) TAB1.method_y = OIB_RL6.Datentypen.table_lookup_method.nearest "Optionen: nearest, left, right, interpolate";
constant Real TAB1.header_x[1] = 1.0;
constant Real TAB1.header_x[2] = 2.0;
constant Real TAB1.header_x[3] = 3.0;
constant Real TAB1.header_x[4] = 4.0;
constant Real TAB1.header_y[1] = 1.0;
constant Real TAB1.header_y[2] = 2.0;
constant Real TAB1.header_y[3] = 3.0;
constant Real TAB1.header_y[4] = 4.0;
constant Real TAB1.tableData[1,1] = 1.0;
constant Real TAB1.tableData[1,2] = 2.0;
constant Real TAB1.tableData[1,3] = 3.0;
constant Real TAB1.tableData[1,4] = 4.0;
constant Real TAB1.tableData[2,1] = 5.0;
constant Real TAB1.tableData[2,2] = 6.0;
constant Real TAB1.tableData[2,3] = 7.0;
constant Real TAB1.tableData[2,4] = 8.0;
constant Real TAB1.tableData[3,1] = 9.0;
constant Real TAB1.tableData[3,2] = 10.0;
constant Real TAB1.tableData[3,3] = 11.0;
constant Real TAB1.tableData[3,4] = 12.0;
constant Real TAB1.tableData[4,1] = 13.0;
constant Real TAB1.tableData[4,2] = 14.0;
constant Real TAB1.tableData[4,3] = 15.0;
constant Real TAB1.tableData[4,4] = 16.0;
Real TAB1.in_x.value;
Real TAB1.in_y.value;
Real TAB1.out.value;
output Real GL4.result.value;
parameter Real GL4.x = 1.9999999 "Ausgabewert";
output Real GL5.result.value;
parameter Real GL5.x = 2.0000001 "Ausgabewert";
output Real GL6.result.value;
Real GL6.inPort.value;
parameter enumeration(index, exact, nearest, left, right, interpolate) TAB2.method_x = OIB_RL6.Datentypen.table_lookup_method.left "Optionen: nearest, left, right, interpolate";
parameter enumeration(index, exact, nearest, left, right, interpolate) TAB2.method_y = OIB_RL6.Datentypen.table_lookup_method.right "Optionen: nearest, left, right, interpolate";
constant Real TAB2.header_x[1] = 1.0;
constant Real TAB2.header_x[2] = 2.0;
constant Real TAB2.header_x[3] = 3.0;
constant Real TAB2.header_x[4] = 4.0;
constant Real TAB2.header_x[5] = 5.0;
constant Real TAB2.header_y[1] = 1.0;
constant Real TAB2.header_y[2] = 2.0;
constant Real TAB2.header_y[3] = 3.0;
constant Real TAB2.header_y[4] = 4.0;
constant Real TAB2.tableData[1,1] = 1.0;
constant Real TAB2.tableData[1,2] = 2.0;
constant Real TAB2.tableData[1,3] = 3.0;
constant Real TAB2.tableData[1,4] = 4.0;
constant Real TAB2.tableData[2,1] = 5.0;
constant Real TAB2.tableData[2,2] = 6.0;
constant Real TAB2.tableData[2,3] = 7.0;
constant Real TAB2.tableData[2,4] = 8.0;
constant Real TAB2.tableData[3,1] = 9.0;
constant Real TAB2.tableData[3,2] = 10.0;
constant Real TAB2.tableData[3,3] = 11.0;
constant Real TAB2.tableData[3,4] = 12.0;
Real TAB2.in_x.value;
Real TAB2.in_y.value;
Real TAB2.out.value;
output Real Summe.result.value;
Real Summe.inPort1.value;
Real Summe.inPort2.value;
equation
  GL1.result.value = GL1.x;
  GL2.result.value = GL2.x;
  GL3.result.value = sin(0.0174527777777778 * (time * GL3.inPort.value));
  TAB1.out.value = OIB_RL6.BEISPIELE.Tabellen.TestTabelle1.lookup({1.0,2.0,3.0,4.0},{1.0,2.0,3.0,4.0},TAB1.in_x.value,TAB1.in_y.value,{{1.0,5.0,9.0,13.0},{2.0,6.0,10.0,14.0},{3.0,7.0,11.0,15.0},{4.0,8.0,12.0,16.0}},TAB1.method_x,TAB1.method_y);
  GL4.result.value = GL4.x;
  GL5.result.value = GL5.x;
  GL6.result.value = sin(0.0174527777777778 * (time * GL6.inPort.value));
  TAB2.out.value = OIB_RL6.BEISPIELE.Tabellen.TestTabelle2.lookup({1.0,2.0,3.0,4.0,5.0},{1.0,2.0,3.0,4.0},TAB2.in_x.value,TAB2.in_y.value,{{1.0,5.0,9.0},{2.0,6.0,10.0},{3.0,7.0,11.0},{4.0,8.0,12.0}},TAB2.method_x,TAB2.method_y);
  Summe.result.value = Summe.inPort1.value + Summe.inPort2.value;
GL1.result.value = TAB1.in_x.value;
GL2.result.value = TAB1.in_y.value;
TAB1.out.value = GL3.inPort.value;
GL4.result.value = TAB2.in_x.value;
GL5.result.value = TAB2.in_y.value;
TAB2.out.value = GL6.inPort.value;
GL6.result.value = Summe.inPort2.value;
GL3.result.value = Summe.inPort1.value;
end OIB_RL6.BEISPIELE.beispielTabellen;

The build log contains a couple of errors like this.

Code:


OIB_RL6.BEISPIELE.beispielTabellen.cpp:477: warning: passing `double' for converting 7 of `OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup_rettype _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup(real_array, real_array, modelica_real, modelica_real, real_array, modelica_integer, modelica_integer)'
OIB_RL6.BEISPIELE.beispielTabellen.cpp:483: error: non-lvalue in unary `&'

Does anyone know, what's going wrong here?

Kind Regards,
Hannes

Re: Problem after Upgrade RC2 > RC3

Could you provide the Modelica function header of the code that fails?
Algorithm section not important.

Re: Problem after Upgrade RC2 > RC3

This is it:

Code:


  function lookup
   
    input Real header_x[:],
               header_y[:];
    input Real value_x,
               value_y;
    input Real tableData[:,:];
    input table_lookup_method method_x = table_lookup_method.nearest,
                              method_y = table_lookup_method.nearest;

    output Real result;

    protected
      Integer index_x, index_y;
      Integer lower, upper;
      Integer i;   
     
      Boolean extrapolate[tableBorder]; //FYI: tableBoder is an enumeration type
   
    algorithm
   
    [...]
   
   end lookup;   

Re: Problem after Upgrade RC2 > RC3

Was the information I provided sufficient?

Re: Problem after Upgrade RC2 > RC3

Ooops... It seems I read the error message a bit too fast... I thought it was line 477 that was weird... But 483 is 6 lines below that. Quite a bit.

I probably need to check the generated C-code to see what's wrong.

Re: Problem after Upgrade RC2 > RC3

...Viola!

This is the functions .cpp:

Code:


#ifdef __cplusplus
extern "C" {
#endif
/* header part */
#define OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex_rettype_1 targ1
typedef struct OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex_rettype_s
{
    modelica_integer targ1; /* [] */
} OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex_rettype;

DLLExport
OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex_rettype _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex(real_array array, modelica_real value);

DLLExport
int in_OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex(type_description * inArgs, type_description * outVar);
#define OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype_1 targ1
typedef struct OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype_s
{
    modelica_real targ1; /* [] */
} OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype;

DLLExport
OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate(modelica_real lowerIndex, modelica_real interimIndex, modelica_real upperIndex, modelica_real lowerValue, modelica_real upperValue);

DLLExport
int in_OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate(type_description * inArgs, type_description * outVar);
#define OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettypeboxed_1 targ1
typedef struct OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettypeboxed_s
{
  modelica_metatype targ1;
} OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettypeboxed;

DLLExport
OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettypeboxed boxptr_OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate(modelica_metatype lowerIndex, modelica_metatype interimIndex, modelica_metatype upperIndex, modelica_metatype lowerValue, modelica_metatype upperValue);
#define OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex_rettype_1 targ1
typedef struct OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex_rettype_s
{
    modelica_integer targ1; /* [] */
} OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex_rettype;

DLLExport
OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex_rettype _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex(real_array array, modelica_real value);

DLLExport
int in_OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex(type_description * inArgs, type_description * outVar);
#define OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype_1 targ1
typedef struct OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype_s
{
    modelica_real targ1; /* [] */
} OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype;

DLLExport
OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate(modelica_real lowerIndex, modelica_real interimIndex, modelica_real upperIndex, modelica_real lowerValue, modelica_real upperValue);

DLLExport
int in_OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate(type_description * inArgs, type_description * outVar);
#define OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettypeboxed_1 targ1
typedef struct OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettypeboxed_s
{
  modelica_metatype targ1;
} OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettypeboxed;

DLLExport
OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettypeboxed boxptr_OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate(modelica_metatype lowerIndex, modelica_metatype interimIndex, modelica_metatype upperIndex, modelica_metatype lowerValue, modelica_metatype upperValue);
#define OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup_rettype_1 targ1
typedef struct OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup_rettype_s
{
    modelica_real targ1; /* [] */
} OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup_rettype;

DLLExport
OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup_rettype _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup(real_array header_x, real_array header_y, modelica_real value_x, modelica_real value_y, real_array tableData, modelica_integer method_x, modelica_integer method_y);

DLLExport
int in_OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup(type_description * inArgs, type_description * outVar);
#define OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup_rettype_1 targ1
typedef struct OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup_rettype_s
{
    modelica_real targ1; /* [] */
} OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup_rettype;

DLLExport
OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup_rettype _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup(real_array header_x, real_array header_y, modelica_real value_x, modelica_real value_y, real_array tableData, modelica_integer method_x, modelica_integer method_y);

DLLExport
int in_OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup(type_description * inArgs, type_description * outVar);
/* End of header part */

/* Body */
OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex_rettype _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex(real_array array, modelica_real value)
{
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex_rettype tmp1;
  state tmp2;
  modelica_integer index;
  modelica_real minDistance;
  modelica_real tmp3;
  size_t tmp9;
  state tmp4;
  modelica_integer tmp6;
  modelica_integer tmp7;
  modelica_integer tmp8;
  modelica_real tmp10;
  modelica_real tmp11;
  tmp2 = get_memory_state();
  tmp3 = fabs((value - (*real_array_element_addr1(&array, 1, 1))));
  minDistance = tmp3;
  index = 1;
  tmp9 = size_of_dimension_real_array(array,1);
  tmp6 = 2; tmp7 = (1); tmp8 = tmp9;
  {
  modelica_integer x;

    for (x = tmp6; in_range_integer(x, tmp6, tmp8); x += tmp7) {
      tmp4 = get_memory_state();
      tmp10 = fabs((value - (*real_array_element_addr1(&array, 1, (modelica_integer)x))));
      if ((tmp10 < minDistance)) {
        tmp11 = fabs((value - (*real_array_element_addr1(&array, 1, (modelica_integer)x))));
        minDistance = tmp11;
        index = (modelica_integer)x;
      }
      restore_memory_state(tmp4);
    }
  } /* end for*/

 
  _return:
  tmp1.targ1 = index;
  restore_memory_state(tmp2);
  return tmp1;
}

int in_OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex(type_description * inArgs, type_description * outVar)
{
  real_array array; /* [:] */
  modelica_real value;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex_rettype out;
  if(read_real_array(&inArgs, &array)) return 1;
  if(read_modelica_real(&inArgs, &value)) return 1;
  out = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex(array, value);
  write_modelica_integer(outVar, &out.targ1);
  return 0;
}

OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate(modelica_real lowerIndex, modelica_real interimIndex, modelica_real upperIndex, modelica_real lowerValue, modelica_real upperValue)
{
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype tmp1;
  state tmp2;
  modelica_real interimValue;
  tmp2 = get_memory_state();
  interimValue = (lowerValue + ((upperValue - lowerValue) * ((interimIndex - lowerIndex) / (upperIndex - lowerIndex))));
 
  _return:
  tmp1.targ1 = interimValue;
  restore_memory_state(tmp2);
  return tmp1;
}

int in_OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate(type_description * inArgs, type_description * outVar)
{
  modelica_real lowerIndex;
  modelica_real interimIndex;
  modelica_real upperIndex;
  modelica_real lowerValue;
  modelica_real upperValue;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype out;
  if(read_modelica_real(&inArgs, &lowerIndex)) return 1;
  if(read_modelica_real(&inArgs, &interimIndex)) return 1;
  if(read_modelica_real(&inArgs, &upperIndex)) return 1;
  if(read_modelica_real(&inArgs, &lowerValue)) return 1;
  if(read_modelica_real(&inArgs, &upperValue)) return 1;
  out = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate(lowerIndex, interimIndex, upperIndex, lowerValue, upperValue);
  write_modelica_real(outVar, &out.targ1);
  return 0;
}

OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettypeboxed boxptr_OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate(modelica_metatype lowerIndex, modelica_metatype interimIndex, modelica_metatype upperIndex, modelica_metatype lowerValue, modelica_metatype upperValue)
{
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettypeboxed tmp1;
  state tmp9;
  mmc__unbox__real_rettype tmp2;
  mmc__unbox__real_rettype tmp3;
  mmc__unbox__real_rettype tmp4;
  mmc__unbox__real_rettype tmp5;
  mmc__unbox__real_rettype tmp6;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype tmp7;
  mmc__mk__rcon_rettype tmp8;
  tmp9 = get_memory_state();
  tmp2 = mmc__unbox__real(lowerIndex);
  tmp3 = mmc__unbox__real(interimIndex);
  tmp4 = mmc__unbox__real(upperIndex);
  tmp5 = mmc__unbox__real(lowerValue);
  tmp6 = mmc__unbox__real(upperValue);
  tmp7 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate(tmp2, tmp3, tmp4, tmp5, tmp6);
  tmp8 = mmc__mk__rcon(tmp7.OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype_1);
  tmp1.OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettypeboxed_1 = tmp8;
  restore_memory_state(tmp9);
  return tmp1;
}

OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex_rettype _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex(real_array array, modelica_real value)
{
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex_rettype tmp1;
  state tmp2;
  modelica_integer index;
  modelica_real minDistance;
  modelica_real tmp3;
  size_t tmp9;
  state tmp4;
  modelica_integer tmp6;
  modelica_integer tmp7;
  modelica_integer tmp8;
  modelica_real tmp10;
  modelica_real tmp11;
  tmp2 = get_memory_state();
  tmp3 = fabs((value - (*real_array_element_addr1(&array, 1, 1))));
  minDistance = tmp3;
  index = 1;
  tmp9 = size_of_dimension_real_array(array,1);
  tmp6 = 2; tmp7 = (1); tmp8 = tmp9;
  {
  modelica_integer x;

    for (x = tmp6; in_range_integer(x, tmp6, tmp8); x += tmp7) {
      tmp4 = get_memory_state();
      tmp10 = fabs((value - (*real_array_element_addr1(&array, 1, (modelica_integer)x))));
      if ((tmp10 < minDistance)) {
        tmp11 = fabs((value - (*real_array_element_addr1(&array, 1, (modelica_integer)x))));
        minDistance = tmp11;
        index = (modelica_integer)x;
      }
      restore_memory_state(tmp4);
    }
  } /* end for*/

 
  _return:
  tmp1.targ1 = index;
  restore_memory_state(tmp2);
  return tmp1;
}

int in_OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex(type_description * inArgs, type_description * outVar)
{
  real_array array; /* [:] */
  modelica_real value;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex_rettype out;
  if(read_real_array(&inArgs, &array)) return 1;
  if(read_modelica_real(&inArgs, &value)) return 1;
  out = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex(array, value);
  write_modelica_integer(outVar, &out.targ1);
  return 0;
}

OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate(modelica_real lowerIndex, modelica_real interimIndex, modelica_real upperIndex, modelica_real lowerValue, modelica_real upperValue)
{
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype tmp1;
  state tmp2;
  modelica_real interimValue;
  tmp2 = get_memory_state();
  interimValue = (lowerValue + ((upperValue - lowerValue) * ((interimIndex - lowerIndex) / (upperIndex - lowerIndex))));
 
  _return:
  tmp1.targ1 = interimValue;
  restore_memory_state(tmp2);
  return tmp1;
}

int in_OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate(type_description * inArgs, type_description * outVar)
{
  modelica_real lowerIndex;
  modelica_real interimIndex;
  modelica_real upperIndex;
  modelica_real lowerValue;
  modelica_real upperValue;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype out;
  if(read_modelica_real(&inArgs, &lowerIndex)) return 1;
  if(read_modelica_real(&inArgs, &interimIndex)) return 1;
  if(read_modelica_real(&inArgs, &upperIndex)) return 1;
  if(read_modelica_real(&inArgs, &lowerValue)) return 1;
  if(read_modelica_real(&inArgs, &upperValue)) return 1;
  out = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate(lowerIndex, interimIndex, upperIndex, lowerValue, upperValue);
  write_modelica_real(outVar, &out.targ1);
  return 0;
}

OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettypeboxed boxptr_OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate(modelica_metatype lowerIndex, modelica_metatype interimIndex, modelica_metatype upperIndex, modelica_metatype lowerValue, modelica_metatype upperValue)
{
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettypeboxed tmp1;
  state tmp9;
  mmc__unbox__real_rettype tmp2;
  mmc__unbox__real_rettype tmp3;
  mmc__unbox__real_rettype tmp4;
  mmc__unbox__real_rettype tmp5;
  mmc__unbox__real_rettype tmp6;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype tmp7;
  mmc__mk__rcon_rettype tmp8;
  tmp9 = get_memory_state();
  tmp2 = mmc__unbox__real(lowerIndex);
  tmp3 = mmc__unbox__real(interimIndex);
  tmp4 = mmc__unbox__real(upperIndex);
  tmp5 = mmc__unbox__real(lowerValue);
  tmp6 = mmc__unbox__real(upperValue);
  tmp7 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate(tmp2, tmp3, tmp4, tmp5, tmp6);
  tmp8 = mmc__mk__rcon(tmp7.OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype_1);
  tmp1.OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettypeboxed_1 = tmp8;
  restore_memory_state(tmp9);
  return tmp1;
}

OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup_rettype _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup(real_array header_x, real_array header_y, modelica_real value_x, modelica_real value_y, real_array tableData, modelica_integer method_x, modelica_integer method_y)
{
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup_rettype tmp1;
  state tmp2;
  modelica_real result;
  modelica_integer index_x;
  modelica_integer index_y;
  modelica_integer lower;
  modelica_integer upper;
  modelica_integer i;
  boolean_array extrapolate; /* [4] */
  modelica_string tmp3;
  size_t tmp4;
  size_t tmp5;
  modelica_string tmp6;
  size_t tmp7;
  size_t tmp8;
  modelica_string tmp9;
  size_t tmp10;
  size_t tmp11;
  modelica_string tmp12;
  size_t tmp13;
  size_t tmp14;
  modelica_string tmp15;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex_rettype tmp16;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex_rettype tmp17;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex_rettype tmp18;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype tmp19;
  modelica_string tmp20;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype tmp21;
  size_t tmp22;
  size_t tmp23;
  size_t tmp24;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype tmp25;
  size_t tmp26;
  modelica_string tmp27;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype tmp28;
  size_t tmp34;
  state tmp29;
  modelica_integer tmp31;
  modelica_integer tmp32;
  modelica_integer tmp33;
  size_t tmp40;
  state tmp35;
  modelica_integer tmp37;
  modelica_integer tmp38;
  modelica_integer tmp39;
  modelica_string tmp41;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex_rettype tmp42;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex_rettype tmp43;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex_rettype tmp44;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype tmp45;
  modelica_string tmp46;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype tmp47;
  size_t tmp48;
  size_t tmp49;
  size_t tmp50;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype tmp51;
  size_t tmp52;
  modelica_string tmp53;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype tmp54;
  size_t tmp60;
  state tmp55;
  modelica_integer tmp57;
  modelica_integer tmp58;
  modelica_integer tmp59;
  size_t tmp66;
  state tmp61;
  modelica_integer tmp63;
  modelica_integer tmp64;
  modelica_integer tmp65;
  modelica_string tmp67;
  tmp2 = get_memory_state();
  alloc_boolean_array(&extrapolate, 1, 4);
  (*boolean_array_element_addr1(&extrapolate, 1, 1)) = (0);
  (*boolean_array_element_addr1(&extrapolate, 1, 2)) = (0);
  (*boolean_array_element_addr1(&extrapolate, 1, 3)) = (0);
  (*boolean_array_element_addr1(&extrapolate, 1, 4)) = (0);
  if ((method_x == 2)) {
    method_x = 3;
  }
  if ((method_x == 1)) {
    method_x = 3;
  }
  if ((method_y == 2)) {
    method_y = 3;
  }
  if ((method_y == 1)) {
    method_y = 3;
  }
  init_modelica_string(&tmp3,"Interpolation ist nur in einer Tabellendimension (Spalten oder Zeilen) moeglich.");
  MODELICA_ASSERT((!((method_x == 6) && (method_y == 6))), tmp3);
  if (((method_x == 3) || (method_x == 6))) {
    tmp4 = size_of_dimension_real_array(tableData,1);
    tmp5 = size_of_dimension_real_array(header_x,1);
    init_modelica_string(&tmp6,"Dimension der Kopfzeile ist inkompatibel zur Dimension der Tabellenbreite.");
    MODELICA_ASSERT((tmp4 == tmp5), tmp6);
  }
  else {
    if (((method_x == 4) || (method_x == 5))) {
      tmp7 = size_of_dimension_real_array(tableData,1);
      tmp8 = size_of_dimension_real_array(header_x,1);
      init_modelica_string(&tmp9,"Dimension der Kopfzeile ist inkompatibel zur Dimension der Tabellenbreite.");
      MODELICA_ASSERT((tmp7 == (tmp8 - 1)), tmp9);
    }
  }
  if (((method_y == 3) || (method_y == 6))) {
    tmp10 = size_of_dimension_real_array(tableData,2);
    tmp11 = size_of_dimension_real_array(header_y,1);
    init_modelica_string(&tmp12,"Dimension der Indexspalte ist inkompatibel zur Dimension der Tabellenhöhe.");
    MODELICA_ASSERT((tmp10 == tmp11), tmp12);
  }
  else {
    if (((method_y == 4) || (method_y == 5))) {
      tmp13 = size_of_dimension_real_array(tableData,2);
      tmp14 = size_of_dimension_real_array(header_y,1);
      init_modelica_string(&tmp15,"Dimension der Indexspalte ist inkompatibel zur Dimension der Tabellenhöhe.");
      MODELICA_ASSERT((tmp13 == (tmp14 - 1)), tmp15);
    }
  }
  if ((method_x == 3)) {
    tmp16 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex(header_x, value_x);
    index_x = tmp16.OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex_rettype_1;
  }
  else {
    if ((method_x == 6)) {
      tmp17 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex(header_x, value_x);
      index_x = tmp17.OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex_rettype_1;
      tmp18 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex(header_y, value_y);
      index_y = tmp18.OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex_rettype_1;
      if ((value_x < (*real_array_element_addr1(&header_x, 1, (modelica_integer)index_x)))) {
        if ((((modelica_integer)index_x - 1) < 1)) {
          if ((*boolean_array_element_addr1(&extrapolate, 1, 1))) {
            lower = 1;
            upper = 2;
            tmp19 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate((*real_array_element_addr1(&header_x, 1, (modelica_integer)lower)), value_x, (*real_array_element_addr1(&header_x, 1, (modelica_integer)upper)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)lower, (modelica_integer)index_y)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)upper, (modelica_integer)index_y)));
            result = tmp19.OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype_1;
            goto _return;
          }
          else {
            init_modelica_string(&tmp20,"Spalten-Eingangswert erfodert Extrapolation am linken Tabellenrand.");
            MODELICA_ASSERT((!((((modelica_integer)index_x - 1) < 1) && (!(*boolean_array_element_addr1(&extrapolate, 1, 1))))), tmp20);
          }
        }
        else {
          lower = ((modelica_integer)index_x - 1);
          upper = (modelica_integer)index_x;
          tmp21 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate((*real_array_element_addr1(&header_x, 1, (modelica_integer)lower)), value_x, (*real_array_element_addr1(&header_x, 1, (modelica_integer)upper)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)lower, (modelica_integer)index_y)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)upper, (modelica_integer)index_y)));
          result = tmp21.OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype_1;
          goto _return;
        }
      }
      else {
        if ((value_x > (*real_array_element_addr1(&header_x, 1, (modelica_integer)index_x)))) {
          tmp22 = size_of_dimension_real_array(header_x,1);
          if (((1 + (modelica_integer)index_x) > tmp22)) {
            if ((*boolean_array_element_addr1(&extrapolate, 1, 2))) {
              tmp23 = size_of_dimension_real_array(header_x,1);
              lower = (tmp23 - 1);
              tmp24 = size_of_dimension_real_array(header_x,1);
              upper = tmp24;
              tmp25 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate((*real_array_element_addr1(&header_x, 1, (modelica_integer)lower)), value_x, (*real_array_element_addr1(&header_x, 1, (modelica_integer)upper)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)lower, (modelica_integer)index_y)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)upper, (modelica_integer)index_y)));
              result = tmp25.OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype_1;
              goto _return;
            }
            else {
              tmp26 = size_of_dimension_real_array(header_x,1);
              init_modelica_string(&tmp27,"Spalten-Eingangswert erfodert Extrapolation am rechten Tabellenrand.");
              MODELICA_ASSERT((!(((1 + (modelica_integer)index_x) > tmp26) && (!(*boolean_array_element_addr1(&extrapolate, 1, 2))))), tmp27);
            }
          }
          else {
            lower = (modelica_integer)index_x;
            upper = (1 + (modelica_integer)index_x);
            tmp28 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate((*real_array_element_addr1(&header_x, 1, (modelica_integer)lower)), value_x, (*real_array_element_addr1(&header_x, 1, (modelica_integer)upper)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)lower, (modelica_integer)index_y)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)upper, (modelica_integer)index_y)));
            result = tmp28.OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype_1;
            goto _return;
          }
        }
      }
    }
    else {
      if ((method_x == 4)) {
        tmp34 = size_of_dimension_real_array(header_x,1);
        tmp31 = 1; tmp32 = (1); tmp33 = (tmp34 - 1);
        {
  modelica_integer i;

          for (i = tmp31; in_range_integer(i, tmp31, tmp33); i += tmp32) {
            tmp29 = get_memory_state();
            if ((((*real_array_element_addr1(&header_x, 1, (modelica_integer)i)) <= value_x) && (value_x < (*real_array_element_addr1(&header_x, 1, (1 + (modelica_integer)i)))))) {
              index_x = (modelica_integer)i;
              break;
            }
            restore_memory_state(tmp29);
          }
        } /* end for*/

      }
      else {
        if ((method_x == 5)) {
          tmp40 = size_of_dimension_real_array(header_x,1);
          tmp37 = 1; tmp38 = (1); tmp39 = (tmp40 - 1);
          {
  modelica_integer i;

            for (i = tmp37; in_range_integer(i, tmp37, tmp39); i += tmp38) {
              tmp35 = get_memory_state();
              if ((((*real_array_element_addr1(&header_x, 1, (modelica_integer)i)) < value_x) && (value_x <= (*real_array_element_addr1(&header_x, 1, (1 + (modelica_integer)i)))))) {
                index_x = (modelica_integer)i;
                break;
              }
              restore_memory_state(tmp35);
            }
          } /* end for*/

        }
        else {
          init_modelica_string(&tmp41,"Unbekannte Lookup-Methode für Tabellenspalte.");
          MODELICA_ASSERT((0), tmp41);
        }
      }
    }
  }
  if ((method_y == 3)) {
    tmp42 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex(header_y, value_y);
    index_y = tmp42.OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex_rettype_1;
  }
  else {
    if ((method_y == 6)) {
      tmp43 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex(header_x, value_x);
      index_x = tmp43.OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex_rettype_1;
      tmp44 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex(header_y, value_y);
      index_y = tmp44.OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_findClosestIndex_rettype_1;
      if ((value_y < (*real_array_element_addr1(&header_y, 1, (modelica_integer)index_y)))) {
        if ((((modelica_integer)index_y - 1) < 1)) {
          if ((*boolean_array_element_addr1(&extrapolate, 1, 3))) {
            lower = 1;
            upper = 2;
            tmp45 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate((*real_array_element_addr1(&header_y, 1, (modelica_integer)lower)), value_y, (*real_array_element_addr1(&header_y, 1, (modelica_integer)upper)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)index_x, (modelica_integer)lower)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)index_x, (modelica_integer)upper)));
            result = tmp45.OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype_1;
            goto _return;
          }
          else {
            init_modelica_string(&tmp46,"Zeilen-Eingangswert erfodert Extrapolation am unteren Tabellenrand.");
            MODELICA_ASSERT((!((((modelica_integer)index_y - 1) < 1) && (!(*boolean_array_element_addr1(&extrapolate, 1, 3))))), tmp46);
          }
        }
        else {
          lower = ((modelica_integer)index_y - 1);
          upper = (modelica_integer)index_y;
          tmp47 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate((*real_array_element_addr1(&header_y, 1, (modelica_integer)lower)), value_y, (*real_array_element_addr1(&header_y, 1, (modelica_integer)upper)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)index_x, (modelica_integer)lower)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)index_x, (modelica_integer)upper)));
          result = tmp47.OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype_1;
          goto _return;
        }
      }
      else {
        if ((value_y > (*real_array_element_addr1(&header_y, 1, (modelica_integer)index_y)))) {
          tmp48 = size_of_dimension_real_array(header_y,1);
          if (((1 + (modelica_integer)index_y) > tmp48)) {
            if ((*boolean_array_element_addr1(&extrapolate, 1, 4))) {
              tmp49 = size_of_dimension_real_array(header_y,1);
              lower = (tmp49 - 1);
              tmp50 = size_of_dimension_real_array(header_y,1);
              upper = tmp50;
              tmp51 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate((*real_array_element_addr1(&header_y, 1, (modelica_integer)lower)), value_y, (*real_array_element_addr1(&header_y, 1, (modelica_integer)upper)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)index_x, (modelica_integer)lower)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)index_x, (modelica_integer)upper)));
              result = tmp51.OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype_1;
              goto _return;
            }
            else {
              tmp52 = size_of_dimension_real_array(header_y,1);
              init_modelica_string(&tmp53,"Zeilen-Eingangswert erfodert Extrapolation am oberen Tabellenrand.");
              MODELICA_ASSERT((!(((1 + (modelica_integer)index_y) > tmp52) && (!(*boolean_array_element_addr1(&extrapolate, 1, 4))))), tmp53);
            }
          }
          else {
            lower = (modelica_integer)index_y;
            upper = (1 + (modelica_integer)index_y);
            tmp54 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate((*real_array_element_addr1(&header_y, 1, (modelica_integer)lower)), value_y, (*real_array_element_addr1(&header_y, 1, (modelica_integer)upper)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)index_x, (modelica_integer)lower)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)index_x, (modelica_integer)upper)));
            result = tmp54.OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_interpolate_rettype_1;
            goto _return;
          }
        }
      }
    }
    else {
      if ((method_y == 4)) {
        tmp60 = size_of_dimension_real_array(header_y,1);
        tmp57 = 1; tmp58 = (1); tmp59 = (tmp60 - 1);
        {
  modelica_integer i;

          for (i = tmp57; in_range_integer(i, tmp57, tmp59); i += tmp58) {
            tmp55 = get_memory_state();
            if ((((*real_array_element_addr1(&header_y, 1, (modelica_integer)i)) <= value_y) && (value_y < (*real_array_element_addr1(&header_y, 1, (1 + (modelica_integer)i)))))) {
              index_y = (modelica_integer)i;
              break;
            }
            restore_memory_state(tmp55);
          }
        } /* end for*/

      }
      else {
        if ((method_y == 5)) {
          tmp66 = size_of_dimension_real_array(header_y,1);
          tmp63 = 1; tmp64 = (1); tmp65 = (tmp66 - 1);
          {
  modelica_integer i;

            for (i = tmp63; in_range_integer(i, tmp63, tmp65); i += tmp64) {
              tmp61 = get_memory_state();
              if ((((*real_array_element_addr1(&header_y, 1, (modelica_integer)i)) < value_y) && (value_y <= (*real_array_element_addr1(&header_y, 1, (1 + (modelica_integer)i)))))) {
                index_y = (modelica_integer)i;
                break;
              }
              restore_memory_state(tmp61);
            }
          } /* end for*/

        }
        else {
          init_modelica_string(&tmp67,"Unbekannte Lookup-Methode für Tabellenzeile.");
          MODELICA_ASSERT((0), tmp67);
        }
      }
    }
  }
  result = (*real_array_element_addr2(&tableData, 2, (modelica_integer)index_x, (modelica_integer)index_y));
 
  _return:
  tmp1.targ1 = result;
  restore_memory_state(tmp2);
  return tmp1;
}

int in_OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup(type_description * inArgs, type_description * outVar)
{
  real_array header_x; /* [:] */
  real_array header_y; /* [:] */
  modelica_real value_x;
  modelica_real value_y;
  real_array tableData; /* [:, :] */
  modelica_integer method_x;
  modelica_integer method_y;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup_rettype out;
  if(read_real_array(&inArgs, &header_x)) return 1;
  if(read_real_array(&inArgs, &header_y)) return 1;
  if(read_modelica_real(&inArgs, &value_x)) return 1;
  if(read_modelica_real(&inArgs, &value_y)) return 1;
  if(read_real_array(&inArgs, &tableData)) return 1;
  if(read_modelica_integer(&inArgs, &method_x)) return 1;
  if(read_modelica_integer(&inArgs, &method_y)) return 1;
  out = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup(header_x, header_y, value_x, value_y, tableData, method_x, method_y);
  write_modelica_real(outVar, &out.targ1);
  return 0;
}

OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup_rettype _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup(real_array header_x, real_array header_y, modelica_real value_x, modelica_real value_y, real_array tableData, modelica_integer method_x, modelica_integer method_y)
{
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup_rettype tmp1;
  state tmp2;
  modelica_real result;
  modelica_integer index_x;
  modelica_integer index_y;
  modelica_integer lower;
  modelica_integer upper;
  modelica_integer i;
  boolean_array extrapolate; /* [4] */
  modelica_string tmp3;
  size_t tmp4;
  size_t tmp5;
  modelica_string tmp6;
  size_t tmp7;
  size_t tmp8;
  modelica_string tmp9;
  size_t tmp10;
  size_t tmp11;
  modelica_string tmp12;
  size_t tmp13;
  size_t tmp14;
  modelica_string tmp15;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex_rettype tmp16;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex_rettype tmp17;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex_rettype tmp18;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype tmp19;
  modelica_string tmp20;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype tmp21;
  size_t tmp22;
  size_t tmp23;
  size_t tmp24;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype tmp25;
  size_t tmp26;
  modelica_string tmp27;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype tmp28;
  size_t tmp34;
  state tmp29;
  modelica_integer tmp31;
  modelica_integer tmp32;
  modelica_integer tmp33;
  size_t tmp40;
  state tmp35;
  modelica_integer tmp37;
  modelica_integer tmp38;
  modelica_integer tmp39;
  modelica_string tmp41;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex_rettype tmp42;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex_rettype tmp43;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex_rettype tmp44;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype tmp45;
  modelica_string tmp46;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype tmp47;
  size_t tmp48;
  size_t tmp49;
  size_t tmp50;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype tmp51;
  size_t tmp52;
  modelica_string tmp53;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype tmp54;
  size_t tmp60;
  state tmp55;
  modelica_integer tmp57;
  modelica_integer tmp58;
  modelica_integer tmp59;
  size_t tmp66;
  state tmp61;
  modelica_integer tmp63;
  modelica_integer tmp64;
  modelica_integer tmp65;
  modelica_string tmp67;
  tmp2 = get_memory_state();
  alloc_boolean_array(&extrapolate, 1, 4);
  (*boolean_array_element_addr1(&extrapolate, 1, 1)) = (0);
  (*boolean_array_element_addr1(&extrapolate, 1, 2)) = (0);
  (*boolean_array_element_addr1(&extrapolate, 1, 3)) = (0);
  (*boolean_array_element_addr1(&extrapolate, 1, 4)) = (0);
  if ((method_x == 2)) {
    method_x = 3;
  }
  if ((method_x == 1)) {
    method_x = 3;
  }
  if ((method_y == 2)) {
    method_y = 3;
  }
  if ((method_y == 1)) {
    method_y = 3;
  }
  init_modelica_string(&tmp3,"Interpolation ist nur in einer Tabellendimension (Spalten oder Zeilen) moeglich.");
  MODELICA_ASSERT((!((method_x == 6) && (method_y == 6))), tmp3);
  if (((method_x == 3) || (method_x == 6))) {
    tmp4 = size_of_dimension_real_array(tableData,1);
    tmp5 = size_of_dimension_real_array(header_x,1);
    init_modelica_string(&tmp6,"Dimension der Kopfzeile ist inkompatibel zur Dimension der Tabellenbreite.");
    MODELICA_ASSERT((tmp4 == tmp5), tmp6);
  }
  else {
    if (((method_x == 4) || (method_x == 5))) {
      tmp7 = size_of_dimension_real_array(tableData,1);
      tmp8 = size_of_dimension_real_array(header_x,1);
      init_modelica_string(&tmp9,"Dimension der Kopfzeile ist inkompatibel zur Dimension der Tabellenbreite.");
      MODELICA_ASSERT((tmp7 == (tmp8 - 1)), tmp9);
    }
  }
  if (((method_y == 3) || (method_y == 6))) {
    tmp10 = size_of_dimension_real_array(tableData,2);
    tmp11 = size_of_dimension_real_array(header_y,1);
    init_modelica_string(&tmp12,"Dimension der Indexspalte ist inkompatibel zur Dimension der Tabellenhöhe.");
    MODELICA_ASSERT((tmp10 == tmp11), tmp12);
  }
  else {
    if (((method_y == 4) || (method_y == 5))) {
      tmp13 = size_of_dimension_real_array(tableData,2);
      tmp14 = size_of_dimension_real_array(header_y,1);
      init_modelica_string(&tmp15,"Dimension der Indexspalte ist inkompatibel zur Dimension der Tabellenhöhe.");
      MODELICA_ASSERT((tmp13 == (tmp14 - 1)), tmp15);
    }
  }
  if ((method_x == 3)) {
    tmp16 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex(header_x, value_x);
    index_x = tmp16.OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex_rettype_1;
  }
  else {
    if ((method_x == 6)) {
      tmp17 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex(header_x, value_x);
      index_x = tmp17.OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex_rettype_1;
      tmp18 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex(header_y, value_y);
      index_y = tmp18.OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex_rettype_1;
      if ((value_x < (*real_array_element_addr1(&header_x, 1, (modelica_integer)index_x)))) {
        if ((((modelica_integer)index_x - 1) < 1)) {
          if ((*boolean_array_element_addr1(&extrapolate, 1, 1))) {
            lower = 1;
            upper = 2;
            tmp19 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate((*real_array_element_addr1(&header_x, 1, (modelica_integer)lower)), value_x, (*real_array_element_addr1(&header_x, 1, (modelica_integer)upper)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)lower, (modelica_integer)index_y)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)upper, (modelica_integer)index_y)));
            result = tmp19.OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype_1;
            goto _return;
          }
          else {
            init_modelica_string(&tmp20,"Spalten-Eingangswert erfodert Extrapolation am linken Tabellenrand.");
            MODELICA_ASSERT((!((((modelica_integer)index_x - 1) < 1) && (!(*boolean_array_element_addr1(&extrapolate, 1, 1))))), tmp20);
          }
        }
        else {
          lower = ((modelica_integer)index_x - 1);
          upper = (modelica_integer)index_x;
          tmp21 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate((*real_array_element_addr1(&header_x, 1, (modelica_integer)lower)), value_x, (*real_array_element_addr1(&header_x, 1, (modelica_integer)upper)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)lower, (modelica_integer)index_y)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)upper, (modelica_integer)index_y)));
          result = tmp21.OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype_1;
          goto _return;
        }
      }
      else {
        if ((value_x > (*real_array_element_addr1(&header_x, 1, (modelica_integer)index_x)))) {
          tmp22 = size_of_dimension_real_array(header_x,1);
          if (((1 + (modelica_integer)index_x) > tmp22)) {
            if ((*boolean_array_element_addr1(&extrapolate, 1, 2))) {
              tmp23 = size_of_dimension_real_array(header_x,1);
              lower = (tmp23 - 1);
              tmp24 = size_of_dimension_real_array(header_x,1);
              upper = tmp24;
              tmp25 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate((*real_array_element_addr1(&header_x, 1, (modelica_integer)lower)), value_x, (*real_array_element_addr1(&header_x, 1, (modelica_integer)upper)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)lower, (modelica_integer)index_y)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)upper, (modelica_integer)index_y)));
              result = tmp25.OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype_1;
              goto _return;
            }
            else {
              tmp26 = size_of_dimension_real_array(header_x,1);
              init_modelica_string(&tmp27,"Spalten-Eingangswert erfodert Extrapolation am rechten Tabellenrand.");
              MODELICA_ASSERT((!(((1 + (modelica_integer)index_x) > tmp26) && (!(*boolean_array_element_addr1(&extrapolate, 1, 2))))), tmp27);
            }
          }
          else {
            lower = (modelica_integer)index_x;
            upper = (1 + (modelica_integer)index_x);
            tmp28 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate((*real_array_element_addr1(&header_x, 1, (modelica_integer)lower)), value_x, (*real_array_element_addr1(&header_x, 1, (modelica_integer)upper)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)lower, (modelica_integer)index_y)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)upper, (modelica_integer)index_y)));
            result = tmp28.OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype_1;
            goto _return;
          }
        }
      }
    }
    else {
      if ((method_x == 4)) {
        tmp34 = size_of_dimension_real_array(header_x,1);
        tmp31 = 1; tmp32 = (1); tmp33 = (tmp34 - 1);
        {
  modelica_integer i;

          for (i = tmp31; in_range_integer(i, tmp31, tmp33); i += tmp32) {
            tmp29 = get_memory_state();
            if ((((*real_array_element_addr1(&header_x, 1, (modelica_integer)i)) <= value_x) && (value_x < (*real_array_element_addr1(&header_x, 1, (1 + (modelica_integer)i)))))) {
              index_x = (modelica_integer)i;
              break;
            }
            restore_memory_state(tmp29);
          }
        } /* end for*/

      }
      else {
        if ((method_x == 5)) {
          tmp40 = size_of_dimension_real_array(header_x,1);
          tmp37 = 1; tmp38 = (1); tmp39 = (tmp40 - 1);
          {
  modelica_integer i;

            for (i = tmp37; in_range_integer(i, tmp37, tmp39); i += tmp38) {
              tmp35 = get_memory_state();
              if ((((*real_array_element_addr1(&header_x, 1, (modelica_integer)i)) < value_x) && (value_x <= (*real_array_element_addr1(&header_x, 1, (1 + (modelica_integer)i)))))) {
                index_x = (modelica_integer)i;
                break;
              }
              restore_memory_state(tmp35);
            }
          } /* end for*/

        }
        else {
          init_modelica_string(&tmp41,"Unbekannte Lookup-Methode für Tabellenspalte.");
          MODELICA_ASSERT((0), tmp41);
        }
      }
    }
  }
  if ((method_y == 3)) {
    tmp42 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex(header_y, value_y);
    index_y = tmp42.OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex_rettype_1;
  }
  else {
    if ((method_y == 6)) {
      tmp43 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex(header_x, value_x);
      index_x = tmp43.OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex_rettype_1;
      tmp44 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex(header_y, value_y);
      index_y = tmp44.OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_findClosestIndex_rettype_1;
      if ((value_y < (*real_array_element_addr1(&header_y, 1, (modelica_integer)index_y)))) {
        if ((((modelica_integer)index_y - 1) < 1)) {
          if ((*boolean_array_element_addr1(&extrapolate, 1, 3))) {
            lower = 1;
            upper = 2;
            tmp45 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate((*real_array_element_addr1(&header_y, 1, (modelica_integer)lower)), value_y, (*real_array_element_addr1(&header_y, 1, (modelica_integer)upper)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)index_x, (modelica_integer)lower)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)index_x, (modelica_integer)upper)));
            result = tmp45.OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype_1;
            goto _return;
          }
          else {
            init_modelica_string(&tmp46,"Zeilen-Eingangswert erfodert Extrapolation am unteren Tabellenrand.");
            MODELICA_ASSERT((!((((modelica_integer)index_y - 1) < 1) && (!(*boolean_array_element_addr1(&extrapolate, 1, 3))))), tmp46);
          }
        }
        else {
          lower = ((modelica_integer)index_y - 1);
          upper = (modelica_integer)index_y;
          tmp47 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate((*real_array_element_addr1(&header_y, 1, (modelica_integer)lower)), value_y, (*real_array_element_addr1(&header_y, 1, (modelica_integer)upper)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)index_x, (modelica_integer)lower)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)index_x, (modelica_integer)upper)));
          result = tmp47.OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype_1;
          goto _return;
        }
      }
      else {
        if ((value_y > (*real_array_element_addr1(&header_y, 1, (modelica_integer)index_y)))) {
          tmp48 = size_of_dimension_real_array(header_y,1);
          if (((1 + (modelica_integer)index_y) > tmp48)) {
            if ((*boolean_array_element_addr1(&extrapolate, 1, 4))) {
              tmp49 = size_of_dimension_real_array(header_y,1);
              lower = (tmp49 - 1);
              tmp50 = size_of_dimension_real_array(header_y,1);
              upper = tmp50;
              tmp51 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate((*real_array_element_addr1(&header_y, 1, (modelica_integer)lower)), value_y, (*real_array_element_addr1(&header_y, 1, (modelica_integer)upper)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)index_x, (modelica_integer)lower)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)index_x, (modelica_integer)upper)));
              result = tmp51.OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype_1;
              goto _return;
            }
            else {
              tmp52 = size_of_dimension_real_array(header_y,1);
              init_modelica_string(&tmp53,"Zeilen-Eingangswert erfodert Extrapolation am oberen Tabellenrand.");
              MODELICA_ASSERT((!(((1 + (modelica_integer)index_y) > tmp52) && (!(*boolean_array_element_addr1(&extrapolate, 1, 4))))), tmp53);
            }
          }
          else {
            lower = (modelica_integer)index_y;
            upper = (1 + (modelica_integer)index_y);
            tmp54 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate((*real_array_element_addr1(&header_y, 1, (modelica_integer)lower)), value_y, (*real_array_element_addr1(&header_y, 1, (modelica_integer)upper)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)index_x, (modelica_integer)lower)), (*real_array_element_addr2(&tableData, 2, (modelica_integer)index_x, (modelica_integer)upper)));
            result = tmp54.OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_interpolate_rettype_1;
            goto _return;
          }
        }
      }
    }
    else {
      if ((method_y == 4)) {
        tmp60 = size_of_dimension_real_array(header_y,1);
        tmp57 = 1; tmp58 = (1); tmp59 = (tmp60 - 1);
        {
  modelica_integer i;

          for (i = tmp57; in_range_integer(i, tmp57, tmp59); i += tmp58) {
            tmp55 = get_memory_state();
            if ((((*real_array_element_addr1(&header_y, 1, (modelica_integer)i)) <= value_y) && (value_y < (*real_array_element_addr1(&header_y, 1, (1 + (modelica_integer)i)))))) {
              index_y = (modelica_integer)i;
              break;
            }
            restore_memory_state(tmp55);
          }
        } /* end for*/

      }
      else {
        if ((method_y == 5)) {
          tmp66 = size_of_dimension_real_array(header_y,1);
          tmp63 = 1; tmp64 = (1); tmp65 = (tmp66 - 1);
          {
  modelica_integer i;

            for (i = tmp63; in_range_integer(i, tmp63, tmp65); i += tmp64) {
              tmp61 = get_memory_state();
              if ((((*real_array_element_addr1(&header_y, 1, (modelica_integer)i)) < value_y) && (value_y <= (*real_array_element_addr1(&header_y, 1, (1 + (modelica_integer)i)))))) {
                index_y = (modelica_integer)i;
                break;
              }
              restore_memory_state(tmp61);
            }
          } /* end for*/

        }
        else {
          init_modelica_string(&tmp67,"Unbekannte Lookup-Methode für Tabellenzeile.");
          MODELICA_ASSERT((0), tmp67);
        }
      }
    }
  }
  result = (*real_array_element_addr2(&tableData, 2, (modelica_integer)index_x, (modelica_integer)index_y));
 
  _return:
  tmp1.targ1 = result;
  restore_memory_state(tmp2);
  return tmp1;
}

int in_OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup(type_description * inArgs, type_description * outVar)
{
  real_array header_x; /* [:] */
  real_array header_y; /* [:] */
  modelica_real value_x;
  modelica_real value_y;
  real_array tableData; /* [:, :] */
  modelica_integer method_x;
  modelica_integer method_y;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup_rettype out;
  if(read_real_array(&inArgs, &header_x)) return 1;
  if(read_real_array(&inArgs, &header_y)) return 1;
  if(read_modelica_real(&inArgs, &value_x)) return 1;
  if(read_modelica_real(&inArgs, &value_y)) return 1;
  if(read_real_array(&inArgs, &tableData)) return 1;
  if(read_modelica_integer(&inArgs, &method_x)) return 1;
  if(read_modelica_integer(&inArgs, &method_y)) return 1;
  out = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup(header_x, header_y, value_x, value_y, tableData, method_x, method_y);
  write_modelica_real(outVar, &out.targ1);
  return 0;
}

/* End Body */

#ifdef __cplusplus
}
#endif

Re: Problem after Upgrade RC2 > RC3

...and this is the main .cpp:

Code:


// Simulation code for OIB_RL6.BEISPIELE.beispielTabellen generated by the OpenModelica Compiler.
#include "modelica.h"
#include "assert.h"
#include "string.h"
#include "simulation_runtime.h"

#if defined(_MSC_VER) && !defined(_SIMULATION_RUNTIME_H)
  #define DLLExport   __declspec( dllexport )
#else
  #define DLLExport /* nothing */
#endif

#include "OIB_RL6.BEISPIELE.beispielTabellen_functions.cpp"

extern "C" {

}

#define NHELP 0
#define NG 0//number of zero crossing
#define NX 1
#define NY 17
#define NP 8 // number of parameters
#define NO 7 // number of outputvar on topmodel
#define NI 0 // number of inputvar on topmodel
#define NR 18 // number of residuals for initialialization function
#define NEXT 0 // number of external objects
#define MAXORD 5
#define NYSTR 0 // number of alg. string variables
#define NPSTR 0 // number of alg. string variables

static DATA* localData = 0;
#define time localData->timeValue
extern "C" { /* adrpo: this is needed for Visual C++ compilation to work! */
  char *model_name="OIB_RL6.BEISPIELE.beispielTabellen";
  char *model_dir="C:/Users/Hannes Edinger/workspace/OIB_RL6/OIB_RL6/../OIB_RL6/BEISPIELE";
}
char* state_names[1]={"$dummy"};
char* derivative_names[1]={"der($dummy)"};
char* algvars_names[17]={"GL3.inPort.value", "GL6.inPort.value", "Summe.result.value", "Summe.inPort1.value", "Summe.inPort2.value", "GL1.result.value", "GL2.result.value", "GL3.result.value", "TAB1.in_x.value", "TAB1.in_y.value", "TAB1.out.value", "GL4.result.value", "GL5.result.value", "GL6.result.value", "TAB2.in_x.value", "TAB2.in_y.value", "TAB2.out.value"};
char* input_names[1] = {""};
char* output_names[7]={"GL6.result.value", "GL5.result.value", "GL4.result.value", "GL3.result.value", "GL2.result.value", "GL1.result.value", "Summe.result.value"};
char* param_names[8]={"GL1.x", "GL2.x", "TAB1.method_x", "TAB1.method_y", "GL4.x", "GL5.x", "TAB2.method_x", "TAB2.method_y"};
char* string_alg_names[1] = {""};
char* string_param_names[1] = {""};

char* state_comments[1]={""};
char* derivative_comments[1]={""};
char* algvars_comments[17]={"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""};
char* input_comments[1] = {""};
char* output_comments[7]={"", "", "", "", "", "", ""};
char* param_comments[8]={ "Ausgabewert",  "Ausgabewert",  "Optionen: nearest, left, right, interpolate",  "Optionen: nearest, left, right, interpolate",  "Ausgabewert",  "Ausgabewert",  "Optionen: nearest, left, right, interpolate",  "Optionen: nearest, left, right, interpolate"};
char* string_param_comments[1] = {""};
char* string_alg_comments[1] = {""};

#define $TAB2$Pout$Pvalue localData->algebraics[16]
#define $TAB2$Pin_y$Pvalue localData->algebraics[15]
#define $TAB2$Pin_x$Pvalue localData->algebraics[14]
#define $GL6$Presult$Pvalue localData->algebraics[13]
#define $GL5$Presult$Pvalue localData->algebraics[12]
#define $GL4$Presult$Pvalue localData->algebraics[11]
#define $TAB1$Pout$Pvalue localData->algebraics[10]
#define $TAB1$Pin_y$Pvalue localData->algebraics[9]
#define $TAB1$Pin_x$Pvalue localData->algebraics[8]
#define $GL3$Presult$Pvalue localData->algebraics[7]
#define $GL2$Presult$Pvalue localData->algebraics[6]
#define $GL1$Presult$Pvalue localData->algebraics[5]
#define $TAB2$Pmethod_y localData->parameters[7]
#define $TAB2$Pmethod_x localData->parameters[6]
#define $GL5$Px localData->parameters[5]
#define $GL4$Px localData->parameters[4]
#define $TAB1$Pmethod_y localData->parameters[3]
#define $TAB1$Pmethod_x localData->parameters[2]
#define $GL2$Px localData->parameters[1]
#define $GL1$Px localData->parameters[0]
#define $Summe$PinPort2$Pvalue localData->algebraics[4]
#define $Summe$PinPort1$Pvalue localData->algebraics[3]
#define $Summe$Presult$Pvalue localData->algebraics[2]
#define $GL6$PinPort$Pvalue localData->algebraics[1]
#define $GL3$PinPort$Pvalue localData->algebraics[0]
#define $$dummy localData->states[0]
#define $DER$$dummy localData->statesDerivatives[0]

char* getName( double* ptr)
{
  if( &$TAB2$Pout$Pvalue == ptr ) return algvars_names[16];
  if( &$TAB2$Pin_y$Pvalue == ptr ) return algvars_names[15];
  if( &$TAB2$Pin_x$Pvalue == ptr ) return algvars_names[14];
  if( &$GL6$Presult$Pvalue == ptr ) return output_names[6];
  if( &$GL6$Presult$Pvalue == ptr ) return algvars_names[13];
  if( &$GL5$Presult$Pvalue == ptr ) return output_names[5];
  if( &$GL5$Presult$Pvalue == ptr ) return algvars_names[12];
  if( &$GL4$Presult$Pvalue == ptr ) return output_names[4];
  if( &$GL4$Presult$Pvalue == ptr ) return algvars_names[11];
  if( &$TAB1$Pout$Pvalue == ptr ) return algvars_names[10];
  if( &$TAB1$Pin_y$Pvalue == ptr ) return algvars_names[9];
  if( &$TAB1$Pin_x$Pvalue == ptr ) return algvars_names[8];
  if( &$GL3$Presult$Pvalue == ptr ) return output_names[3];
  if( &$GL3$Presult$Pvalue == ptr ) return algvars_names[7];
  if( &$GL2$Presult$Pvalue == ptr ) return output_names[2];
  if( &$GL2$Presult$Pvalue == ptr ) return algvars_names[6];
  if( &$GL1$Presult$Pvalue == ptr ) return output_names[1];
  if( &$GL1$Presult$Pvalue == ptr ) return algvars_names[5];
  if( &$TAB2$Pmethod_y == ptr ) return param_names[7];
  if( &$TAB2$Pmethod_x == ptr ) return param_names[6];
  if( &$GL5$Px == ptr ) return param_names[5];
  if( &$GL4$Px == ptr ) return param_names[4];
  if( &$TAB1$Pmethod_y == ptr ) return param_names[3];
  if( &$TAB1$Pmethod_x == ptr ) return param_names[2];
  if( &$GL2$Px == ptr ) return param_names[1];
  if( &$GL1$Px == ptr ) return param_names[0];
  if( &$Summe$PinPort2$Pvalue == ptr ) return algvars_names[4];
  if( &$Summe$PinPort1$Pvalue == ptr ) return algvars_names[3];
  if( &$Summe$Presult$Pvalue == ptr ) return output_names[0];
  if( &$Summe$Presult$Pvalue == ptr ) return algvars_names[2];
  if( &$GL6$PinPort$Pvalue == ptr ) return algvars_names[1];
  if( &$GL3$PinPort$Pvalue == ptr ) return algvars_names[0];
  if( &$DER$$dummy == ptr ) return derivative_names[0];
  if( &$$dummy == ptr ) return state_names[0];
  return "";
}

static char init_fixed[NX+NX+NY+NP]={
    1/*$dummy*/, 1/*default*/, 0/*GL3.inPort.value*/, 0/*GL6.inPort.value*/,
    0/*Summe.result.value*/, 0/*Summe.inPort1.value*/, 0/*Summe.inPort2.value*/,
    0/*GL1.result.value*/, 0/*GL2.result.value*/, 0/*GL3.result.value*/,
    0/*TAB1.in_x.value*/, 0/*TAB1.in_y.value*/, 0/*TAB1.out.value*/,
    0/*GL4.result.value*/, 0/*GL5.result.value*/, 0/*GL6.result.value*/,
    0/*TAB2.in_x.value*/, 0/*TAB2.in_y.value*/, 0/*TAB2.out.value*/,
    1/*GL1.x*/, 1/*GL2.x*/, 1/*TAB1.method_x*/,
    1/*TAB1.method_y*/, 1/*GL4.x*/, 1/*GL5.x*/,
    1/*TAB2.method_x*/, 1/*TAB2.method_y*/
};

char var_attr[NX+NY+NP]={/*$dummy:*/1+0, /*GL3.inPort.value:*/1+0, /*GL6.inPort.value:*/1+0, /*Summe.result.value:*/1+0,
/*Summe.inPort1.value:*/1+0, /*Summe.inPort2.value:*/1+0, /*GL1.result.value:*/1+0,
/*GL2.result.value:*/1+0, /*GL3.result.value:*/1+0, /*TAB1.in_x.value:*/1+0,
/*TAB1.in_y.value:*/1+0, /*TAB1.out.value:*/1+0, /*GL4.result.value:*/1+0,
/*GL5.result.value:*/1+0, /*GL6.result.value:*/1+0, /*TAB2.in_x.value:*/1+0,
/*TAB2.in_y.value:*/1+0, /*TAB2.out.value:*/1+0, /*GL1.x:*/1,
/*GL2.x:*/1, /*TAB1.method_x:*/4, /*TAB1.method_y:*/4,
/*GL4.x:*/1, /*GL5.x:*/1, /*TAB2.method_x:*/4,
/*TAB2.method_y:*/4};

#define DIVISION(a,b,c) ((b != 0) ? a / b : a / division_error(b,c))


int encounteredDivisionByZero = 0;
double division_error(double b,const char* division_str)
{
  if(!encounteredDivisionByZero){
    fprintf(stderr,"ERROR: Division by zero in partial equation: %s.\n",division_str);
    encounteredDivisionByZero = 1;
   }
   return b;
}

void setLocalData(DATA* data)
{
   localData = data;
}

DATA* initializeDataStruc(DATA_FLAGS flags)
{
  DATA* returnData = (DATA*)malloc(sizeof(DATA));

  if(!returnData) //error check
    return 0;

  memset(returnData,0,sizeof(DATA));
  returnData->nStates = NX;
  returnData->nAlgebraic = NY;
  returnData->nParameters = NP;
  returnData->nInputVars = NI;
  returnData->nOutputVars = NO;
  returnData->nZeroCrossing = NG;
  returnData->nInitialResiduals = NR;
  returnData->nHelpVars = NHELP;
  returnData->stringVariables.nParameters = NPSTR;
  returnData->stringVariables.nAlgebraic = NYSTR;

  if(flags & STATES && returnData->nStates) {
    returnData->states = (double*) malloc(sizeof(double)*returnData->nStates);
    returnData->oldStates = (double*) malloc(sizeof(double)*returnData->nStates);
    returnData->oldStates2 = (double*) malloc(sizeof(double)*returnData->nStates);
    assert(returnData->states&&returnData->oldStates&&returnData->oldStates2);
    memset(returnData->states,0,sizeof(double)*returnData->nStates);
    memset(returnData->oldStates,0,sizeof(double)*returnData->nStates);
    memset(returnData->oldStates2,0,sizeof(double)*returnData->nStates);
  } else {
    returnData->states = 0;
    returnData->oldStates = 0;
    returnData->oldStates2 = 0;
  }

  if(flags & STATESDERIVATIVES && returnData->nStates) {
    returnData->statesDerivatives = (double*) malloc(sizeof(double)*returnData->nStates);
    returnData->oldStatesDerivatives = (double*) malloc(sizeof(double)*returnData->nStates);
    returnData->oldStatesDerivatives2 = (double*) malloc(sizeof(double)*returnData->nStates);
    assert(returnData->statesDerivatives&&returnData->oldStatesDerivatives&&returnData->oldStatesDerivatives2);
    memset(returnData->statesDerivatives,0,sizeof(double)*returnData->nStates);
    memset(returnData->oldStatesDerivatives,0,sizeof(double)*returnData->nStates);
    memset(returnData->oldStatesDerivatives2,0,sizeof(double)*returnData->nStates);
  } else {
    returnData->statesDerivatives = 0;
    returnData->oldStatesDerivatives = 0;
    returnData->oldStatesDerivatives2 = 0;
  }

  if(flags & HELPVARS && returnData->nHelpVars) {
    returnData->helpVars = (double*) malloc(sizeof(double)*returnData->nHelpVars);
    assert(returnData->helpVars);
    memset(returnData->helpVars,0,sizeof(double)*returnData->nHelpVars);
  } else {
    returnData->helpVars = 0;
  }

  if(flags & ALGEBRAICS && returnData->nAlgebraic) {
    returnData->algebraics = (double*) malloc(sizeof(double)*returnData->nAlgebraic);
    returnData->oldAlgebraics = (double*) malloc(sizeof(double)*returnData->nAlgebraic);
    returnData->oldAlgebraics2 = (double*) malloc(sizeof(double)*returnData->nAlgebraic);
    assert(returnData->algebraics&&returnData->oldAlgebraics&&returnData->oldAlgebraics2);
    memset(returnData->algebraics,0,sizeof(double)*returnData->nAlgebraic);
    memset(returnData->oldAlgebraics,0,sizeof(double)*returnData->nAlgebraic);
    memset(returnData->oldAlgebraics2,0,sizeof(double)*returnData->nAlgebraic);
  } else {
    returnData->algebraics = 0;
    returnData->oldAlgebraics = 0;
    returnData->oldAlgebraics2 = 0;
    returnData->stringVariables.algebraics = 0;
  }

  if (flags & ALGEBRAICS && returnData->stringVariables.nAlgebraic) {
    returnData->stringVariables.algebraics = (char**)malloc(sizeof(char*)*returnData->stringVariables.nAlgebraic);
    assert(returnData->stringVariables.algebraics);
    memset(returnData->stringVariables.algebraics,0,sizeof(char*)*returnData->stringVariables.nAlgebraic);
  } else {
    returnData->stringVariables.algebraics=0;
  }

  if(flags & PARAMETERS && returnData->nParameters) {
    returnData->parameters = (double*) malloc(sizeof(double)*returnData->nParameters);
    assert(returnData->parameters);
    memset(returnData->parameters,0,sizeof(double)*returnData->nParameters);
  } else {
    returnData->parameters = 0;
  }

  if (flags & PARAMETERS && returnData->stringVariables.nParameters) {
        returnData->stringVariables.parameters = (char**)malloc(sizeof(char*)*returnData->stringVariables.nParameters);
      assert(returnData->stringVariables.parameters);
      memset(returnData->stringVariables.parameters,0,sizeof(char*)*returnData->stringVariables.nParameters);
  } else {
      returnData->stringVariables.parameters=0;
  }

  if(flags & OUTPUTVARS && returnData->nOutputVars) {
    returnData->outputVars = (double*) malloc(sizeof(double)*returnData->nOutputVars);
    assert(returnData->outputVars);
    memset(returnData->outputVars,0,sizeof(double)*returnData->nOutputVars);
  } else {
    returnData->outputVars = 0;
  }

  if(flags & INPUTVARS && returnData->nInputVars) {
    returnData->inputVars = (double*) malloc(sizeof(double)*returnData->nInputVars);
    assert(returnData->inputVars);
    memset(returnData->inputVars,0,sizeof(double)*returnData->nInputVars);
  } else {
    returnData->inputVars = 0;
  }

  if(flags & INITIALRESIDUALS && returnData->nInitialResiduals) {
    returnData->initialResiduals = (double*) malloc(sizeof(double)*returnData->nInitialResiduals);
    assert(returnData->initialResiduals);
    memset(returnData->initialResiduals,0,sizeof(double)*returnData->nInitialResiduals);
  } else {
    returnData->initialResiduals = 0;
  }

  if(flags & INITFIXED) {
    returnData->initFixed = init_fixed;
  } else {
    returnData->initFixed = 0;
  }

  /*   names   */
  if(flags & MODELNAME) {
    returnData->modelName = model_name;
  } else {
    returnData->modelName = 0;
  }

  if(flags & STATESNAMES) {
    returnData->statesNames = state_names;
  } else {
    returnData->statesNames = 0;
  }

  if(flags & STATESDERIVATIVESNAMES) {
    returnData->stateDerivativesNames = derivative_names;
  } else {
    returnData->stateDerivativesNames = 0;
  }

  if(flags & ALGEBRAICSNAMES) {
    returnData->algebraicsNames = algvars_names;
  } else {
    returnData->algebraicsNames = 0;
  }

  if(flags & PARAMETERSNAMES) {
    returnData->parametersNames = param_names;
  } else {
    returnData->parametersNames = 0;
  }

  if(flags & INPUTNAMES) {
    returnData->inputNames = input_names;
  } else {
    returnData->inputNames = 0;
  }

  if(flags & OUTPUTNAMES) {
    returnData->outputNames = output_names;
  } else {
    returnData->outputNames = 0;
  }

  /*   comments  */
  if(flags & STATESCOMMENTS) {
    returnData->statesComments = state_comments;
  } else {
    returnData->statesComments = 0;
  }

  if(flags & STATESDERIVATIVESCOMMENTS) {
    returnData->stateDerivativesComments = derivative_comments;
  } else {
    returnData->stateDerivativesComments = 0;
  }

  if(flags & ALGEBRAICSCOMMENTS) {
    returnData->algebraicsComments = algvars_comments;
  } else {
    returnData->algebraicsComments = 0;
  }

  if(flags & PARAMETERSCOMMENTS) {
    returnData->parametersComments = param_comments;
  } else {
    returnData->parametersComments = 0;
  }

  if(flags & INPUTCOMMENTS) {
    returnData->inputComments = input_comments;
  } else {
    returnData->inputComments = 0;
  }

  if(flags & OUTPUTCOMMENTS) {
    returnData->outputComments = output_comments;
  } else {
    returnData->outputComments = 0;
  }

  if (flags & EXTERNALVARS) {
    returnData->extObjs = (void**)malloc(sizeof(void*)*NEXT);
    if (!returnData->extObjs) {
      printf("error allocating external objects\n");
      exit(-2);
    }
    memset(returnData->extObjs,0,sizeof(void*)*NEXT);
    setLocalData(returnData); /* must be set since used by constructors*/
  }
  return returnData;
}

void deInitializeDataStruc(DATA* data, DATA_FLAGS flags)
{
  if(!data)
    return;

  if(flags & STATES && data->states) {
    free(data->states);
    data->states = 0;
  }

  if(flags & STATESDERIVATIVES && data->statesDerivatives) {
    free(data->statesDerivatives);
    data->statesDerivatives = 0;
  }

  if(flags & ALGEBRAICS && data->algebraics) {
    free(data->algebraics);
    data->algebraics = 0;
  }

  if(flags & PARAMETERS && data->parameters) {
    free(data->parameters);
    data->parameters = 0;
  }

  if(flags & OUTPUTVARS && data->inputVars) {
    free(data->inputVars);
    data->inputVars = 0;
  }

  if(flags & INPUTVARS && data->outputVars) {
    free(data->outputVars);
    data->outputVars = 0;
  }

  if(flags & INITIALRESIDUALS && data->initialResiduals){
    free(data->initialResiduals);
    data->initialResiduals = 0;
  }
  if (flags & EXTERNALVARS && data->extObjs) {
    free(data->extObjs);
    data->extObjs = 0;
  }
}

int functionDAE_output()
{
  state mem_state;
  real_array tmp0;
  real_array tmp1;
  real_array tmp2;
  real_array tmp3;
  real_array tmp4;
  real_array tmp5;
  real_array tmp6;
  real_array tmp7;
  real_array tmp8;
  real_array tmp9;
  real_array tmp10;
  real_array tmp11;
  real_array tmp12;
  real_array tmp13;
  real_array tmp14;
  real_array tmp15;
  real_array tmp16;
  real_array tmp17;
  real_array tmp18;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup_rettype tmp19;
  sin_rettype tmp20;
  real_array tmp21;
  real_array tmp22;
  real_array tmp23;
  real_array tmp24;
  real_array tmp25;
  real_array tmp26;
  real_array tmp27;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup_rettype tmp28;
  sin_rettype tmp29;
  mem_state = get_memory_state();
  array_alloc_scalar_real_array(&tmp0, 5, (modelica_real)1.0, (modelica_real)2.0, (modelica_real)3.0, (modelica_real)4.0, (modelica_real)5.0);
  array_alloc_scalar_real_array(&tmp1, 4, (modelica_real)1.0, (modelica_real)2.0, (modelica_real)3.0, (modelica_real)4.0);
  promote_scalar_real_array(1.0, 2, &tmp2);
  promote_scalar_real_array(5.0, 2, &tmp3);
  promote_scalar_real_array(9.0, 2, &tmp4);
  promote_scalar_real_array(2.0, 2, &tmp5);
  promote_scalar_real_array(6.0, 2, &tmp6);
  promote_scalar_real_array(10.0, 2, &tmp7);
  promote_scalar_real_array(3.0, 2, &tmp8);
  promote_scalar_real_array(7.0, 2, &tmp9);
  promote_scalar_real_array(11.0, 2, &tmp10);
  promote_scalar_real_array(4.0, 2, &tmp11);
  promote_scalar_real_array(8.0, 2, &tmp12);
  promote_scalar_real_array(12.0, 2, &tmp13);
  cat_alloc_real_array(2, &tmp14, 3, &tmp2, &tmp3, &tmp4);
  cat_alloc_real_array(2, &tmp15, 3, &tmp5, &tmp6, &tmp7);
  cat_alloc_real_array(2, &tmp16, 3, &tmp8, &tmp9, &tmp10);
  cat_alloc_real_array(2, &tmp17, 3, &tmp11, &tmp12, &tmp13);
  cat_alloc_real_array(1, &tmp18, 4, &tmp14, &tmp15, &tmp16, &tmp17);
  tmp19 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup(tmp0, tmp1, $GL4$Px, $GL5$Px, tmp18, $TAB2$Pmethod_x, $TAB2$Pmethod_y);
  $GL6$PinPort$Pvalue = tmp19.OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup_rettype_1;
  tmp20 = sin((0.0174527777777778 * (time * $GL6$PinPort$Pvalue)));
  $Summe$PinPort2$Pvalue = tmp20;
  array_alloc_scalar_real_array(&tmp21, 4, (modelica_real)1.0, (modelica_real)2.0, (modelica_real)3.0, (modelica_real)4.0);
  array_alloc_scalar_real_array(&tmp22, 4, (modelica_real)1.0, (modelica_real)2.0, (modelica_real)3.0, (modelica_real)4.0);
  array_alloc_real_array(&tmp23, 4, &1.0, &5.0, &9.0, &13.0);
  array_alloc_real_array(&tmp24, 4, &2.0, &6.0, &10.0, &14.0);
  array_alloc_real_array(&tmp25, 4, &3.0, &7.0, &11.0, &15.0);
  array_alloc_real_array(&tmp26, 4, &4.0, &8.0, &12.0, &16.0);
  array_alloc_real_array(&tmp27, 4, &tmp23, &tmp24, &tmp25, &tmp26);
  tmp28 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup(tmp21, tmp22, $GL1$Px, $GL2$Px, tmp27, $TAB1$Pmethod_x, $TAB1$Pmethod_y);
  $GL3$PinPort$Pvalue = tmp28.OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup_rettype_1;
  tmp29 = sin((0.0174527777777778 * (time * $GL3$PinPort$Pvalue)));
  $Summe$PinPort1$Pvalue = tmp29;
  $Summe$Presult$Pvalue = ($Summe$PinPort1$Pvalue + $Summe$PinPort2$Pvalue);
  $GL1$Presult$Pvalue = $GL1$Px;
  $GL2$Presult$Pvalue = $GL2$Px;
  $GL4$Presult$Pvalue = $GL4$Px;
  $GL5$Presult$Pvalue = $GL5$Px;
  $TAB1$Pin_x$Pvalue = $GL1$Px;
  $TAB1$Pin_y$Pvalue = $GL2$Px;
  $TAB1$Pout$Pvalue = $GL3$PinPort$Pvalue;
  $TAB2$Pin_x$Pvalue = $GL4$Px;
  $TAB2$Pin_y$Pvalue = $GL5$Px;
  $TAB2$Pout$Pvalue = $GL6$PinPort$Pvalue;
  $GL6$Presult$Pvalue = $Summe$PinPort2$Pvalue;
  $GL3$Presult$Pvalue = $Summe$PinPort1$Pvalue;
  restore_memory_state(mem_state);
  return 0;
}

int functionDAE_output2()
{
  state mem_state;
  mem_state = get_memory_state();
  $GL1$Presult$Pvalue = $GL1$Px;
  $GL2$Presult$Pvalue = $GL2$Px;
  $GL4$Presult$Pvalue = $GL4$Px;
  $GL5$Presult$Pvalue = $GL5$Px;
  $TAB1$Pin_x$Pvalue = $GL1$Px;
  $TAB1$Pin_y$Pvalue = $GL2$Px;
  $TAB1$Pout$Pvalue = $GL3$PinPort$Pvalue;
  $TAB2$Pin_x$Pvalue = $GL4$Px;
  $TAB2$Pin_y$Pvalue = $GL5$Px;
  $TAB2$Pout$Pvalue = $GL6$PinPort$Pvalue;
  $GL6$Presult$Pvalue = $Summe$PinPort2$Pvalue;
  $GL3$Presult$Pvalue = $Summe$PinPort1$Pvalue;
  restore_memory_state(mem_state);
  return 0;
}

/*
*/
int input_function()
{
  return 0;
}

/*
*/
int output_function()
{
  localData->outputVars[0] =$GL6$Presult$Pvalue;
  localData->outputVars[1] =$GL5$Presult$Pvalue;
  localData->outputVars[2] =$GL4$Presult$Pvalue;
  localData->outputVars[3] =$GL3$Presult$Pvalue;
  localData->outputVars[4] =$GL2$Presult$Pvalue;
  localData->outputVars[5] =$GL1$Presult$Pvalue;
  localData->outputVars[6] =$Summe$Presult$Pvalue;return 0;
}

int functionDAE_res(double *t, double *x, double *xd, double *delta, fortran_integer *ires, double *rpar, fortran_integer* ipar)
{
  int i;
  double temp_xd[NX];
  double* statesBackup;
  double* statesDerivativesBackup;
  double timeBackup;
  statesBackup = localData->states;
  statesDerivativesBackup = localData->statesDerivatives;
  timeBackup = localData->timeValue;
  localData->states = x;
  for (i=0; i<localData->nStates; i++) temp_xd[i]=localData->statesDerivatives[i];
 
  localData->statesDerivatives = temp_xd;
  localData->timeValue = *t;
 
  functionODE();
  /* get the difference between the temp_xd(=localData->statesDerivatives) and xd(=statesDerivativesBackup) */
  for (i=0; i < localData->nStates; i++) delta[i]=localData->statesDerivatives[i]-statesDerivativesBackup[i];
 
  localData->states = statesBackup;
  localData->statesDerivatives = statesDerivativesBackup;
  localData->timeValue = timeBackup;
  if (modelErrorCode) {
      if (ires) *ires = -1;
      modelErrorCode =0;
  }
  return 0;
}

int function_zeroCrossing(fortran_integer *neqm, double *t, double *x, fortran_integer *ng, double *gout, double *rpar, fortran_integer* ipar)
{
  double timeBackup;
  state mem_state;
  mem_state = get_memory_state();
  timeBackup = localData->timeValue;
  localData->timeValue = *t;
  functionODE();
  functionDAE_output();
  restore_memory_state(mem_state);
  localData->timeValue = timeBackup;
  return 0;
}

int handleZeroCrossing(long index)
{
  state mem_state;
  mem_state = get_memory_state();
  switch(index) {
    default: break;
  }
  restore_memory_state(mem_state);
  return 0;
}

int function_updateDependents()
{
  state mem_state;
  real_array tmp0;
  real_array tmp1;
  real_array tmp2;
  real_array tmp3;
  real_array tmp4;
  real_array tmp5;
  real_array tmp6;
  real_array tmp7;
  real_array tmp8;
  real_array tmp9;
  real_array tmp10;
  real_array tmp11;
  real_array tmp12;
  real_array tmp13;
  real_array tmp14;
  real_array tmp15;
  real_array tmp16;
  real_array tmp17;
  real_array tmp18;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup_rettype tmp19;
  sin_rettype tmp20;
  real_array tmp21;
  real_array tmp22;
  real_array tmp23;
  real_array tmp24;
  real_array tmp25;
  real_array tmp26;
  real_array tmp27;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup_rettype tmp28;
  sin_rettype tmp29;
  inUpdate=initial()?0:1;
  mem_state = get_memory_state();
  $DER$$dummy = 0.0;
  array_alloc_scalar_real_array(&tmp0, 5, (modelica_real)1.0, (modelica_real)2.0, (modelica_real)3.0, (modelica_real)4.0, (modelica_real)5.0);
  array_alloc_scalar_real_array(&tmp1, 4, (modelica_real)1.0, (modelica_real)2.0, (modelica_real)3.0, (modelica_real)4.0);
  promote_scalar_real_array(1.0, 2, &tmp2);
  promote_scalar_real_array(5.0, 2, &tmp3);
  promote_scalar_real_array(9.0, 2, &tmp4);
  promote_scalar_real_array(2.0, 2, &tmp5);
  promote_scalar_real_array(6.0, 2, &tmp6);
  promote_scalar_real_array(10.0, 2, &tmp7);
  promote_scalar_real_array(3.0, 2, &tmp8);
  promote_scalar_real_array(7.0, 2, &tmp9);
  promote_scalar_real_array(11.0, 2, &tmp10);
  promote_scalar_real_array(4.0, 2, &tmp11);
  promote_scalar_real_array(8.0, 2, &tmp12);
  promote_scalar_real_array(12.0, 2, &tmp13);
  cat_alloc_real_array(2, &tmp14, 3, &tmp2, &tmp3, &tmp4);
  cat_alloc_real_array(2, &tmp15, 3, &tmp5, &tmp6, &tmp7);
  cat_alloc_real_array(2, &tmp16, 3, &tmp8, &tmp9, &tmp10);
  cat_alloc_real_array(2, &tmp17, 3, &tmp11, &tmp12, &tmp13);
  cat_alloc_real_array(1, &tmp18, 4, &tmp14, &tmp15, &tmp16, &tmp17);
  tmp19 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup(tmp0, tmp1, $GL4$Px, $GL5$Px, tmp18, $TAB2$Pmethod_x, $TAB2$Pmethod_y);
  $GL6$PinPort$Pvalue = tmp19.OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup_rettype_1;
  tmp20 = sin((0.0174527777777778 * (time * $GL6$PinPort$Pvalue)));
  $Summe$PinPort2$Pvalue = tmp20;
  array_alloc_scalar_real_array(&tmp21, 4, (modelica_real)1.0, (modelica_real)2.0, (modelica_real)3.0, (modelica_real)4.0);
  array_alloc_scalar_real_array(&tmp22, 4, (modelica_real)1.0, (modelica_real)2.0, (modelica_real)3.0, (modelica_real)4.0);
  array_alloc_real_array(&tmp23, 4, &1.0, &5.0, &9.0, &13.0);
  array_alloc_real_array(&tmp24, 4, &2.0, &6.0, &10.0, &14.0);
  array_alloc_real_array(&tmp25, 4, &3.0, &7.0, &11.0, &15.0);
  array_alloc_real_array(&tmp26, 4, &4.0, &8.0, &12.0, &16.0);
  array_alloc_real_array(&tmp27, 4, &tmp23, &tmp24, &tmp25, &tmp26);
  tmp28 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup(tmp21, tmp22, $GL1$Px, $GL2$Px, tmp27, $TAB1$Pmethod_x, $TAB1$Pmethod_y);
  $GL3$PinPort$Pvalue = tmp28.OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup_rettype_1;
  tmp29 = sin((0.0174527777777778 * (time * $GL3$PinPort$Pvalue)));
  $Summe$PinPort1$Pvalue = tmp29;
  $Summe$Presult$Pvalue = ($Summe$PinPort1$Pvalue + $Summe$PinPort2$Pvalue);
  restore_memory_state(mem_state);
  inUpdate=0;
  return 0;
}

int function_updateDepend()
{
  state mem_state;
  real_array tmp0;
  real_array tmp1;
  real_array tmp2;
  real_array tmp3;
  real_array tmp4;
  real_array tmp5;
  real_array tmp6;
  real_array tmp7;
  real_array tmp8;
  real_array tmp9;
  real_array tmp10;
  real_array tmp11;
  real_array tmp12;
  real_array tmp13;
  real_array tmp14;
  real_array tmp15;
  real_array tmp16;
  real_array tmp17;
  real_array tmp18;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup_rettype tmp19;
  sin_rettype tmp20;
  real_array tmp21;
  real_array tmp22;
  real_array tmp23;
  real_array tmp24;
  real_array tmp25;
  real_array tmp26;
  real_array tmp27;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup_rettype tmp28;
  sin_rettype tmp29;
  inUpdate=initial()?0:1;
  mem_state = get_memory_state();
  $DER$$dummy = 0.0;
  array_alloc_scalar_real_array(&tmp0, 5, (modelica_real)1.0, (modelica_real)2.0, (modelica_real)3.0, (modelica_real)4.0, (modelica_real)5.0);
  array_alloc_scalar_real_array(&tmp1, 4, (modelica_real)1.0, (modelica_real)2.0, (modelica_real)3.0, (modelica_real)4.0);
  promote_scalar_real_array(1.0, 2, &tmp2);
  promote_scalar_real_array(5.0, 2, &tmp3);
  promote_scalar_real_array(9.0, 2, &tmp4);
  promote_scalar_real_array(2.0, 2, &tmp5);
  promote_scalar_real_array(6.0, 2, &tmp6);
  promote_scalar_real_array(10.0, 2, &tmp7);
  promote_scalar_real_array(3.0, 2, &tmp8);
  promote_scalar_real_array(7.0, 2, &tmp9);
  promote_scalar_real_array(11.0, 2, &tmp10);
  promote_scalar_real_array(4.0, 2, &tmp11);
  promote_scalar_real_array(8.0, 2, &tmp12);
  promote_scalar_real_array(12.0, 2, &tmp13);
  cat_alloc_real_array(2, &tmp14, 3, &tmp2, &tmp3, &tmp4);
  cat_alloc_real_array(2, &tmp15, 3, &tmp5, &tmp6, &tmp7);
  cat_alloc_real_array(2, &tmp16, 3, &tmp8, &tmp9, &tmp10);
  cat_alloc_real_array(2, &tmp17, 3, &tmp11, &tmp12, &tmp13);
  cat_alloc_real_array(1, &tmp18, 4, &tmp14, &tmp15, &tmp16, &tmp17);
  tmp19 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup(tmp0, tmp1, $GL4$Px, $GL5$Px, tmp18, $TAB2$Pmethod_x, $TAB2$Pmethod_y);
  $GL6$PinPort$Pvalue = tmp19.OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup_rettype_1;
  tmp20 = sin((0.0174527777777778 * (time * $GL6$PinPort$Pvalue)));
  $Summe$PinPort2$Pvalue = tmp20;
  array_alloc_scalar_real_array(&tmp21, 4, (modelica_real)1.0, (modelica_real)2.0, (modelica_real)3.0, (modelica_real)4.0);
  array_alloc_scalar_real_array(&tmp22, 4, (modelica_real)1.0, (modelica_real)2.0, (modelica_real)3.0, (modelica_real)4.0);
  array_alloc_real_array(&tmp23, 4, &1.0, &5.0, &9.0, &13.0);
  array_alloc_real_array(&tmp24, 4, &2.0, &6.0, &10.0, &14.0);
  array_alloc_real_array(&tmp25, 4, &3.0, &7.0, &11.0, &15.0);
  array_alloc_real_array(&tmp26, 4, &4.0, &8.0, &12.0, &16.0);
  array_alloc_real_array(&tmp27, 4, &tmp23, &tmp24, &tmp25, &tmp26);
  tmp28 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup(tmp21, tmp22, $GL1$Px, $GL2$Px, tmp27, $TAB1$Pmethod_x, $TAB1$Pmethod_y);
  $GL3$PinPort$Pvalue = tmp28.OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup_rettype_1;
  tmp29 = sin((0.0174527777777778 * (time * $GL3$PinPort$Pvalue)));
  $Summe$PinPort1$Pvalue = tmp29;
  $Summe$Presult$Pvalue = ($Summe$PinPort1$Pvalue + $Summe$PinPort2$Pvalue);
  restore_memory_state(mem_state);
  inUpdate=0;
  return 0;
}

int function_onlyZeroCrossings(double *gout,double *t)
{
  state mem_state;
  mem_state = get_memory_state();
  restore_memory_state(mem_state);
  return 0;
}

int checkForDiscreteChanges()
{
  int needToIterate=0;

  return needToIterate;
}
int function_storeDelayed()
{
  state mem_state;
  mem_state = get_memory_state();
  restore_memory_state(mem_state);
  return 0;
}

int function_when(int i)
{
  state mem_state;
  mem_state = get_memory_state();
  switch(i) {
    default: break;
  }
  restore_memory_state(mem_state);
  return 0;
}

int functionODE()
{
  state mem_state;
  mem_state = get_memory_state();
  $DER$$dummy = 0.0;
  restore_memory_state(mem_state);
  return 0;
}

int initial_function()
{
  return 0;
}

int initial_residual()
{
  sin_rettype tmp0;
  real_array tmp1;
  real_array tmp2;
  real_array tmp3;
  real_array tmp4;
  real_array tmp5;
  real_array tmp6;
  real_array tmp7;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup_rettype tmp8;
  sin_rettype tmp9;
  real_array tmp10;
  real_array tmp11;
  real_array tmp12;
  real_array tmp13;
  real_array tmp14;
  real_array tmp15;
  real_array tmp16;
  real_array tmp17;
  real_array tmp18;
  real_array tmp19;
  real_array tmp20;
  real_array tmp21;
  real_array tmp22;
  real_array tmp23;
  real_array tmp24;
  real_array tmp25;
  real_array tmp26;
  real_array tmp27;
  real_array tmp28;
  OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup_rettype tmp29;
  int i=0;
  state mem_state;
  mem_state = get_memory_state();
  tmp0 = sin((0.0174527777777778 * (time * $GL3$PinPort$Pvalue)));
  localData->initialResiduals[i++] = ($Summe$PinPort1$Pvalue - tmp0);
  array_alloc_scalar_real_array(&tmp1, 4, (modelica_real)1.0, (modelica_real)2.0, (modelica_real)3.0, (modelica_real)4.0);
  array_alloc_scalar_real_array(&tmp2, 4, (modelica_real)1.0, (modelica_real)2.0, (modelica_real)3.0, (modelica_real)4.0);
  array_alloc_real_array(&tmp3, 4, &1.0, &5.0, &9.0, &13.0);
  array_alloc_real_array(&tmp4, 4, &2.0, &6.0, &10.0, &14.0);
  array_alloc_real_array(&tmp5, 4, &3.0, &7.0, &11.0, &15.0);
  array_alloc_real_array(&tmp6, 4, &4.0, &8.0, &12.0, &16.0);
  array_alloc_real_array(&tmp7, 4, &tmp3, &tmp4, &tmp5, &tmp6);
  tmp8 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup(tmp1, tmp2, $GL1$Px, $GL2$Px, tmp7, $TAB1$Pmethod_x, $TAB1$Pmethod_y);
  localData->initialResiduals[i++] = ($GL3$PinPort$Pvalue - tmp8.OIB__RL6_BEISPIELE_Tabellen_TestTabelle1_lookup_rettype_1);
  tmp9 = sin((0.0174527777777778 * (time * $GL6$PinPort$Pvalue)));
  localData->initialResiduals[i++] = ($Summe$PinPort2$Pvalue - tmp9);
  array_alloc_scalar_real_array(&tmp10, 5, (modelica_real)1.0, (modelica_real)2.0, (modelica_real)3.0, (modelica_real)4.0, (modelica_real)5.0);
  array_alloc_scalar_real_array(&tmp11, 4, (modelica_real)1.0, (modelica_real)2.0, (modelica_real)3.0, (modelica_real)4.0);
  promote_scalar_real_array(1.0, 2, &tmp12);
  promote_scalar_real_array(5.0, 2, &tmp13);
  promote_scalar_real_array(9.0, 2, &tmp14);
  promote_scalar_real_array(2.0, 2, &tmp15);
  promote_scalar_real_array(6.0, 2, &tmp16);
  promote_scalar_real_array(10.0, 2, &tmp17);
  promote_scalar_real_array(3.0, 2, &tmp18);
  promote_scalar_real_array(7.0, 2, &tmp19);
  promote_scalar_real_array(11.0, 2, &tmp20);
  promote_scalar_real_array(4.0, 2, &tmp21);
  promote_scalar_real_array(8.0, 2, &tmp22);
  promote_scalar_real_array(12.0, 2, &tmp23);
  cat_alloc_real_array(2, &tmp24, 3, &tmp12, &tmp13, &tmp14);
  cat_alloc_real_array(2, &tmp25, 3, &tmp15, &tmp16, &tmp17);
  cat_alloc_real_array(2, &tmp26, 3, &tmp18, &tmp19, &tmp20);
  cat_alloc_real_array(2, &tmp27, 3, &tmp21, &tmp22, &tmp23);
  cat_alloc_real_array(1, &tmp28, 4, &tmp24, &tmp25, &tmp26, &tmp27);
  tmp29 = _OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup(tmp10, tmp11, $GL4$Px, $GL5$Px, tmp28, $TAB2$Pmethod_x, $TAB2$Pmethod_y);
  localData->initialResiduals[i++] = ($GL6$PinPort$Pvalue - tmp29.OIB__RL6_BEISPIELE_Tabellen_TestTabelle2_lookup_rettype_1);
  localData->initialResiduals[i++] = ($Summe$Presult$Pvalue - ($Summe$PinPort1$Pvalue + $Summe$PinPort2$Pvalue));
  localData->initialResiduals[i++] = $DER$$dummy;
  localData->initialResiduals[i++] = ($GL1$Presult$Pvalue - $GL1$Px);
  localData->initialResiduals[i++] = ($GL2$Presult$Pvalue - $GL2$Px);
  localData->initialResiduals[i++] = ($GL4$Presult$Pvalue - $GL4$Px);
  localData->initialResiduals[i++] = ($GL5$Presult$Pvalue - $GL5$Px);
  localData->initialResiduals[i++] = ($TAB1$Pin_x$Pvalue - $GL1$Px);
  localData->initialResiduals[i++] = ($TAB1$Pin_y$Pvalue - $GL2$Px);
  localData->initialResiduals[i++] = ($TAB1$Pout$Pvalue - $GL3$PinPort$Pvalue);
  localData->initialResiduals[i++] = ($TAB2$Pin_x$Pvalue - $GL4$Px);
  localData->initialResiduals[i++] = ($TAB2$Pin_y$Pvalue - $GL5$Px);
  localData->initialResiduals[i++] = ($TAB2$Pout$Pvalue - $GL6$PinPort$Pvalue);
  localData->initialResiduals[i++] = ($GL6$Presult$Pvalue - $Summe$PinPort2$Pvalue);
  localData->initialResiduals[i++] = ($GL3$Presult$Pvalue - $Summe$PinPort1$Pvalue);
  restore_memory_state(mem_state);
  return 0;
}

int bound_parameters()
{
  state mem_state;
  mem_state = get_memory_state();
  restore_memory_state(mem_state);
  return 0;
}

int checkForDiscreteVarChanges()
{
  int needToIterate=0;
 
  for (long i = 0; i < localData->nHelpVars; i++) {
    if (change(localData->helpVars[i])) { needToIterate=1; }
  }
  return needToIterate;
}

Re: Problem after Upgrade RC2 > RC3

While trying to reproduce your problem I came up with something like:

function takesMatrix
  input Real[:,:] myInput;
  output Real out;
algorithm
  out := 3.0;
end takesMatrix;

class MX
  constant Real[:,:] mx = {{1.0,5.0},{2.0,6.0},{3.0,7.0},{4.0,8.0}};
  Real r = takesMatrix({{time,mx[1,2]},mx[2,:]});
end MX;


It doesn't give the same kind of error message, but your also has to do with matrices current/sad
MX.cpp:367: error: ‘$mx$lB2$c1$rB’ was not declared in this scope

Mine were constant though. I have no clue how you got evaluated constants into the code... Anyway, if that constant is no longer constant... It should start working. And that's probably the bug introduced.

Re: Problem after Upgrade RC2 > RC3

Thank you for digging deeply into that.

You were right: The problem has to do with the declaration of constant Arrays. After I commented out the "constant" keyword in the array (re-)declaration, the simulation could be compiled again. BUT the simulation's result in the .plt file is totally wrong now: It consists of only one dataset for each variable (the inital values) even if the test-run was over 100 timesteps current/hmm

There are 0 guests and 0 other users also viewing this topic
You are here: