#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 , 9 years ago
comment:2 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
The fix works. See fb7644bdf6e79bb0fae5e59581534e57f1974fa9/OMCompiler.
The clocked variables were re-added by
translateClockedEquations
. There is a Hudson job scheduled to fix this.