**Analog Design **

**Kevin Aylward B.Sc.**

**XSpice Cores**

__Abstract__

This paper addresses how to construct arbitrary XSpice cored
transformers and inductors. The approach used here is one of engineering
functionality rather then a detailed explanation of the XSpice core
implementation method.

__Component Descriptions__

1 There are two components that are used to build up XSpice
transformers and inductors. All are XSpice specific and require an
"a" as the first letter of their spice reference designator names.

__"CORE" component.__

This component is used to set up a tabulated transfer function of
magnetic flux density **B** verses
magnetic field strength **H. **The core
component has two symmetrical terminals, much like a resistor. Indeed, it can
be used to construct a piece wise nonlinear resistor. The core model can also
be used to construct a v(out) = F(vin), where the function is specified by a
table. This makes conversion of the PSpice TABLE construct possible.

The current through the core component is the applied voltage divided
by the values set by the core specification table, modified by core length and
area scale factors.

A typical core specification is shown here:

.model FerriteCore core area=1e-4 length=1e-2

+ H_array = [-250 -100 -50 -37.5 -25 -12.5 0 12.5 25 37.5 50 100 250]

+ B_array = [-0.375 -0.36 -0.32 -0.29 -0.24 -0.15 0 0.15 0.24 0.29 0.32
0.36 0.375]

The key spice words are "h_array" "b_array"
"length" "area"

This table is formed by examining a standard B/H curve of the core.
Hysteresis is not supported in this
model so data point might need to be extrapolated from the midpoint of the B/H
positive and negative going graphs.

For each data point in the h_array (x-axis), there is a corresponding
data point in the b_array (y-axis). **H**
is in A/M and **B** is in Tesla. For
example, the table above shows that at a H of 100 a B of 0.36 will be produced.

It would be called in a spice line in the following format:

Acore_id node1 node2 FerriteCore

__Nonlinear Resistor__

To construct a nonlinear resistor set length and area to 1, and set the
h_array data points to the input voltage and the b_array to the current value
that that voltage produces.

e.g.

a_nonliner_resistor node1 node2 NonLinResModel

.model NonLinResModel

+h_array [-4 -3 -2 -1 0 1 2 3 4]

+b_array [-16 -9 -4 -1 0 1 4 9 16]

Note, the resistor does not have to be symmetrical.

The above will produce a current of 16A for an input of 4 volts. Other
values in-between the table data points will be interpolated by a straight
line.

1.1
The "LCOUPLE"
component

This component forms the inductor of the transformer, and an interface
to the core component. It has 4 terminals. The first two terminals are the
terminals of the inductor that is being modeled. The third terminal connects to
one end of the core component and the other, in most cases can be connected to
ground. Terminals can be swapped for polarity reasons, if required, i.e. 1 with
2 and 3 with 4.

The lcouple has a number of turns parameter num_turns.

**2 Constructing the core
model**

2.1 Use one lcouple model in place of every inductor in a transformer,
treating all transformer taps as stops and start of separate windings. That is,
connect the inductor terminals 1 and 2 to terminals 1 and 2 of the lcouple.

2.2 Connect each 3^{rd} terminal of the lcouple through a core component
to every other 3^{rd} terminal of the lcoples described in 2.1. Connect
all 4^{th} terminals of the lcouples to ground.

Specify the number of turns on the windings.

__Example primary and
secondary center tapped transformer.__

.subckt CenterTappedTransformer P1 PCT P2 S1 SCT S2

*

a_LP1 P1 PC1 1 0 lcouple_primary

a_LP2 PCT P2 2 0 lcouple_primary

a_LS1 S1 SCT 3 0 lcouple_secondary

a_LS2 SCT S2 4 0 lcouple_secondary

*

a_core_12 1 2 FerriteCore

a_core_13 1 3 FerriteCore

a_core_14 1 4 FerriteCore

a_core_23 2 3 FerriteCore

a_core_24 2 4 FerriteCore

a_core_34 3 4 FerriteCore

*

.model FerriteCore core area=1e-4 length=.01

+ H_array = [-250 -100 -50 -37.5 -25 -12.5 0 12.5 25 37.5 50 100 250]

+ B_array = [-0.375 -0.36 -0.32 -0.29 -0.24 -0.15 0 0.15 0.24 0.29 0.32
0.36 0.375]

.model inductor_lcouple_prim num_turns=50

.model lcouple_secondary num_turns=100

.ends

Note, due to the conventions used in the models, the above example will
result in an inverted output on the primary. This can be corrected by swapping
the subckt input line's S1 and S2

__Example Inductor__

.subckt CoredInductor 1 2

a1 1 2 3 0 inductor_lcouple

a2 3 0 inductor_core

*

.model inductor_lcouple num_turns=50

.model inductor_core area=1e-4 length=.01

+ H_array = [-250 -100 -50 -37.5 -25 -12.5 0 12.5 25 37.5 50 100 250]

+ B_array = [-0.375 -0.36 -0.32 -0.29 -0.24 -0.15 0 0.15 0.24 0.29 0.32
0.36 0.375]

*

.ends

__3 Example V(out)=F(vin)
Table__

Vi in is on 1 and 2, vout is at nodes 3 and 4

.SUBCKT GenericTable 1 2 3 4

*

e1 5 0 1 2 1

atable 5 6 table

v1 6 0 0

h1 4 3 v1 1k

.model table core area=1m length=1

+ H_array=[-4 -3 -2 -1 0 1 2 3 4]

+ B_array=[-16 -9 -4 -1 0 1 4 9 16]

.ends

e1 performs a high impedance transfer of the input voltage to a nonlinear cored
resistor.

h1 measures the current in this resistor and outputs a voltage
dependent on this current.

H_array is the input voltage, b_array is the corresponding output
voltage.

The scale factors 1k and 1m are arbitrary and could both be unity,
without changing the results. They are used to avoid possible numerical issues
by keeping currents in the lower ranges.

This model can be copied, with only the tables changed to support other
transfer functions.

© Kevin Aylward 2013

All rights reserved

The information on the page may be
reproduced

providing that this source is acknowledged.

Website last modified 30^{th} August
2013