The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> Multi-tone voltage source in PSS simulation
https://designers-guide.org/forum/YaBB.pl?num=1115733490

Message started by wchlee on May 10th, 2005, 6:58am

Title: Multi-tone voltage source in PSS simulation
Post by wchlee on May 10th, 2005, 6:58am

Hello:

I write a multi-tone voltage source(up to 5 harmonics) in verilog-A to simulate the impact of high order harmonic contents in divider phase noise. But I have problems in PSS convergence when using "oscillator" to find beat frequency nor specify beat frequency as driven ckts, both failed to converge. Could anyone show me how to to?
my code is listed below:
`include "constants.h"
`include "discipline.h"

module multitone_gen(PLUS,MINUS);
output PLUS, MINUS;
electrical PLUS,MINUS;

parameter real tt=10p from(0:inf);
parameter real ttol=1p from (0:inf);
parameter real f_fund=2e9;
parameter real vpk_fund=1;
parameter real dBc_2nd=10;
parameter real dBc_3rd=10;
parameter real dBc_4th=10;
parameter real dBc_5th=10;

real v_minus;
real phase_fund;
real phase_2nd;
real phase_3rd;
real phase_4th;
real phase_5th;
real vpk_2nd;
real vpk_3rd;
real vpk_4th;
real vpk_5th;

  analog begin
     v_minus=V(MINUS);
     vpk_2nd=vpk_fund*pow(10,dBc_2nd/20);
     vpk_3rd=vpk_fund*pow(10,dBc_3rd/20);
     vpk_4th=vpk_fund*pow(10,dBc_4th/20);
     vpk_5th=vpk_fund*pow(10,dBc_5th/20);
     phase_fund=2*`M_PI*idtmod(f_fund,0,1,-0.5);
     phase_2nd=2*`M_PI*idtmod(2*f_fund,0,1,-0.5);
     phase_3rd=2*`M_PI*idtmod(3*f_fund,0,1,-0.5);
     phase_4th=2*`M_PI*idtmod(4*f_fund,0,1,-0.5);
     phase_5th=2*`M_PI*idtmod(5*f_fund,0,1,-0.5);
     V(PLUS)<+ v_minus+vpk_fund*cos(phase_fund)+vpk_2nd*cos(phase_2nd)+vpk_3rd*cos(phase_3rd)+vpk_4th*cos(phase_4th)+vpk_5th*cos(phase_5th);
     $bound_step(1.0/(500*f_fund));
  end
endmodule

Title: Re: Multi-tone voltage source in PSS simulation
Post by Ken Kundert on May 10th, 2005, 9:12pm

The approach you have taken is both inefficient and cumbersome. Integrating the constant f_fund is simply an expensive and somewhat error prone way of computing t*f_fund. Why don't you just use f_fund directly.

I suggest using ...
 V(PLUS,MINUS)<+ vpk_fund*cos(2*'M_PI*f_fund*$abstime())+vpk_2nd*cos(4*'M_PI*f_fund*$abstime())+...

Using bound_step to force 100 points per period of the highest harmonic is too much. It will cause the simulator to run excessively slowly. 10 points is more than sufficient, and 4-5 is enough. All you are trying to do with the bound_step is get the simulator to notice the sine wave, not control the timestep for accuracy. The simulator is capable of doing that on its own once it 'sees' the sinewave.

-Ken

Title: Re: Multi-tone voltage source in PSS simulation
Post by Andrew Beckett on May 17th, 2005, 10:17am

The other thing is that you should not be using oscillator mode for PSS with this as an input source. There is no variability in the frequency for this source - it's a direct function of the f_fund parameter.

So by using oscillator mode you're asking PSS to solve an additional unknown, which is not unknown. So you end up with a set of simultaneous equations being solved which have more unknowns than equations (I think I got that the right way around), leading to an ill conditioned matrix, and consequently convergence difficulties. This is why you should never use oscillator mode on a driven circuit.

Fix the inefficient coding (as Ken suggests) and turn off oscillator mode and specify the fundamental for PSS - hopefully it should then converge.

Regards,

Andrew.

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.