﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
3931	Do not generate stupid equations	Martin Sjölund	Lennart Ochel	"Simple initialization equations can be handled by the init.xml-file instead of requiring GCC to link things and executing code at run-time. Take a simple model like:

{{{#!mo
model M
  Real r(fixed=false, start=0);
initial equation
  r = 1;
equation
  der(r) = 1;
end M;
}}}

Yields
{{{#!c
/*
 equation index: 2
 type: SIMPLE_ASSIGN
 r = 1.0
 */
void M_eqFunction_2(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int equationIndexes[2] = {1,2};
  data->localData[0]->realVars[0] /* r STATE(1) */ = 1.0;
  TRACE_POP
}
}}}

Even using fixed=true, we get a function generated:
{{{#!c
/*
 equation index: 2
 type: SIMPLE_ASSIGN
 r = $_start(r)
 */
void M_eqFunction_2(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int equationIndexes[2] = {1,2};
  data->localData[0]->realVars[0] /* r STATE(1) */ = data->modelData->realVarsData[0].attribute /* r */.start;
  TRACE_POP
}
}}}

These should both be avoided, keeping the start-value from the XML-file if nothing is given."	enhancement	new	high	Future	Initialization				Francesco Casella
