Opened 14 years ago
Last modified 14 years ago
#1550 closed defect (worksforme)
Initialization of non-fixed parameters
| Reported by: | Martin Sjölund | Owned by: | Martin Sjölund |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | Version: | ||
| Keywords: | Cc: | Martin Sjölund, Lennart Ochel, Willi Braun |
Description
loadString("
model M
parameter Real r[30](each fixed=false);
Real x = time;
initial equation
for i in 1:30 loop
der(r[i]) = i-1;
end for;
end M;
");
simulate(M,numberOfIntervals=10);
generates C-code
... localData->initialResiduals[i++] = 2.0; ...
Which is clearly wrong
Change History (2)
comment:1 by , 14 years ago
comment:2 by , 14 years ago
Oh yea... It's true der(param)=0. But there are still problems with initialization if der is not used (albeit different ones); convergence is then too slow.
Note:
See TracTickets
for help on using tickets.

The initial equations make no sense, since if "r" is a parameter the result of "der(r)=0".
Then you get wrong initial equations like 0=1,0=2,0=3...
May be need somewhere a check for constant equations like that, which cannot be satisfied.