Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qucs-s simulation with xyce #153

Open
FhatuL opened this issue Jun 28, 2024 · 23 comments
Open

qucs-s simulation with xyce #153

FhatuL opened this issue Jun 28, 2024 · 23 comments
Assignees

Comments

@FhatuL
Copy link

FhatuL commented Jun 28, 2024

Hi,

I wanted to ask, regarding the qucs-s HBT models, is it possible to run the simulations using xyce instead of ngspice? Every time I try to use the xyce simulator i get this error -> Netlist error: Number of nodes for subcircuit instance XNPN13G2L1 does not
agree with number of nodes in subcircuit
IHP_PDK_NONLINEAR_COMPONENTS_NPN13G2L

@KrzysztofHerman
Copy link
Contributor

Hi @FhatuL, could you please share your testcase ?

@FhatuL
Copy link
Author

FhatuL commented Jul 1, 2024

Hi @KrzysztofHerman , please let me know if i missed something:

  • Qucs Version: 24.2.1
  • OS/Platform: Ubuntu 24.04

Expected Behavior

While using the HBT models, I am expecting the simulation to run without errors when using xyce

Actual Behavior

While trying to run a simulation with xyce, netlist errors occur.
image of error:
image

Steps to Reproduce the Problem

  1. Create a schematic and use one of the HBT models, in this case I used the npn13G2l model.
  2. Add an include script for the HBT models, in my case, I just copied the include syntax provided in one of the example schematics for qucs-s in the repository.
  3. Make sure xyce is selected as the simulator
  4. Insert a simulation type in the schematic, for my case I was using the S parameter simulation
  5. Try to run the simulation
    Image of my schematic:
    image

@KrzysztofHerman
Copy link
Contributor

@FhatuL does it run when you use ngspice ?
Anyway QUCS-S only generate the netlist and then calls the simulator.

@FhatuL
Copy link
Author

FhatuL commented Jul 1, 2024

@KrzysztofHerman It runs when I use ngspice yes.

@KrzysztofHerman
Copy link
Contributor

Could you please provide the netlist an message log. You can generate it pressing F5 and F6

@FhatuL
Copy link
Author

FhatuL commented Jul 1, 2024

find attached
netlist1.txt
log1.txt

@sergeiandreyev
Copy link
Contributor

based on the log it seems that all the .parameters commands in cornerHBT.lib file are not supported in Xyce, so the parameters are not set and simulation of course could not run
we need to change the syntax of the models in a way to be supported by Xyce (like we did for diodes and resistors models)

@sergeiandreyev
Copy link
Contributor

ok, after the change .parameters to .param (Xyce syntax) I'm still getting the 'incorrect number of nodes' error

@sergeiandreyev
Copy link
Contributor

ok, found it
.SUBCKT IHP_PDK_nonlinear_components_npn13G2l gnd c b e bn t Nx=1 El=1
here gnd is the extra pin

@sergeiandreyev
Copy link
Contributor

or the other way around, you should add additional pin to the line 10:
Xnpn13G2l1 0 _net0 _net1 0 gnd IHP_PDK_nonlinear_components_npn13G2l Nx=1 El=1

@sergeiandreyev
Copy link
Contributor

so now I'm stuck with this error:
Model is required for device QNPN13G2L and no valid model card found.
I'm using Xyce v7.6

@FhatuL
Copy link
Author

FhatuL commented Jul 2, 2024

ok, found it .SUBCKT IHP_PDK_nonlinear_components_npn13G2l gnd c b e bn t Nx=1 El=1 here gnd is the extra pin

is it the circuit symbol that causes this extra pin to appear? How could i remove it since the netlist is auto-generated in my case.

@KrzysztofHerman
Copy link
Contributor

in the line 259 of this file you have this definition: .SUBCKT IHP_PDK_nonlinear_components_npn13G2l gnd c b e bn t Nx=1 El=1 . You could try to remove gnd, which seems to be optional, and let us know how it goes.

@sergeiandreyev
Copy link
Contributor

is it the circuit symbol that causes this extra pin to appear? How could i remove it since the netlist is auto-generated in my case.

I think it comes from this file -> link
lines 259-261

@dwarning
Copy link

dwarning commented Jul 3, 2024

Beside .parameters statements you have to change level model parameter from 9 to 12 in file sg13g2_hbt_mod.lib.

@dwarning
Copy link

dwarning commented Jul 3, 2024

Just a copy of the 3 hbt files into the xyce model folder with these changes is sufficient.
But the netlister seems not to fit xyce requirements for this nested loop:
Bildschirmfoto vom 2024-07-03 14-34-50

@sergeiandreyev
Copy link
Contributor

thank you, @dwarning !
now at least Xyce is running on my side (standalone)

@dwarning
Copy link

dwarning commented Jul 3, 2024

The problem with the nested loop arises after a copy from ngspice schematic. Removing the both parameter sweeps, save and re-insert again solved the problem.

@FhatuL
Copy link
Author

FhatuL commented Jul 3, 2024

Just a copy of the 3 hbt files into the xyce model folder with these changes is sufficient. But the netlister seems not to fit xyce requirements for this nested loop: Bildschirmfoto vom 2024-07-03 14-34-50

Thank you, doing what you said got it to work.

@FhatuL
Copy link
Author

FhatuL commented Jul 3, 2024

Also, removing the extra gnd port on line 259 in the IHP_PDK_nonlinear_components.lib, although it does allow the simulation to run, it gives totally different simulation results compared to when it is there with ngspice. For xyce I just added an extra .PortSym and that seems to have gotten rid of the Number of nodes for subcircuit instance XNPN13G2L2 does not
agree with number of nodes in subcircuit error.

@sergeiandreyev
Copy link
Contributor

sergeiandreyev commented Jul 4, 2024

@FhatuL, great! Could you please attach the final updated netlist here for reference?
On PDK side, we will provide model files with required changes in libs.tech/xyce/models folder

@FhatuL
Copy link
Author

FhatuL commented Jul 4, 2024

@FhatuL, great! Could you please attach the final updated netlist here for reference? On PDK side, we will provide model files with required changes in libs.tech/xyce/models folder

  • Qucs 24.2.1 /home/fhatu/test2.sch

.SUBCKT IHP_PDK_nonlinear_components_npn13G2l gnd c b e bn t Nx=1 El=1
.INCLUDE ../../.qucs/IHP-Open-PDK-main/ihp-sg13g2/libs.tech/xyce/models/sg13g2_hbt_mod.lib
X1 c b e bn t npn13G2l Nx={Nx} El={El}
.ENDS

.LIB ../../.qucs/IHP-Open-PDK-main/ihp-sg13g2/libs.tech/xyce/models/cornerHBT.lib hbt_typ

Xnpn13G2l1 0 _net0 _net1 0 gnd 0 IHP_PDK_nonlinear_components_npn13G2l Nx=1 El=1
C1 _net2 _net1 1N
C2 _net0 _net3 1N
L1 _net0 _net4 1M
L2 _net5 _net1 1M
I1 0 _net5 DC 2U
P1 _net2 0 port=1 z0=50 AC 0.316228 SIN 0 0.316228 1MEG
P2 _net3 0 port=2 z0=50 AC 0.316228 SIN 0 0.316228 1MEG

V1 _net4 0 DC 1
.AC LIN 201 10G 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

@sergeiandreyev sergeiandreyev self-assigned this Jul 31, 2024
@sergeiandreyev
Copy link
Contributor

Hi @FhatuL, we pushed the HBT models for Xyce to the dev branch: d2c5295
So we have only the Qucs-S netlisting issue left

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants