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

OmcInteractiveEnvironment(): No connection to Omc established

OmcInteractiveEnvironment(): No connection to Omc established

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

Edited by: jez - Apr-21-10 13:37:58

Re: OmcInteractiveEnvironment(): No connection to Omc established

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..

Re: OmcInteractiveEnvironment(): No connection to Omc established

Hi,

Yes, I can verify the problem. The compiler seems to go into an infinite loop.
We'll have a look at it.

Cheers,
Adrian Pop/

Re: OmcInteractiveEnvironment(): No connection to Omc established

You have a circular parameter:
  compliantPumpFR.contractionSource.amplitude
depends on
  compliantPumpFR.contractionSource.offset
which depends again on:
  compliantPumpFR.contractionSource.amplitude.

This is not allowed in Modelica, see Section:
4.4.3 Acyclic Bindings of Constants and Parameters
in the Modelica Specification:
http://modelica.org/documents/ModelicaSpec32.pdf

Cheers,
Adrian Pop/

Re: OmcInteractiveEnvironment(): No connection to Omc established

Oh, and I nearly lost the hope current/smile

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!

Re: OmcInteractiveEnvironment(): No connection to Omc established

Okay now, one problem solved, one to go current/smile

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.

Re: OmcInteractiveEnvironment(): No connection to Omc established

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

Re: OmcInteractiveEnvironment(): No connection to Omc established

Hi,

For me the simulation takes 13 minutes.

adrpo@KAFKA ~/dev/OpenModelica/build/bin/
$ time ./PulsatileCirculatory.exe -v
real    13m56.953s
user    0m0.015s
sys     0m0.031s
You can call the generated executable with -v to see how it progresses.

So there is no infinite loop, it just takes a long time.
OpenModelica does not optimize the simulation code very well.
It does not do tearing (by default) or other optimizations, that's why is taking so long.

We have some people looking into these things but it will
take time to implement optimizations for the generated code.

Cheers,
Adrian Pop/

There are 0 guests and 0 other users also viewing this topic
You are here: