import skrf
nw = skrf.network.Network('YourSparameterFile.s4p')
vf = skrf.VectorFitting(nw)
vf.auto_fit()
vf.passivity_enforce()
vf.write_spice_subcircuit_s('YourSparameterModel.cir')
The YourSparameterModel.cir file is basically ready for Xyce to simulate, just instanciate one instance of the subckt and add the PORT devices like this:
.AC DEC 20 0.01 100e9
.LIN FORMAT=TOUCHSTONE2 LINTYPE=S DATAFORMAT=MA FILE=OutputSparameters.s4p WIDTH=15 PRECISION=12
* Note: You can also do a Transient simulation here, of course. Put what ever you like. Xdut will represent your s-parameters.
Xdut nt_p1 nt_p2 nt_p3 nt_p4 s_equivalent
P1 nt_p1 0 port=1
P2 nt_p2 0 port=2
P3 nt_p3 0 port=3
P4 nt_p4 0 port=4
[Here comes everything that is already in YourSparameterModel.cir]
It happens that in the recent weeks I wrote a new circuit synthesizer for scikit-rf that will hopefully soon replace the current one that is implemented in write_spice_subcircuit_s()
If you use the new one in the future once it is released, you can generate even more compact circuits behaving exactly the same.
Those will also run faster in the Xyce because they have less nodes and components.
If you already want to try out the new one, it's code is right now in this pull-request: https://github.com/scikit-rf/scikit-rf/pull/1198
It would be great if this technique could be incorporated right into the code of Xyce so that the YLIN device would do the vectorFit on its own automatically.
But until then, happy fitting!
Thomas
Hi Caglar,
Thanks for your interest in Xyce.
As Dietmar mentioned, the S-parameter or YLIN device is only supported in HB analysis currently. So it will not work in your netlist which uses .LIN analysis.
The method that Thomas described is a workaround that is similar to what we suggest to our internal users. You can also achieve the same thing using Matlab. Matlab has functions to read S-parameter files, do rational fitting and output an equivalent SPICE subckt. You can then use this subckt for any analysis.
Supporting S-parameter device in AC or LIN analysis requires less work than supporting it in transient analysis using convolution. Some commercial simulators, such as Hspice, implement transient simulation of S-parameter device (described in frequency domain) using convolution. This requires more work in order to make it work robustly in transient than AC/LIN in Xyce.
Thanks,
Ting
From: xyce-...@googlegroups.com <xyce-...@googlegroups.com>
On Behalf Of fnp
Sent: Monday, November 18, 2024 4:00 AM
To: xyce-users <xyce-...@googlegroups.com>
Subject: [EXTERNAL] [xyce-users] Re: Problem with sp simulation using touchstone file
Some people who received this message don't often get email from fnor...@gmail.com. Learn why this is important |
--
You received this message because you are subscribed to the Google Groups "xyce-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
xyce-users+...@googlegroups.com.
To view this discussion visit
https://groups.google.com/d/msgid/xyce-users/cb4cd073-2b5e-4f71-a4f3-19a42ec6bc51n%40googlegroups.com.