- Index
- » Programming
- » Modelica Language
- » variable delay
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;
- ceraolo
- 147 Posts
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.
- sjoelund.se
- 1700 Posts
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
- ceraolo
- 147 Posts
Re: variable delay
In OpenModelica r10002+ the syntax in the initial post works.
- sjoelund.se
- 1700 Posts
- Index
- » Programming
- » Modelica Language
- » variable delay