ra3xdh / qucs_s

Qucs-S is a circuit simulation program with Qt-based GUI
https://ra3xdh.github.io/
GNU General Public License v2.0
886 stars 115 forks source link

S-parameter File Handling Observation #1075

Open tomhajjar opened 1 week ago

tomhajjar commented 1 week ago

@ra3xdh @transmitterdan

For a Mini Circuits ADQ_22+ Hybrid coupler I was comparing how Qucs-S makes a sub-circuit from the S-parameter file versus how S2spice makes a netlist from the S-parameter file. Mini Circuits says the device needs a ground reference.

S2spice makes a netlist from the S-parameter file with 4-ports and a ground resulting in a sub-circuit with a ground. Qucs-S makes a sub-circuit from the S-parameter file with 4-ports BUT without a ground.

Both sub-circuits work but if the ground is removed from the sub-circuit created from the S2spice created netlist, it doesn't work.

2024-11-18_113043 2024-11-18_113001

S-parameter_files_ngspice_prj.zip

tomhajjar commented 1 week ago

@ra3xdh

Here is another example of a "missing" Reference ground. It makes a 1/2-port device look odd without a ground.

This ONLY happens when Qucs-S converts a S-parameter file to a sub-circuit for ngspice. It doesn't happen when S2spice externally does the conversion or when when Qucs-S is using qucsator-rf.

2024-11-19_163601 2024-11-19_163544

ADL5536_RF_Amp_prj.zip

tomhajjar commented 1 week ago

Here is a S-parameter file project made for qucsator-rf.

When Qucs-S is in "Qucsator mode", a 2-port S-parameter file whether placed into the schematic directly or made into a sub-circuit will ALWAYS have 2-ports plus the 3rd Reference port. Circuit will not work without Ref connected to ground.

When Qucs-S is in "ngspice mode" a 2-port S-parameter file placed directly into the schematic will ONLY have 2-ports. A 2-port S-parameter file converted by S2spice will have 2-ports PLUS the 3rd Reference port.

S-parameter_files_qucs_prj.zip

transmitterdan commented 1 week ago

I decided to make S2spice use the "reference" port because sometimes you may want that reference to be something other than "ground". Others have decided to force the reference of each port to be node 0 (aka "ground") so they don't require you to connect it on your schematic. But the connection is there just hidden inside the subcircuit. I felt this was overly restrictive.

If one were to be pedantic, every port should have 2 terminals (v+ & v-) since S-parameters assume that is the case. However, very few practical circuits actually have the references for all ports floating. That would make the schematic symbol larger and require numerous ground connections to be made to every port.

If you think there is something wrong with how S2spice works, please explain because when I read your messages, I don't see a specific action suggested.

tomhajjar commented 1 week ago

No actions for now.

I was making an observation that Qucs-S handles S-parameter files differently for ngspice than it does for qucsator or how S2spice handles it. Some might be confused that there is no gnd/ref. It will also preclude connecting an impedance to the ref port.

tomhajjar commented 1 week ago

@ra3xdh @transmitterdan

Would adding User selectability be a major change? The device could default to no Ref unless the User makes a change.