Opened 7 years ago
Last modified 7 years ago
#4497 new defect
Overriding a parameter that sets a parameter in a record has no effect
Reported by: | Owned by: | somebody | |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | *unknown* | Version: | |
Keywords: | Cc: |
Description
Consider the following:
record MyRecord Real y; end MyRecord; function InitRecord input Real x; output MyRecord s(y = x); end InitRecord; model test parameter Real t = 1; parameter MyRecord r = InitRecord (t); algorithm print("t="+String(t)+" "); print("r.y="+String(r.y)+"\n"); assert(t== r.y, "Correct assignment from structure"); end test;
When running this with default values of 't', this works as expected.
However, when overriding 't' on the command line or via _init.xml, the record's parameter is not updated. In this example program, running the program has an assertion failure:
./test -override t=2 t=2 r.y=1 assert | warning | The following assertion has been violated during initialization at time 0.000000 | | | | t == r.y assert | error | Correct assignment from structure assert | info | simulation terminated by an assertion at initialization
More information: similar test program which assigns an element of an array works correctly, as does assigning a simple scalar parameter.
Note:
See TracTickets
for help on using tickets.
This seems to come from record equations being evaluated in the frontend, but it doesn't register that t was evaluated and thus should be marked not changeable.