PSIM User Manual
PSIM User Manual
PSIM User Manual
User’s Guide
Powersim Inc.
-9
PSIM User’s Guide
Version 7.0
Release 4
June 2006
Disclaimer
Powersim Inc. (“Powersim”) makes no representation or warranty with respect to the adequacy or
accuracy of this documentation or the software which it describes. In no event will Powersim or its
direct or indirect suppliers be liable for any damages whatsoever including, but not limited to, direct,
indirect, incidental, or consequential damages of any character including, without limitation, loss of
business profits, data, business information, or any and all other commercial damages or losses, or for
any damages in excess of the list price for the licence to the software and documentation.
Powersim Inc.
email: info@powersimtech.com
http://www.powersimtech.com
-8
Contents
1 General Information
1.1 Introduction 1
2.2 Switches 11
2.2.1 Diode, DIAC, and Zener Diode 12
2.2.2 Thyristor and TRIAC 13
2.2.3 GTO, Transistors, and Bi-Directional Switch 15
2.2.4 Linear Switches 17
2.2.5 Switch Gating Block 19
2.2.6 Single-Phase Switch Modules 21
2.2.7 Three-Phase Switch Modules 22
2.4 Transformers 26
2.4.1 Ideal Transformer 26
i -7
2.4.2 Single-Phase Transformers 26
2.4.3 Three-Phase Transformers 29
-6
ii
2.11 Mechanical Elements and Sensors 98
2.11.1 Mechanical Elements and Sensors 98
2.11.1.1 Constant-Torque Load 98
2.11.1.2 Constant-Power Load 99
2.11.1.3 Constant-Speed Load 100
2.11.1.4 General-Type Load 100
2.11.1.5 Externally-Controlled Load 101
2.11.2 Gear Box 101
2.11.3 Mechanical Coupling Block 102
2.11.4 Mechanical-Electrical Interface Block 102
2.11.5 Speed/Torque Sensors 105
2.11.6 Position Sensors 107
2.11.6.1 Absolute Encoder 108
2.11.6.2 Incremental Encoder 108
2.11.6.3 Resolver 109
2.11.6.4 Hall-Effect Sensor 110
iii-5
3.2.8 Fast Fourier Transform Block 121
-4
iv
3.5.10 Multi-Rate Sampling System 148
4 Other Components
4.1 Parameter File 157
v -3
4.7.4 Lookup Tables 182
4.7.5 C Script Block 185
4.7.6 External DLL Blocks 186
4.7.7 Embedded Software Block 191
5 Analysis Specification
5.1 Transient Analysis 193
-2
vi
7 Waveform Processing
7.1 File Menu 226
vii-1
0viii
1
General Information
1.1 Introduction
PSIM is a simulation software specifically designed for power electronics and motor
drives. With fast simulation and friendly user interface, PSIM provides a powerful
simulation environment for power electronics, analog and digital control, magnetics,
and motor drive system studies.
This manual covers both PSIM1 and the following add-on Modules:
Motor Drive Module
Digital Control Module
SimCoupler Module
Thermal Module
MagCoupler Module
MagCoupler-RT Module
The Motor Drive Module has built-in machine models and mechanical load models for
motor drive system studies.
The Digital Control Module provides discrete elements such as zero-order hold, z-
domain transfer function blocks, quantization blocks, digital filters, for digital control
system analysis.
The SimCoupler Module provides interface between PSIM and Matlab/Simulink2 for
co-simulation.
The Thermal Module provides the capability to calculate semiconductor devices losses.
The MagCoupler Module provides interface between PSIM and the electromagnetic
field analysis software JMAG3 for co-simulation.
The MagCoupler-RT Module links PSIM with JMAG-RT3 data files.
In addition, PSIM supports links to third-party software through custom DLL blocks.
The overall PSIM environment is shown below.
Introduction 1
Third-party
Software
Matlab/Simulink PSIM
- Control systems - Power electronics JMAG /
- Analog/digital control JMAG-RT
- Motor drives
- Finite element analysis
- Electric machines, and
other magnetic devices
The PSIM simulation environment consists of the circuit schematic program PSIM, the
simulator engine, and the waveform processing program SIMVIEW1. The simulation
process is illustrated as follows.
2 General Information
Power Circuit
Switch
Sensors
Controllers
Control Circuit
The power circuit consists of switching devices, RLC branches, transformers, and
coupled inductors. The control circuit is represented in block diagram. Components in s
domain and z domain, logic components (such as logic gates and flip flops), and
nonlinear components (such as multipliers and dividers) are used in the control circuit.
Sensors are used to measure power circuit quantities and pass them to the control
circuit. Gating signals are then generated from the control circuit and sent back to the
power circuit through switch controllers to control switches.
Files Description
PSIM.exe PSIM circuit schematic editor
SIMVIEW.exe Waveform display program SIMVIEW
PcdEditor.exe Device database editor
s2z_converter.exe s-domain to z-domain converter
Software/Hardware Requirement 3
SetSimPath.exe Program to set up the SimCoupler
Module
psim.lib, psimimage.lib PSIM library files
The parameters in the Parameters tab are used in the simulation. The information in the
4 General Information
Other Info tab, on the other hand, is not used in the simulation. It is for reporting
purposes only and will appear in the parts list in View -> Element List in PSIM.
Information such as device rating, manufacturer, and part number can be stored under
the Other Info tab.
The component color can be set in the Color tab.
Parameters under the Parameters tab can be a numerical value or a mathematical
expression. A resistance, for example, can be specified in one of the following ways:
12.5
12.5k
12.5Ohm
12.5kOhm
25./2.Ohm
R1+R2
R1*0.5+(Vo+0.7)/Io
where R1, R2, Vo, and Io are symbols defined either in a parameter file (see Section
4.1), or in a main circuit if this resistor is in a subcircuit (see Section 6.3.4.1).
Power-of-ten suffix letters are allowed in PSIM. The following suffix letters are
supported:
G 109
M 106
k or K 103
m 10-3
u 10-6
n 10-9
p 10-12
A mathematical expression can contain brackets and is not case sensitive. The following
mathematical functions are allowed:
+ addition
- subtraction
* multiplication
/ division
^ to the power of [Example: 2^3 = 2*2*2]
SQRT square-root function
SIN sine function
COS cosine function
6 General Information
2
Power Circuit Components
Images:
R L C RL RC LC
Attributes:
Parameters Description
Resistance Resistance, in Ohm
Inductance Inductance, in H
Capacitance Capacitance, in F
Initial Current Initial inductor current, in A
Initial Cap. Voltage Initial capacitor voltage, in V
Resistor-Inductor-Capacitor Branches 7
Current Flag Flag for branch current output.
If the flag is zero, there is no current output. If the flag is
1, the current will be available for display in the runtime
graphs (under Simulate -> Runtime Graphs). It will also
be saved to the output file for display in SIMVIEW.
The current is positive when it flows into the dotted
terminal of the branch.
Current Flag_A; Current flags for Phase A, B, and C of three-phase
Current Flag_B; branches, respectively.
Current Flag_C
The resistance, inductance, or capacitance of a branch can not be all zero. At least one of
the parameters has to be a non-zero value.
2.1.2 Rheostat
A rheostat is a resistor with a tap.
Image:
k m
Attributes:
Parameters Description
Total Resistance Total resistance of the rheostat R (between Node k and m),
in Ohm
Tap Position (0 to 1) The tap position Tap. The resistance between Node k and t
is: R*Tap.
Current Flag Flag for the current that flows into Node k.
Image:
Attributes:
Parameters Description
Current v.s. Inductance Characteristics of the current versus the inductance (i1,
L1), (i2, L2), etc.
Current Flag Flag for the current display
The nonlinear B-H curve is represented by piecewise linear approximation. Since the
flux density B is proportional to the flux linkage λ and the magnetizing force H is
proportional to the current i, the B-H curve can be represented by the λ-i curve instead,
as shown below.
λ (B)
λ3
λ2 Inductance L = λ / i
λ1
i1 i2 i3 i (H)
The inductance is defined as: L = λ / i, the ratio of λ v.s. i at each point. The saturation
characteristics are defined by a series of data points as: (i1, L1), (i2, L2), (i3, L3), etc.
Note that the defined saturation characteristics must be such that the flux linkage λ is
monotonically increasing. That is, L1*i1 < L2*i2 < L3*i3, etc.
Also, similar to the saturation characteristics in the real world, the slope of each linear
segment must be monotonically decreasing as the current increases.
In certain situations, circuits that contain saturable inductors may fail to converge.
Connecting a very small capacitor across the saturable inductor may help the
convergence.
Resistor-Inductor-Capacitor Branches 9
2.1.4 Nonlinear Elements
The following elements with nonlinear voltage-current relationship are provided:
- Resistance-type [v = f(i)]
- Resistance-type with additional input x [v = f(i,x)]
- Conductance-type [i = f(v)]
- Conductance-type with additional input x [i = f(v,x)]
The additional input x must be a voltage signal.
Images:
Input x
Attributes:
For resistance-type elements:
Parameters Description
Expression f(i) or f(i,x) Expression of v in terms of i and x [v = f(i) or v = f(i,x)]
Expression df/di The derivative of the voltage v versus current i, i.e. df(i)/di
Initial Value io The initial value of the current i
Lower Limit of i The lower limit of the current i
Upper Limit of i The upper limit of the current i
For conductance-type elements:
Parameters Description
Expression f(v) or f(v,x) Expression of i in terms of v and x [i = f(v) or i = f(v,x)]
Expression df/dv Derivative of the current i versus voltage v, i.e. df(v)/dv
Initial Value vo The initial value of the voltage v
Lower Limit of v The lower limit of the voltage v
Upper Limit of v The upper limit of the voltage v
The nonlinear element (NONI) in the circuit above models a nonlinear diode. The diode
current is expressed as a function of the voltage as: i = 10-14 * (e 40*v-1). In PSIM, the
specifications of the nonlinear element will be:
2.2 Switches
There are two basic types of switches in PSIM. One is the switchmode type. It operates
either in the cut-off region (off state) or saturation region (on state). The other is the
linear type. It can operates in either cut-off, linear, or saturation region.
Switches in switchmode include the following:
- Diode and DIAC
- Thyristor and TRIAC
- Self-commutated switches, specifically:
- Gate-Turn-Off switch
- npn bipolar junction transistor
- pnp bipolar junction transistor
- Insulated-Gate Bipolar Transistor (IGBT)
- n-channel Metal-Oxide-Semiconductor Field-Effect Transistor
(MOSFET) and p-channel MOSFET
- Bi-directional switch
Switches 11
Switch models are ideal. That is, both turn-on and turn-off transients are neglected. A
switch has an on-resistance of 10μΩ and an off-resistance of 10MΩ. Snubber circuits
are not required for switches.
Linear switches include the following:
- npn bipolar junction transistor
- pnp bipolar junction transistor
Image:
Attributes:
Parameters Description
Diode Voltage Drop Diode conduction voltage drop, in V
Initial Position Flag for the initial diode position. If the flag is 0, the diode
is off. If it is 1, the diode is on.
Current Flag Current flag of the diode.
A DIAC is a bi-directional diode. A DIAC does not conduct until the breakover voltage
is reached. After that, the DIAC goes into avalanche conduction, and the conduction
voltage drop is the breakback voltage.
Image:
Attributes:
Parameters Description
Breakover Voltage Voltage at which breakover occurs and the DIAC begins to
conduct, in V
Images:
Zener K
K Circuit Model
VB
A A
Attributes:
Parameters Description
Breakdown Voltage Breakdown voltage VB of the zener diode, in V
Forward Voltage Drop Voltage drop of the forward conduction (diode voltage
drop from anode to cathode), in V
Current Flag Flag for zener current output (from anode to cathode)
When the zener diode is positively biased, it behaviors as a regular diode. When it is
reverse biased, it will block the conduction as long as the cathode-anode voltage VKA is
less than the breakdown voltage VB. When VKA exceeds VB, the voltage VKA will be
clamped to VB. [Note: when the zener is clamped, since the diode is modelled with an
on-resistance of 10μΩ, the cathode-anode voltage will in fact be equal to: VKA = VB +
10μΩ * IKA. Therefore, depending on the value of IKA, VKA will be slightly higher than
VB. If IKA is very large, VKA can be substantially higher than VB].
Switches 13
Images:
Thyristor TRIAC
A K
Gate
Gate
Attributes:
Parameters Description
Voltage Drop Thyristor conduction voltage drop, in V
Holding Current Minimum conduction current below which the device stops
conducting and returns to the OFF state (for thyristor only)
Latching Current Minimum ON state current required to keep the device in the
ON state after the triggering pulse is removed (for thyristor
only)
Initial Position Flag for the initial switch position (for thyristor only)
Current Flag Flag for switch current output
Note that for the TRIAC device, the holding current and latching current are set to zero.
There are two ways to control a thyristor or TRIAC. One is to use a gating block, and
the other is to use a switch controller. The gate node of a thyristor or TRIAC must be
connected to either a gating block or a switch controller.
The following examples illustrate the control of a thyristor switch.
Gating Block
Alpha
Controller
Images:
Switches 15
Attributes:
Parameters Description
Initial Position Initial switch position flag. For MOSFET and IGBT, this
flag is for the active switch, not for the anti-parallel diode.
Current Flag Switch current flag. For MOSFET and IGBT, the current
through the whole module (the active switch plus the diode)
will be displayed.
A switch can be controlled by either a gating block or a switch controller. They must be
connected to the gate (base) node of the switch. The following examples illustrate the
control of a MOSFET switch.
On-off Controller
The circuit on the left uses a gating block, and the one on the right uses an on-off switch
controller. The gating signal is determined by the comparator output.
Images:
Switches 17
Attributes:
Parameters Description
Current Gain beta Transistor current gain β, defined as: β=Ic/Ib
Bias Voltage Vr Forward bias voltage, in V, between base and emitter for
the npn transistor, or between emitter and base for the pnp
transistor.
Vce,sat [or Vec,sat for Saturation voltage, in V, between collector and emitter for
pnp] the npn transistor, and between emitter and collector for
the pnp transistor.
A linear BJT switch is controlled by the base current Ib. It can operate in one of the three
regions: cut-off (off state), linear, and saturation region (on state). The properties of
these regions for the npn transistor are:
- Cut-off region: Vbe < Vr; Ib = 0; Ic = 0
- Linear region: Vbe = Vr; Ic = β∗Ib; Vce > Vce,sat
- Saturation region: Vbe = Vr; Ic < β∗Ib; Vce = Vce,sat
where Vbe is the base-emitter voltage, Vce is the collector-emitter voltage, and Ic is the
collector current.
Note that for both the npn and pnp transistors, the gate node (base node) is a power
node, and must be connected to a power circuit component (such as a resistor or a
source). It can not be connected to a gating block or a switch controller.
WARNING: It has been found that the linear model for npn and pnp
transistors works well in simple circuits, but may not work when
circuits are complex. Please use this model with caution.
NPN_1
Image:
Attributes:
Parameters Description
Frequency Operating frequency of the switch or switch module connected
to the gating block, in Hz
No. of Points Number of switching points (for the Gating Block element
only)
Switching Points Switching points, in deg. If the frequency is zero, the switching
points is in second. (for the Gating Block element only)
File for Gating Name of the file that stores the gating table (for the Gating
Table Block (1) element only)
The number of switching points is defined as the total number of switching actions in
one period. Each turn-on or turn-off action is counted as one switching point. For
example, if a switch is turned on and off once in one cycle, the number of switching
points will be 2.
Switches 19
For the Gating Block (1) element, the file for the gating table must be in the same
directory as the schematic file. The gating table file has the following format:
n
G1
G2
... ...
Gn
where G1, G2, ..., Gn are the switching points.
Example:
Assume that a switch operates at 2000 Hz and has the following gating pattern in one
period:
The specification of the Gating Block element for this switch will be:
Frequency 2000.
No. of Points 6
Switching Points 35. 92. 175. 187. 345. 357.
The gating pattern has 6 switching points (3 pulses). The corresponding switching
angles are 35o, 92o, 175o, 187o, 345o, and 357o, respectively.
If the Gating Block (1) element is used instead, the specification will be:
Frequency 2000.
File for Gating Table test.tbl
The file “test.tbl” will contain the following:
6
35.
92.
175.
187.
Images:
Diode bridge Thyristor bridge
A+ DC+ DC+ DC+ 1 Ct 3 DC+
1 3 A+
A+
A+
A-
A-
4 2 A- 4 2
A- DC- DC- DC-
DC-
Ct
Attributes:
Parameters Description
Diode Voltage Drop or Forward voltage drop of each diode or thyristor, in V
Voltage Drop
Init. Position_i Initial position for Switch i
Current Flag_i Current flag for Switch i
Node Ct at the bottom of the thyristor module is the gating control node for Switch 1.
For the thyristor module, only the gating signal for Switch 1 needs to be specified. The
gating signals for other switches will be derived internally in the program.
Similar to the single thyristor switch, a thyristor bridge can also be controlled by either a
gating block or an alpha controller, as shown in the following examples.
Switches 21
2.2.7 Three-Phase Switch Modules
The following figure shows three-phase switch modules and the internal circuit
connections. A three-phase voltage source inverter module VSI3 consists of either
MOSFET-type or IGBT-type switches. A current source inverter module CSI3 consists
of GTO-type switches, or equivalently IGBT in series with diodes.
Images:
Diode full-wave Thyristor full-wave DC+
DC+ Ct
1 3 5 DC+ DC+ 1 5
A A
3
A A
B B
B B
C C
C
DC- 6 2 C 4 6 2
4
DC-
DC-
Ct DC-
C 3
C
Ct A6 6
Ct
DC-
CSI3 CSI3
DC+
DC+ A 1 3 5
Ct
B A
B
C
DC- C
4 6 2
Ct DC-
Attributes:
Parameters Description
On-Resistance On resistance of the MOSFET switch during the on state,
in Ohm (for MOSFET-type switches only)
Saturation Voltage Conduction voltage drop of the IGBT switch, in V (for
IGBT-type switches only)
Voltage Drop Conduction voltage drop of the switch, in V (for CSI3
only)
Diode Voltage Drop Conduction voltage drop of the anti-parallel diode, in V
(for VSI3 only)
Init. Position_i Initial position for Switch i
Current Flag_i Current flag for Switch i
Similar to single-phase modules, only the gating signal for Switch 1 need to be specified
for three-phase modules. Gating signals for other switches will be automatically
derived. For the 3-phase half-wave thyristor bridge, the phase shift between two
consecutive switches is 120o. For all other bridges, the phase shift is 60o.
Thyristor bridges can be controlled by an alpha controller. Similarly, voltage/current
Switches 23
source inverters can be controlled by a PWM lookup table controller.
The following examples illustrate the control of three-phase thyristor and voltage source
inverter modules.
The thyristor circuit on the left uses an alpha controller. For a three-phase circuit, the
zero-crossing of the voltage Vac corresponds to the moment when the delay angle alpha
is equal to zero. This signal is used to provide synchronization to the controller.
The circuit on the right uses a PWM lookup table controller. The PWM patterns are
stored in a lookup table in a text file. The gating pattern is selected based on the
modulation index. Other inputs of the PWM lookup table controller include the delay
angle, the synchronization, and the enable/disable signal. A detailed description of the
PWM lookup table controller is given in the Switch Controllers section.
Images:
2-branch 3-branch 4-branch
Parameters Description
Lii (self) Self inductance of the inductor i, in H
Lij (mutual) Mutual inductance between Inductor i and j, in H
ii_initial Initial current in Inductor i
Iflag_i Flag for the current printout in Inductor i
In the images, the circle, square, triangle, and plus marks refer to Inductor 1, 2, 3, and 4,
respectively.
The following shows a coupled inductor with two branches.
v1 -
i1 +
i2 v2 -
+
Let L11 and L22 be the self-inductances of Branch 1 and 2, and L12 and L21 the mutual
inductances, the branch voltages and currents have the following relationship:
v1 L 11 L 12 d i
= ⋅ ----- 1
v2 L 21 L 22 dt i
2
The mutual inductances between two windings are assumed to be always equal, i.e., L12
= L21.
Example:
Two mutually coupled inductors have the self inductances and mutual inductance as:
L11 = 1 mH, L22 = 1.1 mH, and L12 = L21 = 0.9 mH. The specification of this element
will be:
L11 (self) 1m
L12 (mutual) 0.9m
L22 (self) 1.1m
Coupled Inductors 25
2.4 Transformers
Images:
Np Ns Np Ns
The winding with the larger dot is the primary, and the other winding is the secondary.
Attributes:
Parameters Description
Np (primary) No. of turns of the primary winding
Ns (secondary) No. of turns of the secondary winding
Since the turns ratio is equal to the ratio of the rated voltages, the number of turns can be
replaced by the rated voltage at each side.
s_4 s_4 p
p_2
2-windinge 5-winding 4-winding
Attributes:
Parameters Description
Rp (primary); Resistance of the primary/secondary/tertiary winding, in
Rs (secondary); Ohm
Rt (tertiary)
Lp (pri. leakage); Leakage inductance of the primary/secondary/tertiary
Ls (sec. leakage); winding, in H (seen from the primary)
Lt (ter. leakage)
Lm (magnetizing) Magnetizing inductance, in H
Np (primary); No. of turns of the primary/secondary/tertiary winding
Ns (secondary);
Nt (tertiary)
Transformers 27
All the resistances and inductances are referred to the primary winding side. If there are
multiple primary windings, they are referred to the first primary winding side.
For the transformers with more than 1 primary winding or more than 3 secondary
windings, the attributes are as follows.
Attributes:
Parameters Description
Rp_i (primary i); Resistance of the ith primary/secondary/tertiary winding,
Rs_i (secondary i) in Ohm
Lp_i (pri. i leakage); Leakage inductance of the ith primary/secondary/tertiary
Ls_i (sec. i leakage) winding, in H (referred to the first primary winding)
Lm (magnetizing) Magnetizing inductance, in H (seen from the first primary
winding)
Np_i (primary i); No. of turns of the ith primary/secondary/tertiary winding
Ns_i (secondary i)
All the resistances and inductances are referred to the first primary winding side.
Modeling of a Transformer:
A transformer is modeled as coupled inductors. For example, a single-phase two-
winding transformer is modeled as two coupled inductors. The equivalent circuit can be
shown as:
Rp Lp Rs Ls Np : Ns
Primary Lm Secondary
Ideal
In the circuit, Rp and Rs are the primary and secondary winding resistances; Lp and Ls are
the primary and secondary winding leakage inductances; and Lm is the magnetizing
inductance. All the values are referred to the primary side.
Example:
A single-phase two-winding transformer has a winding resistance of 0.002 Ohm and
leakage inductance of 1 mH at both the primary and the secondary side (all the values
are referred to the primary). The magnetizing inductance is 100 mH, and the turns ratio
Rp (primary) 2m
Rs (secondary) 2m
Lp (primary) 1m
Ls (secondary) 1m
Lm (magnetizing) 100m
Np (primary) 220
Ns (secondary) 440
Images:
Y/Y Y/D D/D 2-winding (unconnected)
A a A a A a A+ a+
A- a-
B b B b B b B+ b+
B- b-
C c C c C c C+ c+
C- c-
N n N
Y/Y/D Y/D/D 3-winding (unconnected) 4-winding (unconnected)
n
a A+ A+ a+
a a+ A- a-
A b A b A- a- B+ b+
c B+ b+ B- b-
c C+ c+
B B B- b- C- c-
aa aa C+ c+
C AA+ aa+
C bb bb C- c- AA- aa-
cc cc BB+ bb+
BB- bb-
N aa+ bb+ cc+ CC+ cc+
N aa- bb- cc- CC- cc-
Transformers 29
Attributes:
Parameters Description
Rp (primary); Resistance of the primary/secondary/tertiary winding, in
Rs (secondary); Ohm
Rt (tertiary)
Lp (pri. leakage); Leakage inductance of the primary/secondary/tertiary
Ls (sec. leakage); winding, in H
Lt (ter. leakage)
Lm (magnetizing) Magnetizing inductance, in H (seen from the primary side)
Np (primary); No. of turns of the primary/secondary/tertiary winding
Ns (secondary);
Nt (tertiary)
In the images, P refers to primary, S refers to secondary, and T refers to tertiary. All
resistances and inductances are referred to the primary or the first primary winding side.
Three-phase transformers are modeled in the same way as single-phase transformers.
2.5.1 Winding
A winding element provides the interface between the electric circuit and the magnetic
equivalent circuit.
Image:
M1
E1
E2
M2
Parameters Description
Number of Turns No. of turns of the winding
Winding Resistance Winding resistance, in Ohm
This element represents a winding on a magnetic core. The two electric nodes (E1 and
E2) are connected to an electric circuit, while the two magnetic nodes (M1 and M2) are
connected to other magnetic elements (such as leakage flux path, air gap, and magnetic
core).
Image:
M1 M2
Attributes:
Parameters Description
Inductance Factor AL Inductance factor AL, defined as the inductance per turn
squared
Resistance for Losses Resistance R, in Ohm, that represents the losses due to the
leakage flux.
Current Flag Display flag of the current that flows through the resistor R
The resistance R represents the losses due to the leakage flux.
Assuming that the mmf (magnetomotive force) applied across the leakage flux path is F,
the electric equivalent circuit of the leakage flux path is as follows:
Magnetic Elements 31
+ i
AL
F
R
-
The mmf, in the form of a voltage source, applies across the capacitor (the capacitance
is AL) and the resistor R. Let the current flowing through this branch be i, and the rms
value be Irms, the relationship between the losses due to the leakage flux and the
resistance R is:
2
P loss = I rms ⋅ R
Image:
M1 M2
The input parameters of the air gap can be defined in two ways. One is to define the air
gap length and the cross section area, and the other is to define the inductance factor AL.
They are as follows.
Attributes:
Parameters Description
Air Gap Length The length of the air gap, lg, in m
Cross Section Area Cross section of the air gap, Ac, in m2
Resistance for Losses Resistance R, in ohm, that represents the losses due to the
air gap fringing effect
Current Flag Display flag of the current that flows through the resistor R
Parameters Description
Inductance Factor AL Inductance factor AL, defined as the inductance per turn
squared
Resistance for Losses Resistance R, in ohm, that represents the losses due to the
air gap fringing effect
Current Flag Display flag of the current that flows through the resistor R
The resistance R represents the losses due to the air gap fringing effect. Assuming that
the mmf (magnetomotive force) applied across the air gap is F, the electric equivalent
circuit of the air gap is as follows:
+ i
AL
F
R
-
The mmf, in the form of a voltage source, applies across the capacitor (the capacitance
has the value of the inductance factor AL) and the resistor R. For the element Air Gap,
the inductance factor can be calculated from the air gap length and the cross section area
as:
μo ⋅ Ac
A L = ---------------
-
lg
where Irms is the rms value of the current i flowing through the resistor.
Magnetic Elements 33
2.5.4 Linear Core
This element represents a linear lossless core.
Image:
M1 M2
Attributes:
Parameters Description
Inductance Factor AL Inductance factor AL of the core, defined as the inductance
per turn squared
If the length of the core is Llength and the cross section area is Ac, the inductance factor
AL is expressed as:
μo ⋅ μr ⋅ Ac
A L = -------------------------
L length
Image:
C1
M1 M2
Parameters Description
Inductance Factor AL Inductance factor AL of the core, defined as the inductance
per turn squared
Resistance for Losses Resistance R, in Ohm, that represents the core losses
Coefficient phi_sat Coefficient Φsat for the core B-H curve, in Weber
Coefficient K1 Coefficient K1 for the core B-H curve
Coefficient Kexp1 Coefficient Kexp1 for the core B-H curve
Coefficient K2 Coefficient K2 for the core B-H curve
Coefficient Kexp2 Coefficient Kexp2 for the core B-H curve
Current Flag Display flag of the electric current that flows through the
resistor R. If the rms value of the current is Irms, the core
losses can be calculated as: Pcore_loss = Irms2 * R.
In the element image, the nodes M1 and M2 are the two nodes that connect the core to
other magnetic elements (such as winding, flux leakage path, air gap, etc.). The node
marked with a dot is Node M2. Node C1 is a control output node, which shows the flux
(in Weber) flowing through the core, from Node M2 to M1.
A differential voltage probe connected between Node M2 to M1 will measure the mmf
(in ampere*turn) applied to the core.
The coefficients Φsat, K1, Kexp1, K2, and Kexp2 are used to fit the B-H curve of an actual
magnetic material. A good initial guess of Φsat is the maximum flux of the B-H curve in
deep saturation. To calculate this flux, multiply the corresponding flux density B by the
cross section area of the core. Coefficient K1 usually varies between 0.7 and 1,
depending on the core material. Coefficient Kexp1 mainly affects the rate of the core
saturation, and is in the range between 10 and 200 (10 for low permeability ferrite, and
200 for metglas).
The coefficients K2 and Kexp2 are used in very rare occasions, such as for ferroresonant
regulators. They are normally set as follows to keep them from affecting the B-H curve:
K2 > 2
Kexp2 > 20
Magnetic Elements 35
2.6 Other Elements
Images:
V+ Ro
gnd
where
V+; V- - noninverting and inverting input voltages
Vo - output voltage
A - op. amp. gain (A is set to 100,000.)
Ro - output resistance (Ro is set to 80 Ohms)
Attributes:
Parameters Description
Voltage Vs+ Upper voltage source level of the op. amp.
Voltage Vs- Lower voltage source levels of the op. amp.
Comparator
Image:
The output of the dv/dt block is equal to the derivative of the input voltage versus time.
It is calculated as:
V in ( t ) – V in ( t – Δt )
V o = ---------------------------------------------
-
Δt
Other Elements 37
where Vin(t) and Vin(t-Δt) are the input values at the current and previous time step, and
Δt is the simulation time step.
Thermal Module 39
- Electrical characteristics
- Thermal characteristics
- Dimension and weight
Device
database
files
Device
information
Device
list
To create a new device file, choose File -> New Device File. To load a device files into
the editor, choose File -> Open Device File. To unload a device file from the editor,
choose File -> Close Device File.
Three types of devices can be added to a device files: diode, IGBT, and MOSFET.
However, since dual IGBT-diode modules have a different set of parameters as
compared to the regular IGBT devices, they are treated as a separate type (referred to as
the IGBT-DIODE type). The sections that follow describe in more details each type of
devices.
To create a new device, go to the Device menu, and choose either New Diode, New
IGBT, New IGBT-Diode, or New MOSFET.
To make a copy of an existing device in the same database file, highlight the device in
the list, and choose Device -> Save Device As. To make a copy of an existing device
and save it in a different database file, first highlight the device in the list, then highlight
the file name in the File Name list, and choose Device -> Save Device As.
Thermal Module 41
Graph
wizard icons
Help area
X and Y
axis settings
Data area
X/Y axis
multiplying
factor
Graph area
There are two ways to define the graph. One is to enter the graph data points
manually. Another is to use the Graph Wizard to capture the graph directly from
the datasheet image. Defining the graph manually is preferred if there is only one
data point or there are just a few data points. However, if the graph image is
available, it is easier with the Graph Wizard.
Then press the Print Screen key (the key is labeled as "Prt Scr" on the
keyboard) to copy the screen image to the clipboard.
Thermal Module 43
- Click on the forward wizard icon to paste the screen image into the graph
window in the database editor. Position the graph image properly in the graph
window by dragging the left mouse so that the complete graph is displayed
within the window.
If the graph image is either too large or too small, go back to the previous step
by clicking on the backward wizard icon . Then resize the image of the
graph in the Adobe Acrobat, and copy the screen image to the clipboard again.
The graph dialog window should look something like follows.
Opposite
end of the
origin
Origin of
the graph
Then click on the forward wizard icon to move on to the next step.
- In this step, the x and y axis settings will be defined. Enter the settings as
Thermal Module 45
follows:
X0: 1
Xmax: 1000
Y0: 0.6
Ymax: 2.6
X in log: checked
- Left click on top of the graph to capture the data points. In this case, for
example, four data points at the current values of around 1A, 10A, 100A, and
300A are captured. Again, right click to zoom in.
Data points
Then click on the forward wizard icon to complete the data capture
process. The final graph dialog window should appear as follows.
To see the x and y axis values of a particular data point on the graph, place the
cursor inside the graph area. The cursor image will change to a cross image,
and the x and y coordinates of the cursor will be displayed at the upper right
corner of the dialog window. Place the cursor on top of the curve to read the x
and y axis readings.
- With the same process, define the reverse recovery characteristics trr v.s. IF, Irr
Thermal Module 47
v.s. IF, and Qrr v.s. IF.
- Enter the Thermal Characteristics as:
Rth(j-c): 0.6
Rth(c-s): 0.4
- Enter the Dimension and Weight as:
Length (mm): 53
Width (mm): 36
Height (mm): 29
Choose Device -> Save Device to save the device information. This completes the
process of adding the diode into the database.
Psw
Pcond
Attributes:
Parameters Description
Device The specific device selected from the device database
Frequency Frequency, in Hz, under which the losses are calculated
Pcond Calibration The calibration factor Kcond of the conduction losses Pcond
Factor
Psw Calibration Factor The calibration factor Ksw of the switching losses Psw
The parameter Frequency refers to the frequency under which the losses are calculated.
For example, if the device operates at the switching frequency of 10 kHz, and the
Thermal Module 49
parameter Frequency is also set to 10 kHz, the losses will be the values for one
switching period. However, if the parameter Frequency is set to 60 Hz, then the losses
will be the value for a period of 60 Hz.
The parameter Pcond Calibration Factor is the correction factor for the conduction
losses. For the example, if the calculated conduction losses before the correction is
Pcond_cal, then
Pcond = Kcond * Pcond_cal
Similarly, the parameter Psw Calibration Factor is the correction factor for the
switching losses. For the example, if the calculated switching losses before the
correction is Psw_cal, then
Psw = Ksw * Psw_cal
Conduction Losses:
The diode conduction losses is calculated as:
Conduction Losses = Vd * IF
where Vd is the diode voltage drop, and IF is the diode forward current.
Switching Losses:
In calculating the switching losses, the diode turn-on losses are neglected and are not
considered. The diode turn-off losses due to the reverse recovery is calculated as:
Turn-off Losses = 1/4 * Qrr * VR * f
where Qrr is the reverse recovery charge, VR is the reverse blocking voltage, and f is the
frequency as defined in the input parameter Frequency. The reverse recovery charge Qrr
is defined as:
Qrr = 1/2 * trr * Irr
Whenever Qrr is given in the device database, the losses will be calculated based on Qrr.
If Qrr is not given, the losses will be calculated based on trr and Irr. If both are not given,
the losses will be treated as 0.
Speed
Sensor
Thermal Module 51
Discrete Dual 6-Pack
Pcond_Q
Psw_Q
Pcond_D Q1
Psw_D
Q4
Q1 Q4
Thermal Module 53
Attributes:
Parameters Description
Device The specific device selected from the device database
Frequency Frequency, in Hz, under which the losses are calculated
Pcond_Q Calibration The calibration factor Kcond_Q of the transistor conduction
Factor losses Pcond_Q
Psw_Q Calibration The calibration factor Ksw_Q of the transistor switching
Factor losses Psw_Q
Pcond_D Calibration The calibration factor Kcond_D of the diode conduction
Factor losses Pcond_D
Psw_D Calibration The calibration factor Ksw_D of the diode switching losses
Factor Psw_D
The parameter Frequency refers to the frequency under which the losses are calculated.
For example, if the device operates at the switching frequency of 10 kHz, and the
parameter Frequency is also set to 10 kHz, the losses will be the values for one
switching period. However, if the parameter Frequency is set to 60 Hz, then the losses
will be the value for a period of 60 Hz.
The parameter Pcond_Q Calibration Factor is the correction factor for the transistor
conduction losses. For the example, if the calculated conduction losses before the
correction is Pcond_Q_cal, then
Pcond_Q = Kcond_Q * Pcond_Q_cal
Similarly, the parameter Psw_Q Calibration Factor is the correction factor for the
transistor switching losses. For the example, if the calculated switching losses before the
correction is Psw_Q_cal, then
Psw_Q = Ksw_Q * Psw_Q_cal
Parameters Pcond_D Calibration Factor and Psw_D Calibration Factor work in the same
way, except that they are for the diode losses.
Conduction Losses:
The transistor conduction losses is calculated as:
Transistor Conduction Losses = Vce(sat) * Ic
Switching Losses:
The transistor turn-on losses is calculated as:
Transistor Turn-on Losses = Eon * f
where Eon is the transistor turn-on energy losses, and f is the frequency as defined in the
input parameter Frequency.
The transistor turn-off losses is calculated as:
Transistor Turn-off Losses = Eoff * f
where Eoff is the transistor turn-off energy losses.
The loss calculation for the anti-parallel diode or free-wheeling diode is the same as
described in the section for the diode device.
Thermal Module 55
2.7.6 MOSFET Device in the Database
The following information is defined for a MOSFET device in the database:
General Information:
Manufacturer: Device manufacture
Part Number: Manufacturer’s part number
Package: It can be discrete, dual, or 6-pack, as shown in the
figure below:
Q1 Q4
Thermal Module 57
gate resistance Rg, in ohm)
Qg, Qgs, and Qgd: Total gate charge Qg, gate-to-source charge Qgs, and
gate-to-drain ("Miller") charge Qgd, respectively, all
in nC (test conditions: drain-to-source voltage VDS, in
V; gate-to-source voltage VDS, in V; and drain current
ID, in A)
Ciss, Coss, and Crss: Input capacitance Ciss, output capacitance Coss, and
reverse transfer capacitance Crss, respectively, all in
pF (test conditions: drain-to-source voltage VDS, in V;
gate-to-source voltage VDS, in V; and test frequency,
in MHz)
Electrical Characteristics - Diode:
Vd v.s. IF: Forward conduction voltage drop Vd v.s. forward
current IF
trr and Qrr: Reverse recovery time trr, in ns, and reverse recovery
charge Qrr, in uC (test conditions: forward current IF,
in A; rate of change of the current di/dt, in A/us, and
junction temperature Tj, in oC)
Thermal Characteristics:
Rth(j-c): Junction-to-case thermal resistance, in oC/W
Rth(c-s): Case-to-sink thermal resistance, in oC/W
Dimensions and Weight:
Length (mm): Length of the device, in mm
Width (mm): Width of the device, in mm
Height (mm): Height of the device, in mm
Weight (g): Weight of the device, in g
The losses Pcond_Q, Psw_Q, Pcond_D, and Psw_D, in watts, are represented in the form of
currents which flow out of these nodes. Therefore, to measure and display the losses, an
ammeter should be connected between the nodes and the ground. When they are not
used, these nodes cannot be floating and must be connected to ground.
Parameters Description
Device The specific device selected from the device database
Frequency Frequency, in Hz, under which the losses are calculated
VGG+ (upper level) Upper level of the gate source voltage, in V
VGG- (lower level) Lower level of the gate source voltage, in V
Rg_on (turn-on) Gate resistance during turn-on
Rg_off (turn-off) Gate resistance during turn-off. In most cases, the turn-on
gate resistance Rg_on and the turn-off gate resistance Rg_off
are identical.
RDS(on) Calibration The calibration factor of the on-state resistance RDS(on)
Factor
gfs Calibration Factor The calibration factor of the forward transconductance gfs
Pcond_Q Calibration The calibration factor Kcond_Q of the transistor conduction
Factor losses Pcond_Q
Psw_Q Calibration The calibration factor Ksw_Q of the transistor switching
Factor losses Psw_Q
Pcond_D Calibration The calibration factor Kcond_D of the diode conduction
Factor losses Pcond_D
Psw_D Calibration The calibration factor Ksw_D of the diode switching losses
Factor Psw_D
The parameter Frequency refers to the frequency under which the losses are calculated.
For example, if the device operates at the switching frequency of 10 kHz, and the
parameter Frequency is also set to 10 kHz, the losses will be the values for one
switching period. However, if the parameter Frequency is set to 60 Hz, then the losses
will be the value for a period of 60 Hz.
The parameter Pcond_Q Calibration Factor is the correction factor for the transistor
conduction losses. For the example, if the calculated conduction losses before the
correction is Pcond_Q_cal, then
Pcond_Q = Kcond_Q * Pcond_Q_cal
Thermal Module 59
Similarly, the parameter Psw_Q Calibration Factor is the correction factor for the
transistor switching losses. For the example, if the calculated switching losses before the
correction is Psw_Q_cal, then
Psw_Q = Ksw_Q * Psw_Q_cal
Parameters Pcond_D Calibration Factor and Psw_D Calibration Factor work in the same
way. except that they are for the diode losses.
Conduction Losses:
The transistor conduction losses is calculated as:
Conduction Losses = ID2 * RDS(on)
where ID is the drain current, and RDS(on) is the static on-resistance.
Switching Losses:
The transistor turn-on losses is calculated as:
Transistor Turn-on Losses = Eon * f
where Eon is the transistor turn-on energy losses, and f is the frequency as defined in the
input parameter Frequency.
The transistor turn-off losses is calculated as:
Transistor Turn-off Losses = Eoff * f
where Eoff is the transistor turn-off energy losses. The energy losses Eon and Eoff are
calculated based on the information of the gate current, input/output/reverse transfer
capacitances, and gate charges of the MOSFET devices.
The loss calculation for the anti-parallel diode or free-wheeling diode is the same as
described in the diode device section.
The system consists of two induction machines, IM1 and IM2, connected back-to-back.
One operates as a motor, and the other as a generator. From the point of view of the first
machine IM1, the mechanical equation can be written as:
dω
( J 1 + J 2 ) ⋅ ---------m- = T em1 – T em2
dt
where J1 and J2 are the moment of inertia, and Tem1 and Tem2 are the developed torques
of the machine IM1 and IM2, respectively.
From the point of view of the second machine IM2, however, the mechanical equation
can be written as:
dω
( J 1 + J 2 ) ⋅ ---------m- = T em2 – T em1
dt
These two equations are equally valid, but will produce opposite mechanical speed.
In order to avoid this ambiguity, in PSIM, the concept "reference direction" is used in
the mechanical system so that the mechanical equation can be uniquely defined.
In a mechanical system, one element is designated as the master unit (this element is
considered to operate in the master mode), and the rest of the elements are in the slave
The reference direction of each element and the reference direction of the overall
mechanical system determine how the element interacts with the mechanical system.
For example, if the reference direction of a machine is along the same direction as the
reference direction of the mechanical system, the developed torque of the machine will
contribute to the shaft rotation in the positive direction. However, if the reference
direction of the machine is opposite to that of the mechanical system, the developed
torque will contribute to the shaft rotation in the negative direction.
In the two-machine example above, using the notation of the "reference direction", if we
define the machine IM1 as the master unit, the reference direction of the overall
mechanical system will be from left to right, as shown below. Based on this direction,
the machine IM1 will be along the reference direction, and the machine IM2 will be
Master Unit
Equivalent Circuit
Reference direction
(J1+J2)*dWm/dt = Tem1 - Tem2
Similarly, if we define the machine IM2 as the master unit, the reference direction of the
overall mechanical system will be from right to left, as shown below. Based on this
direction, the machine IM1 will be opposite to the reference direction, and the machine
IM2 will be along the reference direction. This leads to the equivalent circuit of the
mechanical system as shown on the right.
Master Unit
Equivalent Circuit
The following shows another mechanical system with sensors and loads connected in
different ways.
2.8.2 DC Machine
The image and parameters of a dc machine are as follows:
Image:
+
Armature
Shaft Node
Winding
-
+
Field
Winding
-
Attributes:
Parameters Description
Ra (armature) Armature winding resistance, in Ohm
La (armature) Armature winding inductance, in H
Rf (field) Field winding resistance, in Ohm
Lf (field) Field winding inductance, in H
Ea = k ⋅ φ ⋅ ωm
T em = k ⋅ φ ⋅ i a
dω
J ⋅ ---------m- = T em – T L
dt
where vt, vf, ia, and if are the armature and field winding voltage and current,
respectively; Ea is the back emf, ωm is the mechanical speed in rad./sec., Tem is the
internal developed torque, and TL is the load torque. The back emf and the internal
torque can also be expressed as:
E a = L af ⋅ i f ⋅ ω m
T em = L af ⋅ i f ⋅ i a
where Laf is the mutual inductance between the armature and the field windings. It can
( Vt – Ia ⋅ Ra )
L af = -----------------------------
-
If ⋅ ωm
Note that the dc machine model assumes magnetic linearity. Saturation is not
considered.
Speed
Sensor
Armature current
Constant-
Torque
Load Speed (in rpm)
Attributes:
Parameters Description
Rs (stator) Stator winding resistance, in Ohm
Ls (stator) Stator winding leakage inductance, in H
Rr (rotor) Rotor winding resistance, in Ohm
Lr (rotor) Rotor winding leakage inductance, in H
Lm (magnetizing) Magnetizing inductance, in H
Ns/Nr Turns Ratio Stator and rotor winding turns ratio (for wound-rotor machine
only)
No. of Poles Number of poles P of the machine (an even integer)
Moment of Inertia Moment of inertia J of the machine, in kg*m2
Torque Flag Output flag for internal torque Tem
Master/Slave Flag Master/slave flag of the machine (1: master; 0: slave)
d T d
v abc, r = R r ⋅ i abc, r + L r ⋅ ----- i abc, r + M sr ⋅ ----- i abc, s
dt dt
where
v a, s v a, r i a, s i a, r
v abc, s = v b, s v abc, r = v b, r i abc, s = i b, s i abc, r = i b, r
v c, s v c, r i c, s i c, r
For squirrel-cage machines, va,r = vb,r = vc,r= 0. The parameter matrices are defined as:
Rs 0 0 Rr 0 0
Rs = 0 Rs 0 Rr = 0 Rr 0
0 0 Rs 0 0 Rr
M sr M sr M sr M sr
L s + M sr – -------- – -------- L r + M sr – -------- – --------
2 2 2 2
M sr M sr M sr M sr
Ls = – -------- L s + M sr – -------- Lr = – -------- L r + M sr – --------
2 2 2 2
M sr M sr M sr M sr
– -------- – -------- L s + M sr – -------- – -------- L r + M sr
2 2 2 2
2π 2π
cos θ cos ⎛⎝ θ + ------⎞⎠ cos ⎛⎝ θ – ------⎞⎠
3 3
2π 2π
M sr = M sr ⋅ cos ⎛ θ – ------⎞ cos θ cos ⎛ θ + ------⎞
⎝ 3⎠ ⎝ 3⎠
2π 2π
cos ⎛ θ + ------⎞ cos ⎛ θ – ------⎞ cos θ
⎝ 3⎠ ⎝ 3⎠
Rs Ls Rr Lr
Lm Rr(1-s)/s
Speed Torque
Sensor Sensor
Speed
SPWM Tem
Tload
3-phase currents
Images:
Parameters Description
Rs (stator) Stator winding resistance, in Ohm
Ls (stator) Stator winding leakage inductance, in H
Rr (rotor) Rotor winding resistance, in Ohm
Lr (rotor) Rotor winding leakage inductance, in H
Ns/Nr Turns Ratio Stator and rotor winding turns ratio (for wound-rotor
machine only)
No. of Poles Number of poles P of the machine (an even integer)
Moment of Inertia Moment of inertia J of the machine, in kg*m2
Torque Flag Output flag for internal torque Tem
Master/Slave Flag Master/slave flag of the machine (1: master; 0: slave)
Im v.s. Lm (Im1,Lm1) ... Characteristics of the magnetizing current Im versus the
magnetizing inductance [(Im1,Lm1) (Im2,Lm2) ...]
2π 2π
1 – ---
1 1
– --- cos θ cos ⎛ θ + ------⎞ cos ⎛ θ – ------⎞
2 2 ⎝ 3 ⎠ ⎝ 3⎠
λ abc, s = M sr ⋅ – 1--- 1 1 2π
– --- ⋅ i abc, s + M sr ⋅ cos ⎛ θ – ------⎞ cos θ
2π
cos ⎛ θ + ------⎞ i abc, r
2 2 ⎝ 3⎠ ⎝ 3⎠
1 1 2π 2π
– --- – ---
2 2
1 cos ⎛ θ + ------⎞ cos ⎛ θ – ------⎞ cos θ
⎝ 3⎠ ⎝ 3⎠
In this case, the inductance Msr is no longer constant, but a function of the magnetizing
current Im.
Image:
b Shaft Node
n sa sb sc
6-pulse Hall Effect Position Sensor
Attributes:
Parameters Description
R (stator resistance) Stator phase resistance R, in Ohm
L (stator self ind.) Stator phase self inductance L, in H
E a = k e_a ⋅ ω m
E b = k e_b ⋅ ω m
The coefficients ke_a, ke_b, and ke_c are dependent on the rotor angle θr. In this model, an
ideal trapezoidal waveform profile is assumed, as shown below for Phase A. Also shown
is the Phase A hall effect sensor signal Sa.
ke_a
Sa
Kpk
o
180
o θr
360
-Kpk
α
where Kpk is the peak trapezoidal value, in V/(rad./sec.), which is defined as:
V pk ⁄ krpm 1
- ⋅ --------------------------------- . Given the values of Vpk/krpm and Vrms/krpm, the
K pk = ------------------------
2 1000 ⋅ 2π ⁄ 60
angle α is determined automatically in PSIM.
The developed torque of the machine is:
T em = ( E a ⋅ i a + E b ⋅ i b + E c ⋅ i c ) ⁄ ω m
dθ P
--------r = --- ⋅ ω m
dt 2
where B is a coefficient, Tload is the load torque, and P is the no. of poles. The
coefficient B is calculated from the moment of inertia J and the mechanical time
constant τmech as below:
J
B = ------------
τ mech
Brushless DC Motor
Speed
Tem
3-phase currents
Brushless DC Motor
Speed
Phase A current
Vgfb/2 Vgs
Image:
b Shaft Node
c
n
field+ field-
Attributes:
Parameters Description
Rs (stator) Stator winding resistance, in Ohm
Ls (stator) Stator leakage inductance, in H
Ldm (d-axis mag. ind.) d-axis magnetizing inductance, in H
Lqm (q-axis mag. ind.) q-axis magnetizing inductance, in H.
Rf (field) Field winding resistance, in Ohm
Lfl (field leakage ind.) Field winding leakage inductance, in H
Rdr (damping cage) Rotor damping cage d-axis resistance, in Ohm
Ldrl (damping cage) Rotor damping cage d-axis leakage inductance, in H
Rqr (damping cage) Rotor damping cage q-axis resistance, in Ohm
Lqrl (damping cage) Rotor damping cage q-axis leakage inductance, in H
Ns/Nf (effective) Stator-field winding effective turns ratio
Number of Poles P Number of Poles P
Moment of Inertia Moment of inertia J of the machine, in kg*m2
Torque Flag Output flag for internal developed torque Tem
Master/slave Flag Master/slave flag of the machine (1: master; 0: slave)
T
R = diag R s R s R s R f R dr R qr λ = λ a λ b λ c λ f λ dr λ qr
L 11 L 12
L = T
L 12 L 22
and
L 2π L 2π
L s + L o + L 2 cos ( 2θ r ) – ----o- + L 2 cos ⎛ 2θ r – ------⎞ – ----o- + L 2 cos ⎛ 2θ r + ------⎞
2 ⎝ 3⎠ 2 ⎝ 3⎠
L 2π 2π L
L 11 = – ----o- + L 2 cos ⎛ 2θ r – ------⎞ L s + L o + L 2 cos ⎛ 2θ r + ------⎞ – ----o- + L 2 cos ( 2θ r )
2 ⎝ 3⎠ ⎝ 3⎠ 2
L 2π L 2π
– ----o- + L 2 cos ⎛ 2θ r + ------⎞ – ----o- + L 2 cos ( 2θ r ) L s + L o + L 2 cos ⎛ 2θ r – ------⎞
2 ⎝ 3⎠ 2 ⎝ 3⎠
L f L fdr 0
L 22 = L fdr L dr 0
0 0 L qr
dθ r P
-------- = --- ⋅ ω m
dt 2
Image:
b Shaft Node
Attributes:
Parameters Description
Rs (stator resistance) Stator winding resistance, in Ohm
Ld (d-axis ind.) Stator d-axis inductance, in H
va Rs 0 0 ia λa
d
vb = 0 R s 0 ⋅ i b + ----- λ b
dt
vc 0 0 Rs ic λc
where va, vb, vc, and ia, ib, and ic, and λa, λb, λc are the stator phase voltages, currents,
and flux linkages, respectively, and Rs is the stator phase resistance. The flux linkages
are further defined as:
where θr is the rotor electrical angle, and λpm is a coefficient which is defined as:
60 ⋅ V pk ⁄ krpm
λ pm = --------------------------------------
-
3 ⋅ π ⋅ P ⋅ 1000
where P is the number of poles.
The stator self and mutual inductances are rotor position dependent, and are defined as:
L aa = L s + L o + L 2 ⋅ cos ( 2θ r )
2π
L bb = L s + L o + L 2 ⋅ cos ⎛ 2θ r + ------⎞
⎝ 3⎠
2π
L cc = L s + L o + L 2 ⋅ cos ⎛ 2θ r – ------⎞
⎝ 3⎠
Lo 2π
L ab = L ba = – ----- + L 2 ⋅ cos ⎛ 2θ r – ------⎞
2 ⎝ 3⎠
Lo 2π
L ac = L ca = – ----- + L 2 ⋅ cos ⎛ 2θ r + ------⎞
2 ⎝ 3⎠
Lo
L bc = L cb = – ----- + L 2 ⋅ cos ( 2θ r )
2
where Ls is the stator leakage inductance. The d-axis and q-axis inductances are
associated with the above inductances as follows:
3 3
L d = L s + --- L o + --- L 2
2 2
3 3
L q = L s + --- L o – --- L 2
2 2
The developed torque can be expressed as:
sin ( θ r )
⎛ 2π⎞
= --- ⋅ λ pm ⋅ i a i b i c ⋅ sin ⎝ θ r – 3 ⎠
P ------
2
2π
sin ⎛ θ r + ------⎞
⎝ 3⎠
dθ r P
-------- = --- ⋅ ω m
dt 2
where B is a coefficient, Tload is the load torque, and P is the no. of poles. The
coefficient B is calculated from the moment of inertia J and the mechanical time
constant τmech as below:
J
B = ------------
τ mech
Image:
b Shaft Node
c
n
Attributes:
Parameters Description
Rs (stator resistance) Stator winding resistance, in Ohm
Ls (stator leakage ind.) Stator d-axis inductance, in H
Vpk / krpm Peak line-to-line back emf constant, in V/krpm
(mechanical speed).
The value of Vpk/krpm should be available from the
machine data sheet. If this data is not available, it can be
obtained through an experiment by operating the machine
as a generator at 1000 rpm and measuring the peak line-to-
line voltage.
No. of Poles P Number of poles P
Moment of Inertia Moment of inertia J of the machine, in kg*m2
Mech. Time Constant Mechanical time constant τmech, in sec. It is associated with
the friction coefficient B as: B = J / τmech.
Ld Lookup Table File File name of the lookup table for Ldm
Lq Lookup Table File File name of the lookup table for Lqm
dq Flag Flag for the lookup table. When the flag is 0, Ldm and Lqm
are function of Id and Iq. When the flag is 1, Ldm and Lqm
are function of the current magnitude Im and the angle.
Transformation Flag Flag for the transformation convention (see details below)
Torque Flag Output flag for internal developed torque Tem
Master/Slave Flag Master/slave flag of the machine (1: master; 0: slave)
L d = L s + L dm
L q = L s + L qm
where Ls is the stator leakage inductance. Since Ls is normally very small, Ld can be
considered equivalent to Ldm, and Lq can be considered equivalent to Lqm.
The Transformation Flag defines the transformation convention between the abc frame
and the dq frame. When the Transformation Flag is 0:
2π 2π
cos ( θ r ) cos ⎛ θ r – ------⎞ cos ⎛ θ r + ------⎞ ia
Id 2 ⎝ 3⎠ ⎝ 3⎠
= --- ⋅ ⋅ ib
Iq 3 2π 2π
– sin ( θ r ) – sin ⎛ θ r – ------⎞ – sin ⎛ θ r + ------⎞ ic
⎝ 3⎠ ⎝ 3⎠
2 2
Im = Id + Iq
θ m = atan 2 ( I q, I d )
2π 2π
cos ( θ r ) cos ⎛⎝ θ r – ------⎞⎠ cos ⎛⎝ θ r + ------⎞⎠ ia
Id 2 3 3
= --- ⋅ ⋅ ib
Iq 3 2π 2π
– sin ( θ r ) – sin ⎛ θ r – ------⎞ – sin ⎛ θ r + ------⎞ ic
⎝ 3⎠ ⎝ 3⎠
2--- ⋅ I 2 + I 2
Im = d q
3
θ m = atan 2 ( – I d, I q )
Image:
a+
a-
b+ Shaft Node
b-
c+
c-
c1 c2 c3 c4 c1 c4 c1 c4 θ
Phase a Phase b Phase c
Attributes:
Parameters Description
Resistance Stator phase resistance R, in Ohm
Inductance Lmin Minimum phase inductance, in H
Inductance Lmax Maximum phase inductance, in H
θr Duration of the interval where the inductance increases, in
deg.
Moment of Inertia Moment of inertia J of the machine, in kg*m2
Torque Flag Output flag for internal torque Tem
Master/Slave Flag Master/slave flag of the machine (1: master; 0: slave)
For more details on the definition and use of the master/slave flag, refer to Section 2.8.1.
The node assignments are: Nodes a+, a-, b+, b-, and c+, c- are the stator winding
terminals for Phase a, b, and c, respectively. The shaft node is the connecting terminal
for the mechanical shaft. They are all power nodes and should be connected to the
power circuit.
Node c1, c2, c3, and c4 are the control signals for Phase a, b, and c, respectively. The
control signal value is a logic value of either 1 (high) or 0 (low). Node θ is the
d(L ⋅ i)
v = i ⋅ R + -----------------
dt
where v is the phase voltage, i is the phase current, R is the phase resistance, and L is the
phase inductance. The phase inductance L is a function of the rotor angle θ, as shown in
the following figure.
Lmax
Lmin
θ
θr
The rotor angle is defined such that, when the stator and the rotor teeth are completely
out of alignment, θ = 0. The value of the inductance can be in either rising stage, flat-top
stage, falling stage, or flat-bottom stage.
If we define the constant k as:
L max – L min
k = --------------------------
-
θ
we can express the inductance L as a function of the rotor angle θ:
L = Lmin + k ∗ θ [rising stage. Control signal c1=1)
L = Lmax [flat-top stage. Control signal c2=1)
L = Lmax - k ∗ θ [falling stage. Control signal c3=1)
L = Lmin [flat-bottom stage. Control signal c4=1)
The selection of the operating state is done through control signals c1, c2, c3, and c4
which are applied externally. For example, when c1 in Phase a is high (1), the rising
stage is selected and Phase a inductance will be: L = Lmin + k ∗ θ. Note that only one and
at least one control signal out of c1, c2, c3, and c4 in one phase must be high (1).
Image:
Block with 4 inputs and 4 outputs
Attributes:
Parameter Description
Link Table File The XML file that defines the interface between PSIM and
JMAG. It has the .xml extension.
JMAG Input File The JCF input data file for JMAG. It has the .jcf extension.
Note that the .xml file and the .jcf file must be in the same
directory.
JMAG Case Text Comments for the JMAG circuit
IN Nodes Nodes that pass the values from PSIM to JMAG
The JMAG Input File is the JCF input data file that is read by the JMAG solver. The
name is defined in the Link Table File.
Note that JCF input file .jcf must be in the same directory as the input link table file
.xml. If any material database is used in JMAG, it should also be placed in the directory
of the .xml file. Also, the .xml file does not have to be in the same directory as the
schematic file. However, if a .xml file with the same name is present in the schematic
directory, PSIM will read the one in the schematic directory first.
The JMAG Case Text is a text identifying the specific JMAG circuit. It can be any text
describing the JMAG circuit.
The IN Nodes are the nodes through which PSIM passes the values to JMAG. In the
MagCoupler block image, the order of the input nodes is from the top to the bottom. The
order can be changed by highlighting the node and click on the upper or down arrow.
The OUT Nodes are the nodes through which JMAG passes the values back to PSIM. In
the MagCoupler block image, the order of the output nodes is from the top to the
bottom. The order can be changed by highlighting the node and click on the upper or
down arrow.
By clicking on the Edit Image button, one can edit and customize the image of the
MagCoupler block. Clicking on the Display File button will display the Link Table File
in the Microsoft Internet Explorer environment, and clicking on the Read File button
will read or re-load the Link Table File.
MagCoupler Module 91
the link table file, and loading the link table file into PSIM.
An inductor example below is used to illustrate this process.
In the PSIM circuit of this example, the circuit on the left uses the built-in inductor
element from the PSIM library, and the circuit on the right has the inductor implemented
in JMAG. In this case, the inductor is modelled as a controlled current source in PSIM.
The voltage across the inductor is first converted to a node-to-ground voltage through a
voltage-controlled voltage source, and the value is passed to the input node VL of the
MagCoupler block. At each time step, PSIM calls JMAG functions which calculate the
inductor current based on the voltage input. This current is then sent back to PSIM in the
voltage form, and is used to control the current source that represents the inductor.
In the JMAG circuit of this example, the voltage function (on the left side) receives the
voltage from PSIM, and through the current probe in series with the FEM coil, the
current is calculated and sent back to PSIM. The inductor structure in the JMAG
environment is shown on the lower right.
Circuit in PSIM (file: inductor_jmag.sch)
In JMAG:
- In the JMAG circuit, connect a voltage function to the right of the FEM coil.
Under Electrical Potential in the property window, choose Constant Value,
and set Constant Value[V] to 0.
- Connect a current probe to the left of the FEM coil.
- Connect another voltage function to the left of the current probe (the circuit
will look like what is shown above). In the property window, choose
Cooperates with an external circuit simulator.
- Highlight the inductor structure window. Go to the menu Conditions ->
Create Conditions. From the Conditions List, highlight Coupled External
Circuit Simulator, and click Modify.
- On the Coupled External Circuit Simulator dialog window, there are two
lists. The list on the right, called JMAG, contains all the functions that can be
used to interface with PSIM. The list on the left, called External Circuit
Simulator, contains the functions that are selected to interface with PSIM. In
this case, there are two items in the JMAG list, one is the Voltage Function,
and the other is the Current Probe.
- Highlight the Voltage Function, and click on the <- button to move the item
from the list on the right to the list on the left. Repeat the same step to the
Current Probe. Now both items should appear in the list on the left.
- Highlight the Voltage Function, and change the terminal name to VL. Also,
change the Current Probe terminal name to iL. Close the dialog window.
- Go to the menu File -> Export and select JCF.... With the JCF file name
defined as "inductor", the JCF file "inductor.jcf" and the link table file
"inductor_csl.xml" will be generated.
- Copy the JCF file "inductor.jcf" and the link table file "inductor_csl.xml" to the
folder containing the PSIM schematic file "inductor_jmag.sch". Rename the
link table file to "inductor_jmag.xml". Note that the XML file does not have to
be renamed, and both the JCF and XML files do not have to be moved to the
folder of the schematic file. They are done here for the simplicity of file
management
In PSIM:
- After the rest of the power circuit is created, go to Elements -> Power ->
MagCoupler Module 93
MagCoupler Module, and select MagCoupler Block. Place the block on the
schematic.
- Double click on the MagCoupler block to bring out the property window. click
on the browser button next to the Link Table File edit field to locate and
select the file "inductor_jmag.xml". After the file is read, the property window
will display the IN node VL and the OUT node iL.
- Connect the MagCouple block to the rest of the circuit in the schematic.
The setup is now complete and the simulation is ready to run.
Images:
MagCoupler-RT PMSM Block MagCoupler-RT Block
A B C A+ A- B+ B- C+ C-
M- M+
M- M+
Attributes:
Parameter Description
Netlist XML File The XML file that defines the interface between PSIM and
JMAG-RT. It has the .xml extension.
JMAG-RT Input File The JMAG-RT data file. It has the .rtt extension. Note that
the .xml file and the .rtt file must be in the same directory.
JMAG Case Text Comments for the JMAG-RT circuit
Terminal Names Terminal names of the block
MagCoupler-RT Module 95
In the MagCoupler-RT block images, the electric nodes (such as A, B, C, A+, A-, B+, B-
, C+, and C-, as shown above) are placed at the top of the block, arranged from the left
to the right. The rotor shaft nodes are placed on the left and right of the block, with the
first shaft node (such as M+ as shown above) on the right, and the second shaft node
(such as M-) on the left.
The electric nodes and rotor shaft nodes, as well as the rest of the interface between
PSIM and the JMAG-RT data files, are defined in the JMAG-RT Input File. This file is
in XML format, and is generated by the JMAG-RT Manager. To specify this file, click
on the browse button at the right of the edit field.
The JMAG-RT Input File is the JMAG-RT data file for the device modeled. The file has
the .rtt extension and is defined in the JMAG-RT Input File. Note that the .rtt file and the
.xml file must be in the same directory.
The JMAG Case Text is a text identifying the specific JMAG-RT study case. It can be
any text.
The Terminal Names are the names of the interface nodes. The nodes on the top of the
block are the power circuit nodes, and the nodes on the left and right of the blocks are
the mechanical shaft nodes.
The figure below shows the property window of the MagCoupler-RT PMSM block. The
.xml file in this example defines three electric nodes (Nodes U, V, and W), and two rotor
shaft nodes (Nodes shaft+ and shaft-). The shaft nodes can be connected directly to
MagCoupler-RT Module 97
2.11 Mechanical Elements and Sensors
This section describes elements that are shared by Motor Drive Module, MagCoupler
Module, and MagCoupler-RT Module. The elements include mechanical loads, gear
boxes, mechanical coupling blocks, mechanical-electrical interface blocks, and various
speed/torque/position sensors.
Image:
Attributes:
Parameters Description
Constant Torque Torque constant Tconst, in N*m
Moment of Inertia Moment of inertia of the load, in kg*m2
If the reference direction of a mechanical system enters the dotted terminal, the load is
along the reference direction, and the loading torque to the master machine is Tconst.
Otherwise the loading torque will be -Tconst. See Section 2.6.1 for more detailed
explanation on the reference direction.
A constant-torque load is expressed as:
T L = T const
Image:
Attributes:
Parameters Description
Maximum Torque Maximum torque Tmax of the load, in N*m
Base Speed Base speed nbase of the load, in rpm
Moment of Inertia Moment of inertia of the load, in kg*m2
The torque-speed curve of a constant-power load is shown below:
Tmax
Torque
(N*m)
When the mechanical speed is less than the base speed nbase, the load torque is:
T L = T max
When the mechanical speed is above the base speed, the load torque is:
P
T L = ----------
ωm
Image:
Attributes:
Parameters Description
Constant Speed (rpm) Speed constant, in rpm
Moment of Inertia Moment of inertia of the load, in kg*m2
A constant-speed mechanical load defines the speed of a mechanical system, and the
speed will remain constant, as defined by the speed constant.
Image:
Attributes:
Parameters Description
Tc Constant torque term
k1 (coefficient) Coefficient for the linear term
k2 (coefficient) Coefficient for the quadratic term
k3 (coefficient) Coefficient for the cubic term
Moment of Inertia Moment of inertia of the load, in kg*m2
A general-type load is expressed as:
Image:
Attributes:
Parameters Description
Speed Flag Flag for speed dependency
(Flag = 0: The load is frictional and is always against the
rotational direction;
Flag = 1: The load is independent of the rotational
direction.)
Moment of Inertia Moment of inertia of the load, in kg*m2
The value of the mechanical load is defined by the voltage value at the control node (1V
corresponds to 1 N*m). This node is a control circuit node.
Image:
Shaft 1
Shaft 2
Parameter Description
Gear Ratio The gear ratio a
Shaft 1 Master/Slave Flag Master/slave flag for Shaft 1
Shaft 2 Master/Slave Flag Master/slave flag for Shaft 2
The shaft with the bigger dot is Shaft 1.
If the numbers of teeth of the first gear and the second gear are n1 and n2, respectively,
the gear ratio a is defined as: a = n1 / n2. Let the radius, torque, and speed of these two
gears be: r1, r2, T1, T2, ω1, and ω2, we have: T1 / T2 = r1 / r2 = ω2 / ω1= a.
The two shafts of the gear box can be in either master mode or slave mode. For more
information on the definition and use of the master/slave flag, refer to Section 2.8.1.
Image:
This block is used in situations where both mechanical systems have a device in the
master mode, and they must be connected together to form one system. Based on the
connection convention in PSIM, a mechanical system can have only one master device.
In this case, the mechanical coupling block can be inserted in between, and the
mechanical system on each side of the coupling block can have its own device in the
master mode.
Image:
Parameter Description
Master/Slave Flag Flag for the master/slave mode (1: master, 0: slave)
Similar to electric machines, the mechanical-electrical interface block can be used to
define the reference direction of a mechanical system through the master/slave flag.
When the interface block is set to the master mode, the reference direction is along the
mechanical shaft, away from the mechanical node, and towards the rest of the
mechanical elements.
Let’s assume that a drive system consists of a motor (with a developed torque of Tem and
a moment of inertia of J1) and a mechanical load (with a load torque of Tload and a
moment of inertia of J2). The equation that describes the mechanical system is:
dω m
( J 1 + J 2 ) ⋅ ---------- = T em – T load
dt
where ωm is the shaft mechanical speed. In PSIM, this equation is modelled by an
equivalent circuit as shown below.
ωm speed node
Tem J1 J2 Tload
In this circuit, the two current sources have the values of Tem and Tload, and the
capacitors have the values of J1 and J2. The node-to-ground voltage (speed node
voltage) represents the mechanical speed ωm. This is analogous to C*dV/dt = i for a
capacitor where C = J1+J2, V = ωm, and i = Tem-Tload.
In PSIM, mechanical equivalent circuits for motors and mechanical loads all use the
capacitor-based circuit model. The mechanical-electrical interface block provides the
access to the internal mechanical equivalent circuit. If the mechanical side of an
interface block (with the letters “M”) is connected to a mechanical shaft, the electrical
side (with the letters “E”) will be the speed node of the mechanical equivalent circuit.
One can thus connect any electrical circuits to this node.
With this element, users can connect built-in motors or mechanical loads with user-
defined load or motor models.
Wm
Mechanical
speed
Images:
Attribute:
Parameter Description
Gain Gain of the sensor
The output of the speed sensor is in rpm.
The output of the speed/torque sensor depends on how the sensor is connected in a
mechanical system.
For the speed sensor, if the sensor is along the reference direction of the mechanical
system (refer to Section 2.8.1 for more details on the definition and use of the reference
direction), a positive mechanical speed would give a positive sensor output. Otherwise,
if the sensor is opposite to the reference direction of the mechanical system, a positive
mechanical speed would give a negative sensor output.
For example, in the mechanical system below, Speed Sensor 1 is along the reference
direction, and Speed Sensor 2 is opposite to the reference direction of the mechanical
system. If the actual mechanical speed is positive, the output of Speed Sensor 1 will be
positive, and the output of Speed Sensor 2 will be negative.
Reference direction of the mechanical system
The torque sensor measures the torque difference between the dotted side of the sensor
and the undotted side. To understand the physical meaning of the torque sensor
measurement, we use the diagram below as an illustration.
10 Wm Load
10
Torque sensor
In this case, the direction of the positive speed and torque is in the clockwise direction.
The dotted side of the sensor is on the left, and the load is in such a way that it tries to
slow down the shaft (the load torque is in the counter-clockwise direction).
The physical meaning of the torque sensor is that, if the dotted side of the sensor is
fixed, the sensor will measure the torque tension on the undotted side of the sensor, and
a positive sensor output would mean that the torque is opposite to the direction of the
speed reference. Therefore, for the example above, the positive speed reference is in the
clockwise direction, and the load torque is in the counter-clockwise direction. This will
give a torque sensor reading of 10 N*m.
Similarly, if the undotted side of the sensor is fixed, the sensor will measure the torque
tension on the dotted side of the sensor, in the positive direction of the speed reference.
For example, in the system below, the torque sensor is flipped with the dotted side on
the right. If the undotted side is fixed, the load torque is applied to the dotted side of the
sensor, in the opposite direction of the speed reference. The torque sensor output will be
-10 N*m instead.
10 Wm Load
10
Torque sensor
To understand how the torque sensor is modeled in the equivalent circuit of the
mechanical system, we use the following system as an example.
The system consists of one machine, 2 torque sensors, and 2 mechanical loads. The
torques and moment of inertia for the machine and the loads are as labelled in the
diagram. The reference direction of this mechanical system is from left to right. The
equation for this system can be written as:
dω
( J + J L1 + J L2 ) ⋅ ---------m- = T em – T L1 – T L2
dt
The equivalent electrical circuit of the equation is shown below:
Sensor 1 Sensor 2
ωm
The node voltage in the circuit represents the mechanical speed ωm. The current probe
on the left represents the reading of the Torque Sensor 1. Similarly, the current probe on
the right represents the reading of the Torque Sensor 2. Note that the second current
probe is from right to left since Sensor 2 is opposite to the reference direction of the
mechanical system.
The equivalent circuit also illustrates how mechanical power is transferred. The
multiplication of the current to the voltage, which is the same as the torque times the
mechanical speed, represents the mechanical power. If the power is positive, it is
transferred in the direction of the speed ωm.
Image:
Attribute:
Parameter Description
Initial Position (deg.) Initial shaft position, in deg.
No. of Bits of Resolution Number of Bits of resolution N
The encoder output resolution is determined by the number of bits N. The encoder has
two outputs: one is the number of counts (the range is from 0 to 2N-1), and the other is
the position, in mechanical deg. (the range is from 0 to 360o).
An example of a PMSM drive system using the absolute encoder is given in the sample
file "Absolute Encoder PMSM Drive.sch".
Image:
Parameter Description
Initial Position (deg.) Initial shaft position, in deg.
No. of Lines Number of lines that are in the code pattern of the code
disk of the encoder
The two quadrature outputs are A and A (A is the inverse of A), and B and B. They are
offset by 90o. In addition, the encoder provides separate index signal output Z and Z that
provide one count per revolution.
An example of an induction motor drive system using the incremental encoder is given
in the sample file "Incremental Encoder INDM Drive.sch".
2.11.6.3 Resolver
A resolver is essentially a rotary transformer with one rotor winding and two stator
windings. These two stator windings, referring to as the COS winding and SIN winding,
are located 90o apart.
As the shaft rotates, the output voltages of the COS and SIN windings vary as the cosine
and sine functions of the shaft angle.
Image:
cos+
sin+
cos-
sin-
Attribute:
Parameter Description
Initial Position (deg.) Initial shaft position, in deg.
No. of Poles Number of poles of the resolver
The resolver has four outputs: cos+, cos- (the inverse of cos+), sin+, and sin- (the
inverse of sin+). The peak amplitude of all the outputs is 1.
Image:
Attribute:
Parameter Description
Initial Position (deg.) Initial shaft position, in deg.
No. of Poles Number of poles of the sensor
The hall-effect sensor provides three logic signal outputs A, B, and C, which are spaced
120 electrical deg. apart.
The hall-effect sensor is the same as the built-in hall-effect sensor in the brushless dc
machine.
An example of a BDCM motor drive system using the hall-effect sensor is given in the
sample file "Hall-Effect Sensor BDCM_Drive.sch".
Two types of transfer function blocks are provided: one with zero initial values (the
element is called s-domain Transfer Function in the PSIM library) and the other with
initial values as input parameters (called s-domain Transfer Function (1) in the PSIM
library).
Images:
Attributes:
Parameters Description
Order n Order n of the transfer function
Gain Gain k of the transfer function
Coeff. Bn...Bo Coefficients of the numerator (from Bn to Bo)
Coeff. An...Ao Coefficients of the denominator (from An to Ao)
Initial Values xn..x1 Initial values of the state variables xn to x1 (for the element
s-domain Transfer Function (1) only)
Let Y(s) = G(s)*U(s) where Y(s) is the output and U(s) is the input, we can convert the s-
domain expression into the differential equation form as follows:
The initial values of the state variables xn to x1 can be specified as the inputs in the
element s-domain Transfer Function (1).
Example:
The following is a second-order transfer function:
3
400.e
G ( s ) = 1.5 ⋅ ---------------------------------------------------
2
-
3
s + 1200 ⋅ s + 400.e
Order n 2
Gain 1.5
Coeff. Bn...Bo 0. 0. 400.e3
Coeff. An...Ao 1. 1200. 400.e3
Image:
Parameter Description
Gain Gain k of the transfer function
3.1.2 Integrator
The transfer function of an integrator is:
1
G ( s ) = ------
sT
There are three types of integrators. regular integrator, external resettable integrator, and
internal resettable integrator.
Images:
Attributes:
Parameters Description
Time Constant Time constant T of the integrator, in sec.
Initial Output Value Initial value of the output
Parameters Description
Time Constant Time constant T of the integrator, in sec.
Initial Output Value Initial value of the output
Reset Flag Reset flag (0: edge reset; 1: level reset)
Parameters Description
Time Constant Time constant T of the integrator, in sec.
Initial Output Value Initial value of the output
Lower Output Limit Lower limit of the output
Upper Output Limit Upper limit of the output
The output of the external resettable integrator can be reset by an external control signal
(at the bottom of the block). For the edge reset (reset flag = 0), the integrator output is
reset to zero at the rising edge of the control signal. For the level reset (reset flag = 1),
the integrator output is reset to zero as long as the control signal is high (1).
The output of the internal resettable integrator is reset to 0 when the output reaches
either the lower limit or the upper limit. It works in the same way as the external
resettable integrator with the edge reset, except that in this case users do not need to set
up the external reset circuit.
To avoid over saturation, a limiter should be placed at the integrator output.
Example:
The following circuit illustrates the use of the resettable integrator. The input of the
integrator is a dc quantity. The control input of the integrator is a pulse waveform which
resets the integrator output at the end of each cycle. The reset flag is set to 0.
Vd
vo
vctrl
v in ( t ) – v in ( t – Δt )
v o ( t ) = T ⋅ --------------------------------------------
Δt
where Δt is the simulation time step, vin(t) and vin(t-Δt) are the input values at the
present and the previous time step.
Image:
Attribute:
Parameter Description
Time Constant Time constant T of the differentiator, in sec.
Since sudden changes of the input will generate spikes at the output, it is recommended
that a low-pass filter be placed at the input of the differentiator.
Image:
Parameters Description
Gain Gain k of the PI controller
Time Constant Time constant T of the PI controller
To avoid over saturation, a limiter should be placed at the PI output.
Images:
Low-pass Filter High-pass Filter Band-pass Filter Band-stop Filter
Attributes:
Parameters Description
Gain Gain k
Damping Ratio Damping ratio ξ
ω
Cut-off Frequency Cut-off frequency fc ( f c = -----c- ) for low-pass and high-
2π
pass filters, in Hz
ω
Center Frequency Center frequency fo ( f o = -----o- ) for band-pass and band-
2π
stop filter, in Hz
Passing Band; B
Frequency width fb ( f b = ------ ) of the passing/stopping
2π
Stopping Band band for band-pass/band-stop filters, in Hz
The transfer function of these filters are listed below.
For a second-order low-pass filter:
2
ωc
G ( s ) = k ⋅ --------------------------------------
2
-
2
s + 2ξω c s + ω c
3.2.1 Summer
The input of a one-input summer or two-input summer can be either a scalar or a vector.
The input of a three-input summer can only be a scalar.
Images:
1-input 2-input 2-input 3-input
Input 1
Input 1 Input 1
Input 2
Attribute:
Parameter Description
Gain_i Gain ki for the ith input
For the three-input summer, the input with a dot is the first input.
If the inputs are scalar, the output of a summer with n inputs is defined as:
V o = k 1 V 1 + k 2 V 2 + ... + k n V n
If the input is a vector, the output of a two-input summer will also be a vector, which is
defined as:
Images:
Multiplier Divider
Numerator
Denominator
For the divider, the dotted node is for the numerator input.
The input of a multiplier can be either a vector or a scalar. If the two inputs are vectors,
their dimensions must be equal. Let the two inputs be:
V1 = [a1 a2 ... an]
V2 = [b1 b2 ... bn]
The output, which is a scalar, will be:
Vo = V1 * V2T = a1*b1 + a2*b2 + an*bn
Image:
Images:
Parameters Description
Coefficient k1 Coefficient k1
Coefficient k2 Coefficient k2
For example, if k1 = 1, k2 = 2.718281828, and Vin = 2.5, then Vo = e2.5 where e is the
base of the natural logarithm.
The output of a power function block is defined as:
k2
V o = k 1 ⋅ V in
The function block LOG gives the natural logarithm (base e) of the input, and the block
LOG10 gives the common logarithm (base 10) of the input.
Image:
Parameter Description
Base frequency Base frequency fb, in Hz
Images:
Absolute Sign
Images:
Imaginary
Real
The dotted note of the arc tangent block is for the real input and the other node is for the
imaginary input. The output is the arc tangent of the ratio between the imaginary and the
V
real input, i.e. θ = tg ⎛⎝ ----------------------
imaginary⎞
–1
- .
V real ⎠
∑ ⎜ v in ( n ) – v in ⎛⎝ n + ----⎞⎠ ⋅ e
N
v o = ---- ⋅ ⎟
N ⎝ 2 ⎠
n=0
Image:
Amplitude
Phase Angle
Attributes:
Parameters Description
No. of Sampling Points No. of sampling points N
Fundamental Frequency Fundamental frequency fb, in Hz.
The dotted node of the block refers to the output of the amplitude. Note that the phase
angle output has been internally adjusted such that a sine function Vm*sin(ωt) will give
a phase angle output of 0.
Example:
In the circuit below, the voltage vin contains a fundamental component v1 (100 V at 60
Hz), a 5th harmonic voltage v5 (25 V at 300 Hz), and a 7th harmonic v7 (25 V at 420
Hz). After one cycle, the FFT block output reaches the steady state with the amplitude
of 100 V and the phase angle of 0o.
v7
vamp
Angle
3.3.1 Comparator
The output of a comparator is high when the positive input is higher than the negative
input. When the positive input is lower, the output is zero. If the two input are equal, the
output is undefined and it will keep the previous value.
Image:
Note that the comparator image is similar to that of the op. amp. For the comparator, the
noninverting input is at the upper left and the inverting input is at the lower left. For the
op. amp., however, it is the opposite.
3.3.2 Limiter
The output of a limiter is clamped to the upper or lower limit whenever the input
exceeds the limiter range. If the input is within the limit, the output is equal to the input.
Image:
Parameters Description
Lower Limit Lower limit of the limiter
Upper Limit Upper limit of the limiter
Image:
Attribute:
Parameter Description
dv/dt Limit Limit of the rate of change (dv/dt) of the input
Images:
Attributes:
Parameters Description
Rising Angle theta Rising angle θ, in deg.
Peak Value Peak value Vpk of the waveform
Attribute:
Parameter Description
Pulse Width (deg.) Pulse width θ in half cycle, in deg.
The waveforms of these two blocks are shown below. Note that the input vin is in deg.,
and can be in the range of -360o to 360o. Both waveforms are half-wave and quarter-
wave symmetrical.
Vpk 1
o vin θ vin
180
0 0 o o
o
360 180 360
-Vpk -1
θ
Image:
Input
Control
The difference between this block and the zero-order hold block (ZOH) in Digital
Control Module is that this block is treated as a continuous element and sampling
moments can be controlled externally; whereas the zero-order hold block is a discrete
element and the sampling moments are fixed and of equal distance.
For a discrete system, the zero-order hold block should be used.
Example:
In this example, a sinusoidal input is sampled. The control signal is a square wave
voltage source with an amplitude of 1.
vctrl
Image:
Attributes:
Parameters Description
No. of Digits No. of digits N after the decimal point
Truncation Flag Truncation flag (1: truncation; 0: round-off)
Let the input of the round-off block be Vin. The input is first scaled based on the
following expression:
N
V in, new = V in ⋅ 10
If the truncation flag is 1, the output will be equal to Vin,new truncated, and then divided
by 10N. Otherwise, the output will be equal to Vin,new rounded off to the nearest integer,
and then divided by 10N.
Examples:
If Vin = 34.5678; N = 0, truncation flag = 0, then we have the output Vout = 35.
Similarly, if Vin = 34.5678; N = 0, truncation flag = 1, the output Vout = 34.
Image:
Attribute:
Parameter Description
Time Delay Time delay, in sec.
Note that the difference between this block and the unit delay block (UDELAY) in
Digital Control Module is that this block is a continuous element and the delay time can
be arbitrarily set; whereas the unit delay block is a discrete element and the delay time is
equal to the sampling period.
For a discrete system, the unit delay block should be used.
Example:
In this circuit, the first time delay block has a delay time of 1 ms, and the second block
has a delay time of 4 ms. This example illustrates that the input of the time delay block
can be either an analog or a digital signal.
1 ms
vin1
vo1
vin2
vo2
4 ms
vin2
vo2
Images:
2-input 4-input 8-input
d0
d0 d0
d1
Y Y
d1 d2 Y
d3
s0 d7
s1 s0
s2 s1 s0
In the images, d0..d7 are the data inputs; and s0..s2 are the control signals. The truth
tables of the multiplexers are as follows.
2-Input MUX 4-Input MUX 8-Input MUX
s0 Y s1 s0 Y s2 s1 s0 Y
0 d0 0 0 d0 0 0 0 d0
1 d1 0 1 d1 0 0 1 d1
1 0 d2 0 1 0 d2
1 1 d3 0 1 1 d3
1 0 0 d4
1 0 1 d5
1 1 0 d6
1 1 1 d7
Note that the data input could be either an analog or digital signal.
Example:
The following circuit selects the maximum value out of two inputs. When Va is greater
than Vb, the comparator output will be 1, and Vo = Va. Otherwise Vo = Vb.
V 2
V rms – V 12
THD = -----h = --------------------------
-
V1 V1
where V1 is the fundamental component (rms), Vh is the harmonic rms value, and Vrms is
the overall rms value of the waveform. The THD block is modelled as shown below.
Image:
Vrms Vh
THD vin(t) THD
vin(t)
v1(t) V1
v1(t)
Parameters Description
Fundamental Frequency Fundamental frequency of the input, in Hz
Passing Band Passing band of the band-pass filter, in Hz
Example:
In the single-phase thyristor circuit below, a THD block is used to measure the THD of
the input current. The delay angle of the thyristor bridge is chosen as 30o. For the THD
block, the fundamental frequency is set at 60 Hz and the passing band of the filter is set
at 20 Hz. The simulation results are shown on the right.
vs
alpha=30 deg.
is THD
is1
One of the THD block output is the input current fundamental component is1. By
comparing the phase difference between the input voltage vs and the current is1, one can
calculate the input displacement power factor. This, together with the THD value, can
be used to calculate the input power factor.
Image:
Attribute:
Parameter Description
Trigger Flag Trigger flag (0: edge-triggered; 1: level-triggered)
An edge-triggered flip-flop only changes the states at the rising edge of the set/reset
input. The truth table of an edge-triggered flip-flop is:
S R Q Qn
0 0 no change
0 ↑ 0 1
↑ 0 1 0
↑ ↑ not used
A level-triggered flip-flop, on the other hand, changes the states based on the input
level. The truth table of a level-triggered set-reset flip-flop is:
Image:
3.4.4 D Flip-Flop
A D flip-flop is positive edge-triggered.
Image:
Images:
Monostable Controlled Monostable
Attribute:
Parameter Description
Pulse Width On-time pulse width, in sec.
The input node at the bottom of the controlled monostable block is for the pulse width
input.
Image:
Preset Enable
Preset Value
Clock Output
Up/Down
Reset
Attribute:
Parameter Description
No. of Bits Number of bits N
When the Up/Down input is 0, the counter decrements, and when the Up/Down input is
1, the counter increments.
The Reset input resets the counter to 0 when it is high (1).
The Preset Enable input sets the counter to the preset value when it is high.
The truth table of the counter is:
Up/Down Preset Enable Reset Clock Action
x 0 0 x No count
1 0 0 ↑ Count up
0 0 0 ↑ Count down
x 1 0 x Preset
x x 1 x Reset
x: Do not care
Images:
Vin Vo Vin Vo
Clock
Let N be the number of bits. The output of the A/D converter is calculated as:
N
2
V o = --------- ⋅ V in
V ref
Image:
Attribute:
Parameter Description
Sampling Frequency Sampling frequency of the zero-order hold, in Hz
Like all other discrete elements, the zero-order hold has a free-running timer which
determines the moment of sampling. The sampling moment is synchronized with the
origin of the simulation time. For example, if the zero-order hold has a sampling
frequency of 1000 Hz, the input will be sampled at 0, 1 msec., 2 msec., 3 msec., and so
on.
Example:
In the following circuit, the zero-order hold sampling frequency is 1000 Hz. The input
and output waveforms are shown on the left.
If a0 = 1, the expression Y(z) = H(z) * U(z) can be expressed in difference equation as:
[ a 1 ⋅ y ( n – 1 ) + a 2 ⋅ y ( n – 2 ) + ... + a N ⋅ y ( n – N ) ]
Image:
Attributes:
Parameters Description
Order N Order N of the transfer function
Coeff. b0...bN Coefficients of the numerator (from b0 to bN)
Coeff. a0...aN Coefficients of the denominator (from a0 to aN)
Sampling Frequency Sampling frequency, in Hz
Example:
The following is a second-order transfer function:
3
400.e
H ( z ) = ---------------------------------------------------
2
-
3
z + 1200 ⋅ z + 400.e
Assuming a sampling frequency of 3 kHz, the specification will be:
Order N 2
Coeff. b0...bN 0. 0. 400.e3
Coeff. a0...aN 1. 1200. 400.e3
Sampling Frequency 3000.
Images:
Regular Integrator External Resettable Integrator Internal Resettable Integrator
Attribute:
Parameters Description
Algorithm Flag Flag for integration algorithm
0: trapezoidal rule
1: backward Euler
2: forward Euler
Initial Output Value Initial output value
Reset Flag Reset flag (0: edge reset; 1: level reset) (for external
resettable integrator only)
Lower Output Limit Lower limit of the output (for internal resettable
integrator only)
Upper Output Limit Upper limit of the output (for internal resettable integrator
only)
Sampling Frequency Sampling frequency, in Hz
The output of an external resettable integrator can be reset by an external control signal
(at the bottom of the block). With the edge reset (reset flag = 0), the integrator output is
reset to zero at the rising edge of the control signal. With the level reset (reset flag = 1),
the integrator output is reset to zero as long as the control signal is high (1).
The output of an internal resettable integrator is reset to 0 whenever the output reaches
either the lower limit or the upper limit. The integrator works in the same way as the
external resettable integrator with the edge reset, except that users do not need to set up
the external reset circuit in this case.
If we define u(t) as the input, y(t) as the output, T as the sampling period, and H(z) as the
discrete transfer function, the input-output relationship of an integrator can be expressed
T
y ( n ) = y ( n – 1 ) + --- ⋅ ( u ( n ) + u ( n – 1 ) )
2
y(n) = y( n – 1) + T ⋅ u(n)
3.5.2.2 Differentiator
The transfer function of a discrete differentiator is:
1 z–1
H ( z ) = --- ⋅ -----------
T z
where T is the sampling period. The input-output relationship can be expressed in
difference equation as:
1
y ( n ) = --- ⋅ ( u ( n ) – u ( n – 1 ) )
T
Image:
Parameter Description
Sampling Frequency Sampling frequency, in Hz
Images:
Attributes:
For elements that read the coefficients directly:
Parameters Description
Order N Order N of the transfer function
Coeff. b0...bN Coefficients of the numerator (from b0 to bN)
Coeff. a0...aN Coefficients of the denominator (from a0 to aN)
Sampling Frequency Sampling frequency, in Hz
For elements that read the coefficients from a text file:
Parameters Description
File for Coefficients Name of the file storing the filter coefficients
Sampling Frequency Sampling frequency, in Hz
The transfer function of the general digital filter is expressed in polynomial form as:
–1 –( N – 1 ) –N
b 0 + b 1 ⋅ z + ... + b N – 1 ⋅ z + bN ⋅ z
H ( z ) = -------------------------------------------------------------------------------------------------------
–1 –( N – 1 ) –N
-
a 0 + a 1 ⋅ z + ... + a N – 1 ⋅ z + aN ⋅ z
y ( n ) = b 0 ⋅ u ( n ) + b 1 ⋅ u ( n – 1 ) + ... + b N ⋅ u ( n – N ) –
[ a 1 ⋅ y ( n – 1 ) + a 2 ⋅ y ( n – 2 ) + ... + a N ⋅ y ( n – N ) ]
If the denominator coefficients a0..aN are not zero, this type of filter is called infinite
impulse response (IIR) filter.
The transfer function of the FIR filter is expressed in polynomial form as:
–1 –( N – 1 ) –N
H ( z ) = b0 + b1 ⋅ z + ... + b N – 1 ⋅ z + bN ⋅ z
If a0 = 1, the output y and input u can be expressed in difference equation form as:
y ( n ) = b 0 ⋅ u ( n ) + b 1 ⋅ u ( n – 1 ) + ... + b N ⋅ u ( n – N )
The coefficient file for block FILTER_D1 and FILTER_FIR1 has the following format:
For Filter_FIR1:
N
b0
b1
... ... ...
bN
Order N 2
Coeff. b0...bN 0.0201 0.0402 0.0201
Coeff. a0...aN 1. -1.561 0.6414
Sampling Frequency 10000.
If the coefficients are stored in a file, the file content will be:
2
0.0201
0.0402
0.0201
1.
-1.561
0.6414
Or the file can also have the content as follows:
Image:
Attribute:
Parameter Description
Sampling Frequency Sampling frequency, in Hz
The difference between a unit delay block and a time delay block (TDELAY) is that the
unit delay block is a discrete element and it delays the sampled points by one sampling
period, whereas TDELAY is a continuous element and it delays the whole waveform by
the delay time specified.
Image:
Attributes:
Parameters Description
No. of Bits Number of bits N
Vin_min Lower limit of the input value Vin,min
Vin_max Upper limit of the input value Vin,max
The number of bits determines the output resolution ΔV which is defined as:
V o, max – V o, min
ΔV = -----------------------------------
N
-
2 –1
The output Vo will be equal to the truncated value of Vox based on the resolution ΔV.
Example:
If N = 4, Vin,min = 0, Vin,max = 10, Vo,min = -5, Vo,min = 5, and Vin = 3.2, then:
Vox = -5 + (3.2 - 0) * (5 - (05)) / (10 - 0) = -1.8
Image:
Parameters Description
Buffer Length The length of the buffer
Sampling Frequency Sampling frequency, in Hz
A circular buffer stores data in a buffer. When the pointer reaches the end of the buffer,
it will start again from the beginning.
The output of the circular buffer is a vector. To access to each memory location, use the
memory read block MEMREAD.
Example:
If a circular buffer has a buffer length of 4 and a sampling frequency of 10 Hz, we have
the buffer storage at different time as follows:
Image:
C = A⊗B
= [cm+n-1 cm+n-2 ... c1]
where
ci = Σ [ ak+1 * bj-k], k=0, ..., m+n-1; j=0, ..., m+n-1; i=1, ..., m+n-1
Example:
If A = [1 2 3] and B = [4 5], we have m = 3; n = 2; and the convolution of A and B is:
C = [4 13 22 15].
Image:
Attribute:
Parameter Description
Memory Index Offset Offset from the starting memory location
A memory read block allows one to access the memory location of elements such as
convolution block, vector array, and circular buffer. The index offset defines the offset
from the starting memory location.
Example:
Let a vector be A = [2 4 6 8]. If index offset is 0, the memory read block output will be
2. If the index offset is 2, the output will be 6.
Attributes:
Parameters Description
Array Length The length of the data array N (for the element Array only)
Values Values of the array (for the element Array only)
File for Coefficients Name of the file storing the array (for the element Array
(1) only)
If the array is read from a file, the file will have the following format:
N
a1
... ... ...
aN
where N is the length of the array, and a1..aN are the array values.
Example:
To define an array A = [2 4 6 8], we will have: Array Length = 4; Values = 2 4 6 8. If the
array is to be read from a file, the file will be:
4
2.
4.
6.
8.
Image:
Vin
push Vo
pop
Attribute:
Parameter Description
Stack Depth The stack depth
The rising edge triggers the push or pop action. When a pop action is performed and the
stack is empty, the output remains unchanged. When a push action is performed and the
stack is already full, the data at the bottom of the stack will be pushed out and will be
lost.
Images:
In PSIM In SimuLink
SimCoupler Model Block
SLINK_IN SLINK_OUT
In PSIM, the SLINK_IN nodes receive values from Simulink, and the SLINK_OUT
nodes send the values to Simulink. They are all control elements and can be used in the
control circuit only. In Simulink, the SimCoupler model block is connected to the rest of
the system through input/output ports.
File: pmsm_psim.sch
Control
in SimuLink
File: pmsm_simulink.mdl
The following are the steps to set up SimCoupler for PSIM-Matlab/Simulink co-
simulation for the example above.
In Simulink:
- Start Matlab.
- Launch Simulink. Open an existing file or create a new file. After the rest of
the system is created, go to the menu "S-function SimCoupler" in the Simulink
Library Browser, select the SimCoupler block, and place it on the schematic.
- In the PMSM example file, double click on the SimCoupler block, and click on
the Browser button to locate and select the PSIM schematic file
“C:\PSIM\pmsm_psim.sch”. Then click on Apply. The number of input and
output ports of the SimCoupler model block will automatically match those
defined in the PSIM netlist. In this case, there will be 3 input ports and 4 output
ports.
- Go to the Simulation menu and select Simulation Parameters. Under Solver
Options, set the Type to “Fixed-step”. Set Fixed step size to be the same as or
close to PSIM’s time step. In this case, the time step is set to 0.1ms. More
discussion on the selection of the solver option and the time step is given in the
next section.
- The setup is now complete. Go to Simulink and start the simulation.
The SimCoupler Module supports Matlab/Simulink Release 13 and 14.
Please also note that when the SimCoupler model block is used in a feedback system in
Simulink, the SimCoupler model block may be part of an algebraic loop (please refer to
It is recommended that Simulink use the same time step as PSIM, although we have
found that, even if the Simulink time step is slightly larger than PSIM time step,
satisfactory results are obtained. In this case, for example, the time step is set to 20 us,
10 times larger than the PSIM time step.
If the Simulink Solver type is instead set to Variable-step, the simulation results will
not be correct. The figure below shows this option.
When the Simulink Solver type is set to Variable-step, in order to obtain correct results,
a zero-order-hold must be placed at the input of the SimCoupler model block. Moreover,
the zero-order-hold sample time must be the same or close to PSIM time step. The
figure below shows the configuration.
Therefore, Simulink must be set up to have the Solver Type as Fixed-step with the time
step the same or close to the PSIM time step, or if the Solver Type is Variable-step, a
zero-order-hold must be used with the sample time the same or close to PSIM time step
Image:
The parameter file is a text file created by the user. The format is shown below:
<name> = <value>
<name> <value>
LIMIT <name> <lower limit> <upper limit>
% A comment line
The field <value> can be either a numerical number (e.g. “R1 = 12.3”) or a
mathematical expression (e.g. “R3 = R1 + R2/2.”). The name and the value can be
separated by either an equation sign (e.g. “R1 = 12.3”) or a space (e.g. “R1 12.3”). Text
from the character “%” to the end of the line is treated as comments (e.g. “% R3 is the
load resistance”).
For example, a parameter file may look like the following:
R1=12.3 [R1 is defined as 12.3]
R2 23.4Ohm [Equation sign can be replaced by space]
% R3 is the load resistance [This line is comments]
R3=R1+R2/2. [Math expression is allowed]
L1=3m [power-of-ten suffix is allowed. L1=0.003]
C1=100uF
4.2 Sources
Several types of independent voltage/current sources are available in PSIM. The
notation of a current source direction is: the current flows out of the higher-potential
node, through the external circuit, and back into the lower-potential node of the source.
Note that current sources can be used in the power circuit only.
4.2.1 Time
The Time element is a special case of the piecewise linear voltage source. It is treated as
a grounded voltage source, and the value is equal to the simulation time, in sec.
Image:
4.2.2 DC Source
A dc source has a constant amplitude. The reference of the grounded dc voltage sources
is the ground.
Images:
DC DC (battery) Grounded DC Grounded DC (1) Current
Attribute:
Parameter Description
Amplitude Amplitude of the source
v o = V m ⋅ sin ( 2π ⋅ f ⋅ t + θ ) + V offset
θ t
1/f
Images:
Voltage Current
Attributes:
Parameters Description
Peak Amplitude Peak amplitude Vm
Frequency Frequency f, in Hz
Phase Angle Initial phase angle θ, in deg.
DC Offset DC offset Voffset
Tstart Starting time, in sec. Before this time, the source is 0.
To facilitate the setup of three-phase circuits, a symmetrical three-phase Y-connected
sinusoidal voltage module is provided. The dotted phase of the module refers to Phase
A.
Sources 159
Image:
3-phase Voltage
a
Attributes:
Parameters Description
V (line-line-rms) Line-to-line rms voltage amplitude
Frequency Frequency f, in Hz
Init. Angle (phase A) Initial angle for Phase A
Images:
Voltage Current
Parameters Description
Vpeak-peak Peak-to-peak amplitude Vpp
Frequency Frequency, in Hz
Duty Cycle Duty cycle D of the high-potential interval
DC Offset DC offset Voffset
Phase Delay Phase delay θ of the waveform, in deg.
Vpp
D*T Voffset
0 t
T
θ (T=1/f)
When the phase delay θ is positive, the waveform is shifted to the right along the time
axis.
Images:
Voltage Current
Sources 161
Attributes:
Parameters Description
Vpeak-peak Peak-to-peak amplitude Vpp
Frequency Frequency, in Hz
Duty Cycle Duty cycle D of the rising slope interval
DC Offset DC offset Voffset
Phase Delay Phase delay θ of the waveform, in deg.
D*T Vpp
0 t
Voffset
T
θ
(T=1/f)
When the phase delay θ is positive, the waveform is shifted to the right along the time
axis.
Images:
Voltage Current
Parameters Description
Vstep Value Vstep after the step change
Tstep Time Tstep at which the step change occurs
Parameters Description
Vstep1 Value Vstep1 before the step change
Vstep2 Value Vstep2 after the step change
Tstep Time Tstep at which the step change occurs
T_transition Transition time Ttransition from Vstep1 to Vstep2
Vstep Vstep2
Vstep1
Ttransition
0 Tstep t 0 Tstep t
Images:
Voltage Current
Sources 163
Attributes:
For the sources that define the values and times separately:
Parameters Description
Frequency Frequency of the waveform, in Hz
No. of Points n No. of points
Values V1...Vn Values at each point
Time T1...Tn Time at each point, in sec.
For the sources that define the values and times in pair:
Parameters Description
Frequency Frequency of the waveform, in Hz
Times, Values (t1,v1) ... Time and value at each point
The time and value pair must be enclosed by left and right brackets. The time and value
can be separated by either a comma, such as (1.2m,5.5), or a space, such as (1.2m 5.5),
or both, such as (1.2m, 5.5).
Example:
The following is a non-periodic piecewise linear source. It has 3 segments which can be
defined by four points (marked in the figure).
3
2
1
The specification for the piecewise linear voltage source will be:
Frequency 0.
No. of Points n 4
Values V1...Vn 1. 1. 3. 3.
Times T1...Tn 0. 0.1 0.2 0.3
Frequency 0.
Times, Values (t1,v1)... (0., 1) (0.1, 1) (0.2, 3) (0.3, 3)
v o = V m ⋅ n + V offset
Images:
Voltage Current
Attributes:
Parameters Description
Peak-Peak Amplitude Peak-to-peak amplitude of the source
DC Offset DC offset
Image:
Sources 165
Attributes:
Parameters Description
Expression The mathematical expression of the source
Tstart Start time of the source
In the expression, “T” or “t” represents time. For example, to implement a sinusoidal
source, the expression will be: sin(2*3.14159*60*t+2.09).
Images:
vin1 vin2
Variable-gain
Voltage-controlled Current-controlled Current-controlled (1) voltage-controlled
vin1 vin2
Parameter Description
Gain Gain of the source
For voltage-controlled sources, the controlling voltage is from the positive node (+) to
the negative node (-).
For current-controlled sources (with an arrow pointing from one node to another), the
control nodes are connected across a RLC branch, and the direction of the controlling
current is indicated by the arrow.
For current-controlled sources (with a wire connecting the two nodes), the controlling
current flows from one control node to another, as indicated by the arrow. A 10-uOhm
resistor is used to sense the controlling current.
The output of a controlled source, except variable-gain controlled sources, is equal to
the gain multiplied by the controlling voltage or current. For the variable-gain
controlled sources, the output is equal to the following:
v o = ( k ⋅ v in2 ) ⋅ v in1
i o = ( k ⋅ v in2 ) ⋅ v in1
Input 1 is on the side with the multiplication sign, and Input 2 is on the side with the
letter k.
The difference between a variable-gain controlled source and a nonlinear source with
multiplication is that, for the nonlinear source with multiplication, values of both vin1
and vin2 at the current time step are used to calculate the output and are updated in each
iteration. But for the variable-gain controlled source, it is assumed that the change of
vin2 is small from one time step to the next, and the value of vin2 at the previous time
step is used at the current time step. This assumption is valid as long as vin2 changes at a
much slower rate as compared to vin1 and the time step is small as compared to the
change of vin2. Variable-gain controlled sources can be used in circuits which may
otherwise have convergence problem with nonlinear sources with multiplication.
Example:
The circuits below illustrates the use of current controlled voltage sources.
In the circuit on the left, the voltage source is controlled by the inductor current is. With
a gain of 1, the waveform of the voltage vis is equal to that of is. In this way, a current
quantity can be converted to a voltage quantity.
Sources 167
The circuit on the right is equivalent to that on the left, except that a different current
controlled source is used instead.
Vis Vis
is is
In the nonlinear power source, the term sign(vin) is 1 if vin is positive, and it is -1 if vin is
negative.
Note that these nonlinear sources can be used in the power circuit only.
Images:
vin1 vin2
vin1 vin2
Parameter Description
Gain Gain k of the source
For the nonlinear power source:
Parameters Description
Gain Gain k of the source
Coefficient k1 Coefficient k1
Coefficient k2 Coefficient k2
For the nonlinear (division) source, Input 1 is on the side of the division sign.
Images:
VSEN ISEN
Attribute:
Parameter Description
Gain Gain of the sensor
Images:
Attributes:
Parameters Description
Operating Frequency Operating frequency or fundamental frequency of the ac
meter, in Hz
Cut-off Frequency Cut-off frequency of the low-pass/high-pass filter, in Hz
VA Display Flag Display flag for apparent power (0: no display; 1: display)
PF Display Flag Display flag for power factor (0: no display; 1: display)
DPF Display Flag Display flag for displacement power factor (0: no display;
1: display)
A low-pass filter is used in the dc meter and wattmeter models to filter out high-
frequency components, whereas a high-pass filter is used in the ac meter and VAR meter
where ω1 is the fundamental frequency and all others are harmonic frequencies. We
have the rms values of the voltage and current as:
2 2
V rms = V 1 + V 2 + ...
2 2
I rms = I 1 + I 2 + ...
S = V rms ⋅ I rms
DPF = cos ( φ 1 – θ 1 )
For the three-phase circuit, the definitions are similar. Note that the meter VA_PF3 is for
the 3-phase 3-wire circuit, and the summation of the three phase voltages or currents
must be equal to zero, that is:
ia + ib + ic = 0
The 1-channel voltage scope and the current scope have the same interface.
The scope is designed to operate in a similar way as the actual oscilloscope in the lab. It
has 3 main sections: Timebase section, Channel section, and Trigger section.
In the Timebase section, the scale of time (x axis) is defined.
In the Channel section, the scale of the Y axis, as well as the offset and the color of the
Image:
Example:
The circuit below implements the step change of a load. In the circuit, the on-off switch
controller is used to control the bi-directional switch. The step voltage source, which is
connected to the controller input, changes from 0 to 1 at the time of 12 ms. The closure
of the switch results in the short-circuit of the resistor across the switch and the increase
of the current.
Image:
Enable/Disable
Sync. alpha
Signal
Attributes:
Parameters Description
Frequency Operating frequency of the controlled switch/switch
module, in Hz
Pulse Width On-time pulse width of the switch gating, in deg.
The input for the delay angle alpha is in deg.
vs iRL1
vsync
Image:
Enable/Disable
Parameters Description
Frequency Switching frequency, in Hz
Update Angle Update angle, in deg., based on which the gatings are
internally updated. If the angle is 360o, the gatings are
updated at every cycle. If it is 60o, the gatings are updated
at every 60o.
File Name Name of the file storing the PWM gating pattern
A lookup table, which is stored in a file, contains the gating patterns. It has the
following format:
n, m1, m2, ..., mn
k1
G1,1, G1,2, ..., G1,k1
... ... ...
kn
Gn,1, Gn,2, ..., Gn,kn
where n is the number of gating patterns; mi is the modulation index correspondent to
Pattern i; and ki is the number of switching points in Pattern i. The modulation index
array m1 to mn should be monotonically increasing. The output will select the ith pattern
if the input is smaller than or equal to mi. If the input exceeds mn, the last pattern will be
selected.
The following table shows an example of a PWM pattern file with five modulation
index levels and 14 switching points.
5, 0.901, 0.910253, 0.920214, 1.199442, 1.21
14
7.736627 72.10303 80.79825 99.20176 107.8970 172.2634 180.
187.7366 252.1030 260.7982 279.2018 287.8970 352.2634 360.
14
7.821098 72.27710 80.72750 99.27251 107.7229 172.1789 180.
187.8211 252.2771 260.7275 279.2725 287.7229 352.1789 360.
14
7.902047 72.44823 80.66083 99.33917 107.5518 172.0979 180.
Example:
This example shows a three-phase voltage source inverter (file: “vsi3pwm.sch”). The
PWM for the converter uses the selected harmonic elimination. The gating patterns are
described above and are pre-stored in File “vsi3pwm.tbl”. The gating pattern is selected
based on the modulation index. The waveforms of the line-to-line voltage and the three-
phase load currents are shown below.
Image:
LOAD I
V
P
k=1
Example:
The following circuit illustrates how a control circuit signal can be passed to the power
circuit. As seen from the power circuit, the CTOP block behaviors as a grounded
voltage source.
Images:
ABC to DQO DQO to ABC
θ θ
It should be noted that, in the power circuit, currents must first be converted into voltage
quantities (using current-controlled voltage sources) before they can be transformed.
Also, if an input terminal is not used (such as in the DQO-to-ABC transformation block
where only Phase D and Q are not used, and Phase O is not used), it must be connected
to ground.
The transformation equations from abc to dqo are:
2π 2π
cos θ cos ⎛ θ – ------⎞ cos ⎛ θ + ------⎞
⎝ 3⎠ ⎝ 3⎠
vd va
2--- 2π 2π
vq = ⋅ sin θ sin ⎛ θ – ------⎞ sin ⎛ θ + ------⎞ ⋅ v b
3 ⎝ 3⎠ ⎝ 3⎠
vo vc
1 1 1
--- --- ---
2 2 2
Example:
In this example, three symmetrical ac waveforms are transformed into dqo quantities.
The angle θ is defined as θ = ωt where ω = 2π*60. Since the angle θ changes linearly
with time, a piecewise linear voltage which has a ramp waveform is used to represent θ.
The simulation waveforms show the three-phase ac (top), the angle θ (middle), and the
dqo output. In this example, the “q” component is constant, and both the “d” and the “o”
components are zero.
Images:
Attributes:
Parameters Description
Expression Expression of the output versus inputs where n is the
f(x1,x2,...,xn) number of inputs
Expression df/dxi Expression of the derivative of the function f versus the ith
input
The derivative df/dxi can be set to zero.
The variables that are allowed in the expression are: T or t for time, and xi (i from 1 to n)
which represents the ith input. For example, for the 3-input math function block, the
allowed variables are: T, t, x1, x2, and x3. For the 1-input math function block, the
variable x, which refers to the only input, is also allowed.
Images:
1-dimensional 2-dimensional
Index j
Index i
Parameter Description
File Name Name of the file storing the lookup table
For the 2-dimensional lookup table block, the node at the left is for the row index input,
and the node at the top is for the column index input.
The one-dimensional lookup table has one input and one output. Two data arrays,
corresponding to the input and the output, are stored in the lookup table in a file. The
format of the table is as follows.
Vin(1), Vo(1)
Vin(2), Vo(2)
...
Vin(n), Vo(n)
The input array Vin must be monotonically increasing. Between two points, linear
interpolation is used to obtain the output. When the value of the input is less than Vin(1)
or greater than Vin(n), the output will be clamped to Vo(1) or Vo(n).
The 2-dimensional lookup table with integer input has two inputs. The output data is
stored in a 2-dimensional matrix. The two input correspond to the row and column
indices of the matrix. For example, if the row index is 3 and the column index is 4, the
output will be A(3,4) where A is the data matrix. The data for the lookup table are stored
in a file and have the following format:
m, n
A(1,1), A(1,2), ..., A(1,n)
A(2,1), A(2,2), ..., A(2,n)
... ... ...
A(m,1), A(m,2), ..., A(m,n)
where m and n are the number of rows and columns, respectively. Since the row or the
column index must be an integer, the input value is automatically converted to an
integer. If either the row or the column index is out of the range (for example, the row
index is less than 1 or greater than m), the output will be zero.
The 2-dimensional lookup table with floating-point inputs is similar to the 2-
dimensional lookup table with integer inputs. The difference is that in this case, inputs
are floating-point values, and interpolation is used to calculate the output.
The data for the lookup table are stored in a file and have the following format:
Examples:
The following shows a one-dimensional lookup table:
1., 10.
2., 30.
3., 20.
4., 60.
5., 50.
If the input is 0.99, the output will be 10. If the input is 1.5, the output will be
( 1.5 – 1 ) ⋅ ( 30 – 10 )
10 + ------------------------------------------------ =20.
2–1
The following shows a 2-dimensional lookup table with integer inputs:
3, 4
1., -2., 4., 1.
2., 3., 5., 8.
3., 8., -2., 9.
If the row index is 2 and the column index is 4, the output will be 8. If the row index is
5, regardless of the column index, the output will be 0.
The following shows a 2-dimensional lookup table with floating-point inputs:
3, 4
1.1 2.2 3.3
Column
2.3 3 3.4
1.1 -2 4
Row 2 2.091 3.826 4.818
2.2 3 5
Function
selection
Area for
custom code
Click on the Check Code button to check if the code has any compiling errors. Click on
the Edit Image button to customize the image of the C script block.
The difference between the C script block and the external DLL block is that, even
though the C script block is easier to use, it does have the disadvantage that the custom
code in the C script block can not be debugged, while in the external DLL block it is
possible to set break points and trace/step through the code for debugging.
Images:
1 1 1 1
2 2
3 3
6 6
input output
Attribute:
Parameter Description
File Name Name of the DLL file
The node with a dot is for the first input (in[0]). The sequence of the input/output nodes
is from the top to the bottom.
The images and parameters of the simple DLL blocks are shown below.
1
1
2
2 3
input output
Parameter Description
DLL File Name of the DLL file
Input Data File Name of the input data file that the DLL routine reads
(optional)
Number of Input Number of input nodes (optional)
Nodes
Number of Output Number of output nodes (optional)
Nodes
IN Nodes List of input nodes (optional)
OUT Nodes List of output nodes (optional)
Parameter 1 Parameter to be passed from PSIM into the DLL routine
(optional)
Parameter 2 Parameter to be passed from PSIM into the DLL routine
(optional)
Edit Image (button) Click this button to edit and customize the image of the
DLL block.
Display File (button) Click this button to display the content of the Input Data
File (optional).
Read File (button) If the Input Data File is modified, click this button to
reload the data file (optional).
The node with a dot is for the first input (in[0]). The sequence of the input/output nodes
is from the top to the bottom.
By default, users define the number of inputs and outputs. But the number of inputs and
outputs, the node names, as well as the number of parameters and the parameter names
can all be defined inside the DLL routine. For more details on defining and
programming for the general DLL block, please refer to the help file "Help General
DLL Block.pdf" and related examples.
The name of the DLL file can be arbitrary. The DLL file can be placed in one of the
three places, in the order of precedence: in the PSIM directory, in the same directory as
the schematic file that uses the DLL file, or in the directory as defined in the Options ->
Set Path function in PSIM.
Sample DLL files are provided in PSIM, and users can use these files as the templates to
Example:
The following shows a power factor correction circuit with the inductor current and the
load voltage feedback. The input voltage is used to generate the current reference. The
control scheme is implemented in a digital environment, with a sampling rate of 30 kHz.
The control scheme is implemented in an external C code and is interfaced to the power
circuit through a simple DLL block.
The input of the DLL block are the sampled input voltage, inductor current, and output
voltage. One of the DLL block outputs is the modulation wave Vm, which is compared
with the carrier wave to generate the PWM gating signal for the switch. The other
output is the inductor current reference for monitoring purpose.
Part of the source code, which is in the file “pfc_vi_dll.c”, is shown below. Both the
inner current loop and the outer voltage loop use a PI controller. Trapezoidal rule is used
to discretize the controllers. Discretization using Backward Euler is also implemented
but the codes are commented out.
Attribute:
Parameter Description
DLL File Name of the DLL file that defines the functionality and the
interface of the block
Number of Nodes Total number of input and output nodes
The Embedded Software Block has similar functionality as the general external DLL
block. However, unlike the general DLL block whose connection nodes are predefined
as either inputs or outputs, the Embedded Software Block allows the node types to be
programmed as needed.
Also, additional information, such as the exact instant at which the state of a variable
changes, can be calculated and passed to and from PSIM.
The Embedded Software Block is a control circuit element, and can be used in the
control circuit only.
For more information on how to use the Embedded Software Block, please refer to the
document "Help Embedded Software Block.pdf".
5.2 AC Analysis
The frequency response of a circuit or a control loop can be obtained with the ac
analysis. A key feature of the ac analysis in PSIM is that, a circuit can be in its original
switchmode form, and no average model is required. Nevertheless, with the average
model, the time it takes to perform the ac analysis will be shorter.
The following are the steps to set up the ac analysis:
- Identify a sinusoidal voltage source as the excitation source for the ac sweep.
- Place ac sweep probes at the desired output location. To measure the loop
response of a closed control loop, use the node-to-node probe.
- Place the .ACSWEEP element on the schematic, and define the parameters of
the ac sweep.
- Run the simulation.
Below are the images of the ac sweep probes and the .ACSWEEP sweep element.
Images:
Parameters Description
Start Frequency Start frequency of the ac sweep, in Hz
End Frequency End frequency of the ac sweep, in Hz
No. of Points Number of data points
Flag for Points Flag to define how the data points is generated.
Flag = 0: Points are distributed linearly in LOG10 scale
Flag = 1: Points are distributed linearly in linear scale
Source Name Name of the excitation source
Start Amplitude Excitation source amplitude at the start frequency
End Amplitude Excitation source amplitude at the end frequency
Freq. for extra Points Frequencies of additional data points. If the frequency-
domain characteristics change rapidly at a certain
frequency range, one can add extra points in this region to
obtain better data resolution.
The principle of the ac analysis is that a small ac excitation signal is injected into the
system as the perturbation, and the signal at the same frequency is extracted at the
output. To obtain accurate ac analysis results, the excitation source amplitude must be
set properly. The amplitude must be small enough so that the perturbation stays in the
linear region. On the other hand, the excitation source amplitude must be large enough
so that the output signal is not affected by numerical errors.
In general, a physical system has low attenuation in the low frequency range and high
attenuation in the high frequency range. A good selection of the excitation source
amplitude would be to have a relatively small amplitude at the low frequency, and a
relatively large amplitude at the high frequency.
Sometimes, after ac analysis is complete, a warning message is displayed as follows:
Warning: The program did not reach the steady state after 60 cycles.
See File “message.txt” for more details.
This message occurs when the software fails to detect the steady state at the ac sweep
output after 60 cycles. To address this problem, one may increase damping in the circuit
(by including parasitic resistances, for example), or adjust the excitation source
amplitude, or reduce simulation time step. The file “message.txt” gives the information
on the frequency at which this occurs and the relative error. The relative error will
indicate how far the data point is from reaching the steady state.
AC Analysis 195
Example: Impedance of Shunt Filters
The circuit below consists of two shunt filters tuned at the 5th and 7th harmonics (the
fundamental frequency is 60 Hz). By injecting the excitation source as the current and
measuring the voltage, we obtain the impedance characteristics of the filters. The ac
analysis waveform on the right clearly shows two troughs at 300 Hz and 420 Hz.
AC Analysis 197
5.3 Parameter Sweep
Parameter sweep can be performed for the following parameters:
- Resistance, inductance, and capacitance of RLC branches
- Gain of proportional blocks
- Time constant of integrators
- Gain and time constant of proportional-integral controllers
- Gain, cut-off frequency, and damping ratio of 2nd-order low-pass and high-
pass filters
- Gain, center frequency, and passing and stopping band of 2nd-order band-pass
and band-stop filters
The image and parameters of the parameter sweep element are shown below.
Attributes:
Parameters Description
Start Value Starting value of the parameter
End Value End value of the parameter
Increment Step Increment step
Parameter to be Swept Parameter to be swept
For example, let the resistance of a resistor be “Ro”. To sweep the resistance from 2
Ohm to 10 Ohm, with a step of 2 Ohm, the specification will be:
Start Value 2
End Value 10
Increment Step 2
Parameter to be Swept Ro
PSIM’s schematic program provides interactive and user-friendly interface for circuit
schematic entry and editing. The following figure shows a boost power factor correction
circuit in the PSIM environment.
In PSIM, all the elements are stored under the Elements menu. The elements are
divided into four groups: Power (for power circuit element), Control (for control
elements), Other (for switch controllers, sensors, probes, interface elements, and
elements that are common to both power and control), and Sources (for voltage and
current sources).
Place Once an element is selected from the menu, the image of the
element will appear on the screen and move with the mouse. Click
the left button of the mouse to place the element.
Rotate Before the element is placed, right click to rotate the element.
After an element is selected, select Rotate to rotate the element.
Toolbar
icon area
Predefined
icon images
Icon
editing area
- In the section Add Shortcut Key, select the option Elements. Then find and
highlight the element "Resistor".
- Move the cursor into the input field of Press new shortcut key, and press the
key "r" on the keyboard. Then click on Assign.
- The key "r" will be assigned to the resistor, and the definition will appear in the
Current Shortcut Key list.
6.4 Subcircuit
The following functions are provided for subcircuit editing and manipulation.
New Subcircuit To create a new subcircuit
Load Subcircuit To load an existing subcircuit. The subcircuit will appear on the
screen as a block.
Edit Subcircuit To edit the size and file name of the subcircuit
Set Size To set the size of the subcircuit
Place Port To place the connection port between the main circuit and the
subcircuit
Display Port To display the connection port of the subcircuit
Edit Default To edit the default variable list of the subcircuit
Variable List
Edit Image To edit the subcircuit image
Display Subcircuit To display the subcircuit name
Name
Show Subcircuit To display the port names of the subcircuit in the main circuit
Ports
Hide Subcircuit To hide the port names of the subcircuit in the main circuit
Ports
Subcircuit List To list the file names of the main circuit and the subcircuits
One Page up To go back to the main circuit. The subcircuit is automatically
Subcircuit 207
saved.
Top Page To jump from a lower-level subcircuit to the top-level main
circuit. This is useful for circuits with multiple layers of
subcircuits.
The one-quadrant chopper circuit below illustrates the use of the subcircuit.
The diamonds on the four sides represent the connection nodes and the
positions of the subcircuit. They correspond to the connection nodes of the
subcircuit block on the right. There are no diamonds at the four corners since
connections to the corners are not permitted.
When a diamond is selected, it is colored red. By default, the left diamond at
the top is selected and marked with red color. Click on the desired diamond to
select and to specify the port name.
In this example, in the main circuit “chop.sch”, there are four linking nodes,
two on the left side and two on the right side of the subcircuit block. The
relative position of the nodes are that the upper two nodes are 1 division below
the top and the lower two nodes are 1 division above the bottom.
To specify the upper left linking node, click on the top diamond of the left side,
and type “in+”. The text “in+” will be within that diamond box and a port
labelled with “in+” will appear on the screen. Connect the port to the upper left
node. The same procedure is repeated for the linking nodes “in-”, “out+”, and
“out-”.
- After the four nodes are placed, the node assignment and the subcircuit appear
in PSIM as shown below.
Subcircuit 209
The creation of the subcircuit is now complete. Save the subcircuit, and go back to the
main circuit.
File: sub.sch
Subcircuit 211
In the case where the same subcircuit is used several times in one main circuit, different
parameters can be assigned to the same variable. For example, if the subcircuit
“sub.sch” is used two times in above example, in one subcircuit L can be defined as
3mH, and in another subcircuit L can be defined as 1mH.
Note that this example also illustrates the feature that parameters can be defined as a
variable (for example “Vin” for the input dc voltage source) or a mathematical
expression (for example “R1+R2” for the load resistance). The variables “Vin”, “R1”,
and “R2”, are defined in the parameter file “para-main.txt”. See Section 4.1 for more
details.
In the window, the diamonds marked red are the connection nodes of the
subcircuit block, in exactly the same positions as appearing in the main circuit.
- Use the drawing tool to create/edit the image for the subcircuit block. If the
drawing tool is not already displayed, go to the View menu and check Drawing
Tools. Click on Zoom In and Zoom Out icons on the toolbar to adjust the size
of the image working area.
After the image is created, the pop-out window will appear as follows.
Subcircuit 213
- Subcircuit 3
- Project B
- Subcircuit 4
In this way, common-used custom-built subcircuits can be grouped together and easily
managed and accessed.
- Place the cursor inside the input field of the dialog window for the gain, and
change the gain either by pressing on the upper/down arrow keys on the
keyboard, or by entering a new value and then clicking on Apply. Watch how
the waveforms change as the gain is changed.
Other parameters, such as current reference, dc input voltage, inductance,
capacitance, and load resistance, can be changed in the similar way.
- Branch currents can also be displayed in the free-run mode. To display the
inductor current, for example, right click on top of the inductor, and a menu
will appear. Choose Current Scopes and the branch current name.
- An image of the current scope (similar to the voltage scope image, but without
connection terminals) will appear. Double click on the scope to expand and
view the inductor waveform.
Below is how the window would look like with both the voltage scope and the
current scope.
Other branch currents, such as capacitor current, load current, diode current, or
MOSFET switch current, can be displayed in the similar way.
Voltage scope
Here Variable Label is the text that describes the parameter, Variable Name is the
variable that is used as the parameter value in the subcircuit, and Variable Value is the
6.7.3 Settings
Grid display, rubber band feature, text fonts, simulation warning, and colors can be set
in the Settings... in the Option menu.
Before a circuit is printed, its position on the paper can be viewed by selecting Print
Page Border in the Settings... option. If a circuit is split into two pages, it can be moved
into one single page. If the circuit is too big to fit in one page, one can zoom out and
reduce the circuit size by clicking the Zoom Out button.
Print page legend, such as company name, circuit title, designer’s name, date, etc., can
be specified by choosing Print Page Setup in the File menu. It can be disabled in the
Settings... option.
Also in the Settings... option, if Disable simulation warning messages is checked,
warning messages generated during the simulation will be suppressed. Otherwise,
warning messages will be shown before waveforms are displayed in SIMVIEW.
SIMVIEW reads data in either ASCII text format or SIMVIEW binary format. The
following shows a sample text data file:
Time Isa Isc Isb Tem_IM
5.000000000E-006 0.000000000E+000 0.000000000E+000 0.000000000E+000 7.145888260E-048
1.000000000E-005 0.000000000E+000 0.000000000E+000 0.000000000E+000 1.082981714E-046
1.500000000E-005 0.000000000E+000 0.000000000E+000 0.000000000E+000 5.408644357E-046
2.000000000E-005 1.139566166E-001 -2.279132474E-001 1.139566166E-001 1.613605209E-017
2.500000000E-005 5.072914178E-001 -1.014582858E+000 5.072914178E-001 3.598226665E-015
... ... ... ...
If the Auto-Scale and Auto-Grid boxes are checked, the maximum data range will be
selected and the number of axis divisions will be automatically determined. Both the
data range and grid division, however, can be manually set.
By default, the first column of the data, which is usually Time, is used as the X axis.
However, any other column of the data can be used as the X axis. For example, the
following figure shows a sine waveform as the X axis versus a cosine waveform in the
Y axis.
Edit Box
All the data variables available for display are in the Variables Available box, and the
variables currently being displayed are in the Variables for Display box. After a variable
is highlighted in the Variables Available box, it can be added to the Variables for
Display box by clicking on “Add ->”. Similarly, a variable can be removed from display
by highlighting the variable and clicking on “<- Remove”.
In the Edit Box, an mathematical expression can be specified.
A mathematical expression can contain brackets and is not case sensitive. The following
math functions are allowed:
+ addition
- subtraction
* multiplication
/ division
^ to the power of [Example: 2^3 = 2*2*2]
Once Measure is selected, an individual curve can be selected by clicking on the pull-
down menu on the Measure toolbar. The functions, Max, Min, Next
Max, Next Min, Avg, and rms, can be used to evaluate the curve. Note that these
functions are only enabled in the Measure mode.
Q0 Q0 Q1
Q1
clock
clock
1V
1V
In the circuit on the left, the initial values of both Q0 and Q1 are assumed to be zero. At
the clock rising edge, Q0 will change to 1. Without delay, the position of Q1, which
should remain at 0, will toggle to 1 at the same time.
To prevent this, a time delay element with the delay period of one time step needs to be
Comparator Comparator
It should be noted that, in PSIM, the power circuit and the control circuit are solved
separately. There is one time step delay between the power and the control circuit
solutions.
W-2 Warning!!! The program did not reach the steady state after 60 cycles when
performing the ac sweep.
This warning occurs when the program fails to reach the steady state after 60
cycles when performing the ac sweep. The cause of the problem could be that
the system is poorly damped at that particular frequency or the signal amplitude
is too small.
You may try the following to isolate and solve the problem:
- Run the time-domain simulation with the excitation source at that fre-
quency and see if time-domain waveforms are oscillatory.
- Increase the excitation voltage amplitude for larger signal level, or
- Reduce the time step for better accuracy and resolution.
8.3 Debugging
Some of the approaches in debugging a circuit is discussed in the following.
Symptom:
Simulation results show sudden changes (discontinuity) of inductor currents and
capacitor voltages.
Solution:
This may be caused by the interruption of inductor current path and short-circuit
Symptom:
Simulation waveforms look incorrect or inaccurate, or the waveform resolution
is poor.
Solution:
This may be caused by two reasons. One is the time step. Since PSIM uses the
fixed time step during the entire simulation, one should make sure that the time
step is sufficiently small. As a rule of thumb, the time step should be several tens
times smaller than the switching period.
Another reason is the problem of waveform display. One should make sure that
the print step is not too big. To display all the data points, set the print step to 1.
Debugging 237
238 Error/Warning Messages and Other Simulation Issues