Opened 14 years ago

Last modified 14 years ago

#1275 closed defect (fixed)

Flattenning of Modelica.Mechanics.MultiBody does not work for all components

Reported by: Jan Brugård Owned by: Jan Brugård
Priority: blocker Milestone: Red October
Component: Version:
Keywords: Cc: Jan Brugård, Per Östlund

Description

The following models do not work to check, because flattening fails:

Check of Modelica.Mechanics.MultiBody.Frames.Quaternions.multipleResolve1 failed
Check of Modelica.Mechanics.MultiBody.Frames.Quaternions.multipleResolve2 failed
Check of Modelica.Mechanics.MultiBody.Frames.Quaternions.planarRotation failed
Check of Modelica.Mechanics.MultiBody.Frames.TransformationMatrices.multipleResolve1 failed
Check of Modelica.Mechanics.MultiBody.Frames.TransformationMatrices.multipleResolve2 failed

Check of Modelica.Mechanics.MultiBody.Interfaces.PartialLineForce failed

Check of Modelica.Mechanics.MultiBody.Types.RotationSequence failed

Attachments (2)

planarRotationTotal.mo (37.0 KB ) - added by dhedberg 14 years ago.
Run the mos file and check the results. OpenModelica produces the following for me: […] So it does not seem to work as suggested, hence reopening this ticket.
planarRotationTotal.mos (132 bytes ) - added by dhedberg 14 years ago.
Run the mos file and check the results. OpenModelica produces the following for me: […] So it does not seem to work as suggested, hence reopening this ticket.

Download all attachments as: .zip

Change History (11)

comment:2 by Adrian Pop, 14 years ago

Thanks to the fixes already made for bug #1273 [BUG:1273] and #1274 [BUG:1274], everything except for RotationSequence now works.

comment:3 by Per Östlund, 14 years ago

RotationSequence fixed in r6134.
checkModel now works on all MultiBody models, see test case libraries/msl32/Modelica.Mechanics.MultiBody.

by dhedberg, 14 years ago

Attachment: planarRotationTotal.mo added

Run the mos file and check the results. OpenModelica produces the following for me:

true
instantiateDaeFunction failed for Math.sin in scope: Modelica.Mechanics.MultiBody.Frames.Quaternions.planarRotation
instantiateDaeFunction failed for Math.sin in scope: Modelica.Mechanics.MultiBody.Frames.Quaternions.planarRotation
"Error: No matching function found for Math.sin(angle / 2.0) of type function(x:Real) => Real in component <NO COMPONENT>, candidates are function(x:Real) => Real
Error: Class Math.sin not found in scope Modelica.Mechanics.MultiBody.Frames.Quaternions.planarRotation.
Error: Wrong type or wrong number of arguments to vector([e * Math.sin(angle / 2);Math.cos(angle / 2)])'.
 (in component <NO COMPONENT>)
Error: No matching function found for Math.sin(angle / 2.0) of type function(x:Real) => Real in component <NO COMPONENT>, candidates are function(x:Real) => Real
Error: Class Math.sin not found in scope Modelica.Mechanics.MultiBody.Frames.Quaternions.planarRotation.
Error: Wrong type or wrong number of arguments to vector([e * Math.sin(angle / 2);Math.cos(angle / 2)])'.
 (in component <NO COMPONENT>)
"
""

So it does not seem to work as suggested, hence reopening this ticket.

by dhedberg, 14 years ago

Attachment: planarRotationTotal.mos added

Run the mos file and check the results. OpenModelica produces the following for me:

true
instantiateDaeFunction failed for Math.sin in scope: Modelica.Mechanics.MultiBody.Frames.Quaternions.planarRotation
instantiateDaeFunction failed for Math.sin in scope: Modelica.Mechanics.MultiBody.Frames.Quaternions.planarRotation
"Error: No matching function found for Math.sin(angle / 2.0) of type function(x:Real) => Real in component <NO COMPONENT>, candidates are function(x:Real) => Real
Error: Class Math.sin not found in scope Modelica.Mechanics.MultiBody.Frames.Quaternions.planarRotation.
Error: Wrong type or wrong number of arguments to vector([e * Math.sin(angle / 2);Math.cos(angle / 2)])'.
 (in component <NO COMPONENT>)
Error: No matching function found for Math.sin(angle / 2.0) of type function(x:Real) => Real in component <NO COMPONENT>, candidates are function(x:Real) => Real
Error: Class Math.sin not found in scope Modelica.Mechanics.MultiBody.Frames.Quaternions.planarRotation.
Error: Wrong type or wrong number of arguments to vector([e * Math.sin(angle / 2);Math.cos(angle / 2)])'.
 (in component <NO COMPONENT>)
"
""

So it does not seem to work as suggested, hence reopening this ticket.

comment:4 by dhedberg, 14 years ago

See attachment, planarRotation still seems to produce errors. I tested this with an OpenModelica compiled for mingw some days old.

comment:5 by Per Östlund, 14 years ago

I am unable to reproduce this. checkModel of planarRotation succeeds without any errors with the latest trunk, and has done so since I fixed this bug and added the test case.

comment:6 by Adrian Pop, 14 years ago

Your attached model is not TOTAL (not complete).
In package Math you're missing the sin function,
i.e. Math.sin and this is the error you're getting.
Fix your dependency analysis!

comment:7 by dhedberg, 14 years ago

OpenModelica suffers from the same problem. The only reason you do not notice it is because you do not do a dependency analysis when you save a total model. You collect and save everything. Anyways, I fixed the problem which was in OpenModelica Absyn.traverseExp, see commit/revision 6387. Closing this ticket.

comment:8 by Adrian Pop, 14 years ago

We know that OpenModelica has the same problem.
But as we never used the dependency analysis the problem doesn't exist.
I would really suggest you do also a checking if is really faster do do the dependency
instead of directly instantiating the class. For me it seems *really really* weird that
is faster to do dependency+smaller instantiation rather than directly the full instantiation.
The problem is not the strategy, which is sound, the problem is with the implementation
which does instantiation during dependency, so:

 Dependency analysis includes instantiation
 O(dependency) = O(smaller instantiation) + O(traverse)
 The real question is:
 O(dependency) + O(smaller instantiation) > O(full instantiation)
 or
 O(dependency) + O(smaller instantiation) < O(full instantiation)
 ??

I don't know the answer to this question, but you could run some checks.
From what tests I ran, doing the dependency analysis is *always* slower than
doing full instantiation directly, but I might be wrong.
BTW, to help you a bit I added a testsuite/dependency directory to check
a bit if the dependency works fine, so if we break it at least we know when
(what revision).
I will add the instantiation of planarRotation to the dependency directory
so we make sure we don't break it in the future.

comment:9 by Adrian Pop, 14 years ago

I added more tests to testsuite/dependency.
Note that Modelica.Mechanics.MultiBody.Interfaces.PartialLineForce
does not work yet if +d=usedep is used, so there are still problems
with the dependency analysis.

Note: See TracTickets for help on using tickets.