Opened 9 years ago
Last modified 7 years ago
#3498 reopened defect
Wrong generation of base partitions
Reported by: | Rüdiger Franke | Owned by: | Lennart Ochel |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | Backend | Version: | |
Keywords: | Cpp run-time | Cc: |
Description
The code generated for the following model does not compile due to the attempt to access the not existing previous(dt).
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;
The sample rate dt should be constant. Instead omc -s -d=dumpSynchronous SID.mo
gives
Base clocks (1) ======================================== 1: Clock(previous(dt))[1]
Change History (14)
comment:1 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 9 years ago
comment:3 by , 9 years ago
Status: | assigned → accepted |
---|
comment:5 by , 9 years ago
Please note: I didn't touched the evaluation of dt. The generated base clock is now defined as follows:
Base partitions (1) ======================================== 1: Clock(dt)[1]
comment:6 by , 9 years ago
The results seem to be wrong since xd
is zero.
comment:8 by , 9 years ago
Keywords: | Cpp run-time added |
---|---|
Resolution: | → fixed |
Status: | accepted → closed |
Summary: | Wrong sim code due to ignored annotation(Evaluate=true) → Wrong generation of base partitions |
comment:9 by , 9 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
The clock parameter is not evaluated -- see initial title of this ticket. Take the example:
The test declares dt constant. The clock interval must not disappear from modelDescription.xml
if changed to a parameter with annotation(Evaluate=true)
-- the generation of modelDescription.xml expects an RCONST.
comment:13 by , 8 years ago
Milestone: | 1.11.0 → 1.12.0 |
---|
Milestone moved to 1.12.0 due to 1.11.0 already being released.
comment:14 by , 7 years ago
Milestone: | 1.12.0 → Future |
---|
The milestone of this ticket has been reassigned to "Future".
If you think the issue is still valid and relevant for you, please select milestone 1.13.0 for back-end, code generation and run-time issues, or 2.0.0 for front-end issues.
If you are aware that the problem is no longer present, please select the milestone corresponding to the version of OMC you used to check that, and set the status to "worksforme".
In both cases, a short informative comment would be welcome.
see also #3482