Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#3502 closed defect (fixed)

Wrong tempvars from createInitialEquations for synchronous models

Reported by: Rüdiger Franke Owned by: somebody
Priority: high Milestone: 1.9.4
Component: Backend Version:
Keywords: Cc:

Description

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:

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?

Change History (4)

comment:1 by Rüdiger Franke, 9 years ago

The clocked variables were re-added by translateClockedEquations. There is a Hudson job scheduled to fix this.

comment:2 by Rüdiger Franke, 9 years ago

Resolution: fixed
Status: newclosed

comment:3 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.4-1.9.x

Milestone renamed

comment:4 by Martin Sjölund, 9 years ago

Milestone: 1.9.4-1.9.x1.9.4

Milestone renamed

Note: See TracTickets for help on using tickets.