Saarland University
Lehrstuhl für Automatisierungstechnik

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> MultiBody with OM 1.4.5, Implementation of an aircraft model in OpenModelica
adrpo
post Feb 18 2009, 06:14 PM
Post #1


Member
**

Group: Members
Posts: 11
Joined: 17-December 07
From: Linköping, Sweden
Member No.: 4,942



Hi,

Well, I agree that error messages are rather scarce in OMC.
We will fix that in the next version.

However, you could add: getErrorString();
after each command like loadModel(), simulate(), etc.

To get the most information out of omc I run it from the command line:
.\omc +d=failtrace Model.mo (or Script.mos)
Also, check all the generated .log files.

About your model: OMC has a bug with the vectorization of reinit and pre:
Edit MultiBody.Joints.FreeMotion and replace the when equation with this one:

CODE
   when switch_state then
      // S_fix = pre(S_rel);
      S_fix[1] = pre(S_rel[1]);
      S_fix[2] = pre(S_rel[2]);
      S_fix[3] = pre(S_rel[3]);
      // reinit(phi,zeros(3));
      reinit(phi[1], 0.0);
      reinit(phi[2], 0.0);
      reinit(phi[3], 0.0);
   end when;


Then your model will simulate. I used this Multi.mos:
CODE
loadModel(Modelica);
getErrorString();
loadModel(ModelicaAdditions);
getErrorString();
loadFile("Multi.mo");
getErrorString();
simulate(TestBodyFreeFall, stopTime=100);
getErrorString();
//--------


Calling the script:
CODE
.\omc Multi.mos
true
""
true
""
true
""
record SimulationResult
    resultFile = "TestBodyFreeFall_res.plt"
end SimulationResult;
""

Cheers,
Adrian Pop/
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
shui
post Feb 16 2009, 01:44 AM
Post #2


Newbie
*

Group: Members
Posts: 4
Joined: 11-February 09
Member No.: 30,428



I just solved the problem on my own: when i replace
MultiBody.Types.Axis n={0,1,0} with Real[3] n={0,1,0} everything is fine.
Although this bug was hard to track because OpenModelica didn't report it.

Now, i tried another test: A body in free fall:

model TestBodyFreeFall
import ModelicaAdditions.MultiBody;
MultiBody.Parts.InertialSystem inertialSystem;
MultiBody.Joints.FreeMotion freemotion;
MultiBody.Parts.Body acstructure(m=1, I11=0.1,I22=0.1,I33=0.1);
equation
connect(inertialSystem.frame_b, freemotion.frame_a);
connect(acstructure.frame_a, freemotion.frame_b);
end TestBodyFreeFall;


This doesnt work too and no error is reported either. I think it should be easy to get this work...

record SimulationResult
resultFile = "Simulation failed.
"
end SimulationResult;


The error occurs since "MultiBody.Joints.FreeMotion" is declared. Although i cannot find anything suspicious there.

Maybe, someone can tell me, how to make OpenModelica to report errors???
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
shui
post Feb 11 2009, 10:47 PM
Post #3


Newbie
*

Group: Members
Posts: 4
Joined: 11-February 09
Member No.: 30,428



Hello Everybody!

I'm new to Modelica and i want to learn by realizing a first project: implementing an model aircraft.
The Pendulum example works fine, so i guess it should work in theory...

I want to attach a motor (1-D-mechanics) to the aircrafts body by adding this model to ModelicaAdditions.MultiBody.Parts.Mounting1D. (Gyro-effects will be neglected but the reaction-torque is neccessary)

model Mounting1D
extends Interfaces.OneFrame_a;
import ModelicaAdditions.MultiBody.Interfaces;
parameter Modelica.SIunits.Angle phi0=0 "Fixed offset angle of housing";
parameter ModelicaAdditions.MultiBody.Types.Axis n={0,1,0}
"Axis of rotation = axis of support torque (resolved in frame_a)";

Modelica.Mechanics.Rotational.Interfaces.Flange_b flange_b
"(right) flange fixed in housing";
//Interfaces.Frame_a frame_a ;
equation
flange_b.phi = phi0;
frame_a.f=zeros(3);
frame_a.t = -n*flange_b.tau;
end Mounting1D;


Now, i tried the following test:


>> loadModel(Modelica)
true

>> loadModel(ModelicaAdditions.MultiBody)
true

>> model TestMounting1D
import Modelica.Mechanics.Rotational;
import ModelicaAdditions.MultiBody.Joints;
import ModelicaAdditions.MultiBody.Parts;
Parts.InertialSystem inertialSystem;
Parts.Mounting1D mounting1D;
Modelica.Mechanics.Rotational.Spring spring(c=1);
Modelica.Mechanics.Rotational.Inertia inertia(J=1);
//Parts.Body body;
equation
connect(inertia.flange_b,spring.flange_a);
connect(spring.flange_a, mounting1D.flange_b);
connect(inertialSystem.frame_b, mounting1D.frame_a);
//connect(inertialSystem.frame_b, body.frame_a);
end TestMounting1D;

Ok

>> simulate(TestMounting1D,stopTime=1.0)
record SimulationResult
resultFile = "Simulation failed.
"
end SimulationResult;

>> readFile("output.log")
"Error, input data file does not match model.
nx in initfile: 0 from model code :2
ny in initfile: 111 from model code :44
np in initfile: 9 from model code :7
npstr in initfile: 2 from model code: 2
nystr in initfile: 0 from model code: 0
"


I have no idea what went wrong there.
Can someone help please?

Thanks!
joerg
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 19th March 2019 - 04:44 AM