Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#4203 closed defect (fixed)

Problem with matching and sorting when using functions with multiple outputs

Reported by: Francesco Casella Owned by: Volker Waurich
Priority: critical Milestone: 1.11.0
Component: Backend Version:
Keywords: evalFunc Cc: Volker Waurich

Description (last modified by Francesco Casella)

When compiling the model Gazebo.Examples.TestSphere2PlaneModelica from the attached package, the following error is obtained

Model is structurally singular, error found sorting equations 
1: depth_b[1] = 0.0;
2: normals_a[1,3] = 1.0;
3: normals_a[1,2] = 0.0;
4: normals_a[1,1] = 0.0;
5: normals_b[1,3] = 1.0;
6: normals_b[1,2] = 0.0;
7: normals_b[1,1] = 0.0;
 for variables 
sphere2Plane.cp_a[1,1](20), sphere2Plane.cp_b[1,3](15), sphere2Plane.cp_b[1,2](16),
sphere.frame_interaction.t[2](23), sphere2Plane.cp_a[1,3](18), sphere2Plane.cp_a[1,2](19), 
sphere2Plane.numberOfContactPoints(21), sphere2Plane.t[3](1), sphere2Plane.t[2](2),
sphere2Plane.t[1](3), sphere2Plane.f[3](4), sphere2Plane.f[2](5),
sphere2Plane.f[1](6), sphere2Plane.normals_b[1,3](7)

First of all, I do not understand how OMC figures out those seven equations. Since the functions in the Gazebo.InteractionModels.Sphere2PlaneModelica model have both annotation(Inline = false), the compiler should see the result from the function call as a black box, and not try to do any fancy optimization.

Second, the 7 equations contain variable names depth_b, normal_a, normal_b which are actually not found in the global scope, but rather belong to the instance sphere2Plane.

I guess there's something badly wrong with how functions with multiple outputs are handled by the back-end.

The model runs smoothly with Dymola 2017.

Can you please have a look at that?

Attachments (1)

Gazebo.zip (9.0 KB ) - added by Francesco Casella 8 years ago.

Download all attachments as: .zip

Change History (7)

by Francesco Casella, 8 years ago

Attachment: Gazebo.zip added

comment:1 by Francesco Casella, 8 years ago

Description: modified (diff)

comment:2 by Lennart Ochel, 8 years ago

Cc: Volker Waurich added
Keywords: evalFunc added

The error is connected to some optimization within pre-optimization module evalFunc. @vwaurich can you have a look?

It seems that compilation works fine if that module gets disabled, e.g. using --preOptModules-=evalFunc.

comment:3 by Volker Waurich, 8 years ago

Owner: changed from Lennart Ochel to Volker Waurich
Status: newassigned

comment:4 by Volker Waurich, 8 years ago

Inline annotations are now considered by function evaluation. The bug with the variable names was due to multidimensional variables. This wont evaluated any longer. I also added a simplified model to the testsuite.

comment:5 by Volker Waurich, 8 years ago

Resolution: fixed
Status: assignedclosed

If there are no issues left,I will close the ticket.

comment:6 by Francesco Casella, 8 years ago

I confirm that the problem is solved with the latest nightly build and that the test case runs as expected. Thanks!

Note: See TracTickets for help on using tickets.