Opened 9 years ago
Closed 9 years ago
#3387 closed defect (fixed)
Bad parameter indexing with Evaluate=true
Reported by: | Owned by: | somebody | |
---|---|---|---|
Priority: | critical | Milestone: | Future |
Component: | *unknown* | Version: | trunk |
Keywords: | Cc: |
Description
The following model gives two different answers depending on whether Evaluate=true or false is used for the parameter. This only happens when the parameter is a two-dimensional array and when the variable R_rel_A is used in the equation (although it is a null rotation). Further investigation shows that phi_B[:,4:6] does not get correctly substituted in the reduction of tmpB because it substitutes from the wrong index of phi_B.
This issue may be related to #3386.
loadString(" model indexbug import Modelica.Mechanics.MultiBody.Frames; parameter Real[2, 6] phi_A = {{1, 2, 3, 4, 5, 6}, {21, 22, 23, 24, 25, 26}} annotation(Evaluate = false); parameter Real[2, 6] phi_B = {{1, 2, 3, 4, 5, 6}, {21, 22, 23, 24, 25, 26}} annotation(Evaluate = true); Real[2] tmpA, tmpB; Frames.Orientation R_rel_A; equation R_rel_A = Frames.nullRotation(); tmpA = phi_A[:, 1:3] * Frames.resolve1(R_rel_A, {0, 1, 0}) + phi_A[:, 4:6] * Frames.resolve1(R_rel_A, {0, 0, -1}); tmpB = phi_B[:, 1:3] * Frames.resolve1(R_rel_A, {0, 1, 0}) + phi_B[:, 4:6] * Frames.resolve1(R_rel_A, {0, 0, -1}); end indexbug; "); simulate(indexbug); val(tmpA[1],1); val(tmpB[1],1);
Tested in v1.9.3-dev-1158-g32bc683.
Note:
See TracTickets
for help on using tickets.
Seems to be working now. Not sure when it was fixed.