Package Modelica.​Electrical.​Spice3.​Additionals
Some useful additional models, e.g., from SPICE2 the polynomial sources

Information

This package contains additional useful models which do not belong to the original SPICE3 model set.

Extends from Modelica.​Icons.​Package (Icon for standard packages).

Package Contents

NameDescription
E_VCV_POLYPolynomial voltage controlled voltage source, like SPICE2
F_CCC_POLYPolynomial current controlled current source, like SPICE2
G_VCC_POLYPolynomial voltage controlled current source, like SPICE2
H_CCV_POLYPolynomial current controlled voltage source, like SPICE2
polyPOLY function of SPICE2

Function Modelica.​Electrical.​Spice3.​Additionals.​poly
POLY function of SPICE2

Information

Function needed for polynomial interpolation of POLY controlled sources:

Extends from Modelica.​Icons.​Function (Icon for functions).

Inputs

TypeNameDescription
Reals[:]Variables
Reala[:]Coefficients

Outputs

TypeNameDescription
RealvValue of polynomial

Model Modelica.​Electrical.​Spice3.​Additionals.​E_VCV_POLY
Polynomial voltage controlled voltage source, like SPICE2

Information

The polynomial source is a SPICE2 model, which is also known in other SPICE derivatives.

Nonlinear voltage controlled voltage source. The "right" port voltage between pin p2 and n2 (=p2.v - n2.v) is controlled by the "left" port vector of voltages at the pin vector pc[:] via

    p2.v - n2.v = f(pc[1].v - pc[2].v, pc[3].v - pc[4].v,...)

The controlling port (left) current vector is zero.

f is a polynomial in N variables s1...sN of the following form with M+1 coefficients a0, a1, a2,...aM.

f = a0 +
    a1s1 + a2s2 + ... + aNsN +
    a(N+1)s1² + a(N+2)s1s2 + ... + a(.)s1sN +
    a(.)s2² + a(.)s2s3 + ... + a(.)s2sN +
    a(.)s3² + s3s4 + ... + a(.)s4sN +
    ... +
    a(.)sN² +
    a(.)s1³ + a(.)s1²s2 + a(.)s1²s3 + ... + a(.)s1²sN +
    a(.)s1s2² + a(.)s1s2s3 + ... + a(.)s1s2sN +
    ... +
    a(.)sN³ + ... 

The Coefficients a(.) are counted in this order. Reaching M, the particular sum is canceled.

In connection with the VCV, s1...sN are the voltages of the controlling side: s1=pc[1].v - pc[2].v, s2=pc[3].v - pc[4].v, s3=...

The corresponding SPICE description of the VCV polynomial source is the following:

    Ename A1 A2 POLY(N) E11 E21 ... E1N E2N P0 P1...

where Ename is the name of the instance, A1 and A2 are the nodes between them the controlled voltage is gripped,

N is the number of the controlling voltages, E11 E12 ... E1N E2N are pairs of nodes between them the controlling voltages

are gripped, and P0, P1... are the coefficients that are called a0, a1, ... aM in the description of the polynomial f above.

To describe the SPICE line in Modelica, the following explanation would be useful:

Ename -> E_VCV_POLY name
A1, A2 -> pins name.p2, name.p1
N -> parameter N
E11 -> name.pc[2]
E12 -> name.pc[1]
...
E1N -> name.pc[N]
E2N -> name.pc[N-1]
P0, P1 -> polynomial coefficients name.coeff(coeff={P0,P1,...})

Parameters

TypeNameDefaultDescription
IntegerN1Number of controlling voltages
Realcoeff[:]{1}Coefficients of polynomial

Connectors

TypeNameDescription
PositivePinpPositive pin of the controlled (normally right) port (potential p2.v > n2.v for positive voltage drop v2)
NegativePinnNegative pin of the controlled (normally right) port
PositivePinpc[2 * N]Pin vector of controlling pins (normally left)

Model Modelica.​Electrical.​Spice3.​Additionals.​G_VCC_POLY
Polynomial voltage controlled current source, like SPICE2

Information

The polynomial source is a SPICE2 model, which is also known in other SPICE derivatives.

Nonlinear voltage controlled current source. The right port current at pin p2 (=p2.i) is controlled by the left port vector of voltages at the pin vector pc[:] via

    p2.i = f(pc[1].v - pc[2].v, pc[3].v - pc[4].v,...)

The controlling port (left) current vector is zero.

f is a polynomial in N variables s1...sN of the following form with M+1 coefficients a0, a1, a2,...aM.

f = a0 +
    a1s1 + a2s2 + ... + aNsN +
    a(N+1)s1² + a(N+2)s1s2 + ... + a(.)s1sN +
    a(.)s2² + a(.)s2s3 + ... + a(.)s2sN +
    a(.)s3² + s3s4 + ... + a(.)s4sN +
    ... +
    a(.)sN² +
    a(.)s1³ + a(.)s1²s2 + a(.)s1²s3 + ... + a(.)s1²sN +
    a(.)s1s2² + a(.)s1s2s3 + ... + a(.)s1s2sN +
    ... +
    a(.)sN³ + ... 

The Coefficients a(.) are counted in this order. Reaching M, the particular sum is canceled.

In connection with the VCC, s1...sN are the voltages of the controlling side: s1=pc[1].v - pc[2].v, s2=pc[3].v - pc[4].v, s3=...

The corresponding SPICE description of the VCC polynomial source is the following:

    Gname A1 A2 POLY(N) E11 E21 ... E1N E2N P0 P1...

where Gname is the name of the instance, A1 and A2 are the nodes between them the current source is arranged, whose current is calculated,

N is the number of the controlling voltages, E11 E12 ... E1N E2N are pairs of nodes between them the controlling voltages

are gripped, and P0, P1... are the coefficients that are called a0, a1, ... aM in the description of the polynomial f above.

To describe the SPICE line in Modelica, the following explanation would be useful:

Gname -> G_VCC_POLY name
A1, A2 -> pins name.p2, name.p1
N -> parameter N
E11 -> name.pc[2]
E12 -> name.pc[1]
...
E1N -> name.pc[N]
E2N -> name.pc[N-1]
P0, P1 -> polynomial coefficients name.coeff(coeff={P0,P1,...}) 

Parameters

TypeNameDefaultDescription
IntegerN1Number of controlling voltages
Realcoeff[:]{1}Coefficients of polynomial

Connectors

TypeNameDescription
PositivePinpPositive pin of the right port (potential p2.v > n2.v for positive voltage drop v2)
NegativePinnNegative pin of the right port
PositivePinpc[2 * N]Pin vector of controlling pins

Model Modelica.​Electrical.​Spice3.​Additionals.​H_CCV_POLY
Polynomial current controlled voltage source, like SPICE2

Information

The polynomial source is a SPICE2 model, which is also known in other SPICE derivatives.

Nonlinear current controlled voltage source. The right port voltage between pin p2 and n2 (=p2.v - n2.v) is controlled by the left port vector of currents at pin pc (=pc.i) via

    p2.v - n2.v = f(pc[2].i, pc[4].i,...)

The controlling port (left) current vector is zero.

The corresponding SPICE description

    Hname A1 A2 POLY(N) V1...VN P0 P1...

f is a polynomial in N variables s1...sN of the following form with M+1 coefficients a0, a1, a2,...aM.

f = a0 +
    a1s1 + a2s2 + ... + aNsN +
    a(N+1)s1² + a(N+2)s1s2 + ... + a(.)s1sN +
    a(.)s2² + a(.)s2s3 + ... + a(.)s2sN +
    a(.)s3² + s3s4 + ... + a(.)s4sN +
    ... +
    a(.)sN² +
    a(.)s1³ + a(.)s1²s2 + a(.)s1²s3 + ... + a(.)s1²sN +
    a(.)s1s2² + a(.)s1s2s3 + ... + a(.)s1s2sN +
    ... +
    a(.)sN³ + ... 

The Coefficients a(.) are counted in this order. Reaching M, the particular sum is canceled.

In Modelica the controlling pins have to be connected to the CCV in that way, that the required currents flow through the according pins of the CCV:

s1 = pc[2].i, s2 = pc[4].i, s3 = pc[6].i,...

The pairs pc[1].i and pc[2].i, pc[3].i and pc[4].i...form ports with pc[2].i + pc[1].i = 0, pc[4].i + pc[3].i = 0, ...

The corresponding SPICE description of the CCV polynomial source is the following:

    Hname A1 A2 POLY(N) V1...VN P0 P1...

where Hname is the name of the instance, A1 and A2 are the nodes between them the controlled voltage is gripped.

N is the number of the controlling currents, V1...VN are the voltage sources, that are necessary in SPICE to supply the controlling currents,

and P0, P1... are the coefficients that are called a0, a1, ... aM in the description of the polynomial f above.

To describe the SPICE line in Modelica, the following explanation would be useful:

Hname -> H_CCV_POLY name
A1, A2 -> pins name.p2, name.p1
N -> parameter N

V1 (...VN) is declared in SPICE:

   V1 V1+ V1- type of voltage source (constant, pulse, sin...)

In Modelica the currents through V1...VN has to be led through the CCV. Therefore V1...VN have to be disconnected and additional nodes

   V1_AD...VN_AD

have to be added. In the case, that the SPICE source is

   V1 n+ n- 0,

this source can be eliminated.

V1_AD -> name.pc[2]
V1- -> name.pc[1]
...
VN_AD -> name.pc[N]
VN- -> name.pc[N-1]
P0, P1 -> polynomial coefficients name.coeff(coeff={P0,P1,...})

Parameters

TypeNameDefaultDescription
IntegerN1Number of controlling voltages
Realcoeff[:]{1}Coefficients of polynomial

Connectors

TypeNameDescription
PositivePinpPositive pin of the right port (potential p2.v > n2.v for positive voltage drop v2)
NegativePinnNegative pin of the right port
PositivePinpc[2 * N]Pin vector of controlling pins

Model Modelica.​Electrical.​Spice3.​Additionals.​F_CCC_POLY
Polynomial current controlled current source, like SPICE2

Information

The polynomial source is a SPICE2 model, which is also known in other SPICE derivatives.

Nonlinear current controlled current source. The "right" port current at pin p2 (=p2.i) is controlled by the "left" port vector of currents at pin pc[:] via

    p2.i = f(pc[2].i, pc[4].i,...)

The controlling port (left) voltage is zero for each pair: pc[2].v - pc[1].v = 0, ...

Furthermore the currents of each pair are pc[2].i + pc[1].i = 0, ...

f is a polynomial in N variables s1...sN of the following form with M+1 coefficients a0, a1, a2,...aM.

f = a0 +
    a1s1 + a2s2 + ... + aNsN +
    a(N+1)s1² + a(N+2)s1s2 + ... + a(.)s1sN +
    a(.)s2² + a(.)s2s3 + ... + a(.)s2sN +
    a(.)s3² + s3s4 + ... + a(.)s4sN +
    ... +
    a(.)sN² +
    a(.)s1³ + a(.)s1²s2 + a(.)s1²s3 + ... + a(.)s1²sN +
    a(.)s1s2² + a(.)s1s2s3 + ... + a(.)s1s2sN +
    ... +
    a(.)sN³ + ... 

The Coefficients a(.) are counted in this order. Reaching M, the particular sum is canceled.

In Modelica the controlling pins have to be connected to the CCC in that way, that the required currents flow through the according pins of the CCC:

s1=pc[2].i, s2=pc[4].i, s3=pc[6].i,...

The pairs pc[1].i and pc[2].i, pc[3].i and pc[4].i...form ports with pc[2].i + pc[1].i = 0, pc[4].i + pc[3].i = 0, ...

The corresponding SPICE description of the CCC polynomial source is the following:

    Fname A1 A2 POLY(N) V1...VN P0 P1...

where Fname is the name of the instance, A1 and A2 are the nodes between them the current source is arranged, whose current is calculated.

N is the number of the controlling currents, V1...VN are the voltage sources, that are necessary in SPICE to supply the controlling currents,

and P0, P1... are the coefficients that are called a0, a1, ... aM in the description of the polynomial f above.

To describe the SPICE line in Modelica, the following explanation would be useful:

Fname -> F_CCC_POLY name
A1, A2 -> pins name.p2, name.p1
N -> parameter N

V1 (...VN) is declared in SPICE:

   V1 V1+ V1- type of voltage source (constant, pulse, sin...)

In Modelica the currents through V1...VN has to be led through the CCC. Therefore V1...VN have to be disconnected and additional nodes

   V1_AD...VN_AD

have to be added. In the case, that the SPICE source is

   V1 n+ n- 0,

this source can be eliminated.

V1_AD -> name.pc[2]
V1- -> name.pc[1]
...
VN_AD -> name.pc[N]
VN- -> name.pc[N-1]
P0, P1 -> polynomial coefficients name.coeff(coeff={P0,P1,...})

Parameters

TypeNameDefaultDescription
IntegerN1Number of controlling voltages
Realcoeff[:]{1}Coefficients of polynomial

Connectors

TypeNameDescription
PositivePinpPositive pin of the right port (potential p2.v > n2.v for positive voltage drop v2)
NegativePinnNegative pin of the right port
PositivePinpc[2 * N]Pin vector of controlling pins