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

Posts

Posts

Mar-22-19 10:02:22
CombiTimeTable creates events if values are extrapolated at the beginning of the time series
Category: Developer

Suppose the following CombiTimeTable:

     time   value
0   72.0  14.231281
1   73.0  14.231205
2   74.0  14.230978
3   75.0  14.230604
4   76.0  14.230086
5   77.0  14.229427
6   78.0  14.228630
7   79.0  14.227699
8   80.0  14.226636
9   81.0  14.225445
10  82.0  14.224130

Time starts at 72 and not at 0. If simulation starts at 0, events are created for each value (10 events) even if the smoothing is set to ContinuousDerivative. Missing values are extrapolated with hold on value.  If simulation is started from time 72 no events are created. This is quit annoying since simulation will run much slower if the solver has to be restarted even if the input is continuous.

I have a model made of many process models connected between them (series/parallel/recirculation). Some of those models are continuous and if simulated by their own with the "Restart after event" option off run much faster then if the option is on. This is of course because there are some events that are triggered. Unfortunately, I'm not able to find those events in the code (the code is quite extensive) in order to apply noEvent(). Is it possible to apply somehow noEvent() to single model inside a super-structure that is simulated with the "Restart after event" ON?

Thanks!

ps: Any types on how to find events inside the code are welcome.

I have noticed one more thing. If you modify the code of model A and B, but you stay inside the window of B and save, then only the code of B will be saved but the changes in A will NOT be saved. But if you open another window, for example of model C, and press the save bottom then both A and B changes will be saved! Plus, no additional indentations will be added to the code of A and B.

This is just a work around unfortunately.

I have the same problem on Windows x64 and for the moment a restart of OMedit doesn't help current/hmm
...I just observed that the extra indentation spaces are not added if you follow those steps: suppose you have two models A and B inside a package, make some changes inside A, but before saving go to B (open its window) and finally press the save bottom. When you go back to A text-code you will see that no indentation spaces have been added. Black magic.

Thanks for the reply!

perost, you are wright, the compiler doesn't catch my error.  If I make Definitions a package as you suggested the code compiles correctly!

I have problems with enumeration version of the below test-model.
If I try to compile MyModel, it starts but get an error and aborts compilation (OMEdit v1.12.0 (64-bit)). However, if I use a simple vectorized version, compilation is successful. Is this a ticket for omc or I'm missing something?


package test

model MyModel
  ModelA stage1;
  Source source(q=1, cin=10);
  Sink sink;
  equation
    connect(source.OUT, stage1.IN);
    connect(stage1.OUT, sink.IN);
end MyModel;


partial model Parmodel
  extends Definitions;
  input pipe IN;
  output pipe OUT;
 
  parameter Real V=1;
  Real c[Species];

  initial equation
  c = {1.0, 10.0};
end Parmodel;


model Source

  extends Definitions;
  output pipe OUT;
  parameter Real q = 10;
  parameter Real cin = 1;

equation
  OUT.q = -q;
  OUT.c = {cin, 2*cin};
end Source;


model Sink
  input pipe IN;
end Sink;


model ModelA
extends Parmodel;
  equation
    der(c)={IN.q/V*(IN.c[Species.A]-c[Species.A]), IN.q/V*(IN.c[Species.B]-c[Species.B])};
    OUT.c = c;
    OUT.q + IN.q = 0.0;
end ModelA;

connector pipe
extends Definitions;

  flow Real q;
  Real c[Species];
end pipe;


type Definitions
  type Species = enumeration(A, B);
end Definitions;

end test;

Hi all,

I've recently installed Anaconda2-4.3.0.1-Windows-x86_64 and OpenModelica1.11.0-64bit.
I've tried to follow the example from https://openmodelica.org/doc/OpenModeli … ython.html but I get this error running in python

>>>mod=ModelicaSystem("mypath/BouncingBall.mo","BouncingBall")

2017-02-27 17:12:56,349 - OMCSession - INFO - OMC Server is up and running at file:///c:\users\1474933\appdata\local\temp\openmodelica.objid.ce932d05a8c84a48b17a7b6ce3e79922
Expected end of text (at char 177), (line:3, col:57)

...and when I try

>>> mod=ModelicaSystem("C:/OpenModelica1.11.0-64bit/share/doc/omc/testmodels/dcmotor.mo","dcmotor")

2017-02-27 17:16:09,661 - OMCSession - INFO - OMC Server is up and running at file:///c:\users\1474933\appdata\local\temp\openmodelica.objid.45f14d6372e04a34ae650425d8dd3924
[C:/OpenModelica1.11.0-64bit/share/doc/omc/testmodels/dcmotor.mo:2:3-2:66:writable] Error: Class Modelica.Electrical.Analog.Basic.Resistor not found in scope dcmotor.
Error: Error occurred while flattening model dcmotor

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Anaconda2\lib\site-packages\ompython-2.0.7-py2.7.egg\OMPython\__init__.py", line 545, in __init__
    self.__loadingModel(self.fileName, self.modelName, self.lmodel)
  File "C:\Anaconda2\lib\site-packages\ompython-2.0.7-py2.7.egg\OMPython\__init__.py", line 588, in __loadingModel
    self.tree = ET.parse(self.xmlFile)
  File "C:\Anaconda2\lib\xml\etree\ElementTree.py", line 1182, in parse
    tree.parse(source, parser)
  File "C:\Anaconda2\lib\xml\etree\ElementTree.py", line 647, in parse
    source = open(source, "rb")
IOError: [Errno 22] invalid mode ('rb') or filename: ''

The least one seems a version conflict with the anaconda package distribution. Any idea? Should I downgrade anaconda? What downgrade version to use?

Hi all,

The question is what kind of membership should one take (level1 or 2) in order to develop a web application that runs Modelica models at client request. Imagine that within a web interface you are able to set-up some parameters and run case studies. Is it enough to have a Level 1 membership since no binary is deployed on "external" machines.

For your info:

A Level 1 membership is a basic membership level that allows the member to combine OpenModelica with proprietary code for internal use according to the OSMC-Internal-EPL mode of the OSMC Public License.

A Level 2 membership is a membership level that allows the member to combine OpenModelica with proprietary code for internal use and/or external distribution in binary form according to the OSMC-External-EPL mode of the OSMC Public License.

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