Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#5946 closed defect (fixed)

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

Reported by: anonymous Owned by: perost
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 follow-up: Changed 4 years ago by Karim.Abdelhak

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 follow-up: Changed 4 years ago by phannebohm

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

Last edited 4 years ago by phannebohm (previous) (diff)

comment:3 Changed 4 years ago by phannebohm

  • Component changed from Frontend to New Instantiation
  • Owner changed from somebody to phannebohm
  • Status changed from new to accepted

comment:4 in reply to: ↑ 1 ; follow-up: Changed 4 years ago by 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.

comment:5 in reply to: ↑ 4 Changed 4 years ago by Karim.Abdelhak

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?

comment:6 in reply to: ↑ 2 Changed 4 years ago by Karim.Abdelhak

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 Changed 4 years ago by perost

  • Owner changed from phannebohm to perost
  • Status changed from accepted to assigned

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

comment:8 Changed 4 years ago by perost

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed in 57ea0be6.

comment:9 Changed 4 years ago by casella

  • Milestone changed from Future to 1.16.0
Note: See TracTickets for help on using tickets.