Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Problem with sp simulation using touchstone file

69 views
Skip to first unread message

Caglar Ozdag

unread,
Nov 17, 2024, 9:27:55 AM11/17/24
to xyce-users
Long story short, I need a flow to EM simulate multi port designs and do sparameter and transient simulations on the multi-port sp (touchstone) file. I figured out that OpenEMS and Xyce is my best choice. I am using Qucs-S for my simulator GUI, but this is not necessary. Just nice to have.

I confirmed that I successfully integrated Xyce and Qucs-S because I was able to simulate a simple inductor S11 this way.

But my main task is to run sp simulation on a touchstone file (example below is for a 2 port touchstone file, but eventually I need to be able to run multi port simulations).

The following netlist and attached schematic screenshot results in an empty results database. As you can see S11 is all 1s.

* Qucs 24.3.2  /home/caglarozdag/qucs_s_tests/2portspsim_xyce.sch
P1 _net0 0 port=1  z0=50  AC 0.632456  SIN 0 0.632456 1MEG
P2 _net1 0 port=2  z0=50  AC 0.632456  SIN 0 0.632456 1MEG
YLIN YLIN_X1 _net0 0 _net1 0 YLIN_X1_model
.MODEL YLIN_X1_model LIN TSTONEFILE=/home/caglarozdag/OpenEMStest/test1/data3/run_2port_simpletest2_2port_network.s2p
.AC LIN 201 1MEG 30G
.LIN format=touchstone sparcalc=1
.PRINT ac format=std file=spice4qucs_sparam.prn sdb(1,1) s(1,1) sp(1,1) y(1,1) z(1,1) sdb(1,2) s(1,2) sp(1,2) y(1,2) z(1,2) sdb(2,1) s(2,1) sp(2,1) y(2,1) z(2,1) sdb(2,2) s(2,2) sp(2,2) y(2,2) z(2,2)
.END


Can someone help me debug my issue? Alternatively, I could directly run a Xyce netlist from command line, but no luck there either. Any help is appreciated.

sp_schematic.png

Dietmar Warning

unread,
Nov 17, 2024, 11:19:46 AM11/17/24
to xyce-users
From Reference Guide:
At present, the YLIN device is only supported in the frequency domain for HB
analyses.

It's a pity.

fnp

unread,
Nov 18, 2024, 5:59:31 AM11/18/24
to xyce-users
What you need is VectorFitting with a circuit synthesizer. This will convert your n-port sparameter-data into an n-port equivalent circuit that can be simulated in any type of simulation, including transient, ac, harmonic balance, whatever. The commercial simulators usually have this built in and it runs automatically in the background.

Xyce's YLIN device does not have this feature yet, so you need to do it on your own, but it's fortunately not very complicated and it is available already in scikit-rf.

There is a pretty good tutorial about this process in the scikit-rf documentation but the steps that you would run are pretty much those:

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


XYCE

unread,
Nov 18, 2024, 3:33:05 PM11/18/24
to xyce-users, Smith, Joshua M.

 

 

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.

Reply all
Reply to author
Forward
0 new messages