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

variable delay

variable delay

The following very simple model does compile and run under Dymola, but OM (build 9599) says it is incorrect.
Which one is right?
Massimo


block Variable3Delay "Delay block with variable DelayTime"
  extends Modelica.Blocks.Interfaces.MIMO;
  parameter Real delayMax(min=0, start=1) "maximum delay time";
  Modelica.Blocks.Interfaces.RealInput delayTime       
equation
  y[:] = delay(u[:], delayTime, delayMax);
end Variable3Delay;

Re: variable delay

I believe Dymola is correct. delay is a vectorizable function, but OpenModelica does not support calling it as such. The following works:

Code:

block Variable3Delay "Delay block with variable DelayTime" 

  extends Modelica.Blocks.Interfaces.MIMO;
  parameter Real delayMax(min=0, start=1) "maximum delay time";
  Modelica.Blocks.Interfaces.RealInput delayTime;
equation
  for i loop
    y[i] = delay(u[i], delayTime, delayMax);
  end for;
end Variable3Delay;

I'll see if I can solve it easily.

Re: variable delay

In this OM beats Dymola! Indeed, if I submit your code to OM, it works; if I submit it to Dymola 2012 I get:

Error: Current version of Dymola cannot deduce indices for for-loops.

Your code modified in only the for statement as follows:
       for i in 1:nout loop

works in both environments

Massimo

Re: variable delay

In OpenModelica r10002+ the syntax in the initial post works.

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