Yet another alternative is to return a vector instead of a scalar.
Let the set s_a be defined as { dp, dq, pi, qi } and i_a be an index in s_a, then you can define a function that returns a 1-dimensional parameter indexed over i_a as follows:
Function vecFunc {
Arguments: (a,b);
IndexDomain: i_a;
Body: {
! data { dp, dq, pi, qi }
temp('dp') := 1 + a ;
temp('dq') := 1 + b ;
temp('pi') := a + b ;
temp('qi') := a * a ;
vecFunc(i_a) := temp(i_a) ;
}
Parameter a {
Property: Input;
}
Parameter b {
Property: Input;
}
Parameter temp {
IndexDomain: i_a;
}
}
subsequently, you can use such a function like:
p_d(i_a) := vecFunc( 3, 4)(i_a);
this would result in:
p_d := data { dp : 4, dq : 5, pi : 7, qi : 9 } ;
For your convenience, I attached the project that contains this example.