- Index
- » Users
- » jez
- » Profile
Posts
Posts
In order to disseminate our physiological model to the community, it is necessary to run it in open tools, such as OpenModelica. I am trying to make that happen, but fail so far. I have discovered some OM bugs and workarounds, but now I do not know what is happening and why.
The simulation just fails with these transaltion errors in message browser:
[156] 14:58:27 Translation Error
Internal error IndexReduction.pantelidesIndexReduction failed! Found empty set of continuous equations. Use -d=bltdump to get more information.
[157] 14:58:27 Translation Error
Internal error Transformation Module PFPlusExt index Reduction Method Pantelides failed!
[158] 14:58:27 Translation Error
[C:/OM116/OM64bit/OMCompiler/Compiler/BackEnd/SymbolicJacobian.mo: 2135:10-2135:88]: Internal error function optimizeJacobianMatrix failed
[159] 14:58:27 Translation Error
[C:/OM116/OM64bit/OMCompiler/Compiler/BackEnd/SymbolicJacobian.mo: 2052:9-2052:79]: Internal error function createJacobian failed
and this output from simulation output window:
Fatal error on line 23, column 10: tag mismatch
Error solving nonlinear system 10906 at time 3.88943e-006
nonlinear system 10906 fails: at t=3.88943e-006
[1] Real heartComponent.ventricles.xm_SEP(start=2.90348, nominal=1)
[2] Real heartComponent.ventricles.xm_LV(start=-4.6627, nominal=1)
[3] Real heartComponent.ventricles.xm_RV(start=6.26344, nominal=1)
The initialization finished successfully without homotopy method.
Jacobian determinant is NaN.
Jacobian determinant is NaN.
Jacobian determinant is NaN.
Error solving nonlinear system 10906 at time 3.88943e-006
Jacobian determinant is NaN.
Jacobian determinant is NaN.
Jacobian determinant is NaN.
Dymola runs fine.
One needs the dev Physiolibrary version: https://github.com/filip-jezek/Physioli … teadyState and the model ADAN_main.SystemicTree.CVS_OM from https://github.com/filip-jezek/Valsalva or grab the total saved here
CVS-OMTotal.mo
Thanks for any nudges or workarounds.
Filip Jezek
Hi,
I have just simulated that in Dymola, which were able to give some hints. First of all, I had to select different medium that water_base - e.g. WaterIF97_ph as the base allegedly missed some constants.
Then it compiled but failed in initialization because of too low source pressure:¨
Error: The following error was detected at time: 0
IF97 medium function tsat called with too low pressure
p = 1.2 Pa <= 611.657 Pa (triple point pressure)
Failed condition: p > 611.657
I set to at 1.2 Bars instead and seems to simulate fine in both OM and Dymola.
Best,
F/
I am attaching the modified model.
ExampleFluids.mo
Hi,in integrative physiology we deal with large models, where lots of signal buses are merged into one expandable connector (e.g.
the Physiomodel). The clarity of such model is then greatly reduced, as one has to search manually where does particular signal come from or what it affects.
The idea is to visualize the connections in some sort of tree graph. Have you came upon some similar project?
Having a Modelica library to do the job would be neat, but I have no idea how to implement it. The XML description could not be used, as it is not exactly stated what is a connector. So far I came up with solution relying on OpenModelica API (traverse through used classes, search for connectors, build graph nodes on connect equations containing particular connector instance name), which could be called from some Python script. The visualization can be done in python or in generated javascript page, which would take the JSON as an input.
- With the long-term idea in mind to extend the OpenModelica (or Modelica) by such feature, would you agree with the proposed solution?
- Is there some cook-book how to prepare OpenModelica extensions?
- Any simpler / more worth ways to try?
- Any hints or feature requests to consider?
thanks!
Filip
I can confirm this model runs fine in Dymola 2016, even in pedantic mode. I would guess it is a problem with events. Try using very small value (e.g. 1e-6 ) instead of hard 0.
F/
I have been playing around with this for a while and only documentation I have found so far is this: https://openmodelica.org/svn/OpenModeli … on/OCP.pdf
However, currently the OpenModelica is not useful for problems, which employ events. See following code:
Code:
model testTT
annotation(
uses(Modelica(version = "3.2.2")));
Real x(start=0);
input Real power(min = -10, max = 10);
Real goal annotation(isLagrange = true);
discrete Real zeroHold(start = 0);
parameter Real data[:, 2] = [0,0;1,0.1;2,0.4;3,0.3;4,0.8;5,1;100, 1];
Integer i(start = 1);
equation
goal = x^2;
der(x) = - x + zeroHold + power;
when time > data[pre(i), 1] then
zeroHold = data[pre(i), 2];
i = pre(i)+1;
end when;
end testTT;
it simulates pretty well, but using the optimize command in CLI:
Code:
optimize(testTT, numberOfIntervals=40, tolerance = 1e-9, stopTime = 10)
provides bad results (the i is not incremented, the zeroHold does strange things).
The original testuite example with algorithms ( https://trac.openmodelica.org/OpenModel … sic/TT.mos ) does not compile at all.
Is this a known issue? Is there a plan how to fix / workaround?
Thanks!
F/
Hi all,
I have been trying to run some examples of Optimica in OpenModelica. However, I run into lack of examples, the one posted at https://www.openmodelica.org/doc/OpenMo … ation.html does not work exactly (until I remove the FinalTime constraint) and the optimized model is not very intuitive what is going on.
The only Optimica "specification" is in the JModelica documentation http://www.jmodelica.org/api-docs/users … /ch09.html . Apart from that, there are only several articles from Modelica Conferences.
Currently, the OpenModelica claims to have "limited" support. Do we have somewhere specification of what is supported? Or any conscise Optimica specification? Any other Optimica examples for OpenModelica?
Thanks a lot in advance!
Best,
Filip
We are currently also pursuing this topic. Any solution so far? Thanks!
Thansk for the reply, closing!
F/
1.8 GB from 560 megs and 7GB of install size is just intolerable humungous - especially when trying to catch up with current nightly builds.
What caused such arise? Do you plan to optimize it in near future?
Thanks!
F/
Fine, it seems it has been already reported - bump https://trac.openmodelica.org/OpenModelica/ticket/3470
Hi all,
during teaching with OpenModelica Connection Editor, we sometimes run into strange behaviour, that once we create objects and connectors, the connectors are inactive to let being connected. In fact, only some of them dont - I could start the line, but cannot end it. Then we also can not begin it at this "weird" connector - the component gets dragged instead.
After restarting OME and loading the model, it works perfectly.
I cannot provide exact reproduction, but I think it happens when we construct the connector and have opened the object in which the connector is inserted.
Could you confirm that?
Thanks a lot, it really bugs us a lot recently.
Hi all,
I failed to find any documentation regarding the .mat file, which is created during the simulation. Could someone point me out, how to tell which data corresponds to which variables? Not only the descirption, but also the name vars are malformed in matlab2008b import, what is the difference between data_1 and data_2? The order of variables seems quite random.
The same (or similar) file is exported when simulating in dymola, but I cannot find any doc to it neither. Just the name and desc werent malformed, but the order in data_2 didnt make any sense too.
Thanks all.
Hi all,
we are attempting to teach Modelica using OpenModelica but we are often running into difficulties.
The most important one is that the models inside a package cannot be saved. I have filed a bug (https://openmodelica.org:8443/cb/issue/1631) about this, but no response by now:
Save changes in model (tried with a package of models) only by clicking the button "Save As" with further renaming of this file. Yet when closing OMEdit a message occurs that we have unsaved work (which is already stored by the previous clicking at the package and than by the button Save As). The button "Save" don't work.
However, at first the saving works with both buttons, this occurs during longer work when saving more times.
Since that is really a blocking problem, we need either a bugfix or some workaround how to allow our students to continue working in OM.
Also, some other problems arised, which are listed in here https://docs.google.com/spreadsheet/ccc … &hl=cs
Any workaround? Or estimation, when the fix would be availiable?
Thanks,
Filip
PS. Also, what is better, to cry here, or to file a bug? It seems to me, that this way is faster, although the bugtracker way feels more correct.
Thanks for the fast reply.
Right, the bugtracker is now working fine, sorry, probably my fault. [ Edit: on some work/school networks the 8443 port is blocked, thats why this confusion. Write to your system admin to enable outcoming connections ]
To the sample() problem, I think that according to modelica specifications it should work. The sample is generated at EXACT time and as the simulation is stopped at events, the value of sample should really be the same. And in addition, it works in dymola.
The usage was, that I had quite complicated When condition, where there were like 4 conditions in a tuple. Then I needed to choose which one was the hit. So this functionality is not unusable as it looks like [unless the elsewhen is working, which I havent tried to be honest].
Regarding the comments - by string-comments you mean in the annotations? How long you mean by "long way off" ?
And so what you think of the other features - are they already scheduled, ignored, or never-thought-bout-it?
thanks
F;
Hi all OM developers!
Is there some wishlist or feature requests for OME? Either its not or at least I havent found any. Or are you planning one?
The thing is, that we want to teach modelling in modelica next semester and we would like to use just OMEdit for that. Regretably, it still lacks some features, which would make it equally usable to dymola or others (not even speaking about OMNotebook)
So, do you think it is realistic - is the development effort aimed at this tool? Would it be usable for students by the start of september? Or should we buy dymolae instead?
So my wishes and bugs i´ve found till now in OME
- Does not save individual models in a package - the message is really confusing. Sometimes it does not save model at all (ctr+s on model, then on package and even then it asks on exit)
- OMC does not support drag&drop with custom models - you can drag&drop from OM library only - quite annoying
- when double clicking on icon [model] in model it should open it for edit
- It does not save commentary in models! - i know you could use annotations, but its still very needed
- using tab on block of code int text view should indent it instead of deleting it - using shift+tab should delete one level of indentation
- All shapes are lacking fillings, colors are missing completely (least important of course)
and in OMC
- this doesnt run and does not produce any explanation (!):
[Generally if equations in when clause. Quite important as the elsewhen does not work either (or does it?). Solvable by if-expression though]
when A > B then
if C then
D = 1;
else
D = 2;
end if;
end when;
- This compiles, but the A is never TRUE -
when sample(0, 1) then
A = if sample(0, 1) then TRUE else FALSE;
end when;
that would be all for now but this wishlist would be really helpful. And by the way, not even the bugtracker is currently working.
Thank you for your cooperation!
Best regards,
Filip Jezek
(Creative Connections / 1. LF UK CZ)
EDIT: The bugreports are working now, sorry
Hi guys,
the thing is, that the 1ds table is interpolating.
This works fine for me in dymola:
Modelica.Blocks.Tables.CombiTable1Ds combiTable1Ds(table=[0,5; 1,1; 2,1; 5,2;10,8]);
equation
combiTable1Ds.u = time;
end Unnamed;
The problem lies in your parametrization, which is by coincidence equal to input. Change it and see. If it doesnt work in openModelica, then blame it.
Documentation follows:
Linear interpolation in one dimension of a table. Via parameter columns it can be defined how many columns of the table are interpolated. If, e.g., icol={2,4}, it is assumed that one input and 2 output signals are present and that the first output interpolates via column 2 and the second output interpolates via column 4 of the table matrix.
The grid points and function values are stored in a matrix "table[i,j]", where the first column "table[:,1]" contains the grid points and the other columns contain the data to be interpolated. Example:
table = [0, 0;
1, 1;
2, 4;
4, 16]
If, e.g., the input u = 1.0, the output y = 1.0,
e.g., the input u = 1.5, the output y = 2.5,
e.g., the input u = 2.0, the output y = 4.0,
e.g., the input u =-1.0, the output y = -1.0 (i.e. extrapolation).
The interpolation is efficient, because a search for a new interpolation starts at the interval used in the last call.
If the table has only one row, the table value is returned, independent of the value of the input signal.
If the input signal u is outside of the defined interval, i.e., u > table[size(table,1),1] or u < table[1,1], the corresponding value is also determined by linear interpolation through the last or first two points of the table.
The grid values (first column) have to be strict monotonically increasing.
The table matrix can be defined in the following ways:
Explicitly supplied as parameter matrix "table", and the other parameters have the following values:
tableName is "NoName" or has only blanks,
fileName is "NoName" or has only blanks.
Read from a file "fileName" where the matrix is stored as "tableName". Both ASCII and binary file format is possible. (the ASCII format is described below). It is most convenient to generate the binary file from Matlab (Matlab 4 storage format), e.g., by command
save tables.mat tab1 tab2 tab3 -V4
when the three tables tab1, tab2, tab3 should be used from the model.
Statically stored in function "usertab" in file "usertab.c". The matrix is identified by "tableName". Parameter fileName = "NoName" or has only blanks.
Table definition methods (1) and (3) do not allocate dynamic memory, and do not access files, whereas method (2) does. Therefore (1) and (3) are suited for hardware-in-the-loop simulation (e.g. with dSpace hardware). When the constant "NO_FILE" is defined, all parts of the source code of method (2) are removed by the C-preprocessor, such that no dynamic memory allocation and no access to files takes place.
If tables are read from an ASCII-file, the file need to have the following structure ("-----" is not part of the file content):
-----------------------------------------------------
#1
double tab1(5,2) # comment line
0 0
1 1
2 4
3 9
4 16
double tab2(5,2) # another comment line
0 0
2 2
4 8
6 18
8 32
-----------------------------------------------------
Note, that the first two characters in the file need to be "#1". Afterwards, the corresponding matrix has to be declared with type, name and actual dimensions. Finally, in successive rows of the file, the elements of the matrix have to be given. Several matrices may be defined one after another.
Extends from Modelica.Blocks.Interfaces.SIMO (Single Input Multiple Output continuous control block).
Do not agree exactly, but feel free to simulate to prove / disaprove that.
The thing is, that for simulation you need to quanticize stuff. That goes better with greed (if stuff.isAvailible then person.wantStuff(); ) than with love (the only eq that comes to my mind is unpublicable).
Think of ideal relationships first, then write it down, try to describe them in more detail. I think some sociology studies must have been addressing this issue. Start with Utopia Also, I would recommend to exploit some of current "evil economy models" and see how it has been done.
Also modeling tries to abstract the reality. Are you sure no control, no power and such stuff would be in the EOL society? I doubt it. You definitely must adress it and then see what it does, when negative emotions are also included.
Inspirating issue though!
rgrds
F.
Hi,
I do not understand exactly what do you mean.
If you want to create a GUI of your own, I believe that OpenModelica does not support that. However, it makes something even more interesting - it creates c code library and even compiles it to an exe. This app could be then executed by your application and simulation results used in your very own way.
If any user interface, where you can twiddle the parameters, is enough, then proprietary environments such as Dymola or MAthModelica support that for sure.
I am now not sure about the opensource SimForge for Modelica, but I think that some Eclipse plugin should allow that.
rgrds,
F.
Now, after fixing the above the persisting problem is, that simulation never ends.
running:
simulate(PulsatileCirculatory, startTime=0, stopTime=10, numberOfIntervals=500, tolerance=1e-4)
I left it for ten minutes and cpu still on 100%, no log message, nothing. In dymola it usually takes around 1.2 sec to simulate at 1200int and stopTime 25 secs
After breaking, it goes just:
record SimulationResult
resultFile = "Simulation failed.
"
end SimulationResult;
I went through the flattened file and found no problem. Could it be another infinite loop somewhere? Could I exploit some log information? Could you please take another look at it?
I uploaded fixed model here http://bmi2007.clevis.org/Ostatn%ed/jez/omcFreezer.zip, again please load both, simulate just the longer name.
Thank you very much in advance
Okay now, one problem solved, one to go
I have managed to selve the problem with Acyclic Bindings of Constants and Parameters.
For others, you can not compute parameters of model and use some cyclic dependencies. Since I was using just the sine, it was quite easy to make it work by rewriting it. Now, this should explain:
//this is not supported by openModelica and it had been rewritten
/*
Modelica.Blocks.Sources.Sine contractionSource(
freqHz=frequency,
amplitude=ejectionPressure/1e4*133-contractionSource.offset,
offset=contractionSource.amplitude*sin( (systoleFraction/frequency)*Modelica.Constants.pi - Modelica.Constants.pi/2) - limiter.uMin)
annotation (Placement(transformation(extent={{-40,-10},{-20,10}})));
*/
// with this
Real sineY "Creates sinusoidal wave simulating pressure in compliant sac";
Real offset;
Real amplitude;
constant Real startTime = 0;
constant Real phase = 0;
constant Real pi = Modelica.Constants.pi;
equation
amplitude = ejectionPressure/1e4*133-offset;
offset = amplitude*sin( (systoleFraction/frequency)*Modelica.Constants.pi - Modelica.Constants.pi/2) - limiter.uMin;
sineY = offset + (if time < startTime then 0 else amplitude*
Modelica.Math.sin(2*pi*frequency*(time - startTime) + phase));
this configuration works.
Edit: however, originally in model, it went with the error message Connection lost.. etc.
When simulating this simplified model, uncommenting the part, which should crash it, it just states, that simulation failed. That is strange somehow.
Oh, and I nearly lost the hope
My fault then, I would try to repair that. It seems, that dymola implementation varies here, because this solution worked there. I also tried an approach using initial equations, but that didnt work in dymola to the contrary.
I would try to figure out a solution, that works in both and eventually post it here.
Thanks Adrian!
Could anyone at least reproduce this problem?
It would be ideal to run omc in debug on this and see why it fails. I haven't found any logs so far..
Hi all,
I have created rather complex model,but it fails to compile in OpenModelica. Under dymola it runs fine, although sometimes the simulation freezes, but I need to turn it to OpenModelica compatible. I believe, that I use just supported commands, no bus connectors etc..
In OMShell it succeeds with instantiateModel, but after running simulate it fails with
OmcInteractiveEnvironment(): No connection to Omc established
Unable to reconnect with OMC. Do you want to restart OMC?
and no additional debug data provided. I am using now the latest build http://www.ida.liu.se/labs/pelab/modeli … n-4928.msi but I think I tried also previous version before (RC1 or...) with same result.
I also tried to update visual studio C++ redistributable, but it still leaves msvcrt.dll in version 7.0.2600 (from 14.4.2008).
Could you please take a look and tell me, where the problem is?
The models are attached - you have to load both, but simulate just the one with longer name.
Thanks F.
EDIT:Oh, didnt know how the attachment thing works here, sorry, you can get the model here http://bmi2007.clevis.org/Ostatn%ed/jez/omcCrasher.zip Thanks
- Index
- » Users
- » jez
- » Profile