Opened 11 years ago
Closed 11 years ago
#2504 closed defect (fixed)
Initialization: start value which is an unfixed parameter
Reported by: | Christian Schubert | Owned by: | Lennart Ochel |
---|---|---|---|
Priority: | high | Milestone: | 1.9.1 |
Component: | Backend | Version: | trunk |
Keywords: | Initialization start value unfixed parameter | Cc: | Willi Braun, Jens Frenkel, Volker Waurich, georg.hess@… |
Description
Hi,
while converting a model from Dymola to OpenModelica we encountered the following problem, which I hope is easy to fix.
Consider the following model
model UnfixedParameter parameter Real c(fixed = false); Real x(start=c,fixed=true); initial equation c = 1; equation der(x) = -x; end UnfixedParameter;
Instead of starting at x(t=0)=1, it starts at 0 which is unexpected.
It's got probably to do with when start values are evaluated.
Attachments (1)
Change History (9)
by , 11 years ago
Attachment: | initial.mos added |
---|
comment:1 by , 11 years ago
Cc: | added |
---|
comment:2 by , 11 years ago
Status: | new → accepted |
---|
comment:3 by , 11 years ago
I get the following messages/errors:
Error: Internal error Transformation Module PFPlusExt index Reduction Method Pantelides failed! Warning: No system for the symbolic initialization was generated. A method using numerical algorithms will be used instead.
- BackendVariable.vararrayNth 1 has NONE!!!
I will fix it.
comment:5 by , 11 years ago
The previously mentioned errors just occurred due to my corrupted omc version.
The combination of a fixed state having a start-expression depending on an unfixed parameter is not yet supported. Good ticket ;-)
comment:6 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Again, this is a very good ticket. Thanks for contributing it. I included the model from above in the test suite.
Fixed in r18967.
@Volker: Some hpcom tests need to get updated. Can you do that?
follow-up: 8 comment:7 by , 11 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Unfortunately, this doesn't completely fix my problem.
Consider the following model
model Fehler encapsulated model SubModel parameter Real n = 1 annotation(Evaluate = true); end SubModel; parameter Real n_b(fixed = false, start = 2); SubModel subModel(n = n_b); initial equation n_b = 5; end Fehler;
The value of parameter n is not correctly calculated if n has the annotation Evaluate=true. If the annotation is not present everything works fine.
comment:8 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Replying to georg.hess@…:
Unfortunately, this doesn't completely fix my problem.
Consider the following model
model Fehler encapsulated model SubModel parameter Real n = 1 annotation(Evaluate = true); end SubModel; parameter Real n_b(fixed = false, start = 2); SubModel subModel(n = n_b); initial equation n_b = 5; end Fehler;The value of parameter n is not correctly calculated if n has the annotation Evaluate=true. If the annotation is not present everything works fine.
n should be initialized with 5. This is the case with and without the Evaluate annotation. The annotation is a Compiler hint to get speedup during symbolic manipulation. (Annotations should never effect the symbolic results of a model.) Hence, your model is working fine and I see no wrong behavior of OpenModelica.
Testfile