﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
3502	Wrong tempvars from createInitialEquations for synchronous models	Rüdiger Franke	somebody	"Commit
https://github.com/OpenModelica/OMCompiler/commit/0a6d92e255ea250fab19bafdfa3c6ef942171b64
introduces clocked states (see ModelicaSpec33, section 16.4 Discrete States). The subsequent commit exploits them for FMI export of discrete states.

There is one remaining issue to get FMI export working for simple models. The sim code contains duplicates for clocked variables (see lots of C compiler warnings and duplicate entries in modelDescription.xml with index 0). The duplicates are introduced in SimCode/SimCodeUtil.mo, line 296ff:
{{{
    // create model info
    modelInfo := createModelInfo(inClassName, dlow, inInitDAE, functions, {}, numStateSets, inFileDir, listLength(clockedSysts));
    modelInfo := addTempVars(tempvars, modelInfo);
}}}
The added `tempvars` only contain duplicates for the following example:
{{{#!mo
model SID ""Single Integrator Discrete-time""
  parameter Real dt = 0.1 ""sample time"" annotation(Evaluate=true);
  parameter Real p = 1 ""gain for input"";
  parameter Real y_start = 0 ""start value for state"";
  Real xd(start = y_start);
  input Real u(start = -2);
  output Real y;
equation
  when Clock(dt) then
    xd = previous(xd) + p * u * dt;
  end when;
  y = hold(previous(xd));
end SID;
}}}
Can someone with insight in the tempvars / createInitialEquations have a look?"	defect	closed	high	1.9.4	Backend		fixed		
