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

Posts

Posts

Apr-27-11 23:10:11
New model completly filled with backround color of one block

Hi

Could you be more specific and give an example code and also which tool you are using (I assume it is OMEdit)

Regards
Mohsen

Apr-27-11 23:00:59
How to get the current time?

Hi

You find two examples in DrControl - Kalman filter how to model a random generator in Modelica

function Mathrandom
  input Real si1;  // {si1,si2,si3} and {so1,so2,so3} should be replaced by si and so with the
  input Real si2;  // type Seed once OMC can handle a function call with an array vector
  input Real si3;
  input Real tim;
  output Real x;
  output Real so1;
  output Real so2;
  output Real so3;
  Seed so;
  Seed si;
  algorithm
  si := {si1,si2,si3};
  so[1] := abs(rem((171*si[1]*exp(mod(tim-11,tim+13))),30269));   
  so[2] := abs(rem((172*si[2]*exp(mod(tim-5,tim+7))),30307));
  so[3] := abs(rem((170*si[3]*exp(mod(tim-23,tim+76))),30323));
  if so[1] < 1e-4 then
     so[1] := 1;
   end if;
  if so[2] < 1e-4 then
     so[2] := 1;
  end if;
  if so[3] < 1e-4 then
    so[3] := 1;
   end if;
  x := rem((so[1]/30269.0 +so[2]/30307.0 + so[3]/30323.0),1.0);
  so1 :=so[1];
  so2:= so[2];
  so3 := so[3];
  end Mathrandom;

-------
function Mathrandom "Pseudo random number generator"   
  input Integer si[3] "Seed from last call";   
  output Real x "Random number between 0 and 1";   
  output Integer so[3] "Modified seed for next call";
algorithm   
  so[1] := rem((171*si[1]), 30269);   
  so[2] := rem((172*si[2]), 30307);   
  so[3] := rem((170*si[3]), 30323);   // Zero is a poor seed, therefore substitute 1;   
  for i in 1:3 loop     
    if so[i] == 0 then       
      so[i] := 1;     
     end if;   
  end for;   
  x := rem((so[1]/30269.0 + so[2]/30307.0 + so[3]/30323.0), 1.0);
  annotation(__OpenModelica_Impure = true);
end Mathrandom;

regards
Mohsen

Apr-19-11 08:18:45
How can we get back data from an extern file (.txt)?

Hi
I assume that you want to extract some part of the result file and insert into another file?
If yes then there is a python script that could help you
In the python script I'm running simulation and parsing the result file and pipe it to a new file for matlab visualization
However you can easily redirect the result to another file.
The files are here: http://openmodelica.org/index.php/home/ … 48-scripts
(beside the other script)

Regards
Mohsen

Apr-19-11 08:09:27
With which examples of MSL 3.1 has OM1.7.0 problems ?

Hi Lisa,

The Media and Fluid libraries are not supported yet fully, but we are working on it. Regarding the thermal library, if it is not dependent on the media it should be fine

Regards
Mohsen

look in
http://openmodelica.org/index.php/home/ … /4-speaker
there is an interface to matlab.

regards
Mohsen

Mar-12-11 07:12:40
2 equal equations leads to one more equation and same number unknows
Category: Programming

Hi,

Does your simulation start? If you get an error message about the number of varaible is not the same as the number of equations then your model is either over-determinant or under. The Modelica compilers rearrange all the equations and not neccessary in the order that the users expects it.

Regards
Mohsen

Mar-12-11 07:03:11
bugs to save

Hi,

try to unistall and re-install OpenModelcia from scratch.

Best Regards
Mohsen

Mar-12-11 07:01:48
simulation time (Tn) jumping forward/backward when changing value

Hi,

Please use the bug report facilities. This sounds like a bug.
http://openmodelica.org/index.php/developer/bugs

Regards
Mohsen

Mar-09-11 16:42:21
An example of the Standard Library compiles but doesn't works fine

Hi,

Maybe this helps

Steps represent the possible states a StateGraph can have. If a step is active the Boolean variable active of the step is true. If it is deactivated, active = false. At the initial time, all "usual" steps are deactivated. The InitialStep objects are steps that are activated at the initial time. They are characterized by a double box (see figure above).
Transitions are used to change the state of a StateGraph. When the step connected to the input of a transition is active, the step connected to the output of this transition is deactivated and the transition condition becomes true, then the transition fires. This means that the step connected to the input to the transition is deactivated and the step connected to the output of the transition is activated.
The transition condition is defined via the parameter menu of the transition object.

In the input field "condition", any type of time varying Boolean expression can be given (in Modelica notation, this is a modification of the time varying variable condition). Whenever this condition is true, the transition can fire. Additionally, it is possible to activate a timer, via enableTimer (see menu above) and provide a waitTime. In this case the firing of the transition is delayed according to the provided waitTime. The transition condition and the waitTime are displayed in the transition icon.
In the above example, the simulation starts at initialStep. After 1 second, transition1 fires and step1 becomes active. After another second transition2 fires and initialStep becomes again active. After a further second step1 becomes again active, and so on.

Feb-25-11 15:14:32
OpenModelica Compiler Optimizatio related
Category: Developer

Hi

There is actually a document for RML
look under
http://www.ida.liu.se/~pelab/rml/rml-ft … 060314.pdf
or
http://www.ida.liu.se/~pelab/rml/

Best Regards
Mohsen

Feb-11-11 09:24:59
or - what is it going to be?

Hi

It is a research project about Real Time simulation capabilities with OpenModelica. It will soon contain more inforamtion

Best Reagrds
Mohsen

There is a section under Kalman filter in DrControl that I'm using the above random generator and input the time varaible as an argument so that omc doesnot consider the function a constant

Best Regards
Mohsen

Jan-29-11 00:27:42
Connect a "flange" connector to a "Frame" connector
Category: Programming

Hi,

Flange is interface for one dimensional components and Frame is for 3 dimensional. In flange you have
    SI.Position s
    flow SI.Force f
and in frame you have
     SI.Position r_0[3]
      Frames.Orientation R
      flow SI.Force f[3]
      flow SI.Torque t[3]
I guess that you can by projecting the 3D frame into a plane will result in the corresponding 1D quatities. In this case s and f, but you also need to think about the position, orientation and torque.
Best Regards
Mohsen

Hi,

When you compile a Modelica model in OpenModelica you get a set of files including the $Modelname$_init.txt file that contains the defined parameters in your model.
Every time the $Modelname$.exe file is executed the init-file is read.
You can change the parameter values before a new simualtion.

Best Regards
Mohsen

Nov-12-10 22:34:16
What is the status of PDElib?
Category: Programming

Hi,

You can also look at Levon Saldamlis PHD thesis from www.ep.liu.se

Levon worked on a branch in omc but it was a while and it has not been updated.
But I think the thesis or the master thesis that you suggested can be a good starting point

Regards
Mohsen

Oct-27-10 22:31:06
Is it possible to call OpenModelica from external applications ?

Hi

You could also look at this thread
http://www.openmodelica.org/index.php/f … pic?id=129
Regards
Mohsen

Hi,

We are curently cooperating with Stuttgart university and working on making a web version of OMC, called OMWEB.
The intended usage is education and not realy yet suitable for heavy simulations.
But the system is divided into three parts
server contains the omc installtion
ECS server that connects the server to the frontend
frontend where the students are posting their source code to the server.
The communication is done in the rest format and the exercises are writen in JSON format.
More about this issue will soon be posted in the homepage.

Best Regards
Mohsen

Hi

Modelica 3.2 will support complex numbers

Best Regards
Mohsen

Hi,

Please at this thread

http://openmodelica.org/index.php/forum/topic?id=139

Best Regards
Mohsen

Oct-27-10 21:41:25
How to edit icons in SimForge

Hi

Icons are drawn from the information provided in the annotations inside each component. If you look for example in the standard Modelica  library component for the electrical  ground then you will find this information:

// This is the result from the OMC API call which is basically printing the annotation textstring belonging to the Ground component //
>> loadModel(Modelica.Electrical.Analog.Basic.Ground)
>> getIconAnnotation(Modelica.Electrical.Analog.Basic.Ground)
{-100.0,-100.0,100.0,100.0,{Line(true,{{-60.0,50.0},{60.0,50.0}},{0,0,255},LinePattern.Solid,0.25,{Arrow.None,Arrow.None},3.0,false),Line(true,{{-40.0,30.0},{40.0,30.0}},{0,0,255},LinePattern.Solid,0.25,{Arrow.None,Arrow.None},3.0,false),Line(true,{{-20.0,10.0},{20.0,10.0}},{0,0,255},LinePattern.Solid,0.25,{Arrow.None,Arrow.None},3.0,false),Line(true,{{0.0,90.0},{0.0,50.0}},{0,0,255},LinePattern.Solid,0.25,{Arrow.None,Arrow.None},3.0,false),Text(true,{0,0,0},{0,0,255},LinePattern.Solid,FillPattern.None,0.25,{{-144.0,-60.0},{138.0,0.0}},"%name",0.0,"")}}

Either read the Modelica specification or  the book Peter Fritzson. Principles of Object-Oriented Modeling and Simulation with Modelica 2.1. 940 pages, Wiley-IEEE Press,
2004
for more inforamtion about annotations.

Best Regards
Mohsen

Oct-12-10 11:37:04
Design "Control System"

Hi,

Regarding the python interoperability I've uploaded a python script for running a parameter sweep from python with OpenMdoelica as simulation engine.
You can find it under MonteCarloSimulation
http://www.openmodelica.org/index.php/h … 48-scripts

I guess that I used OpenModelica instead python sci.

Please look at this tread also.
http://www.openmodelica.org/index.php?o … ;Itemid=87

Best Regards
Mohsen

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