Opened 10 years ago

Closed 9 years ago

#3291 closed defect (fixed)

OMEdit: Simulation of Media.Examples.R134a produces Error

Reported by: anonymous Owned by: Adrian Pop
Priority: blocker Milestone: 1.9.3
Component: Frontend Version: trunk
Keywords: OMEdit; Media, R134a Cc:

Description

When trying to compile and simulate the examples for the R134a lib in OMEdit, I get the following error (Ubuntu Linux 14.04, 64 Bit)

" Model error: Argument of log(adelta) was nan should be >0 "

I have tried to find the problem in the sources (R134a.mo), and it looks like the calculation of the absolute value of variable "delta" is not calculated correctly (abs()-function not working?)

Change History (3)

comment:1 by Rüdiger Franke, 9 years ago

Component: UnknownFrontend
Priority: highblocker

The same error shows up in the nightly tests. One reason is that records are not constructed appropriately in functions. See the following example:

model RecordConstructor
  record R
    parameter Integer n = 3;
    Real[n] a = {1, 2, 3};
  end R;

  function f
    output Real y;
  protected
    R r;
  algorithm
    y := r.a[r.n];
  end f;

  model Test
    parameter R r;
    Real y_good = r.a[r.n];
    Real y_bad = f();
  end Test;
end RecordConstructor;

Saving it to RecordConstructor.mo and calling omc with:

loadFile("RecordConstructor.mo");
simulate(RecordConstructor.Test);
val(y_good, 1);
val(y_bad, 1);

gives

3.0
1.637325164314311e-306

This is a blocker because many Modelica models use data records and the consequences on the simulation are arbitrary.

comment:2 by Adrian Pop, 9 years ago

Owner: changed from somebody to Adrian Pop
Status: newaccepted

comment:3 by Adrian Pop, 9 years ago

Resolution: fixed
Status: acceptedclosed
Note: See TracTickets for help on using tickets.