• 易迪拓培训,专注于微波、射频、天线设计工程师的培养
首页 > ADS > ADS FAQ > Variable as index in a measurement expression

Variable as index in a measurement expression

录入:edatop.com    点击:

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.


附图/附件


var as index in meas eqn.png

Hi,

the value of idx is probably 1.0 and 2.0 though smart formating doesn't unveil this. Use a what(idx) inside a table display and you can inspect the storage type: real. I'd bet int(idx) is going to solve your problem.

Regards,

Toby

The type of idx is Real. However, replacing idx with int(idx) also results in an invalid expression.

Here's a summary of the relevant Variable Info for the example workspace:

what(idx)

Dependency: [Freq]

Num Points: [10]

Matrix Size: scalar

Type: Real

what(int(idx))

Dependency: [Freq]

Num Points: [10]

Matrix Size: scalar

Type: Integer

what(1)

Dependency: [Freq]

Num Points: [10]

Matrix Size: scalar

Type: Integer

There seems to be something else going on here besides the type.

In your expression dBm(vout[x,y]), x is the freq variable and y is the harmonic index (use what(vout) to verify). So when you plot "dBm(vout[::,1])", you are ploting fundamental of vout for all values of freq. "dBm(vout[::,2])" is the second harmonic of vout for all values of freq.

Sounds like you are trying to plot vout against idx, like seeing the frequency output based on an amperage value. Try typing this into the equation box for a plot: "plot_vs(dBm(vout[::,::]), idx)".

That in itself isn't very helpful, so double click one of the lines, and change trace type to scatter or spectral.

You can modify this to plot_vs(dBm(vout[::,1]), idx) to just view the fundamental for different idx values.

The main issue is that you have multidimensional data (freq, vout, idx). ADS data display doesn't work well with multidimensional data without getting into advanced configurations; like use python as described in http://edadocs.software.keysight.com/display/eesofkcads/Advanced%2BPlotting%2Busing%2Bthe%2BADS%2BDatalink:http://edadocs.software.keysight.com/display/eesofkcads/Advanced+Plotting+using+the+ADS+Datalink

I follow your explanation, but it doesn't capture what I am trying to do.

The issue is not that I want to plot vout data vs harmonic index, but that I want to plot vout vs frequency while using a harmonic index that is itself a function of frequency. For that to work, I need to be able to use a variable as an index.

The result should produce one dependent variable to plot against one independent variable (frequency), so there is no problem with the dimensionality of the data.

The example I gave above is a simplified case where the value of idx is constant with respect to frequency. I can see that the equation I have written for idx for my application takes on the expected values vs frequency. However, when I attempt to use the idx variable calculated by this equation to index into vout it fails and flags the expression as invalid.

Does adding a marker to the middle plot, lets assume its m1, and changing the right plot equation to plot_vs(dBm(vout[::,m1]), Freq) get what you are looking for? It doesn't make a plot of vout vs freq where freq is dependent on idx, but you can move m1 for different freq, and visually evaluate the frequency band you are concerned about.

Otherwise you are trying to create a new array variable; where it equals 0dBm 0-5GHz and -10dBm for 6-10GHz, in this scenario. Essentially replacing the harmindex of the vout variable, with fixed idx dependent values. I haven't found a way to create new arrays from the dataset to accomplish this.

A plot manual fix that would have to be adjusted everytime to change your schematic settings:

plot_vs(dBm(vout[0::4,1]), Freq[0::4])

plot_vs(dBm(vout[5::9,2]), Freq[5::9])

Is this the type of plot you are trying to get automated?

Or could you just create a variable in the schematic to adjust power based on freq instead of idx?

P_in=if Freq<=5e9 then 0 else -10 endif

Then P_in goes into PORT1 P[1] equation.

Not sure why you are looking to place fundamentals for some freq and 2ndHarm for others.

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)

申明:网友回复良莠不齐,仅供参考。如需专业帮助,请学习易迪拓培训专家讲授的ADS视频培训课程

上一篇:Not able to find inductormodelfit option in version ADS 2016.01
下一篇:Variable definition of component model

ADS培训课程推荐详情>>

  网站地图