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

Posts

Posts

Hello,

I noticed that the model DynamicPipe has via the extension of other models, the partial model PartialTwoPort two times in the declaration.
The definition of the model DynamicPipe reads

Code:

model DynamicPipe

   extends Modelica.Fluid.Pipes.BaseClasses.PartialStraightPipe
   ...
   extends BaseClasses.PartialTwoPortFlow
   ...

Thus PartialTwoPort is a first time via:
model DynamicPipe extends Modelica.Fluid.Pipes.BaseClasses.PartialStraightPipe ->
partial model  PartialStraightPipe extends Modelica.Fluid.Interfaces.PartialTwoPort

and a second time via:
model DynamicPipe extends extends BaseClasses.PartialTwoPortFlow ->
partial model PartialTwoPortFlow extends Modelica.Fluid.Interfaces.PartialTwoPort
present in the model.

Until now, I was not aware that such a construct would work. I must admit, that I have only little experience with modelica. In Fritzson's book OOMS with Modelica I could, however, not find an example discussing such a situation. If I want to write a new model MyDynamicPipe which is similar but not identical to DynamicPipe, do I have to pay attention, that the order of declaration is unchanged or something else?

al

Hello,
I am trying to use MDT 0.7.33 under eclipse 3.8.0 in debian 3.2.0-4-amd64. The installation run smoothly as described here: https://www.openmodelica.org/index.php/home/tools/133
omc is installed with synaptic (openmodelica 18573-1)

I started eclipse with

Code:

export OPENMODELICAHOME=/usr/; export OPENMODELICALIBRARY=/usr/; eclipse

When creating a project, then a package, then a class and putting the curser into the class, eclipse shows at the bottom "OpenModelica compiler null is Online" thus no connection to the compiler.
When activating the console-tab the first lines suggest, that there is, however, a connection to the compiler:
Welcome to Modelica Development Tooling (MDT) Console
You can send commands to OMC from here.
Type !help for help.
omc>


In the terminal output from which eclipse was started, copied below, one can see, that the omc was found (/usr/bin/omc is indeed the executable). However, there appears an issue in the /tmp file. I can confirm, that "/tmp/openmodelica.josef.objid.mdt" does not exist.
I do not have an environment variable $TEMP or the like. Also in $PATH, there is no temp directory set. Do I have to set something more in eclipse (e.g. in run or debug configurations or window->preferences->modelica)?

Code:

[i]OMCSTATUS: Will look for OMC object reference in '/tmp/openmodelica.josef.objid.mdt'. 

OMCSTATUS: No OMC object reference found, starting server.
OMCSTATUS: Using OPENMODELICAHOME environment variable to find omc-binary
OMCSTATUS: Using omc-binary at '/usr/bin/omc'
OMCSTATUS: Using working directory '/tmp'
OMCSTATUS: Will look for OMC object reference in '/tmp/openmodelica.josef.objid.mdt'.
OMCSTATUS: Running command: /usr/bin/omc +c=mdt +d=interactiveCorba 
OMCSTATUS: Setting working directory to: /tmp
OMCSTATUS: Command run successfully.
OMCSTATUS: Waiting for OMC CORBA object reference to appear on disk.

Execution failed!
OMCSTATUS: Will look for OMC object reference in '/tmp/openmodelica.josef.objid.mdt'.
OMCSTATUS: Will look for OMC object reference in '/tmp/openmodelica.josef.objid.mdt'.
OMCSTATUS: No OMC object reference found, starting server.
OMCSTATUS: Will look for OMC object reference in '/tmp/openmodelica.josef.objid.mdt'.
OMCSTATUS: The OMC Corba object reference file has not been modified in 100 seconds; we give up starting OMC.
Unable to parse list: Empty list: []
Unable to parse list: Empty list: []
Unable to parse list: Empty list: [][/i]

Any ideas where to start to search for fixing that issue?
al

Hello,
when replacing the "model Volume" by a "function Volume" the initialisation works, if the first variable of the function is the required variable. In the example below, the program takes the hydraulic diameter instead of the volume (it does btw not issue a warning for the mismatch of the units). I'd have to change the order of the outputs, which would then render the function unusable for other initialisations than the volume. Is there a way to select a specific output variable when the function is part of a function?
al

Code:

function Volume

  import Modelica.SIunits;
  input  Modelica.SIunits.Length a=1;
  input  Modelica.SIunits.Length b=1;
  input  Modelica.SIunits.Length c=1;
  output Modelica.SIunits.Length dh;
  output Modelica.SIunits.Area A; 
  output Modelica.SIunits.Volume V;
algorithm
  //some sophisticated algorithm which can not be written in one line; only depending on the parameters a,b,c
  dh:=4*a*b/2./(a+b);
  A:=2.*(a+b)*c;
  V:=a*b*c;   
end Volume;


model cap
  import Modelica.SIunits;
  constant Modelica.SIunits.SpecificHeatCapacity cp=500.;
  constant Modelica.SIunits.Density rho=7800.;
  Modelica.Thermal.HeatTransfer.Components.HeatCapacitor hcap(C=Volume(a=2,b=2,c=2)*cp*rho,T(start=300.)); //wrong: it takes dh!
end cap;

Hello,

the simulation of the attached code with simulate(cap) stops with the error msg
"Error: Component hcap.C of variability PARAM has binding 3900000.0 * V of higher variability VAR."

While I thought to have understood the purpose of the restriction not to allow an assignment of a variable with a higher variability to a variable with a lower variability, I am puzzled about the particular case below: The model "Volume" has only parameter inputs which, when applied an algorithm to them, yield a defined, unique result. My feeling was that V should also have (implicitly) the variability PARAM. If I did the calculation myself on paper, I'd have much more work but the expected result and no error. Such a behaviour doesn't appear sound/consistent to me. Is there a particular reason for that or is the reason purely of a formal nature, i.e., the implementation of the language?

Code:

model Volume

  import Modelica.SIunits;
  parameter Modelica.SIunits.Length a=1;
  parameter Modelica.SIunits.Length b=1;
  parameter Modelica.SIunits.Length c=1;
  Modelica.SIunits.Length dh;
  Modelica.SIunits.Area A;
  Modelica.SIunits.Volume V;
algorithm
  //some sophisticated algorithm which can not be written in one line; only depending on the parameters a,b,c
  dh:=4*a*b/2./(a+b);
  A:=2.*(a+b)*c;
  V:=a*b*c;
end Volume;

model cap
  import Modelica.SIunits;
  extends Volume;
  constant Modelica.SIunits.SpecificHeatCapacity cp=500.;
  constant Modelica.SIunits.Density rho=7800.;
  Modelica.Thermal.HeatTransfer.Components.HeatCapacitor hcap(C=V*cp*rho,T(start=300.));
end cap;

How can I achieve a code where I can make some sophisticated calculation for the volume "V" and being able to initiate the HeatCapacitor with the result of that calculation?

Thank you for your help.

al

Apr-21-13 19:19:08
Category: Developer

Hello,
thank you for the quick help.
al

Apr-20-13 22:23:27
Category: Developer

Hello,

the update with synaptic yields the following error msg:
E: /var/cache/apt/archives/omlib-modelica-2.2.2_6200-p2-1_all.deb: Versuch, »/usr/lib/omlibrary/Modelica 2.2.2/help/Documentation/Modelica-Documentation-Template.ott« zu überschreiben, welches auch in Paket omlibrary-msl222 15755-1 ist

which translates to English into somewhat like:

E: /var/cache/apt/archives/omlib-modelica-2.2.2_6200-p2-1_all.deb: Try to overwrite, »/usr/lib/omlibrary/Modelica 2.2.2/help/Documentation/Modelica-Documentation-Template.ott« which is also in package omlibrary-msl222 15755-1

al

Hello,

is there a way to assign a single value to an element of a matrix or vector?

Using OMShell
>> b:=vector([{ii for ii in 1:10}])
{1,2,3,4,5,6,7,8,9,10}

>> b[4]
4

>> b[4]:=6
Error occured building AST
Syntax Error
[<interactive>:1:0-1:0:writable] Error: Parser error: Unexpected token near: b (IDENT)

Any idea why that doesn't work?
al

Hello,

I experienced a nasty behaviour of OMEdit and I am thus wondering whether it is a bug or a feature.
I wrote a test.mo file with my perferred editor which contained several classes:

model AA
...
end AA;
model BB
...
end BB;
connector XX
...
end XX;
model CC
... (using all of the above mentioned)
end CC;

Then I opened the file in OMEdit. Since all of the classes also included the icons, the whole system was nicely presented, simulation worked everything fine - until I changed something in the model CC from within OMEdit and saved the changes. A new run failed. The reason was that saving from within OMEdit changed the file test.mo so as to contain only the definition of model CC ;(((

OMEdit did not even create a backup file. I must say, that this behaviour came completely unexpected and is quite different from the editors I am used to (gedit, emacs, vi). I do not see any advantage either. I therefore can imagine that this is a bug. If not, what is the reason for such a behaviour?

al

Hello,

OMEdit crashes always when trying to expand the tree of (not to simulate) Media.Examples. Is there a particular reason such as incomplete implementation of the package or is it simply a bug or incompatibility issue?

al

debian squeeze, OMEdit 1.9.0 r15588

Hi,
thanks alot. It works now.
Just a remark: on page https://www.openmodelica.org/index.php/ … /tools/133, in the 5th bullet point of the detailed installation instructions, there is the link without ~ but with "labs/" instead.
al

Hello,
I'm desperately trying to install the om plugin in eclipse 3.8 (on debian 6.0.6). The link http://www.ida.liu.se/labs/pelab/modeli … elica/MDT/ provided in this page https://www.openmodelica.org/index.php/ … /tools/133 always redirects me to the om homepage.
Also eclipse doesn't recognise the link ("No software site found"). The same happens if I download the .zip file and give to eclipse the MDT directory as the source.
What I'm doing wrong?
al

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