ra3xdh / qucs_s

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

TransformerPS1S2 Issue #362

Closed tomhajjar closed 11 months ago

tomhajjar commented 11 months ago

I'm having issues trying to get a 6-phase rectifier circuit to work. I sent the netlist over to the ngspice guys and they found a possible error with .SUBCKT Transformers_TransformerPS1S2. The netlist line "R3 nSPlus nSplus {RS1}" is wrong. There may be other errors in the .SUBCKT.

https://sourceforge.net/p/ngspice/discussion/133842/thread/c4ecc7c227/

2023-11-14_105159

6_Phase_Rectifier.zip

TODO list:

ra3xdh commented 11 months ago

I have fixed the short circuit in the library by the latest commit, but the convergence error remains. I cannot say why this simple circuit still give the convergence error in Ngspice. You can grab the fixed library here: https://raw.githubusercontent.com/ra3xdh/qucs_s/current/library/Transformers.lib

tomhajjar commented 11 months ago

Holger recommendation is shown below. I cannot find "chgtol" in the Qucs Transient properties settings.

You may add this line to the netlist. .options abstol=10u chgtol=1e-10 method=gear Because you have high voltages, chgtol and abstol reduce the precision requirements, especially the gear method here yields a transient solution. It looks strange though, and you should simulate up to 1 s to see the output signal decay.

ra3xdh commented 11 months ago

Yes, the options helps. You may use the .OPTIONS device. image

tomhajjar commented 11 months ago

Output is wrong. Supposed to look like the following.

Dietmar made the following comment:

"The first gnd node in transformer is obsolete and can removed in subckt definition and call."

If I disable TRAN1, the output is unchanged...

6-phase-rectifier

6-phase-rectifier-out

tomhajjar commented 11 months ago

Holger said to use Delay instead of Phase for the AC source. This and the changes to Transient Parameters allows the analysis to be correct starting at T=0 instead of having to wait a long time for the system to settle. Holgers explanation points out why I was having so many issues.

https://github.com/ra3xdh/qucs_s/issues/362

Can the new Spice "ac Voltage Source" have VO (offset), VA (amplitude), FREQ (frequency), TD (delay), THETA (damping) and PHASE (phase) added as the default entry parameters? Presently it has "Vac" which is meaningless. The "V source" usage is a bit confusing.

Dietmar pointed out that the "gnd" entry for .SUBCKT Transformers_TransformerPS1S2 as shown below is unused. Is this a mistake?

.SUBCKT Transformers_TransformerPS1S2 gnd nPplus nPneg nSplus nSneg nSPct L1=0.5 L2=0.125 L3=0.125 K12=0.99 K13=0.99 K23=0.99 Rp=2 Rs1=1 Rs2=1

Attached is the "good and bad" schematics.

6_Phase_Rectifier.zip

ra3xdh commented 11 months ago

Can the new Spice "ac Voltage Source" have VO (offset), VA (amplitude), FREQ (frequency), TD (delay), THETA (damping) and PHASE (phase) added as the default entry parameters?

Yes, you may use the generic SPICE source for this purpose: image

Dietmar pointed out that the "gnd" entry is unused. Is this a mistake?

No, this is done intentionally for Qucs compatibility. This node never caused problems before.

tomhajjar commented 11 months ago

The "ac Voltage Source" at the bottom of the Sources menu is a Spice only component so Qucs compatibility isn't an issue. It has a single default entry of "Vac" which is wrong. ngspice thinks it is a DC source. Why was this device created when "V Source" is already available?

Can you alter "ac Voltage Source" by adding all the parameters to the Menu so the User can change them?

2023-11-15_111458

2023-11-15_111955

ra3xdh commented 11 months ago

Yes, I have just added the TD and VO parameters for AC source. This fix will be available since the new release.

image

tomhajjar commented 11 months ago

The "ac Voltage Source" at the bottom of the Sources menu will still be wrong if not changed or deleted. Why was it created?

2023-11-15_115150

ra3xdh commented 11 months ago

Why was it created?

This device was added by @MikeBrinson long time ago. I cannot say what was the purpose for this device. I am also finding two type of source confusing. I may delete it in the next release. The V source device would be sufficient if one need full SPICE definition.

ra3xdh commented 11 months ago

I have deprecated the red AC source. The remaining issues with the transformer library will be fixed in #367 Closing this as completed.