You are here

array delay II


I have a similar problem to the one expose by Lora on  Mon, 13/03/2006 - 16:15,

I want to apply the "delay" function to an array variable (A), but  unlike Lora I want to delay variable A by a numer of time steps equal to the value of a second variable (B), so the "last" function is not suitable in for me.

I tried to apply the following equation: C = delay([A],B)

However, this produces the following: Testing Equation field produced the following error: Your explicit intermediate result, [array], has brackets round it that would indicate an array of single values. However it actually stands for an array of arrays of single values so should appear as follows: [[array]].

Any suggestions?





The problem is that the delay functions are implemented by macros, so unlike basic Simile functions they cannot operate on arrays.

You can get round it like this: instead of having an array variable, use a single-value variable in a multi-instance submodel. Then each call of the 'delay' function only has one value to work on, but all the values get delayed.

Note that 'delay' delays a certain number of steps, while 'const_delay' and 'var_delay' delay for a certain number of time units. See online help for more details.

Hope this helps