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
  • » alesiem
  • » Profile

Posts

Posts

Thanks, works just fine!

Alex

I think that there is the possibility to run OpenModelicas DASSL solver in single step model now.
How do I set this mode?

May-15-14 13:33:35
Can I disable compilation of OMOptim when I configure OpenModelica?
Category: Developer

Thanks, this did the trick!

May-15-14 12:13:25
Can I disable compilation of OMOptim when I configure OpenModelica?
Category: Developer

Hi,

I have setup that allows me to update OpenModelica from SVN reconfigure and recompile almost without problems on CentOS 6.4.
The only thing that bother me is that I always have to change 3 Makefiles in OMOptim and OMOptimBasic by hand to get everything compiled correctly.
I think it's a bug in the configure script. However, I wonder if I can skip compilation of OMOptim* completely?
Is it needed for OpenModelica to function correctly?
Can I disable it easily without manual interaction, for instance, with an configure switch?

Thanks
Alexander

May-14-14 10:49:46
configure fails on CentOS 6.4
Category: Developer

Sorry, I have just realized that I forgot to run autoconf before configure, now it works fine!

May-14-14 10:46:12
configure fails on CentOS 6.4
Category: Developer

Hi, I have just fetched the latest OpenModelica source via svn.
When I try to configure OpenModelica configuration stops with the following error message:

....
Not compiling ModPar
Not compiling with BOOST
checking for revision... 20587
checking for OpenModelica platform name... linux-x86_64
checking for Modelica platform name... linux64
configure: creating ./config.status
config.status: creating Makefile
config.status: creating Compiler/Makefile
config.status: creating Compiler/Template/Makefile
config.status: creating Compiler/omc_release/Makefile
config.status: creating Compiler/runtime/Makefile
config.status: error: cannot find input file: Compiler/modpar/Makefile.in

Any ideas how to get around this?
Btw. I run on Linux, CentOS 6.4

Alexander

May-14-14 10:43:38
OpenModelica fails to build on CentOS 6.4

Sorry this should have been in the developer list I guess.
I'll post it there.

May-14-14 10:35:41
OpenModelica fails to build on CentOS 6.4

Hi, I have just fetched the latest OpenModelica source via svn.
When I try to configure OpenModelica configuration stops with the following error message:

....
Not compiling ModPar
Not compiling with BOOST
checking for revision... 20587
checking for OpenModelica platform name... linux-x86_64
checking for Modelica platform name... linux64
configure: creating ./config.status
config.status: creating Makefile
config.status: creating Compiler/Makefile
config.status: creating Compiler/Template/Makefile
config.status: creating Compiler/omc_release/Makefile
config.status: creating Compiler/runtime/Makefile
config.status: error: cannot find input file: Compiler/modpar/Makefile.in

Any ideas how to get around this?
Btw. I run on Linux, CentOS 6.4

Alexander

Hi,

I found the problem.

For some reason OMEdit was using the wrong omc, it seems, from a broken build that I had lying around.
Is there a debug option for OMEdit that allows to monitor the OMEdit/OMC interaction?

Alexander

I have just compiled OpenModelica on a OpenSUSE Linux machine.

The build procedure was not staight forward at all, I needed to set several environment variables that where never mentioned in any README file, had to download and install several libraries, fix c++ errors in several files, adjust autogenerated makefiles by hand, and fix some rml generated c-code by hand.

After all that I got it compiled but OMEdit does not work. It gives the following error message:

Unable to find OMEdit server, Object reference file /tmp/openmodelica.alex.objid.OMEdit109da87478000138962734400000038430081163544861 not created.
OMEdit will close.

omc +d=interactiveCorba works fine
OMShell works fine as well.

What could be the problem?
How to I turn on OMEdit/omc debug, to see what OMEdit tries to do?

Alexander

I'm using an external function in OpenModelica to evaluate some forces and moments. The function takes time and other parameters as input.
Now I would like to store and output some data at the taken solver steps (the final step that the solver decided to take).
Therefore I would like to know the exact step the solver has decided to take after evaluating the system of equations multiple times, and force an final evaluation in this step in order to store the correct data. I also need to set a maximum time step length for the solver.

Is that possible in OpenModelica?

Alex

Sep-04-13 11:44:18
CVODE solver in OpenModelica

Hi,

I heard somewhere that I can use CVODE solver with OpenModelica. How do I choose this solver?

Alexander

Jun-05-12 10:01:43
Category: Developer

Just for the record, here is the code that actually works:

Code:


  parameter Real tlmDelay = TLMGetDelay(interfaceName);

initial algorithm
  assert(tlmDelay > 0.0, "Bad tlmDelay in " + interfaceName + ", give up.");

I didn't realize that one can call a function in parameter initialization.
Thanks for the support.

Jun-04-12 15:30:08
Category: Developer

OK, the following construct compiles at least:

Code:


  parameter Real tlmDelay = 0.0;
initial algorithm
  tlmDelay := TLM.TLMGetDelay(interfaceName);
  assert(tlmDelay > 0.0, "Bad tlmDelay in " + interfaceName + ", give up.");

I'm just not sure if I can actually change the parameter value inside "initial algorithm"?! Is that possible?

Also, now the simulation crashes with the following message:

    messages = "Simulation execution failed for model: PendulumTLM
throw   | [line] 192 | [file] simulation/solver/events.c
        | Could not allocate Memory for initSample!


Any ideas what's wrong here?

Jun-04-12 11:57:49
Category: Developer

Note, that I removed some unnecessary code from the TLM.mo file, line 74 in the TLM.mo file is the following:

Code:


        tlmDelay:=TLMGetDelay(interfaceName);

Jun-04-12 11:51:32
Category: Developer

Sorry, I forgot the C-function generated by the Modelica code before, here it is:

Code:


void eqFunction_245(DATA *data) {
  TLM_TLMGetDelay_rettype tmp2124;
  modelica_string tmp2125;
  modelica_string tmp2126;
  /*#modelicaLine [c:/OpenModelica/TLM.mo:74:9-74:45]*/

  #ifdef _OMC_MEASURE_TIME
  SIM_PROF_TICK_FN(TLM_TLMGetDelay_index);
  #endif
  tmp2124 = _TLM_TLMGetDelay($Pmbs_tlminterface1$PinterfaceName);

  #ifdef _OMC_MEASURE_TIME
  SIM_PROF_ACC_FN(TLM_TLMGetDelay_index);
  #endif
  0.0 = tmp2124.c1;
  /*#endModelicaLine*/
  /*#modelicaLine [c:/OpenModelica/TLM.mo:75:5-75:77]*/
  if (!(0)) {
    tmp2125 = cat_modelica_string("Bad TLM delay in",$Pmbs_tlminterface1$PinterfaceName);
    tmp2126 = cat_modelica_string(tmp2125,", give up");
    FILE_INFO info = {"c:/OpenModelica/TLM.mo",75,5,75,77,0};
    MODELICA_ASSERT(info, tmp2126);
  }
  /*#endModelicaLine*/
  /*#modelicaLine [c:/OpenModelica/TLM.mo:76:5-76:25]*/
  (0) = (1);
  /*#endModelicaLine*/
}

Jun-04-12 11:47:38
Category: Developer

OK, here is the code:

Code:


package TLM
  function TLMSetMotion
    input String name "Name of the interface";
    input Real time_in "Simulation time";
    input Real R[3] "Position vector - can be neglected (set {0,0,0}) if you do not use 3D modeling and verification";
    input Real A[3,3] "Rotation matrix - can be neglected (set {1,0,0}{0,1,0}{0,0,1}) if you do not use 3D modeling and verification";
    input Real v[3] "Velocity";
    input Real w[3] "Angular velocity";

    external "C" set_tlm_motion(name,time_in,R,A,v,w)     annotation(Include = "#include<tlmforce.h>", Library = "tlmmodelica");
  end TLMSetMotion;

  function TLMGetDelay
    input String name "Name of the interface";
    output Real TLMdelay "The TLM delay for the secific interface";

    external "C" get_tlm_parameters(name,TLMdelay)     annotation(Include = "#include<tlmforce.h>", Library = "tlmmodelica");
  end TLMGetDelay;

  function TLMGetForce
    input String name "Name of the interface";
    input Real time_in "Simulation time";
    input Real r[3] "Position Vector";
    input Real A[3,3] "Rotation matrix";
    input Real v[3] "Velocity";
    input Real w[3] "Angular velocity";
    output Real f[3] "Force vector";
    output Real t[3] "Torque/moment vector";

    external "C" calc_tlm_force(name,time_in,r,A,v,w,f,t)     annotation(Include = "#include<tlmforce.h>", Library = "tlmmodelica");
  end TLMGetForce;

  model MBS_TLMInterface
    annotation(Diagram(), Icon(graphics = {Rectangle(rotation = 0, lineColor = {0,0,255}, fillColor = {0,0,255}, pattern = LinePattern.Solid, fillPattern = FillPattern.HorizontalCylinder, lineThickness = 0.25, extent = {{-29.5484,42.5806},{96.9032,-45.8065}}),Text(rotation = 0, lineColor = {0,0,0}, fillColor = {0,0,255}, pattern = LinePattern.Solid, fillPattern = FillPattern.None, lineThickness = 0.25, extent = {{-6.32258,18.0645},{74.9677,-20.6452}}, textString = "TLM", fontSize = 28),Line(points = {{-63.2258,-2.58065},{-28.3871,-2.58065}}, rotation = 0, color = {0,0,255}, pattern = LinePattern.Solid, thickness = 5)}));
    Modelica.Mechanics.MultiBody.Interfaces.Frame_a frame_a annotation(Placement(visible = true, transformation(origin = {-67.9907,-3.03738}, extent = {{-12,-12},{12,12}}, rotation = 0), iconTransformation(origin = {-67.9907,-3.03738}, extent = {{-12,-12},{12,12}}, rotation = 0)));
    parameter String interfaceName = "tlm";
    Real v[3];
    Real f[3];
    Real t[3];
    Real tlmDelay = 0.0;
    Boolean initializedFlg = false;
    Real lastSendTime(start = 0.0);
  initial algorithm
    if initializedFlg == false then
        tlmDelay:=TLMGetDelay(interfaceName);
    assert(tlmDelay > 0.0, "Bad TLM delay in" + interfaceName + ", give up");
    initializedFlg:=true;

    else
    end if;
  equation
    v = der(frame_a.r_0);
    frame_a.t = -t;
    frame_a.f = -f;
  algorithm
    (f,t):=TLMGetForce(interfaceName, time, frame_a.r_0, frame_a.R.T, v, frame_a.R.w);
  algorithm
    when time >= lastSendTime + tlmDelay then
          TLMSetMotion(interfaceName, time, frame_a.r_0, frame_a.R.T, v, frame_a.R.w);
      lastSendTime:=time;
   
    end when;
  end MBS_TLMInterface;
end TLM;

model PendulumTLM
  extends Modelica.Icons.Example;
  inner Modelica.Mechanics.MultiBody.World world(gravityType = Modelica.Mechanics.MultiBody.Types.GravityTypes.UniformGravity, n = {-1,0,0}) annotation(Placement(transformation(extent = {{-60,0},{-40,20}}, rotation = 0)));
  Modelica.Mechanics.MultiBody.Joints.Revolute rev(n = {0,1,0}, useAxisFlange = true, phi(fixed = true), w(fixed = true)) annotation(Placement(transformation(extent = {{-20,0},{0,20}}, rotation = 0)));
  Modelica.Mechanics.Rotational.Components.Damper damper(d = 0.1) annotation(Placement(transformation(extent = {{-20,40},{0,60}}, rotation = 0)));
  TLM.MBS_TLMInterface mbs_tlminterface1 annotation(Placement(visible = true, transformation(origin = {85.0467,10.7477}, extent = {{-12,-12},{12,12}}, rotation = 0)));
  Modelica.Mechanics.MultiBody.Parts.BodyBox bodybox1(r = {0,0,0.32}) annotation(Placement(visible = true, transformation(origin = {36.215,10.0467}, extent = {{-12,-12},{12,12}}, rotation = 0)));
equation
  connect(bodybox1.frame_b,mbs_tlminterface1.frame_a) annotation(Line(points = {{48.215,10.0467},{77.1028,10.0467},{77.1028,10.3832},{76.8878,10.3832}}));
  connect(rev.frame_b,bodybox1.frame_a) annotation(Line(points = {{5.55112e-016,10},{25,10},{25,10.0467},{24.215,10.0467}}));
  connect(world.frame_b,rev.frame_a) annotation(Line(points = {{-40,10},{-20,10}}, color = {95,95,95}, thickness = 0.5));
  connect(damper.flange_b,rev.axis) annotation(Line(points = {{0,50},{4,50},{4,26},{-10,26},{-10,20}}, color = {0,0,0}));
  connect(rev.support,damper.flange_a) annotation(Line(points = {{-16,20},{-16,26},{-28,26},{-28,50},{-20,50}}, color = {0,0,0}));
  annotation(experiment(StopTime = 5), Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100,-100},{100,100}}, grid = {2,2}), graphics), Documentation(info = "<html></html>"));
end PendulumTLM;

The external functions are part of some C-code that is too big to publish here. Besides does the problem occur before linking the code.

Alexander

Jun-04-12 09:37:14
Category: Developer

When I try to translate my Modelica models in OpenModelica I got several times the following error message:
Translation    08:00:36        0:0-0:0    Error building simulator. Buildlog: gcc  -O3 -falign-functions -msse2 -mfpmath=sse   -I"C:/OpenModelica1.8.1//include/omc" -I. -L"C:/OpenModelica/MetaModels/BeastModelicaPendulum/ModelicaShaft"   -c -o PendulumTLM.o PendulumTLM.c
PendulumTLM.c: I funktion "eqFunction_245":
PendulumTLM.c:8555: fel: l-v�rde kr�vs som v�nstra operand i tilldelning
PendulumTLM.c:8566: fel: l-v�rde kr�vs som v�nstra operand i tilldelning
mingw32-make: *** [PendulumTLM.o] Error 1


First thing is that the compiler gives error messages in Swedish, which I have never ever seen before. Therefore here a translation of the error message:
PendulumTLM.c:8555: error: lvalue required as left operand of assignment

Looking at line 8555 in PendulumTLM.c I see the following:
  0.0 = tmp2124.c1;

And, yes that is not C code.

Is this a common problem with OpenModelica? I got this several times. What can I do about it?
For your information: I use OpenModelica 1.8.1+ on a WindowsXP system.

Alexander

May-31-12 11:37:16
Converged/Final solver time step information
Category: Programming

Hi,

Provided that OpenModelica supports variable time step solvers, I wonder if there is a possibility to detect final/converged time steps?
I would like to pass this information to an external function, i.e., send some information to the function about the current solver step (converged or intermediate step).
In other words, the solver might evaluate the function many times before it takes the actual converged step. Therefore I would like to know when the function is called for the final, converged, step and when not.. 

Note, that I used when statements before to force a "complete" step computation at certain time instances. But this method seems a bit crude, therefore I would like to use information directly from the solver. Besides, does my external-function not require a fixed step solver, thus the when implementation adds unnecessary complexity.

Alexander

May-31-12 11:04:50
Translation of external function fails

Hi,

I tried to use an external function in OpenModelica but my simple model does not translate.
When I try to translate model MotorExtFunc1D from the package below I get the following error message:

Translation    10:01:04        0:0-0:0    Internal error Inverse Algorithm needs to be solved for in   extinterface1d1.torque := $_start(extinterface1d1.torque);
  extinterface1d1.torque := ExtFuncTest.ExtFunc1D(extinterface1d1.interfaceName,time,extinterface1d1.w);
. This is not implemented yet.


Strange enough does the model RotationExtFunc1D translate without problems.
Any hints?

Alexander

Here the package (attaching it didn't work):
package ExtFuncTest
  model SimpleDCMotor
    Modelica.Electrical.Analog.Basic.Resistor resistor1 annotation(Placement(visible = true, transformation(origin = {-20.4842,54.0037}, extent = {{-12,-12},{12,12}}, rotation = 0)));
    Modelica.Electrical.Analog.Basic.Inductor inductor1 annotation(Placement(visible = true, transformation(origin = {18.622,52.8864}, extent = {{-12,-12},{12,12}}, rotation = 0)));
    Modelica.Electrical.Analog.Basic.Ground ground1 annotation(Placement(visible = true, transformation(origin = {3.72439,-18.2495}, extent = {{-12,-12},{12,12}}, rotation = 0)));
    Modelica.Electrical.Analog.Basic.EMF emf annotation(Placement(visible = true, transformation(origin = {49.5345,17.5047}, extent = {{-12,-12},{12,12}}, rotation = 0)));
    //  annotation(Icon(graphics = {Rectangle(rotation = 0, lineColor = {0,0,255}, fillColor = {170,170,255}, pattern = LinePattern.Solid, fillPattern = FillPattern.HorizontalCylinder, lineThickness = 0.25, extent = {{71.5084,19.3669},{1.11732,-5.95903}}),Rectangle(rotation = 0, lineColor = {0,0,255}, fillColor = {85,0,0}, pattern = LinePattern.Solid, fillPattern = FillPattern.Solid, lineThickness = 0.25, extent = {{1.8622,44.3203},{-87.8957,-48.0447}}),Polygon(points = {{-59.9628,-47.6723},{-69.6462,-58.1006},{-12.2905,-58.1006},{-24.2086,-47.6723},{-59.9628,-47.6723}}, rotation = 0, lineColor = {0,0,255}, fillColor = {0,0,0}, pattern = LinePattern.Solid, fillPattern = FillPattern.Solid, lineThickness = 0.25)}), Diagram());
    annotation(Diagram(), Icon(graphics = {Rectangle(rotation = 0, lineColor = {0,0,255}, fillColor = {170,170,255}, pattern = LinePattern.Solid, fillPattern = FillPattern.HorizontalCylinder, lineThickness = 0.25, extent = {{77.1429,23.6735},{-8.97959,-8.16327}}),Rectangle(rotation = 0, lineColor = {0,0,0}, fillColor = {85,85,0}, pattern = LinePattern.Solid, fillPattern = FillPattern.HorizontalCylinder, lineThickness = 0.25, extent = {{-8.57143,44.898},{-89.3878,-28.9796}}),Polygon(points = {{-71.4286,-28.5714},{-80.4082,-48.1633},{-17.1429,-48.1633},{-25.7143,-28.5714},{-71.4286,-28.5714}}, rotation = 0, lineColor = {0,0,255}, fillColor = {0,0,0}, pattern = LinePattern.Solid, fillPattern = FillPattern.Solid, lineThickness = 0.25)}));
    Modelica.Mechanics.Rotational.Interfaces.Flange_b flange_b annotation(Placement(visible = true, transformation(origin = {88.2682,7.44879}, extent = {{-12,-12},{12,12}}, rotation = 0), iconTransformation(origin = {88.2682,7.44879}, extent = {{-12,-12},{12,12}}, rotation = 0)));
    Modelica.Electrical.Analog.Sources.ConstantVoltage constantvoltage1(V = 1) annotation(Placement(visible = true, transformation(origin = {-50.2793,16.3873}, extent = {{-12,12},{12,-12}}, rotation = -90)));
  equation
    connect(flange_b,emf.flange) annotation(Line(points = {{98.6965,32.0298},{61.4525,32.0298},{61.4525,17.5047},{61.5345,17.5047}}));
    connect(constantvoltage1.p,resistor1.p) annotation(Line(points = {{-50.2793,28.3873},{-33.1471,28.3873},{-33.1471,54.0037},{-32.4842,54.0037}}));
    connect(constantvoltage1.n,ground1.p) annotation(Line(points = {{-50.2793,4.38734},{4.09683,4.38734},{4.09683,-6.24953},{3.72439,-6.24953}}));
    connect(emf.n,ground1.p) annotation(Line(points = {{49.5345,5.50466},{49.5345,-5.95903},{3.72439,-5.95903},{3.72439,-6.24953}}));
    connect(inductor1.n,emf.p) annotation(Line(points = {{30.622,52.8864},{49.9069,52.8864},{49.9069,29.5047},{49.5345,29.5047}}));
    connect(resistor1.n,inductor1.p) annotation(Line(points = {{-8.48417,54.0037},{6.70391,54.0037},{6.70391,52.8864},{6.62197,52.8864}}));
  end SimpleDCMotor;
  function ExtFunc1D
    input String name "Interface name";
    input Real timeIn "Current time";
    input Real w "Angular velocity";
    output Real t "Torque/moment vector";

    external "C" calc_tlm_force(name,timeIn,w,t)     annotation(Include = "#include<tlmforce.h>", Library = "tlmmodelica");
  end ExtFunc1D;
  model MotorExtFunc1D
    ExtFuncTest.SimpleDCMotor simpledcmotor1 annotation(Placement(visible = true, transformation(origin = {-73.8318,10.2804}, extent = {{-12,-12},{12,12}}, rotation = 0)));
    ExtFuncTest.ExtInterface1D extinterface1d1 annotation(Placement(visible = true, transformation(origin = {17.0561,8.64486}, extent = {{-12,-12},{12,12}}, rotation = 0)));
  equation
    connect(simpledcmotor1.flange_b,extinterface1d1.flange_b) annotation(Line(points = {{-63.2396,11.1742},{8.17757,11.1742},{8.17757,8.4126},{7.84317,8.4126}}));
  end MotorExtFunc1D;
  model RotationExtFunc1D
    Modelica.Mechanics.Rotational.Sources.ConstantSpeed constantspeed1 annotation(Placement(visible = true, transformation(origin = {-57.9439,2.80374}, extent = {{-12,-12},{12,12}}, rotation = 0)));
    ExtFuncTest.ExtInterface1D extinterface1d1 annotation(Placement(visible = true, transformation(origin = {27.1028,3.73832}, extent = {{-12,-12},{12,12}}, rotation = 0)));
  equation
    connect(constantspeed1.flange,extinterface1d1.flange_b) annotation(Line(points = {{-45.9439,2.80374},{17.757,2.80374},{17.757,3.50606},{17.8899,3.50606}}));
  end RotationExtFunc1D;
  model ExtInterface1D
    annotation(Diagram(), Icon(graphics = {Rectangle(rotation = 0, lineColor = {0,0,255}, fillColor = {0,0,255}, pattern = LinePattern.Solid, fillPattern = FillPattern.HorizontalCylinder, lineThickness = 0.25, extent = {{-29.5484,42.5806},{96.9032,-45.8065}}),Text(rotation = 0, lineColor = {0,0,0}, fillColor = {0,0,255}, pattern = LinePattern.Solid, fillPattern = FillPattern.None, lineThickness = 0.25, extent = {{-6.32258,18.0645},{74.9677,-20.6452}}, textString = "ExtFunc", fontSize = 28),Line(points = {{-63.2258,-2.58065},{-28.3871,-2.58065}}, rotation = 0, color = {0,0,255}, pattern = LinePattern.Solid, thickness = 5)}));
    Modelica.Mechanics.Rotational.Interfaces.Flange_b flange_b annotation(Placement(visible = true, transformation(origin = {-76.7742,-1.93548}, extent = {{-12,-12},{12,12}}, rotation = 0), iconTransformation(origin = {-76.7742,-1.93548}, extent = {{-12,-12},{12,12}}, rotation = 0)));
    parameter String interfaceName = "tlm";
    Real w(start = 0.0);
    Real torque(start = 0.0);
  equation
    w = der(flange_b.phi);
    flange_b.tau = -torque;
  algorithm
    torque:=ExtFunc1D(interfaceName, time, w);
  end ExtInterface1D;
end ExtFuncTest;

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