OpenModelica


Forgot password? | Forgot username? | Register
  • Index
  • » Users
  • » ulrich1a
  • » Profile

Posts

Posts

I experimented a little bit with your sample code. The trick seems to be, to define y_buf as a discrete variable. The buffer will be filled then.

Code:


block bufferTest
  import Modelica.Constants.pi;

  parameter Integer N = 360 "Total number of samples";

  Integer iTick;
  discrete Real y_buf[N](each fixed = true);

initial algorithm
iTick := 0;

algorithm
when sample(0, 0.01) then     
  iTick :=iTick + 1;
  if iTick > 0 and iTick <= N then
    y_buf[iTick] := Modelica.Math.sin(time);
  end if;
end when;

equation

annotation(experiment(StartTime = 0, StopTime = 4));
end bufferTest;

This model runs in OMEdit and fills the y_buf.

I have attached a modified example RealFFT1, that provides the described results.

Regards Ulrich
RealFFT1-discretemo.zip

May-30-19 14:28:20
Redeclaring two medium packages in one system component

I am trying to use models with two media and I am are new to Modelica too.  In my cases these media are miscible in any ratio or connected to different connections. As far as I know, you can have only one medium per connector. You need to define one medium with two components, water and oil in your case.

But there is the problem, that water and oil do have a miscibility gap. The brine package tries defines such media with water and gas, but this package is not fully compatible with Openmodelica. In order to get a model with realistic behavior, you may need to create a new media which exposes the miscibility gab. Otherwise your model may show unrealistic mixtures of oil and water.

Ulrich

I am new to Modelica and started modeling components for a fluid application. I first used OM 1.13.0. Now I am using:
OMEdit v1.14.0-dev-5817-g44507d2e8 (64-bit)
Connected to v1.14.0-dev-231-g3006b8aee (64-bit)
Connected to OMSimulator v2.1.0-dev-80-g917fc35-mingw

This version crashes always at opening of the Modelica Media-Air library. I observed this both with 64-bit and 32-bit versions running on Windows 10. I can not remember having this crash with the version of OM 1.13.0.

Is this failure already known?
Is it possible to install both a stable version and a development version under windows?

Ulrich

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