Opened 8 years ago

Last modified 7 years ago

#4411 new defect

Odd error-message for over-determined system

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

Description (last modified by Martin Sjölund)

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 8 years ago.
Model with comment characters

Download all attachments as: .zip

Change History (4)

by anonymous, 8 years ago

Attachment: SpinArtistry.mo added

Model with comment characters

comment:1 by Francesco Casella, 7 years ago

Component: *unknown*Backend
Owner: changed from somebody to Lennart Ochel

comment:2 by Martin Sjölund, 7 years ago

Description: modified (diff)

comment:3 by Martin Sjölund, 7 years ago

Summary: OMEdit 1.12 simulate fails with parameter but works when changed to constantOdd 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.