Opened 12 years ago
Closed 12 years ago
#2643 closed defect (fixed)
Generation of Equations from Record Default values not avoided if modification exist
| Reported by: | Jens Frenkel | Owned by: | somebody |
|---|---|---|---|
| Priority: | blocker | Milestone: | 1.9.1 |
| Component: | Frontend | Version: | trunk |
| Keywords: | Cc: | Per Östlund, Lennart Ochel |
Description
For the following model
model RecordDefaultValue
record MyRecord
Real a;
Real b=24;
end MyRecord;
MyRecord r=MyRecord(time,-time);
end RecordDefaultValue;
omc generates the following flat model:
class RecordDefaultValue Real r.a; Real r.b = 24.0; equation r.a = time; r.b = -time; end RecordDefaultValue;
This is absolute wrong because the modification overwrites the default value from r.b.
Attachments (1)
Change History (7)
by , 12 years ago
| Attachment: | RecordDefaultValue.mo added |
|---|
comment:1 by , 12 years ago
| Cc: | added |
|---|
comment:2 by , 12 years ago
comment:3 by , 12 years ago
Or do you actually mean that r.b = 24 should not be present at all?
In that case I agree with you.
comment:4 by , 12 years ago
| Cc: | added |
|---|
comment:5 by , 12 years ago
Yes, this is what I mean r.b = 24 should not be generated. Sorry for the imprecise description.
Note:
See TracTickets
for help on using tickets.

What omc does is correct as if the binding is not a scalar a structure copy should be performed. See 7.2.3 Merging of Modifications (the x5=x3 case).
The binding *always* has higher priority than the default values from the type.