#3502 closed defect (fixed)
Wrong tempvars from createInitialEquations for synchronous models
Reported by: | rfranke | 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 Changed 9 years ago by rfranke
comment:2 Changed 9 years ago by rfranke
- Resolution set to fixed
- Status changed from new to closed
The fix works. See fb7644bdf6e79bb0fae5e59581534e57f1974fa9/OMCompiler.
comment:3 Changed 8 years ago by sjoelund.se
- Milestone changed from 1.9.4 to 1.9.4-1.9.x
Milestone renamed
comment:4 Changed 8 years ago by sjoelund.se
- Milestone changed from 1.9.4-1.9.x to 1.9.4
Milestone renamed
The clocked variables were re-added by translateClockedEquations. There is a Hudson job scheduled to fix this.