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

Transformer Library Testing #228

Closed tomhajjar closed 1 year ago

tomhajjar commented 1 year ago

I cannot figure out how to use some of the transformer models in Transformers.lib and how to use properly use Cores.lib.

First issue is the model XSPICEPS1S2 in Transformers.lib. On the Help web page below, it shows two parameters L and A that don't exist in XSPICEPS1S2 in Transformers.lib. The parameters ntp, nts1 and nts2 cannot be known without knowing L and A.

When I try to use XSPICEPS1S2, it is in saturation as shown below regardless of ntp, nts1 and nts2. (See R5 comments below.)

Also, shouldn't the XSPICE transformer models allow one to choose the core materials mentioned in Cores.lib? How does one use Cores.lib?

Another issue is R5 used in multiple simulations shown on the Help web page below is 2k. No one would use a resistor as large as 2k on the primary. Rp is already in the model. Does the model only work for small input voltages?

Lastly I created a Bridge Rectifier model that would be useful to some and maybe good as a library item.

https://qucs-s-help.readthedocs.io/en/latest/SPICEComp.html#two-winding-transformer-model-with-in-phase-primary-and-secondary-voltages-and-winding-resistance

TODO list from @ra3xdh

2023-02-20_174757

Transformer XSPICE

Transformer_testing.zip

tomhajjar commented 1 year ago

I looked at Transformers.lib and it seems L, A and core laminate are fixed for XSPICEPS1S2.

XSPICEPS1S2: .model Steel core length = 0.2 area=2e-4

LossyTransformer2 let's you change L and A but no mention of core laminate.

These limits should be mentioned in the Library "Show model"

2023-02-20_153502

ra3xdh commented 1 year ago

I looked at Transformers.lib and it seems L, A and core laminate are fixed for XSPICEPS1S2

Yes, this device should be corrected. The L and A parameters are indeed fixed.

Also, shouldn't the XSPICE transformer models allow one to choose the core materials mentioned in Cores.lib? How does one use Cores.lib

It is not possible to specify the model name as the subcircuit parameter. The only way to attach core is to create your own subcircuit as shown in the Qucs-S manual.

tomhajjar commented 1 year ago

Can the *.sch files used to create the following Help file page be released?

https://qucs-s-help.readthedocs.io/en/latest/SPICEComp.html#two-winding-transformer-model-with-in-phase-primary-and-secondary-voltages-and-winding-resistance

ra3xdh commented 1 year ago

I don't own these schematics. The help was written by Mike Brinson around 2016. I am not sure if some schematics are remaining after seven years passed.

tomhajjar commented 1 year ago

Mike is going to look. ;-)

tomhajjar commented 1 year ago

I'm finding multiple issues with this library.

Cosmetic issues:

For ease of drawing schematics or substituting one transformer with another, similar transformer types should use the same symbol and pin locations.

The five, two winding transformers use different symbols and pin locations. .

The two, three winding (center tapped) transformers use an unsymmetrical symbol with one pin in each placed in the wrong location.

Functional issues:

XSPICEPS1S2 output polarity is flipped as shown below. As stated above, parameters N and L are missing and the user should know what the core type is. A lot more work needs to be done to confirm the functionality of the model

I'm trying to test all the models for functionality. The attached files do just a simple check of functionality. Waiting for Mike to send the original files.

XSPICEPS1S2

Transformer_Lib_Test_prj.zip

tomhajjar commented 1 year ago

I made a first cut at new transformer symbols. They are fully symmetrical with pins on the grid. You can substitute a different model, mirror or rotate devices without having to fix the schematic as is required now.

2023-02-23_120406

symbols_transformers.zip

ra3xdh commented 1 year ago

The symbols in the library is not subject of change. The library was fully operational at least until Ngspice-27. And there may be users that designed circuits with old symbols. I don't know how many users used these devices. If we change the symbols in the library, the backward compatibility will be lost and ALL existing schematics will require redesign. This may cause a tons of bugreports why the symbols were changed.

tomhajjar commented 1 year ago

Understand. People can use the symbols to make new transformer sub circuits.

ra3xdh commented 1 year ago

I have attached a TODO list for this issue.

ra3xdh commented 1 year ago

I have fixed XSPICE transformers in the library. You can get the latest library from here: https://raw.githubusercontent.com/ra3xdh/qucs_s/current/library/Transformers.lib Closing this as resolved. The solution for #231 will be added separately.

tomhajjar commented 1 year ago

I confirmed that the changes to Transformers.lib work however XSPICEPS1S2 still has an inverted output. When you cascade 2 Lcouple elements, the output is inverted.

I recreated the two Mike Brinson XSPICE models, XSPICEPS1 and XSPICEPS1S2 in the online Help.

XSPICEPS1 has it's output pins swapped to correct output polarity but XSPICEPS1S2 doesn't so it's output is 180 out of phase. I fixed it in my recreation and confirmed output polarity is correct. Attached is the fixed Transformers.lib.

2023-06-22_210252 2023-06-22_210448

Transformers.zip