I am trying to understand how to use a variable as an index in a measurement expression for use with the data display.
According to the help article on Measurement Expressions, I am trying to use an output variable as the expression list for a sweep index operator.
I have attached an archive of a simple example workspace in ADS 2017 demonstrating the problem (see also the screen capture of schematic and data display). The expression dBm(vout[::,idx]) in the data display window is flagged as invalid even though dB(vout[::,1]), dB(vout[::,2]) and idx are all valid expressions and idx takes on the values 1 and 2.
If the problem is with syntax, I would like to know the correct syntax to perform this operation. If there is an architectural reason why this doesn't work I would like to know why and if there are suggestions for an alternative approach to achieve the same result.
I dug into this again and ended up writing an AEL function to solve the problem.
This function was added to %HPEESOF_DIR%\expressions\ael\user_defined_fun.ael (which for me evaluates to C:\Program Files\Keysight\ADS2017\expressions\ael\user_defined_fun.ael) on my Windows system running ADS 2017.
defun sel_hb_data_by_harm_idx(hb_data, harm_idx_arr)
{
decl hb_data_by_harm_idx = [j];
decl i;
for (i = 0; i < sweep_size(harm_idx_arr); i++)
hb_data_by_harm_idx[i] = hb_data[i,int(harm_idx_arr[i])];
return hb_data_by_harm_idx;
}
You need to restart ADS after the change (not just close your workspace). In the original example workspace, it is used in a measurement expression as:
vs(dBm(sel_hb_data_by_harm_idx(vout, idx)),Freq)