Opened 8 years ago

Closed 8 years ago

#4165 closed defect (fixed)

C runtime simulation_data.h out of date

Reported by: Henning Kiel Owned by: Lennart Ochel
Priority: low Milestone: 1.11.0
Component: Run-time Version: v1.11.0
Keywords: Cc: Adrian Pop

Description (last modified by Henning Kiel)

The file OMCompiler/SimulationRuntime/c/simulation_data.h has inconsistent dummy values. At least the macro dummyRealAttribute causes lots of warnings (which are suppressed, if no error occurs).

#define omc_dummyVarInfo {-1,-1,"","",omc_dummyFileInfo}
#define omc_dummyEquationInfo {-1,0,"",-1,NULL}
#define omc_dummyFunctionInfo {-1,"",omc_dummyFileInfo}
#define omc_dummyRealAttribute {NULL,NULL,DBL_MAX,-DBL_MAX,0,0,1.0,0,0.0}

[...]

/* Model info structures */
typedef struct VAR_INFO
{
  int id;
  int inputIndex; /* -1 means not an input */
  const char *name;
  const char *comment;
  FILE_INFO info;
} VAR_INFO;

typedef struct EQUATION_INFO
{
  int id;
  int profileBlockIndex;
  int parent;
  int numVar;
  const char **vars;
}EQUATION_INFO;

typedef struct FUNCTION_INFO
{
  int id;
  const char* name;
  FILE_INFO info;
}FUNCTION_INFO;

[...]

typedef struct REAL_ATTRIBUTE
{
  modelica_string unit;                /* = "" */
  modelica_string displayUnit;         /* = "" */
  modelica_real min;                   /* = -Inf */
  modelica_real max;                   /* = +Inf */
  modelica_boolean fixed;              /* depends on the type */
  modelica_boolean useNominal;         /* = false */
  modelica_real nominal;               /* = 1.0 */
  modelica_real start;                 /* = 0.0 */
}REAL_ATTRIBUTE;

Change History (8)

comment:1 by Henning Kiel, 8 years ago

Cc: Adrian Pop added

comment:2 by Henning Kiel, 8 years ago

Description: modified (diff)

comment:3 by Lennart Ochel, 8 years ago

Owner: changed from somebody to Lennart Ochel
Status: newaccepted

That's probably my fault. I removed an obsolete attribute from that structure recently.

comment:4 by Lennart Ochel, 8 years ago

omc_dummyRealAttribute should be fixed with OMCompiler#1269.

comment:5 by Lennart Ochel, 8 years ago

Ohh – I just see that omc_dummyEquationInfo is also wrong. Should we use 0 or -1 as default value for parent?

comment:6 by Henning Kiel, 8 years ago

There is also an error with min=DBL_MAX and max=-DBL_MAX (I assume the signs are exchanged)

in reply to:  4 comment:7 by Lennart Ochel, 8 years ago

You are right. I opened OMCompiler#1270 for this.

comment:8 by Lennart Ochel, 8 years ago

Resolution: fixed
Status: acceptedclosed
Note: See TracTickets for help on using tickets.