Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register
  • Index
  • » Users
  • » peterjunglas
  • » Profile

Posts

Posts

The included model DamperBug1 leads to the following error:

Code:

Unbekannter Fehler warning | division by zero in partial equation: ((-$ZERO.$DER.springdamper3.flange_b.phi) * idealrollingwheel2.radius) / (idealrollingwheel2.radius - idealrollingwheel1.radius) because idealrollingwheel2.radius - idealrollingwheel1.radius == 0: File: /usr/lib/omlibrary/Modelica 3.1/Mechanics/Rotational.mo Line: 3644

        | at Time=0.000000
        | [line] 487 | [file] DamperBug1.c
throw   | [line] 45 | [file] util/division.c
        | division by zero

Changing one of the SpringDamper blocks to a Spring works (example DamperBug3).
Deleting the Wheels and staying in the rotational domain works (example DamperBug2).

    Greetings
        Peter

model DamperBug1
  Modelica.Mechanics.Rotational.Sources.ConstantTorque constanttorque1(tau_constant = 100);
  Modelica.Mechanics.Rotational.Components.Inertia inertia1(J = 0.6, w(start = 83.7758, fixed = true), phi(start = 0.0, fixed = true));
  Modelica.Mechanics.Rotational.Components.SpringDamper springdamper3(c = 7500, d = 1);
  Modelica.Mechanics.Rotational.Components.SpringDamper springdamper1(c = 7500, d = 1);
  Modelica.Mechanics.Rotational.Components.IdealRollingWheel idealrollingwheel1(radius = 0.3);
  Modelica.Mechanics.Rotational.Components.IdealRollingWheel idealrollingwheel2(radius = 0.3);
  Modelica.Mechanics.Translational.Components.Mass mass1(m = 1200, v(start = 0, fixed = true));
equation
  connect(idealrollingwheel2.flangeT,mass1.flange_a);
  connect(idealrollingwheel1.flangeT,mass1.flange_a);
  connect(springdamper1.flange_b,idealrollingwheel1.flangeR);
  connect(springdamper3.flange_b,idealrollingwheel2.flangeR);
  connect(springdamper3.flange_a,inertia1.flange_b);
  connect(inertia1.flange_b,springdamper1.flange_a);
  connect(constanttorque1.flange,inertia1.flange_a);
end DamperBug1;

model DamperBug2
  Modelica.Mechanics.Rotational.Sources.ConstantTorque constanttorque1(tau_constant = 100);
  Modelica.Mechanics.Rotational.Components.Inertia inertia1(J = 0.6, w(start = 83.7758, fixed = true), phi(start = 0.0, fixed = true));
  Modelica.Mechanics.Rotational.Components.SpringDamper springdamper3(c = 7500, d = 1);
  Modelica.Mechanics.Rotational.Components.SpringDamper springdamper1(c = 7500, d = 1);
  Modelica.Mechanics.Rotational.Components.Inertia inertia2(J = 2, w(start = 0, fixed = true));
equation
  connect(springdamper3.flange_b,inertia2.flange_a);
  connect(springdamper1.flange_b,inertia2.flange_a);
  connect(springdamper3.flange_a,inertia1.flange_b);
  connect(inertia1.flange_b,springdamper1.flange_a);
  connect(constanttorque1.flange,inertia1.flange_a);
end DamperBug2;

model DamperBug3
  Modelica.Mechanics.Rotational.Sources.ConstantTorque constanttorque1(tau_constant = 100);
  Modelica.Mechanics.Rotational.Components.Inertia inertia1(J = 0.6, w(start = 83.7758, fixed = true), phi(start = 0.0, fixed = true));
  Modelica.Mechanics.Rotational.Components.SpringDamper springdamper3(c = 7500, d = 1);
  Modelica.Mechanics.Rotational.Components.IdealRollingWheel idealrollingwheel1(radius = 0.3);
  Modelica.Mechanics.Rotational.Components.IdealRollingWheel idealrollingwheel2(radius = 0.3);
  Modelica.Mechanics.Translational.Components.Mass mass1(m = 1200, v(start = 0, fixed = true));
  Modelica.Mechanics.Rotational.Components.Spring spring1(c = 7500);
equation
  connect(spring1.flange_b,idealrollingwheel1.flangeR);
  connect(spring1.flange_a,inertia1.flange_b);
  connect(idealrollingwheel2.flangeT,mass1.flange_a);
  connect(idealrollingwheel1.flangeT,mass1.flange_a);
  connect(springdamper3.flange_b,idealrollingwheel2.flangeR);
  connect(springdamper3.flange_a,inertia1.flange_b);
  connect(constanttorque1.flange,inertia1.flange_a);
end DamperBug3;

You can buy a commercial simulation program, throw bug reports in a black hole, pay for yearly updates and hope that some of  your bugs have been fixed in a year or so (and I could name a few examples!).

Or you can use OpenModelica!

Thanks for your fast help
   Peter

Jun-12-12 18:56:49
wrong equation counting when array indexing is used
Category: Developer

Hi,

I've come across this error too and it is most disturbing. I've tried several workarounds without success.
So if I can do anything to push it up the developers' todo list, let me know!

   Regards
      Peter

The attached model is a small part of a SystemDynamics package. Check and instantiation work, but compiling leads to the error:

Translation    17:34:26        0:0-0:0    Error building simulator. Buildlog: gcc   -falign-functions -march=native -mfpmath=sse -fPIC   -I"/usr/include/omc" -I. -L"/home/peter/tmp/raus"   -c -o TestConveyor.o TestConveyor.c
TestConveyor.c: In Funktion »eqFunction_5«:
TestConveyor.c:289:33: Fehler: »$P$PRE$Pconstantflow1$PconstRate« nicht deklariert (erste Benutzung in dieser Funktion)
TestConveyor.c:289:33: Anmerkung: jeder nicht deklarierte Bezeichner wird nur einmal für jede Funktion, in der er vorkommt, gemeldet
make: *** [TestConveyor.o] Fehler 1

Any suggestions for a workaround are highly welcome!
    Greetings
        Peter

------

Update error, therefore code following:

TestConveyor.mo
------------------------

connector MassPort
  flow Real dm;
  Real data; 
end MassPort;

model ConstantFlow
  MassPort outflow;
  parameter Real constRate = 1.0;
protected
  Real inRate;
  Real rate;
equation
  rate = inRate;
  outflow.dm = -rate;
  inRate = constRate;
end ConstantFlow;

model Conveyor
  MassPort inflow(data(start=0));
  MassPort outflow(data(start=0));
  Modelica.Blocks.Interfaces.RealOutput out1;
  parameter Integer nDelay = 5;
  parameter Modelica.SIunits.Time samplePeriod = 1;
  parameter Modelica.SIunits.Time startTime = 0.1;
protected
  Real store[nDelay-1];
  Real load, last;
equation
  when sample(startTime, samplePeriod) then
    store[1] = pre(inflow.dm);
    store[2:end] = pre(store[1:end-1]);
    last = pre(store[end]);
    load = sum(store);
  end when;
  out1 = load;
  inflow.data = 0;
  outflow.data = last;
end Conveyor;

model TestConveyor
  ConstantFlow constantflow1(constRate = 2);
  Conveyor conveyor1;
equation
  connect(constantflow1.outflow,conveyor1.inflow);
end TestConveyor;

testConveyor.mos
-------------------------
loadModel(Modelica);
loadFile("TestConveyor.mo");
simulate(TestConveyor,startTime=0.0,stopTime=6.0);
plot(conveyor1.outflow.dm);

Has anybody a working example showing a 3d animation of a MultiBody model in openModelica?
I'm a bit confused about what should work (and how) and what is still too come...

    Thanks
       Peter

Ok, everything works now! The problem was: One has to install the dev package of libexpat as well to get the correct links. This is probably a bug in expat, but who cares. Now the daily build works for me. And this makes bug #1599 obsolete - everything works fine.

Thanks for your fast help.
    Peter

Actually it is not in /usr/lib/x86_64-linux-gnu/ !

Confusing results (for me):

Code:

> echo "int main() {return 0;}" | gcc -x c - -lexpat


/usr/bin/ld: cannot find -lexpat
collect2: ld returned 1 exit status

and

Code:

> locate libexpat.so


/daten/local/prog/matlab2011a/bin/glnxa64/libexpat.so.1
/daten/local/prog/matlab2011a/bin/glnxa64/libexpat.so.1.5.0
/lib/x86_64-linux-gnu/libexpat.so.1
/lib/x86_64-linux-gnu/libexpat.so.1.5.2
/lib32/libexpat.so
/lib32/libexpat.so.1
/lib32/libexpat.so.1.5.2
/usr/lib/vmware/lib/libexpat.so.0
/usr/lib/vmware/lib/libexpat.so.0/libexpat.so.0
/usr/lib/vmware/ovftool/libexpat.so.0
/usr/lib/vmware-installer/1.1/lib/lib/libexpat.so.0
/usr/lib/vmware-installer/1.1/lib/lib/libexpat.so.0/libexpat.so.0

and finally

Code:

# ldconfig -v | grep expat

/sbin/ldconfig.real: Pfad »/lib/x86_64-linux-gnu« mehrfach angegeben
/sbin/ldconfig.real: Pfad »/usr/lib/x86_64-linux-gnu« mehrfach angegeben
    libexpat.so.1 -> libexpat.so.1.5.2
    libexpatw.so.1 -> libexpatw.so.1.5.2
    libexpat.so.1 -> libexpat.so.1.5.2
    libexpatw.so.1 -> libexpatw.so.1.5.2

Simulating any model (e.g. with OMShell) on a Ubuntu 11-04 (64 bit) system leads to the error
   /usr/bin/ld: cannot find -lexpat
The expat library is properly installed (checked with ldconfig).

This happens with 9705-1 (nightly-ubuntu) and older versions. 9040-1 (stable) works though.

   Greetings
      Peter

  • Index
  • » Users
  • » peterjunglas
  • » Profile
You are here: