Opened 7 years ago

Last modified 7 years ago

#4411 new defect

Odd error-message for over-determined system

Reported by: Vestal Owned by: lochel
Priority: high Milestone: Future
Component: Backend Version:
Keywords: Cc:

Description (last modified by sjoelund.se)

Seems like a bug in verison 1.12.0 of 3 May 2017

model SpinArtistry
import Modelica.SIunits;
import Modelica.Mechanics.MultiBody.Frames.Orientation;
import Modelica.Mechanics.MultiBody.Frames.axisRotation;
import Modelica.Mechanics.MultiBody.Visualizers;
import Modelica.Mechanics.MultiBody.Frames;
import Modelica.Mechanics.MultiBody.Types.Color;
  // Running "simulate" on this model will result in a 
  // Translation Error "The given system is mixed-determined.
  // [index > 3]"
  // If you comment/uncomment the following lines to change
  // the following declaration from a parameter to a constant,
  // it will succeed.
  parameter SIunits.AngularVelocity der_angle = 10.0;
  //constant SIunits.AngularVelocity der_angle = 10.0;

  //parameter Frames.Orientation Rtilt = Frames.axisRotation(3, -0.7, 0);
  constant Frames.Orientation Rtilt = Frames.axisRotation(3, -0.7, 0);
  SIunits.Angle angle;
  Frames.Orientation R;
     
initial equation
  angle = 0.0;
  R = Frames.absoluteRotation(Frames.Orientation(T=identity(3),w={0,der_angle,0}), Rtilt);
equation
  der_angle = der(angle);
  R = Frames.absoluteRotation(Frames.axisRotation(2, angle, der_angle), Rtilt);  
end SpinArtistry;

Attachments (1)

SpinArtistry.mo (1.2 KB) - added by anonymous 7 years ago.
Model with comment characters

Download all attachments as: .zip

Change History (4)

Changed 7 years ago by anonymous

Model with comment characters

comment:1 Changed 7 years ago by casella

  • Component changed from *unknown* to Backend
  • Owner changed from somebody to lochel

comment:2 Changed 7 years ago by sjoelund.se

  • Description modified (diff)

comment:3 Changed 7 years ago by sjoelund.se

  • Summary changed from OMEdit 1.12 simulate fails with parameter but works when changed to constant to Odd error-message for over-determined system

The problem stems from defining R twice: once for initialization and once for the regular equation system. This is not really allowed in Modelica although OpenModelica will look for redundant equations and remove some (which is why it works when derangle is a constant).

Using something like the following works:

  R = Frames.absoluteRotation(if initial() then Frames.Orientation(T=identity(3),w={0,der_angle,0}) else Frames.axisRotation(2, angle, der_angle), Rtilt);

Although it is probably better to use:

  R = Frames.absoluteRotation(Frames.axisRotation(2, angle, der_angle), Rtilt);

I suppose what could be lacking is a better error-message stating that the system is over-determined and listing the equations. @lochel is probably better than myself for that task though.

Note: See TracTickets for help on using tickets.