﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
5083	Issue with MultiBody models in the NF due to lack of scalar product expansion	Francesco Casella	Per Östlund	"Please check [https://libraries.openmodelica.org/branches/newInst/Modelica_trunk/files/Modelica_trunk_Modelica.Mechanics.MultiBody.Examples.Elementary.LineForceWithTwoMasses.sim Modelica.Mechanics.MultiBody.Examples.Elementary.LineForceWithTwoMasses]. Some analysis carried out with the transformational debugger reveals that the equation
{{{
revolute1.tau = -revolute1.frame_b.t * revolute1.e;
}}}
coming out of the NF is firsts transformed by substitution into
{{{
revolute1.constantTorque.tau_constant = 
  -{-bodyBox1.frame_a.t[1], -bodyBox1.frame_a.t[2], -bodyBox1.frame_a.t[3]} * revolute1.e
}}}
which is correct, and then solved in the torn section of a nonlinear system as
{{{
bodyBox1.frame_a.t[2] =
  (-({-bodyBox1.frame_a.t[1], -0.0, -bodyBox1.frame_a.t[3]} * revolute1.e + revolute1.constantTorque.tau_constant)) / ({-0.0, -1.0, -0.0} * revolute1.e)
}}}
that would be OK if {{{{0,-1,0}*e <> 0}}}, which is unfortunately not the case here. 

The old FE instead expands the scalar product in the equation, passing it to the back-end as
{{{
  revolute1.tau = (-revolute1.frame_b.t[3]) * revolute1.e[3] - revolute1.frame_b.t[1] * revolute1.e[1] - revolute1.frame_b.t[2] * revolute1.e[2];
}}}
which allows the back-end to process the equations correctly and eventually find the [https://libraries.openmodelica.org/branches/master/Modelica_trunk/files/Modelica_trunk_Modelica.Mechanics.MultiBody.Examples.Elementary.LineForceWithTwoMasses.sim correct result]. This issue currently prevents a lot of MultiBody models to simulate when using the NF.

I see two problems here. The first is that the NF does not expand {{{revolute1.e}}} into its components and subsequently compute the scalar product explicitly, as the OF did. If this could be fixed, we should hopefully get most of the MultiBody models to work with the NF.

The second is that the back-end solves an equation in a dubious way, which turns out to be singular. I'm not sure whether it is possible to avoid this behaviour without introducing unnecessary restrictions that could harm the successful symbolic solution of equations in other cases.

In any case, I guess it will be best to make sure that the NF expands the scalar product as the NF did."	defect	closed	high	2.0.0	New Instantiation		fixed		
