Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#5946 closed defect (fixed)

[NF] Cross product inside array models is broken in the Frontend

Reported by: anonymous Owned by: Per Östlund
Priority: high Milestone: 1.16.0
Component: New Instantiation Version:
Keywords: Cc:

Description

//Broken model with array, containing cross operator
model CrossBug
  model Foo
    input Real x[3];
    input Real y[3];
    output Real z[3];
  equation
    z = cross(x, y);
  end Foo;
  Foo foo[1];
  
equation
  foo[1].x = time * {1, 2, 3};
  foo[1].y = {time, time^3, time^2};

end CrossBug;

//Flattened model
class CrossBug
  Real foo[1].x[1];
  Real foo[1].x[2];
  Real foo[1].x[3];
  Real foo[1].y[1];
  Real foo[1].y[2];
  Real foo[1].y[3];
  Real foo[1].z[1];
  Real foo[1].z[2];
  Real foo[1].z[3];
equation
  foo[1].z[1] = foo[1].x * foo[1].y - foo[1].x * foo[1].y;
  foo[1].z[2] = foo[1].x * foo[1].y - foo[1].x * foo[1].y;
  foo[1].z[3] = foo[1].x * foo[1].y - foo[1].x * foo[1].y;
  foo[1].x[1] = time;
  foo[1].x[2] = time * 2.0;
  foo[1].x[3] = time * 3.0;
  foo[1].y[1] = time;
  foo[1].y[2] = time ^ 3.0;
  foo[1].y[3] = time ^ 2.0;
end CrossBug;

Change History (9)

comment:1 by Karim Adbdelhak, 5 years ago

I tested it with the current version, seems to work. OpenModelica 1.16.0~dev-311-gd37a91d

For which version did you test this?

comment:2 by Philip Hannebohm, 5 years ago

I just tested it with v1.16.0-dev.353+gb31452a72. The flag -d=newInst makes it break.

Last edited 5 years ago by Philip Hannebohm (previous) (diff)

comment:3 by Philip Hannebohm, 5 years ago

Component: FrontendNew Instantiation
Owner: changed from somebody to Philip Hannebohm
Status: newaccepted

in reply to:  1 ; comment:4 by Philip Hannebohm, 5 years ago

Also, as the title suggests, if foo is scalar the model works. Defining x,y,z as input/output makes no difference.

Replying to Karim.Abdelhak:

I tested it with the current version, seems to work. OpenModelica 1.16.0~dev-311-gd37a91d

I'm curious, did you test it in OMEdit? The old frontend seems to fail here, too, though it works from the command line.

in reply to:  4 comment:5 by Karim Adbdelhak, 5 years ago

Replying to phannebohm:

Also, as the title suggests, if foo is scalar the model works. Defining x,y,z as input/output makes no difference.

Replying to Karim.Abdelhak:

I tested it with the current version, seems to work. OpenModelica 1.16.0~dev-311-gd37a91d

I'm curious, did you test it in OMEdit? The old frontend seems to fail here, too, though it works from the command line.

I did both, command line and OMEdit. Also it works with old and new frontend, no difference there. The only thing that breaks it is -nfScalarize, maybe you left that flag activated by accident?

in reply to:  2 comment:6 by Karim Adbdelhak, 5 years ago

Replying to phannebohm:

I just tested it with v1.16.0-dev.353+gb31452a72. The flag -d=newInst makes it break.

Just to be sure i upgraded to your version, still no difference. Command line/OMEdit, old frontend and new frontend. Everything works.

-d=-nfScalarize breaks it though. But this is expected since that flag is not fully supported right now.

comment:7 by Per Östlund, 5 years ago

Owner: changed from Philip Hannebohm to Per Östlund
Status: acceptedassigned

I think I've fixed this locally, I just need to do a bit of testing.

comment:8 by Per Östlund, 5 years ago

Resolution: fixed
Status: assignedclosed

Fixed in 57ea0be6.

comment:9 by Francesco Casella, 5 years ago

Milestone: Future1.16.0
Note: See TracTickets for help on using tickets.