Vensim does not allow the use of numeric subscripts. Sometimes, however, it is convenient to be able to refer to a subscript numerically. For example the previous element in a subscript range, or an element that might depend on the value of another variable. Vensim's VECTOR ELM MAP function allows you to do this. For example if you want to represent a simple aging chain you could use the equations:
stage : (stage1-stage9) ~~|
inflow[stage] = IF THEN ELSE(stage=stage1,start,
VECTOR ELM MAP(outflow[stage],-1)) ~~|
The first argument to VECTOR ELM MAP is the name of the subscripted variable that you want to map, the second argument is the amount of offset. Thus VECTOR ELM MAP(var[stage],0) is just the same as var[stage] and also the same as VECTOR ELM MAP( var[stage1], stage-1).
You can also use the VECTOR ELM MAP function to match values between different subscripts. For example:
personnel : joe,jen ~~|
task : design,prototype,test,build ~~|
task assignment[task] = 1,0,1,0 ~~|
work quality[task] = VECTOR ELM MAP(personal quality[joe],
task assignment[task]) ~~|
The VECTOR ELM MAP function should be used with care in that it bypasses some of the normal consistency checking that Vensim does. If you try to map outside of a variables values Vensim will report an error message during run time.
There is another function VECTOR SELECT that can also be helpful for this type of situation.