﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4203	Problem with matching and sorting when using functions with multiple outputs	Francesco Casella	Lennart Ochel	"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.

Can you please have a look at that?"	defect	new	critical	1.11.0	Backend				
