Dear all, I am checking how to simulate simple transformers, coupling coefficient equal to 0.1 (image 1), and it seems to me that there are three possible ways to do so:
-
1st - use the integrated Spice model for the mutual induction statement;
-
2nd - use the integrated Spice model “raw spice element”;
-
3rd - use the Spice model from an external file.
In the first case, the resulting code is simply K Ref_L1 Ref_L2 0.1
, but I don’t quite understand the purpose of referencing two external elements in a separate third element in the schematic - it would perhaps be more practical to add this 1-line code traditionally to a text element. Wouldn’t it be more functional and intuitive if L1 and L2 were internally declared in a subcircuit for the transformer, rather than just specified as a reference? This way, this integrated spice model would be more “ready to use”, being in fact the declaration of a subcircuit, whose pinout would be automatically adjusted when the element is instantiated. I was unable to simulate the transformer in this first mode.
In the second case, the code is placed in the element directly, and looks like this:
transformer
.subckt transformer L1_2 L1_1 L2_2 L2_1 params: ind1=1 ind2=1 coef=0.1
L1 L1_2 L1_1 {ind1}
L2 L2_2 L2_1 {ind2}
K1 L1 L2 {coef}
.ends
The element name is T1, and the prefix “X” is added to the default parameter “Spice element type (type)”. From what I observed, it is as if the name of the element and the pins were always automatically added to the first line of the spice code in every schematic element, so that the netlist always returns in the first line as XT1 Gnd /In /Net_4 /Out transformer
. This way, the simulation works well, although the parameters do not appear as editable in the simulation model editor window (image 2) and sometimes the first line of code is filled incorrectly as “X transformer”, or even as “X X transformer”, so automatic, perhaps due to an error in the default parameter.
In the third case, the one usually recommended from what I see, the code is added from an external file. It works perfectly well.
Ultimately, the simulation was carried out, but I wanted to obtain the following information:
-
A - How to carry out a successful simulation using an integrated Spice model for mutual induction statement? (1st case)
-
B - Why is it that when confirming “Ok” in the simulation model editor window, the value of the “Spice element type (type)” parameter is inserted in the 1st line of the “raw spice element” code? If you confirm “Ok” five times, the result in the 1st line will be “X X X X X transformer” (2nd case).
-
C - Why are the parameters not editable in the simulation model editor window when using the integrated “raw spice element” Spice model? (2nd case)
Thank you in advance.
(image 1):
(image 2):