PSS Electrical Module
MATLAB toolboxes for aerospace analysis
Electrical Functions

The Electrical module functions. View the published Electrical Demos. More...

Directories

directory Components
 
directory Demos
 
directory Electromagnetism
 
directory Help
 
directory MatrixConverter
 
directory Motor
 
directory SolarCell
 
directory Wire
 
directory Components
 
directory MatrixConverter
 
directory Motor
 

Functions

function ABC2SRF (in ABC, in S)
 Transformation from abc to the switching reference frame. More...
 
function ABToDQ (in i, in omegaT)
 Convert between AB and DQ coordinates for 3 phase currents. More...
 
function AngleEncoder (in x, in b)
 Angle encoder model. More...
 
function Capacitor (in g, in i)
 Dynamical model for a capacitor. More...
 
function ClassERFAmplifier (in f, in p, in vCEV, in v0, in sF, in qL, in r)
 ClassERFAmplifier design tool. More...
 
function ConformalCoilsInCylinder (in r, in z, in zL, in a, in aW, in nA, in nZ)
 Generate conformal coils in a cylinder. More...
 
function Diode (in g, in v)
 Dynamical model for a diode. More...
 
function DToA (in c, in b, in vMax, in vMin)
 Converts a digital word to a voltage. More...
 
function ForceBetweenCoils (in c, in p, in pS)
 Calculate the forces between a set of coils. More...
 
function Inductor (in g, in v)
 Dynamical model for an inductor model. More...
 
function LRLoopAntenna (in dAnt, in dWire, in f, in n, in rho)
 Computes the inductance and resistance of a circular loop antenna. More...
 
function LRRectangleAntenna (in s1, in s2, in w, in f, in n)
 Computes the inductance and resistance of a printed rectangular loop. More...
 
function MatchingCircuit (in r0, in rL, in xL, in pm)
 Designs an L-type matching circuit. More...
 
function MutualInductanceCoaxialCoil (in a1, in a2, in c)
 Mutual inductance between two filamentary coaxial coils. More...
 
function MutualInductanceCoil (in a1, in a2, in n1, in n2, in r, in u1, in u2)
 Mutual inductance between two coils. More...
 
function NPhase (in w0, in t, in n)
 Generate an n phase signal. More...
 
function ParksTransformation (in omega, in t)
 Parks transformation matrix from ABC to DQ coordinates for 3 phases. More...
 
function PerUnitNormalization (in p, in vL, in nPh, in nPP, in f, in type, in value)
 Per unit normalization. More...
 
function RectifierFullWave (in g, in v)
 Full wave rectifier. More...
 
function RectifierNPhase (in g, in v)
 N Phase rectifier. More...
 
function RectifierThreePhase (in v, in s)
 A six switch rectifier. More...
 
function SRF2ABC (in SRF, in S)
 Transformation from abc to switching reference frame. More...
 
function Transformer (in v1, in i1, in a)
 An ideal transformer. More...
 
function TransformerRHS (in i, in ignoredArg, in d)
 Dynamical model of a transformer in the dq frame. More...
 
function BiotSavart (in i, in r)
 The Biot Savart law. More...
 
function MC33Switching (in Vin, in Vref, in t)
 3-Phase to 3-Phase Matrix Converter Switching Functions. More...
 
function MCDynamics (in t, in x, in ignoredArg, in d)
 Matrix converter dynamics. More...
 
function AxialFluxCoil (in nPh, in nC, in aI, in aO, in rI, in rO, in angle, in cDir, in n)
 Generates the phase coil datastructure. More...
 
function BHalbach (in d, in x, in z)
 Computes the B field of a Halbach array. More...
 
function DCMotor (in v, in omega, in d)
 DC motor model. More...
 
function DFIGEquilibrium (in qRef, in omegaM, in d, in options, in x)
 Doubly fed induction generator model equilibrium voltages. More...
 
function DFIGRHS (in x, in ignoredArg, in d)
 Doubly fed induction generator model. More...
 
function FlywheelStresses (in rho, in mu, in omega, in rO, in rI, in r)
 Computes flywheel stresses. More...
 
function HalbachField (in n, in gap, in xW, in yW)
 Compute the field of a Halbach Segment. More...
 
function PitchServoRHS (in beta, in ignoredArg, in d)
 Pitch servo model. More...
 
function PMABCMachineRHS (in x, in ignoredArg, in d)
 Permanent magnet machine model in ABC coordinates. More...
 
function PMABCMachineSwitchedRHS (in x, in t, in d)
 Permanent magnet machine model in ABC coordinates with 6 switches. More...
 
function PMBMachineRHS (in x, in ignoredArg, in d)
 Permanent magnet brushless machine in DQ coordinates. More...
 
function ReluctanceMachineRHS (in x, in ignoredArg, in d)
 Right hand side for a 3 phase reluctance motor or generator. More...
 
function ShaftStresses (in t, in rI, in rO, in l, in g)
 Computes shaft stresses. More...
 
function SynchronousSpeed (in F, in numP)
 Motor synchronous speed (RPM) from frequency. More...
 
function BandGap (in T, in s)
 Photodiode bandgap. More...
 
function BandGapToWavelength (in eG)
 Compute wavelength from band gap. More...
 
function HgCdTe (in cDF)
 Mercury Cadmium Telluride band gap. More...
 
function HgCdTeWavelength (in lambda, in x)
 Mercury Cadmium Telluride wavelength to Cd fraction. More...
 
function SolarCell (in j, in T, in d)
 Solar cell voltage vs current. More...
 
function SolarCellEff (in T, in s)
 Solar cell monchromatic efficiency. More...
 
function WavelengthToBandGap (in lambda)
 Compute band gap from wavelength. More...
 
function ACResistance (in f, in d, in rho)
 Find enhanced AC wire resistance due to skin effect. More...
 
function DiameterAWG (in n)
 Diameter from AWG gauge. More...
 
function ResistanceAWG (in n, in sigma)
 Resistance from AWG gauge. More...
 
function ResistivityAluminum (in T, in alloy)
 Compute the resistivity of cryogenic aluminum alloys. More...
 
function ResistivityCopper (in t)
 Computes the resistivity of copper. More...
 
function SkinDepth (in f, in rho)
 Find electrical skin depth for an AC signal into a conductor. More...
 

Detailed Description

The Electrical module functions. View the published Electrical Demos.

Function Documentation

◆ ABC2SRF()

function ABC2SRF ( in  ABC,
in  S 
)

Transformation from abc to the switching reference frame.


Form

SRF = ABC2SRF(ABC,S)



Inputs

ABC         (3,1)  Voltage or current in ABC reference frame
S           (3,3)  Switching function matrix

Outputs

SRF         (3,1)  Voltage or current in SRF reference frame

Reference: Nikkhajoei et al "Dynamic Model of a Matrix Converter for Controller Design and System Studies", IEEE Transactions on Power Delivery, vol 21, no. 2, April 2006, pp 744-754


◆ ABToDQ()

function ABToDQ ( in  i,
in  omegaT 
)

Convert between AB and DQ coordinates for 3 phase currents.

It uses the length of the vector to determine the direction
of the transformation.


Type ABToDQ for a demo

Form

i = ABToDQ( i, omegaT )


Inputs

i             (2 or 3,1)  Current [iA;iB;iC] or [iD;iQ]
omegaT        (1,1)       Angular rate times time: omega*t

Outputs

i             (3 or 2,1)  Current [iD;iQ] or [iA;iB;iC]

Reference: Gill Estevez, P. ,"Model Dinamico de Una Turbina de velocidad variable con Generador de Imanes Permanentes y control de angulo de calaje ? Analisis de Control de Velocidad. Figure 7.


◆ ACResistance()

function ACResistance ( in  f,
in  d,
in  rho 
)

Find enhanced AC wire resistance due to skin effect.

Used to find eddy current losses. In the limit of long skin depth, reduces to DC resistance. In the limit of short skin depth, reduces to resistance of a thin layer on the outside of the wire.

Type ACResistance for a demo


Form

ACResistance;   % demo
R = ACResistance( f, d, rho )


Inputs

f      (1,:)    Frequency (Hz)
d      (1,1)  Wire diameter (m, default AWG 10)
rho    (1,1)    Resistivity (ohm*m, default Copper at 20 C)

Outputs

R      (1,:)  Resistance per unit length (ohm/m)
rhoEff (1,:)  Effective volume-averaged resistivity (ohm*m)

References: https://en.wikipedia.org/wiki/Skin_effect

Weeks, Walter L. (1981), Transmission and Distribution of Electrical Energy, Harper & Row, ISBN 978-0060469825


◆ AngleEncoder()

function AngleEncoder ( in  x,
in  b 
)

Angle encoder model.

Outputs is from 0 to b.

Type AngleEncoder for a demo.

Form

e = AngleEncoder( x, b )


Inputs

x     (:)     Angles
b     (1,1)   Maximum Counts

Outputs

e     (:)     Counts

◆ AxialFluxCoil()

function AxialFluxCoil ( in  nPh,
in  nC,
in  aI,
in  aO,
in  rI,
in  rO,
in  angle,
in  cDir,
in  n 
)

Generates the phase coil datastructure.

Type AxialFluxCoil for a demo.

Form

phase = AxialFluxCoil( nPh, nC, w, rI, rO, angle, cDir, n )



Inputs

nPh   (1,1)   Number of phases
nC    (1,1)   Number of coils per phase
aI    (1,1)   Inner angular width of coils (deg)
aI    (1,1)   Outer angular width of coils (deg)
rI    (1,1)   Inner radius (mm)
rO    (1,1)   Outer radius (mm)
angle (1,nC)    Angular location of coil  (deg)
cDir  (1,nC)  Current direction (1 = counterclockwise, -1 is clockwise)
n     (1,1)   Number of turns

Outputs

phase   (nPh)   Phase coil data structure

◆ BandGap()

function BandGap ( in  T,
in  s 
)

Photodiode bandgap.

This is the efficiency when exposed to monochromatic light in the
bandgap. At 0 deg-K the efficiency will be 1. Works for GaAs and Si.

Form

eG = BandGap( T, s )


Inputs

T          (1,:) Temperature (deg-K)
s          (1,:) Either 'silicon' or 'gallium arsenide' or
the data structure
.eG0   (1,1) Band gap at 0 deg-K (eV)
.alpha (1,1) Temperature coefficient (meV)
.beta  (1,1) Coefficent (deg-K}

Outputs

eG         (1,:) Bandgap (eV)

Reference: B. Van Zeghbroeck, "Chapter 4: P-N Junctions http://ece-www.colorado.edu/~bart/book/book/ chapter2/pdf/ex2_2.pdf


◆ BandGapToWavelength()

function BandGapToWavelength ( in  eG)

Compute wavelength from band gap.

Type BandGapToWavelength for a demo.


Form

lambda = BandGapToWavelength( eG )


Inputs

eG      (1,:) Band gap (eV)

Outputs

lambda  (1,:) Wavelength (microns)

See also: WavelengthToBandGap


◆ BHalbach()

function BHalbach ( in  d,
in  x,
in  z 
)

Computes the B field of a Halbach array.

d.lA is the length of one cycle of the Halbach array.
d.nM is the number of magnets per pole.

Form

[bX, bZ] = BHalbach( d, x, z )


Inputs

d             (1,1)   
.t (1,1) Distance between magnets in double sided
rotor. If zero assumed single sided
.bR (1,1) Magnet remanence (T)
.hM (1,1) Magnet thickness (m)
.lA (1,1) Pole period (m)
.nM (1,1) Number of pieces per pole
x             (1,n)    x coordinates
z             (1,m)    z coordinates

Outputs

bX            (m,n)    X field (T)
bZ            (m,n)    Z field (T)

Reference: Gieras, J. F., Wang, R. and M. J. Kamper, "Axial Flux Permanent Magnet Brushless Machines," Kluwer Academic Publishers, pp. 110-111.


◆ BiotSavart()

function BiotSavart ( in  i,
in  r 
)

The Biot Savart law.

The Biot Savart law computes the magnetic field vector given current elements. The vector from i to r is done from the middle of each element. If this would cause a divide by zero it adjusts the location. You may still get unphysical answers if the position is too close to the loop. i may be a vector of data structures. For closed loops include the first and last point in i(k).node.

Type BiotSavart for a demo of a straight line and current loops.


Form

b = BiotSavart( i, r )


Inputs

i     (.) Data structure of currents
.node   (3,:) Current element nodes. Units are meters.
.mag   (1,1) Magnitude of the current. Units are Amperes.
r     (3,:) Locations. Units are meters.

Outputs

b     (3,:) Field vector at the grid points. Units are Tesla

◆ Capacitor()

function Capacitor ( in  g,
in  i 
)

Dynamical model for a capacitor.

It determines the voltage derivative from inductance and current. 


i = c dv/dt


Returns dv/dt or the state space matrices [a, b, c, d]

Form

[a, b, c, d] = Capacitor( c )


or


iDot         = Capacitor( g, i )


Inputs

g          (1,1)  Data structure
.c        (1,1) Capacitance
i          (1,1)  Current

Outputs

iDot pr a  (1,1)  Voltage derivative or state matrix
b          (1,1)  Input matrix
c          (1,1)  Output matrix
d          (1,1)  Feedthrough matrix

◆ ClassERFAmplifier()

function ClassERFAmplifier ( in  f,
in  p,
in  vCEV,
in  v0,
in  sF,
in  qL,
in  r 
)

ClassERFAmplifier design tool.

Produces the inductor and capacitor values for the circuit. qL is the quality. infinite quality means that the circuit is tuned exactly to the frequency f. If r is entered, it will compute the power from r.

Type ClassERFAmplifier for a demo.


Form

[d,s] = ClassERFAmplifier( f, p, vCE, v0, qL, sF, r )


Inputs

f     (1,1) Frequency (kHz)
p     (1,1) Power (W)
vCEV    (1,1) Collector to emitter voltage (V)
v0    (1,1) Base voltage (V)
qL    (1,1) Quality
sF    (1,1) Safety factor
r     (1,1) Load resistance (Ohm)

Outputs

d   (.)   Data structure output
.c1 Capacitor 1 (F)
.c2 Capacitor 2 (F)
.l1 Inductor 1 (H)
.l2 Inductor 2 (H)
.r  Load (Ohms)
.vCC Collector voltage
s   {:,2} Latex array for latex documents

Reference: Nathan O. Sokal,"Class-E High-Efficiency RF/Microwave Power Amplifiers: Principles of Operation, Design Procedures, and Experimental Verification."


◆ ConformalCoilsInCylinder()

function ConformalCoilsInCylinder ( in  r,
in  z,
in  zL,
in  a,
in  aW,
in  nA,
in  nZ 
)

Generate conformal coils in a cylinder.

The coils are embedded in a cylinder of radius r at locations z. The resulting points are compatible with ForceBetweenCoils. If there are no outputs produces a figure.

Type ConformalCoilsInCylinder for a demo.


Form

p = ConformalCoilsInCylinder( r, z, zL, a, aW, nA, nZ )


Inputs

r       (1,1)  Cylinder radius
z       (1,:)  Z location 
zL      (1,:)  Z length
a       (1,:)  Angular location (rad)
aW      (1,:)  Angular width (rad)
nA      (1,1)  Number of segments per arc, optional, default 20
nZ      (1,1)  Number of segments along z, optional, default 1

Outputs

p       {}     Sets of points for each coil, each 3xn

◆ DCMotor()

function DCMotor ( in  v,
in  omega,
in  d 
)

DC motor model.


Form

u = DCMotor( v, omega, d )


Inputs

v             (:)     Input voltage
omega         (:)     Angular rate (rad/sec)
d             (:)     Data structure 
.kT  Torque constant
.r    Resistance
.iMax Maximum current
.iMin Minimum current
.kG   Power amplifier gain
.vMax Maximum voltage

Outputs

u             (:)     Voltage

◆ DFIGEquilibrium()

function DFIGEquilibrium ( in  qRef,
in  omegaM,
in  d,
in  options,
in  x 
)

Doubly fed induction generator model equilibrium voltages.

Computes the equilibrium voltages and states

Form

[u, x] = DFIGEquilibrium( qRef, omegaM, options, x )


Inputs

qRef       (1,1)  Reference reactive power
omegaM     (1,1)  Mechanical power
d          (1,1)  Machine data structure
.p      (1,1) Number of poles
.lM     (1,1) Mutual inductance (H)
.lR     (1,1) Rotor inductance (H)
.lR     (1,1) Stator inductance (H)
.rR     (1,1) Rotor resistance (Ohm)
.rS     (1,1) Stator resistance (Ohm)
.u      (4,1) Phase voltages [uDS;uQS;uDR;uQR] (V)
.omegaS (1,1) Synchronous speed (rad/s)
.tM     (1,1) Mechanical torque (Nm)
.j      (1,1) Inertia (kg-m^2)
options    {}     Options for fminsearch
x          (4,1)  Initial guess for [iDS;iQS;iDR;iQR]

Outputs

uR         (2,1)  Rotor voltages[uD;uQ]
x          (6,1)  States [iDS;iQS;iDR;iQR;omega;angle]

◆ DFIGRHS()

function DFIGRHS ( in  x,
in  ignoredArg,
in  d 
)

Doubly fed induction generator model.


Form

[xDot, tE, pD] = DFIGRHS( x, t, d )


Inputs

x          (6,1)  States [iDS;iQS;iDR;iQR;omega;angle]
t          (1,1)  Time (not used)
d          (1,1)  Machine data structure
.p      (1,1) Number of poles
.lM     (1,1) Mutual inductance (H)
.lR     (1,1) Rotor inductance (H)
.lR     (1,1) Stator inductance (H)
.rR     (1,1) Rotor resistance (Ohm)
.rS     (1,1) Stator resistance (Ohm)
.u      (4,1) Phase voltages [uDR;uDQ;uDS;uQS] (V)
.omegaS (1,1) Synchronous speed (rad/s)
.tM     (1,1) Mechanical torque (Nm)
.j      (1,1) Inertia (kg-m^2)

Outputs

xDot       (5,1)  State Derivatives  [iDS;iQS;iDR;iQR;omega;angle]
tE         (1,1)  Electrical torque (Nm)
q          (2,1)  Reactive power [s;r] (W)
p          (2,1)  Power [s;r] (W)

Reference: T. Demiray, F. Milano and G. Andersson,"Dynamic Phasor Modeling of the Doubly-fed Induction Generator under Unbalanced Conditions


◆ DiameterAWG()

function DiameterAWG ( in  n)

Diameter from AWG gauge.


Form

DiameterAWG;
d = DiameterAWG( n )


Inputs

n          (1,:) AWG gauge 0000 is -3

Outputs

d          (1,:) Diameter (mm)

Reference: http://en.wikipedia.org/wiki/American_wire_gauge# Table_of_AWG_wire_sizes


◆ Diode()

function Diode ( in  g,
in  v 
)

Dynamical model for a diode.

Determines output current.


vO = v if v > g.vDiode.


Returns vO or the state space matrices [a, b, c, d]. The state space
model is for the operating region when v > v.vDiode

Form

[a, b, c, d] = Diode( g )


or


vO          = Diode( g, v )


Inputs

g          (1,1)  Data structure
.vDiode    (1,1) Diode voltage
v          (1,1)  Voltage

Outputs

vO or a    (1,1)  Output current
b          (1,1)  Input matrix
c          (1,1)  Output matrix
d          (1,1)  Feedthrough matrix

◆ DToA()

function DToA ( in  c,
in  b,
in  vMax,
in  vMin 
)

Converts a digital word to a voltage.


Form

v = DToA( c, b, vMax, vMin )


Inputs

c               (:)     Commands
b             (:)     Maximum counts (8 bit = 256)
vMax          (:)     Maximum voltage                      
vMin          (:)     Minimum voltage                      

Outputs

v             (:)     Voltage

◆ FlywheelStresses()

function FlywheelStresses ( in  rho,
in  mu,
in  omega,
in  rO,
in  rI,
in  r 
)

Computes flywheel stresses.

The Tresca Stress must be less than the safe yield stress.

Type FlywheelStresses for a demo.


Form

sigmaR,sigmaTheta,trescaStress] = FlywheelStresses( rho, mu,
omega, rO, rI, r )


Inputs

rho           (1,1)   Density (kg/m^3)
mu            (1,1)   Poisson's ratio
omega         (1,1)   Angular rate (rad/s)
rO            (1,1)   Outer radius (m)
rI            (1,1)   Inner radius (m)
r             (1,:)   Radial position (m)

Outputs

sigmaR        (1,:)   Radial stresses (N/m^2)
sigmaTheta    (1,:)   Circumferential stresses (N/m^2)
trescaStress    (1,1)   Tresca criteria (N/m^2)

Reference: Yongjie Hana, Zhengyi Ren, Yongxiang Tong, "General Design Method of Flywheel Rotor for Energy Storage System", Energy Procedia 16 (2012) 359-364.


◆ ForceBetweenCoils()

function ForceBetweenCoils ( in  c,
in  p,
in  pS 
)

Calculate the forces between a set of coils.

The integral is discretized into the given number of increments. The forces are computed for all of the coils. It computes the forces between line segments at the midpoint of each segment. f is a cell array giving the force imparted by coil k on j ~= k. This does not compute the self force. Use pS to restrict the combinations.

Type ForceBetweenCoils to compute the force between 2 concentric circular coils with a 45 degree tilt. If there are no outputs produces a plot.


Form

f = ForceBetweenCoils( c, p, pS )


Inputs

c       (1,:)   Current in each coil (A)
p       {}      Sets of points for each coil.
pS      (1,:)   Set to test (optional)

Outputs

f       {}(3,:) Force in x,y,z

◆ HalbachField()

function HalbachField ( in  n,
in  gap,
in  xW,
in  yW 
)

Compute the field of a Halbach Segment.

Uses ideal dipoles to plot a Halbach field. The dipoles are in the xy-plane along x and at y = 0 The segment number is:

0: All up 1: left down right up left 5 2: add a 45 degree dipole between each 3: add 22.5, 45, 77.5 dipoles between each etc.

Type HalbachField for a demo.


Form

HalbachField( n, gap, xW, yW )


Inputs

n      (1,1) Segment number (see above)
gap    (1,1) Gap at y = 0 to prevent infinite fields
xW     (1,1) Plot width in x (m)
yW     (1,1) Plot width in y (m)

Outputs

None

◆ HgCdTe()

function HgCdTe ( in  cDF)

Mercury Cadmium Telluride band gap.

Fits a curve x(1) + x(2)*cDF + x(3)*cDF^3

Type HgCdTe for a demo.


Form

[e,x] = HgCdTe( cDF )


Inputs

cDF   (1,:) Cadmium fraction

Outputs

e     (1,:) Band gap (eV)
x     (1,4) Coefficients

Reference: https://en.wikipedia.org/wiki/Mercury_cadmium_telluride


◆ HgCdTeWavelength()

function HgCdTeWavelength ( in  lambda,
in  x 
)

Mercury Cadmium Telluride wavelength to Cd fraction.

Type HgCdTe for a demo.

Form

cDF = HgCdTeWavelength( lambda )


Inputs

lambda  (1,:) Wavelength (microns)
x       (1,3) Coefficients

Outputs

cDF     (1,:) Cadmium fraction

◆ Inductor()

function Inductor ( in  g,
in  v 
)

Dynamical model for an inductor model.

Finds current derivative from inductance and voltage.


v = l di/dt


Returns di/dt or the state space matrices [a, b, c, d]

Form

[a, b, c, d] = Inductor( l )


or


iDot         = Inductor( g, v )


Inputs

g          (1,1)  Data structure
.l        (1,1) Inductance
v          (1,1)  Voltage

Outputs

iDot or a  (1,1)  Current derivative or state matrix
b          (1,1)  Input matrix
c          (1,1)  Output matrix
d          (1,1)  Feedthrough matrix

◆ LRLoopAntenna()

function LRLoopAntenna ( in  dAnt,
in  dWire,
in  f,
in  n,
in  rho 
)

Computes the inductance and resistance of a circular loop antenna.

Default: copper.

Type LRLoopAntenna for a demo.


Form

[l, r, rLoss, rRad] = LRRectangleAntenna( s1, s2, w, f, n )


Inputs

dAnt    (1,1) Antenna diameter (meters)
dWire (1,1) Wire diameter (meters)
f     (1,:) Frequency (Hz)
n     (1,1) Number of loops
rho   (1,1) Restivity (Ohm*m, default Copper)

Outputs

l       (1,1)   Inductance (H)
r     (1,:) Total resistance (Ohm)
rLoss   (1,:) Resistance loss (Ohm)
rRad    (1,:) Radiation loss (Ohm)

Reference: https://www.ece.mcmaster.ca/faculty/nikolova/antenna_dload/current_lectures/L12_Loop.pdf https://www.eeweb.com/tools/loop-inductance


◆ LRRectangleAntenna()

function LRRectangleAntenna ( in  s1,
in  s2,
in  w,
in  f,
in  n 
)

Computes the inductance and resistance of a printed rectangular loop.

It assumes copper. Printed rectangular loop antenna.

Type LRLoopAntenna for a demo.


Form

[l, r, rLoss, rRad] = LRRectangleAntenna( s1, s2, w, f, n )


Inputs

s1      (1,1) Side 1 length (meters)
s2      (1,1) Side 2 length (meters)
w       (1,1) Width of the conductor (meters)
f     (1,:) Frequency (Hz)
n     (1,1) Number of loops

Outputs

l       (1,1)   Inductance (H)
r     (1,:) Total resistance (Ohm)
rLoss   (1,:) Resistance loss (Ohm)
rRad    (1,:) Radiation loss (Ohm)

Reference: http://www.ateretwireless.com/Mutual%20Inductance% 20Matching%20for%20Small%20Loop%20Antennas_2.pdf


◆ MatchingCircuit()

function MatchingCircuit ( in  r0,
in  rL,
in  xL,
in  pm 
)

Designs an L-type matching circuit.

Goes between a load and a source so that the source sees effective resistance r0. r0 must be real. The load has some resistance and reactance.

The output is in units of reactance, but this can be converted into capacitance or impedance via xC = -1/C*w and xL = L*w.

Type MatchingCircuit for a demo of a 50 ohm purely resistive load.


Form

[xS,xP,sFirst] = MatchingCircuit( r0, rL, xL, pm )


Inputs

r0     (1,1) Desired effective resistance (Ohm)
rL     (1,:) Load resistance (Ohm)
xL     (1,:) Load reactance (Ohm), zL = rL + i*xL
pm     (1,1) Plus or minus 1, selecting root of solution. Useful for
deciding whether you want to have an inductor in parallel.

Outputs

xS     (1,:) Reactance of series element (Ohm). 
xP     (1,:) Reactance of parallel element (Ohm). 
sFirst (1,:) Logical. If true, series element must be first in the
L-type matching network (r0<rL). If false, parallel
element must be first in the L-type matching network
(rL<r0).

Reference: http://rfic.eecs.berkeley.edu/142/pdf/module6.pdf


Copyright (c) 2020 Princeton Satellite Systems, Inc. All rights reserved.


Since version 2020.1


◆ MC33Switching()

function MC33Switching ( in  Vin,
in  Vref,
in  t 
)

3-Phase to 3-Phase Matrix Converter Switching Functions.



Inputs

Vin         (3,1)  Input voltage in abc reference frame variables
Vref        (3,1)  Reference voltage specification: [magnitude (Volts);
frequency (rad/s);
phase (rad)]
t           (1,1)  Time (s)

Outputs

S           (3,3)  Switching function matrix
[S1  S2  S3;
S2  S3  S1;
S3  S1  S2]

Reference: Nikkhajoei et al "Dynamic Model of a Matrix Converter for Controller Design and System Studies", IEEE Transactions on Power Delivery, vol. 21, no. 2, April 2006, pp 744-754


◆ MCDynamics()

function MCDynamics ( in  t,
in  x,
in  ignoredArg,
in  d 
)

Matrix converter dynamics.

Right hand side for use with ode113.



Inputs

x    (6,1)    State Vector 
[i_abgi^s;
v_abgi^s-v_abg^s];
d     (.)     Structure containing model parameters   
.omegaGE  (1,1)
.vref     (2,1)
.vsalbega (1,1)
.Rn       (1,1)
.Ln       (1,1)
.CI       (1,1)
.S        (3,3) Transformation matrix to SRF
t   (1,1)     Time (s)

Outputs

xdot   (6,1)  State vector derivatives

Reference: Nikkhajoei et al "Dynamic Model of a Matrix Converter for Controller Design and System Studies", IEEE Transactions on Power Delivery, vol 21, no. 2, April 2006, pp 744-754.


◆ MutualInductanceCoaxialCoil()

function MutualInductanceCoaxialCoil ( in  a1,
in  a2,
in  c 
)

Mutual inductance between two filamentary coaxial coils.

Type MutualInductanceCoaxialCoil for a demo for two coils in the same plane. Computes both M12 and M21 to show reciprocity.


Form

m = MutualInductanceCoaxialCoil( a1, a2, c )


Inputs

a1      (1,1)  Area of coil 1 (m^2)
a2      (1,1)  Area of coil 2 (m^2)
c       (1,:)  Axial distance (m)

Outputs

m       (1,1)  Mutual inductance (H)

Reference: Cevdet Akyel, Slobodan I. Babic, Ke Wu and Jose Fernando

Mojica, "Mutual Inductance of Thin Coaxial Circular Coils with Constant Current Density in Air (Filament Method)," Proceedings of the 5th WSEAS International Conference on Telecommunications and Informatics, Istanbul, Turkey, May 27-29, 2006 (pp 168-175).


◆ MutualInductanceCoil()

function MutualInductanceCoil ( in  a1,
in  a2,
in  n1,
in  n2,
in  r,
in  u1,
in  u2 
)

Mutual inductance between two coils.

The mutual inductance between two coils. It will use MutualInductanceCoaxialCoil if the magnitude of r is zero. Generally valid only for r >> sqrt(a)/pi, i.e. a farfield solution.s

Type MutualInductanceCoil for a demo.


Form

m = MutualInductanceCoil( a1, a2, n1, n2, r, u1, u2  )


Inputs

a1      (1,1)  Area of coil 1 (m^2)
a2      (1,1)  Area of coil 2 (m^2)
n1      (1,1)  Number of turns coil 1
n2      (1,1)  Number of turns coil 2
r       (3,:)  Vector from 1 to 2 (m)
u1      (3,1)  Unit vector for coil 1, ignored if |r| is zero
u2      (3,1)  Unit vector for coil 2

Outputs

m       (1,1)  Mutual inductance (H)

Reference:


◆ NPhase()

function NPhase ( in  w0,
in  t,
in  n 
)

Generate an n phase signal.

The magnitude is +/- 1.


Type NPhase for a demo.

Form

v = NPhase( w0, t, n )


Inputs

w0           (1,1) Base frequency (rad/s)
t            (1,:) Time
n            (1,1) Number of phases

Outputs

v            (n,:) Phases

◆ ParksTransformation()

function ParksTransformation ( in  omega,
in  t 
)

Parks transformation matrix from ABC to DQ coordinates for 3 phases.

Type ParksTransformation for a demo.


Form

mABToDQ = ParksTransformation( omega, t )



Inputs

omega      (1,1)  Electrical frequency (rad/sec)
t          (1,1)  Time

Outputs

mABToDQ    (2,3)  Transformation matrix

Reference: A. Tahri, A. Draou, "DESIGN OF A SIMPLE MEASURING TECHNIQUE OF THE INSTANTANEOUS POWER IN THREE PHASE SYSTEM," Journal of ELECTRICAL ENGINEERING, VOL. 56, NO. 7-8, 2005, 221?224.


◆ PerUnitNormalization()

function PerUnitNormalization ( in  p,
in  vL,
in  nPh,
in  nPP,
in  f,
in  type,
in  value 
)

Per unit normalization.

Type PerUnitNormalization for a demo.

Form

[pu, d] = PerUnitNormalization( p, vL, nPh, nPP, f, type, value )
d       = PerUnitNormalization( p, vL, nPh, nPP, f )


Inputs

p          (1,1)  Power
vL         (1,1)  Line-to-line voltage
nPh        (1,1)  Number of phases
nPP        (1,1)  Number of pole pairs
f          (1,1)  Frequency (Hz)
type       (1,:)  Type of quantity
value      (1,:)  Value of type

Outputs

pu         (1,1)  Per unit quantity
d          (1,1)  Base data structure
d.pB      (1,1) Base power
d.vB      (1,1) Base voltage
d.iB      (1,1) Base current
d.rB      (1,1) Base resistance
d.lB      (1,1) Base inductance
d.cB      (1,1) Base capacitance
d.omegaB  (1,1) Base frequency
d.tB      (1,1) Base torque
d.lambdaB (1,1) Base flux
d.pNom    (1,1) Nominal power

◆ PitchServoRHS()

function PitchServoRHS ( in  beta,
in  ignoredArg,
in  d 
)

Pitch servo model.


Form

betaDot = PitchServoRHS( beta, t, d )


Inputs

beta          (1,1)       Pitch angle
t             (1,1)       Time (not used)
d             (1,1)       Data structure
.k             (1,1) Forward gain
.betaLimit     (1,1) Maximum beta
.betaRateLimit (1,1) Maximum beta rate

Outputs

betaDot       (2,1)       Beta rate

Reference: Gill Estevez, P. ,"Model Dinamico de Una Turbina de velocidad variable con Generador de Imanes Permanentes y control de angulo de calaje ? Analisis de Control de Velocidad. Figure 6.


◆ PMABCMachineRHS()

function PMABCMachineRHS ( in  x,
in  ignoredArg,
in  d 
)

Permanent magnet machine model in ABC coordinates.

Assumes a 3 phase machine in a Y connection.
The permanent magnet flux distribution is assumed sinusoidal.

Form

d = PMABCMachineRHS;
xDot = PMABCMachineRHS( x, t, d )


Inputs

x       (5,1)    The state vector [iA;iB;iC;omegaM;thetaM]
t       (1,1)    Time (unused)
d       (1,1)    Data structure
.lM   (1,1) Mutual inductance
.psiM (1,1) Permanent magnet flux (T)
.lSS  (1,1) Stator self inductance
.rS   (1,1) Stator resistance (Ohms)
.p    (1,1) Number of poles (1/2 pole pairs)
.u    (3,1) [uA;uB;uC]
.tL   (1,1) Load torque
.bM   (1,1) Viscous damping (Nm/rad/s)
.j    (1,1) Inertia

Outputs

xDot   (5,1)    The state vector derivative

Reference: Lyshevski, S. E., "Electromechanical Systems, Electric Machines, and Applied Mechatronics," CRC Press, 2000,


◆ PMABCMachineSwitchedRHS()

function PMABCMachineSwitchedRHS ( in  x,
in  t,
in  d 
)

Permanent magnet machine model in ABC coordinates with 6 switches.

The switches connect the 3 phases to a resistor and capactor in
parallel.
Assumes a 3 phase machine in a Y connection. Control is by setting
the switch positions.
The permanent magnet flux distribution is assumed sinusoidal.
The switch state has six possibilities. For a six switch inverter we"
define


v   
|
s1
|- Phase A ----------
s4
|
ground



v   
|
s3
|- Phase B ----------
s6
|
ground


v   
|
s5
|- Phase C ----------
s2
|
ground


The switch states are


uA        uB        uC
1 S5,S6,S1 closed      1/3      -2/3      1/3
2 S6,S1,S2 closed      2/3      -1/3     -1/3
3 S1,S2,S3 closed      1/3       1/3     -2/3
4 S2,S3,S4 closed     -1/3       2/3     -1/3
5 S3,S4,S5 closed     -2/3       1/3      1/3
6 S4,S5,S6 closed     -1/3      -1/3      2/3

Form

d = PMABCMachineSwitchedRHS;
xDot = PMABCMachineSwitchedRHS( x, t, d )


Inputs

x       (6,1)    The state vector [iA;iB;iC;omegaM;thetaM;u]
t       (1,1)    Time
d       (1,1)    Data structure
.lM   (1,1) Mutual inductance
.psiM (1,1) Permanent magnet flux
.lSS  (1,1) Stator self inductance
.rS   (1,1) Stator resistance
.p    (1,1) Number of poles (1/2 pole pairs)
.s    (1,1) Switch state
.tL   (1,1) Load torque
.bM   (1,1) Viscous damping (Nm/rad/s)
.j    (1,1) Inertia
.cL   (1,1) Load capacitance
.rL   (1,1) Load resistance

Outputs

x       (6,1)    The state vector derivative

Reference: Lyshevski, S. E., "Electromechanical Systems, Electric Machines, and Applied Mechatronics," CRC Press, 2000,


◆ PMBMachineRHS()

function PMBMachineRHS ( in  x,
in  ignoredArg,
in  d 
)

Permanent magnet brushless machine in DQ coordinates.

It returns only the motor current derivatives. It assumes
that the inductances and magnet flux are not functions of time.

Form

d = PMBMachineRHS;
[xDot, tE, pD] = PMBMachineRHS( x, t, d )


Inputs

x          (4,1)  States [iD;iQ;omegaM;thetaM]
t          (1,1)  Time (not used)
d          (1,1)  Machine data structure
.p   (1,1) Number of poles
.lMD (1,1) Direct mutual inductance (H)
.lMQ (1,1) Quadrature mutual inductance (H)
.psi (1,1) Magnet Flux
.rS  (1,1) Stator resistance (Ohm)
.u   (2,1) Phase voltages [uD;uQ] (V)
.inr (1,1) Polar  (kg-m^2)
.tM  (1,1) Mechanical torque (Nm)

Outputs

xDot       (4,1)  State Derivative [iD;iQ;omegaM;thetaM]
tE         (1,1)  Electrical torque (Nm)
pD         (1,1)  Power dissipated (W)

◆ RectifierFullWave()

function RectifierFullWave ( in  g,
in  v 
)

Full wave rectifier.

This uses 4 diodes.

Type RectifierFullWave for a demo.

Form

vO = RectifierFullWave( g, v )


Inputs

g          (1,1)  Data structure
.vDiode    (1,1) Diode threshold voltage
v          (1,:)  Voltages

Outputs

vO         (1,:)  Output voltage

◆ RectifierNPhase()

function RectifierNPhase ( in  g,
in  v 
)

N Phase rectifier.

This uses 2*n diodes.

Type RectifierNPhase for a demo.

Form

vO = RectifierNPhase( g, v )


Inputs

g          (1,1)  Data structure
.vDiode    (1,1) vDiode
v          (n,1)  Voltages

Outputs

vO         (1,1)  Output voltage

◆ RectifierThreePhase()

function RectifierThreePhase ( in  v,
in  s 
)

A six switch rectifier.

The switch states are [A+;A-;B+;B-;C+;C-]


Type RectifierThreePhase for a demo.

Form

vO = RectifierThreePhase( v, s )



Inputs

v          (3,:)  Voltages
s          (6,:)  Switch states

Outputs

vO         (1,:)  Output voltage

◆ ReluctanceMachineRHS()

function ReluctanceMachineRHS ( in  x,
in  ignoredArg,
in  d 
)

Right hand side for a 3 phase reluctance motor or generator.

Static and coulomb friction are allowed.

Form

[xDot, tE] = ReluctanceMachineRHS( x, t, d )


Inputs

x          (5,1)  States [iAS;iBS;iCS;omegaR;thetaR]
t          (1,1)  Time (not used)
d          (1,1)  Machine data structure
.p   (1,1) Number of poles
.b   (1,1) Viscous friction (Nms/rad)
.s   (1,1) Static friction (Nm)
.j   (1,1) Inertia (kg-m^2)
.lMD (1,1) Direct mutual inductance (H)
.lMQ (1,1) Quadrature mutual inductance (H)
.lLS (1,1) Self inductance (H)
.rS  (1,1) Stator resistance (Ohm)
.tL  (1,1) Load torque (Nm)
.u   (3,1) Phase voltages (V)

Outputs

xDot       (5,1)  State Derivative [iAS;iBS;iCS;omega;theta]
tE         (1,1)  Electrical torque (Nm)

Reference: Lyshevski, S. E., "Electromechanical Systems, Electric Machines, and Applied Mechatronics," CRC Press, 2000, pp. 567-575.


◆ ResistanceAWG()

function ResistanceAWG ( in  n,
in  sigma 
)

Resistance from AWG gauge.

Default conductivity is for copper.

Form

ResistanceAWG;
r = ResistanceAWG( n, sigma )


Inputs

n           (1,:) AWG gauge 0000 is -3
sigma       (1,1) Conductivity (1/Ohm*m)

Outputs

r           (1,:) Resistance (Ohm/m)

◆ ResistivityAluminum()

function ResistivityAluminum ( in  T,
in  alloy 
)

Compute the resistivity of cryogenic aluminum alloys.

Uses interpolation from a table of resistivities from 10K to 295K. The default is pure aluminum (alloy 1100). Also contains data for 5083-0 and 6061-T6.


Form

rho = ResistivityAluminum( T, alloy )


Inputs

T      (1,:)   Temperature (deg-K)
alloy   ''     String, from {'1100','5083','6061'}

Outputs

rho    (1,:)   Resisitivity, Ohm-m

◆ ResistivityCopper()

function ResistivityCopper ( in  t)

Computes the resistivity of copper.

Fits low and high temperature curves.

Type ResistivityCopper for a demo.


Form

rho = ResistivityCopper( t )


Inputs

t   (1,:) Temperature (deg-K)

Outputs

rho (1,:) Resistivity (Ohm-m)

Reference: Lisa M. Larrimor, "Low Temperature Resistivity," https://www.sccs.swarthmore.edu/users/02/lisal/ physics/labs/lowtemp.pdf


◆ ShaftStresses()

function ShaftStresses ( in  t,
in  rI,
in  rO,
in  l,
in  g 
)

Computes shaft stresses.

Type ShaftStresses for a demo.


Form

[tau, alpha, j] = ShaftStresses( t, rI, rO, l, g )


Inputs

t         (1,1)   Torque (Nm)
rO        (1,1)   Outer radius (m)
rI        (1,1)   Inner radius (m)
l           (1,:)   Length (m)
g         (1,1)   Modulus of rigidity (Pa)

Outputs

tau       (1,1)   Torsional stress (Pa)
alpha     (1,1)   Twist angle
j         (1,1)   Moment of inertia (m^4)

Reference: J. Dugundji, "16.20 Structural Mechanics Course Notes," MIT, 1976.


◆ SkinDepth()

function SkinDepth ( in  f,
in  rho 
)

Find electrical skin depth for an AC signal into a conductor.

Used to find eddy current losses

Type SkinDepth for a demo


Form

delta = SkinDepth( f, rho )


Inputs

f      (1,:)    Frequency (Hz)
rho    (1,1)    Resistivity (ohm*m, default Copper at 20 C)

Outputs

delta  (1,:) Skin depth (m)

References: https://en.wikipedia.org/wiki/Skin_effect

Weeks, Walter L. (1981), Transmission and Distribution of Electrical Energy, Harper & Row, ISBN 978-0060469825


◆ SolarCell()

function SolarCell ( in  j,
in  T,
in  d 
)

Solar cell voltage vs current.

If j is empty it generates a full v-i curve.


Since version 8.

Form

SolarCell    
v = SolarCell( j, T, d )


Inputs

j          (1,:) Current density (A/m^2)
T          (1,n) Temperature (deg-K)
d          (1,1) Data structure
.r  (1,1) Series resistance (Ohm/m^2)
.jL (1,1) Photo current

Outputs

v          (1,:) Voltage (V)

Reference: Partain, L. D., "Solar Cells and Their Applications", Wiley, pp. 6-7.


◆ SolarCellEff()

function SolarCellEff ( in  T,
in  s 
)

Solar cell monchromatic efficiency.

This is the efficiency when exposed to monochromatic light in the
bandgap. At 0 deg-K the efficiency will be 1.

Form

SolarCellEff
eff = SolarCellEff( T, s )


Inputs

T          (1,:) Temperature (deg-K)
s          (1,:) Either 'silicon' or 'gallium arsenide'

Outputs

eff        (1,n) Monochromatic efficiency

Reference: B. Van Zeghbroeck, "Chapter 4: P-N Junctions http://ece.colorado.edu/~bart/book/book/chapter4/ch4_8.htm


◆ SRF2ABC()

function SRF2ABC ( in  SRF,
in  S 
)

Transformation from abc to switching reference frame.

You need to pass the switching function matrix.


Inputs

SRF         (3,1)  Voltage or current in SRF reference frame
S           (3,3)  Switching function matrix

Outputs

ABC         (3,1)  Voltage or current in ABC reference frame

Reference: Nikkhajoei et al "Dynamic Model of a Matrix Converter for Controller Design and System Studies", IEEE Transactions on Power Delivery, vol. 21, no. 2, April 2006, pp 744-754


◆ SynchronousSpeed()

function SynchronousSpeed ( in  F,
in  numP 
)

Motor synchronous speed (RPM) from frequency.

Compute motor speed in revolutions per minute from electrical frequency and number of poles. This is the speed at which the magnetic field rotates. There is an additional factor of 2 which accounts for the total number of zero crossings.


Forms: rpm = SynchronousSpeed( F, numP )



Input

F     (1,1)    Motor frequency
numP  (1,1)    Number of poles   

Output

rpm   (1,1)    Motor speed in RPM

◆ Transformer()

function Transformer ( in  v1,
in  i1,
in  a 
)

An ideal transformer.

The current ratio can be n or 1/n where n is the ratio of turns in the
two inductors.

Form

[v2, i2] = Transformer( v1, i1, a )


Inputs

v1           (1,1) Input voltage
i1           (1,1) Input current
a            (1,1) Current ratio

Outputs

v2           (1,1) Output voltage
i2           (1,1) Output current

References: http://electronicdesign.com/Files/29/6204/Figure_02.gif


◆ TransformerRHS()

function TransformerRHS ( in  i,
in  ignoredArg,
in  d 
)

Dynamical model of a transformer in the dq frame.


Form

iDot = TransformerRHS( i, t, d )


Inputs

i            (2,1) [iD;iQ]
t            (1,1) Time (not used)
d            (1,1) Data structure
.L     (1,1) Inductance (H)
.R     (1,1) Resistance (ohms)
.omega (1,1) Reference frequency (rad/s)
.u1    (2,1) [uD;uQ]
.u2    (2,1) [uD;uQ]

Outputs

i            (2,1) d[iD;iQ]/dt

References: T. Demiray, F. Milano and G. Andersson

"Dynamic Phasor Modeling of the Doubly-fed Induction Generator under Unbalanced Conditions"


◆ WavelengthToBandGap()

function WavelengthToBandGap ( in  lambda)

Compute band gap from wavelength.

Type WavelengthToBandgap for a demo.


Form

eG = WavelengthToBandgap( lambda )


Inputs

lambda  (1,:) Wavelength (microns)

Outputs

eG      (1,:) Band gap (eV)