S-parameter measurement simulation - Page 1
Forum section: electronics / beginners

author: promach
author_rank: Frequent Contributor
timestamp: September 22, 2017, 04:52:49 pm
content: I am having some problem with s-parameter measurement procedurePlease refer to my question at the bottom of this post.The following plots are obtained by running s-param.cirAs far as I can see, the S-parameters look good, maximum transmission/reflection at 0dB makes sense for low pass filter.s-param.cirRetrieved fromhttp://ngspice.sourceforge.net/docs/ngspice-27-manual.pdf#page=364Code:Test for Scattering Parameters** Two ports** Examples: Bipolar, Tschebyschef, RC.param Rbase=50 Vbias_in=0 Vbias_out=0*** The two-port circuit:** port 1: in 0** port 2: out 0** Bias on both ports through resistor Rbase (to obtain operating point)** Example RF Bipolar mrf5711** VCE 1 V, IE = 5mA** QXXXXXXX nc nb ne** model obtained from** http://141.69.160.32/~krausg/Spice_Model_CD/Vendor%20List/Motorola/Spice/RFBJT/*.include MRF5711.lib*XMRF5711 out in e MRF5711*Ie e 0 5m*Ce e 0 1** Example Tschebyschef Low Pass filterC1 in 0 33.2pL1 in 2 99.2nC2 2 0 57.2pL2 2 out 99.2nC3 out 0 33.2p** Example RC** see** http://www.allenhollister.com/allen/files/scatteringparameters.pdf*R2 in out 10*C1 out int5 30p*R1 int5 0 10*** End of circuit** The following subcircuit to be changed only by an experienced user!*** Driver and readoutX1 in out S22 S12 S_PARAM.SUBCKT S_PARAM 22 66 5 7* Resistors emulate switches with Ron=0.001 and Roff=1e12* to switch driver to input and readout to output (and vice versa, see below)RS1 22 2 0.001RS2 66 6 0.001RS3 22 6 1e12RS4 66 2 1e12*DriverVacdc 1 0 DC 'Vbias_in' AC 1 $ ac voltage and dc bias at input (applied through load resistor)R1 1 2 'Rbase'E1 3 0 2 0 2 $ amplify in port ac voltage by 2Vac 3 4 DC 0 AC 1 $ subtract driving ac voltageR_loop 4 5 0.001R3 5 0 1 $ ground return for measure node 5*ReadoutE2 7 0 6 0 2 $ amplify out port ac voltage by 2R4 6 8 'Rbase' $ load resistor at output (ac)Vdc 8 0 DC 'Vbias_out' AC 0 $ dc bias at output (applied through load resistor).ends** Check the two ac lines below for being equal!.controlset noaskquitset filetype=ascii*** measurement for s11 and s21op** save bias voltages to vectorlet Vdcnew=V(X1.1) $ former Vacdclet Vacdcnew=v(X1.8) $ former Vdc** first ac measurement (change this line only together with following ac line)*ac lin 20 0.1G 2G $ use for bip transistorac lin 100 2.5MEG 250MEG $ use for Tschebyschef*ac lin 101 1k 10G $ use for RC**** switch input and outputalter R.X1.RS1=1e12alter R.X1.RS2=1e12alter R.X1.RS3=0.001alter R.X1.RS4=0.001** switch bias voltages between in and outalter V.X1.Vacdc DC=op1.Vacdcnewalter V.X1.Vdc DC=op1.Vdcnew*** measurement for s12 and s22op** second ac measurement (change this line only together with ac line above)*ac lin 20 0.1G 2G $ use for bip transistorac lin 100 2.5MEG 250MEG $ use for Tschebyschef*ac lin 101 1 10G $ use for RC**let s11=ac1.s22let s21=ac1.s12settype s-param S11 S21 S22 S12let S11db = db(s11)let S12db = db(s12)let S21db = db(s21)let S22db = db(s22)settype decibel S11db S21db S22db S12dblet P11=180*ph(s11)/pilet P21=180*ph(s21)/pilet P22=180*ph(S22)/pilet P12=180*ph(S12)/pisettype phase P11 P21 P22 P12let Rbase=@R.X1.R4settype impedance Rbase*plot s11db s21db S22db S12db ylimit -50 0 xlog $ used with RCplot s11db s21db S22db S12db ylimit -0.5 0 $ used with Tschebyschefplot P11 P21 P22 P12plot smithgrid S11 S12*wrdata s3046 mag(S11) P11 mag(S21) P21 mag(S22) P22 mag(S12) P12 $ write simple tablewrs2p s3046.s2p $ write touchstone vers. 1 file s3046.s2p.endc.endQuotethis 50 ohm Rbase is connected to the netlabel 2 in the screenshot below.Or did I misread the s-param.cir netlist ?

author: bson
author_rank: Unknown
timestamp: September 22, 2017, 09:48:11 pm
content: The comments say it's used to apply a bias to set the operating point. Otherwise this would be undefined and spice can't find it.

author: promach
author_rank: Frequent Contributor
timestamp: September 23, 2017, 04:21:30 am
content: Is the bias resistor, RBase at the wrong place in the netlist ?Should it be at 'in' instead of at '2' ?

author: tec5c
author_rank: Frequent Contributor
timestamp: September 23, 2017, 06:35:23 am
content: I think that you may be a little confused with the SPICE file.There are three separate examples and one subcircuit given in the file.You have a screenshot of the chebyshev filter posted yet you are talking about the subcircuit. If you look at the netlist file, you will see that 2 of the 3 examples are commented out (denoted by *) therefore when you run the s-param.cir netlist file only the filter response will be given, as you have shown in your post.However, it appears that the link for the .lib file for the MRF5711 given in the netlist file does not work (at least it didn't for me) and a quick google search yielded no results.

author: promach
author_rank: Frequent Contributor
timestamp: September 23, 2017, 02:42:40 pm
content: OK. Now I am trying to understand the subcircuit before proceeding to the measurement section.How should E1 and E2 be interpreted ?Quote

author: promach
author_rank: Frequent Contributor
timestamp: September 25, 2017, 06:08:06 am
content: I am stucked at visualizing E1 which purpose is to amplify in port ac voltage by 2Any idea ?

author: promach
author_rank: Frequent Contributor
timestamp: October 10, 2017, 08:50:50 am
content: QuoteThis line means multiply the node voltage at #2 by a factor of two and the resultant voltage appears at node #3QuoteI do not understand this line though. Anyone ?

author: promach
author_rank: Frequent Contributor
timestamp: February 06, 2018, 03:25:14 pm
content: QuoteI do not understand the above statement.Why must RG1 be between S11 and VG1A ?

author: promach
author_rank: Frequent Contributor
timestamp: March 01, 2018, 03:49:36 pm
content: I am using the S11 equations for input impedance to calculate the inductance value as described inhttps://ieee.li/pdf/essay/s_parameters_of_passive_components.pdf#page=5Could anyone tell me why I am not getting Leq to be 1nH ?The following is the netlist for the test circuit :Code:* gnetlist -g spice-noqsi -o test_active_inductor.net test_active_inductor.sch* SPICE file generated by spice-noqsi version 20130710* Send requests or bug reports to jpd@noqsi.comRZ1 Vtest Ltest 50Vtest Vtest GND dc 1+ac 1.GLOBAL Vdd Vss.PARAM SUPPLY=3.3v.options TEMP=25.MODEL n1 NMOS.MODEL p1 PMOS.INCLUDE CMOS_Inverter.net.INCLUDE Gm2.netVd Vdd GND 'SUPPLY'Vs Vss GND 0VLtest Ltest GND 1n.controlset noaskquitAC LIN 1000 100Meg 200Megrunlet S11=(2*v(Ltest)/v(Vtest)-1)settype s-param S11let S11db=db(S11)settype decibel S11dblet P11=180*ph(s11)/pisettype phase P11plot s11db ylimit -0.5 0plot P11print S11 > S11.log*plot smithgrid S11*wrs2p s3046.s2p $ write touchstone vers. 1 file s3046.s2p.endc

author: promach
author_rank: Frequent Contributor
timestamp: March 02, 2018, 10:31:22 am
content: Found the root cause for the miscalculation.I forgot to multiply by Zo which is 50ohm