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

Semantic meaning of -fill(...)

Semantic meaning of -fill(...)

Hello,

I have a question regarding the difference between fill(-a,N) and -fill(a, N).

If I have the following model

Code:


model Test
  parameter Integer N = 1;
  Real a[N];
  Real b[N];
equation   
  a = fill(-1, N);
  b = -fill(1, N);
end Test;

the flattend code is the following:

Code:


class Test
  parameter Integer N = 1;
  Real a[1];
  Real b[1];
equation
  a[1] = -1.0;
  b[1] = DAE.CAST(/tp:T_REAL[1]/, -{1})[1];
end Test;

This appears more or less equal to me, however, I have a more complex model where using fill(-1,N) simulates correctly and -fill(1,N) leads to a simulation error.

Code:


warning | Error solving nonlinear system SES_ALGORITHM 0 at time 0

In my opinion the two solutions should be equal.

Best regards,

Michael

Re: Semantic meaning of -fill(...)

This now works in r11010 (the compiler simplifies the second expression to -1.0).

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