I´m trying to get the next simulation, but I do not success. Could anyone help me?
I have a circuit with a P_nTone input source, and I want to simulate it with the Harmonic Balance simulation.
Sweeping input frequencies and input power, I want to know at which input power for each frequency I get a given output power at a given frequency.
But how do I do that????
I have a circuit with a P_nTone input source, and I want to simulate it with the Harmonic Balance simulation.
Sweeping input frequencies and input power, I want to know at which input power for each frequency I get a given output power at a given frequency.
But how do I do that????
HarmonicBalance
HB1
Freq[1] = F1 GHz
SweepVar = ''P1''
Start = 0
Stop = 10
Step = 1
ParamSweep
Sweep 1
SweepVar = ''F1''
SimInstanceName[1]=''HB1''
Start = 1
Stop = 3
Step = 1
VAR
VAR1
F1 = 1
P1 = 0
P_nTone
PORT1
Freq[1]=F1 GHz
P1 = polar(dbmtow(P1),0)
Attaching a node name, vout, at the output of the P_nTone.
Simulating this circuit and the frequency F1 is swept by the ParamSweep, then the power is swept for each frequency by the Harmonic Balance controller.
The simulation data is stored in a multidimensional dataset.
In the Data Display you can examine the structure of the dataset by using the what() function:
X = what(vout)
List X in a Listing Column and you will see the structure of the data, in this case it says:
what(vout)
Dependency: (F1,P1,Harmindex)
Num.Points: [3,11,4]
Matrix size: Scalar
Type: Complex
Here you can see that the voltage vout is multi dimensional and dependent on F1 (3 values), P1 (11 values) and Harmindex ( 4 values).
So what is Harmindex?
If you list the value of freq in a listing column you will see how it works:
So for each combination of the two swept values you have 4 harmindex values, 0-3. Each index maps to a frequency. In this case the frequency is always the same between the swept combinations. But in a general case it may not be so.
Since it's the same for all combinations we can then simple write this equation to just list the Harmindex vs frequency mapping:
Hidx = freq[0,0,::] (Slices out the frequency array for the first F1 and the first P1 value. :: is wildcard.)
Further you can plot the value of vout in varous ways using this bracketing method to slice out various data from the multidimensional array.
Example:
This calculates the power spectrum in node vout for the second F1 value ( F1[1] = 2 [GHz] ) and the fifth P1 value ( P1[4] = 4 [dbm] ):
Px = dbm(vout[1,4,::])
If you list this value in a listing column then you'll see this:
So now the question is how do we relate Harmindex to real frequency?
Here's how to do that:
we are looking at:
Freq_Arr = freq[1,4,::]
frequency array:
Px_real = vs(Px,Freq_Arr)
power on the Y axis and the real frequency (0-3 GHz) on the X-axis.
Another way, maybe simpler, is to use the >>Add Vs>> button when adding a trace to a plot. First pick Px to be plotted, then in the next step you pick Freq_Arr to plot it against.
The following Support Example shows a similar example:
Plot swept HB data vs real frequency
URL modified by support_admin @ Mar 3 2004