Opened 8 years ago
Closed 8 years ago
#4060 closed defect (fixed)
Final attribute for parameters has no effect at all
Reported by: | Patrick Täuber | Owned by: | Patrick Täuber |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | Code Generation | Version: | |
Keywords: | Cc: |
Description
If you run the following model with
setCommandLineOptions("--preOptModules-=evaluateReplaceProtectedFinalEvaluateParameters --preOptModules+=evaluateReplaceEvaluateParameters");
which means without evaluating final parameters in the backend, it is possible to change final parameter p1 after compilation:
model parameterBug4 final parameter Integer p1 = 2; parameter Integer p2 = p1; equation end parameterBug4;
simulate(parameterBug4); getErrorString(); print("----p1--"); val(p1, 0.0, "parameterBug4_res.mat"); print("----p2--"); val(p2, 0.0); print("\n"); system("./parameterBug4 -override p1=1"); print("\n"); print("----p1--"); val(p1, 0.0, "parameterBug4_res.mat"); print("----p2--"); val(p2, 0.0); getErrorString();
Output:
// ----p1-- // 2.0 // ----p2-- // 2.0 // // // 0 // // // ----p1-- // 1.0 // ----p2-- // 1.0
Note:
See TracTickets
for help on using tickets.
This is fixed in d75f648.