Simulation Manager for OrCAD PSpice Dalibor Biolek1,2, Jaroslav Kadlec1 Faculty of EE and Communications, Dept.

Download Report

Transcript Simulation Manager for OrCAD PSpice Dalibor Biolek1,2, Jaroslav Kadlec1 Faculty of EE and Communications, Dept.

Slide 1

Simulation Manager for OrCAD PSpice
Dalibor Biolek1,2, Jaroslav Kadlec1

Faculty of EE and Communications, Dept. of Microelectronics
Brno University of Technology, Czech Republic
1,2

Faculty of Military Technologies, Dept. of EE
University of Defence, Brno, Czech Republic
1

Outline
•Why PSiM (PSpice Simulation Manager)
•PSiM Conception

•PSiM Features
•Demonstrations
•Conclusions

Why PSiM
OrCAD PSpice limitations:
•ICL (Interactive Command Language) is not implemented
•No possibility to work in so-called sequential mode
•Results of the analysis cannot be input data of the following analysis

circuit file
header
netlist
commands
.end

PSpice
pspice.exe
psp_cmd.exe

user

analysis results
output file
Probe files
...

PSiM Conception
circuit file
header
netlist
commands
.end

PSpice

psp_cmd.exe

SIM

Manager Control File
header
commands
user

analysis results
output file
Probe files
...

PSiM Conception
Manager Control File (MCF)
...
set variable=1
...

psp_cmd.exe

assemblycir x.cir
Extended Circuit File
(ECIR)

...
Rx 1 2 variable
...

x.dat
x.cir

endassembly
.
...
...

run

data from .TRAN, .AC, .DC
data from bias points

re-defining the variables

x.out
x.csd
x.bias

P Spice Circuit File
(P CIR)

PSiM Features
•The PSiM reads the MCF step-by-step, starting from the first line.
•The programming language of the PSiM should support mathematical computations.
•The ECIRs of the circuits being analyzed can appear in the MCF.
•The PCIR can be modified prior to its generation by the PSiM.

•The PSiM is able to process the results of executed simulations.
•All the files generated from all executed simulation runs should be available.
•The PSiM manages commands for program loops and chaining.

Optimization of transistor amplifier

PSiM Demonstrations
Rc design in order to set voltage gain to 10 on a frequency of 1kHz

bat
Vbat
Rc
1.9k

Rb1
180k
c

Cv
in
Vin 10u
1Vac

0

b
Rb2 Q1
33k

0

2N2222
e
Re
200

0

12V

0
Preliminary PSpice analysis:
The gain is approximately 9.

Optimization of transistor amplifier

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:

PSiM Demonstrations
*transistor amplifier
set Rc 1.9k gain 1
while (gain)<=10
assemblycir run.cir
*beginspice
Vbat bat 0 12V
Q c b e Q2N2222
Cv
Rc bat c #$Rc$
in
Re e 0 200
Vin 10u
Rb1 bat b 180k
Rb2 b 0 33k
1Vac
Cv in b 10u
Vin in 0 AC 1
0
.lib
*endspice
genFpoint AMPLI 1k {v([c])}
endassembly
getFpoint AMPLI gain 1
set Rc Rc+20
endwhile

bat
Vbat
Rc
1.9k

Rb1
180k

12V

c
b
Rb2 Q1
33k

0

2N2222
e
Re
200

0
The analysis runs 11 times.
Two last results (Rc, gain):
2100 Ohms, 9.997
2120 Ohms, 10.09

0

AC analysis of SH circuit

PSiM Demonstrations
vin(t)



v(t)

v

1e

t 

t
vin(t)

C

e
v 2 t 

R
v(t)



1

2

1

2

1

2

1

2

1

2

1

2

t
kT

kT+T
kT+T1

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

For k=1..2
*computing coefficients bk
circuit model in phase k, vin=1V, zero initial conditions
TRANSIENT analysis, Tmax =Tk
reading the state variable and saving it to the variable bk
*computing coefficients ak
circuit model in phase k, vin=0V, zero initial conditions
the state variable v = 1
TRANSIENT analysis, Tmax=Tk
reading the state variable and saving it to the variable ak
end

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

Compiling the z-domain equations via behavioral modeling (E-sources)
Solving equations via .AC analysis

PROBE demonstration of frequency responses

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:

*AC analysis of Sample-Hold circuit
set Ron 5k fs 100k T1 0.1/fs T2 1/fs-T1
beginnet SH1
Ron 1 2 #$Ron$
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
beginnet SH2
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
defsim tran1 .TRAN 0 #$T1$ 0 #$T1/100$ skipbp
defsim tran2 .TRAN 0 #$T2$ 0 #$T2/100$ skipbp
defsim AC .AC dec 100 10 #$fs*2$
assemblycir run1.cir
Vin 1 0 1V
use SH1
runsim tran1
endassembly

AC analysis of SH circuit

PSiM Demonstrations
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:

getprobe b tran1 V(3) #$T1$
assemblycir run2.cir
Vin 1 0 0V
use SH1
.IC V(3) 1V
runsim tran1
endassembly
getprobe a1 tran1 V(3) #$T1$
assemblycir run3.cir
use SH2
.IC V(3) 1V
runsim tran2
endassembly
getprobe a2 tran2 V(3) #$T2$
assemblycir run4.cir
Vin 1 0 AC 1
Ec1 c1 x LAPLACE {V(c2)} {#$a1$*exp(-s*#$T1$)}
Ex x 0 value={V(1)*#$b$}
Ec2 c2 0 LAPLACE {V(c1)} {#$a2$*exp(-s*#$T2$)}
runsim AC/nocsdf
endassembly

AC analysis of SH circuit

PSiM Demonstrations
Frequency responses
0

-10

-20

10Hz

100Hz
DB(V(c1))

10KHz
DB(V(c2))
Frequency

200KHz

Conclusions
•PSiM is an independent executable program which controls the OrCAD PSpice.
•It extends significantly the OrCAD PSpice features: Special simulation tasks can be
performed which cannot be done by PSpice alone.

•Currently the PSiM working on the text file level is available.

•The graphical User's Interface (GUI) is developed.


Slide 2

Simulation Manager for OrCAD PSpice
Dalibor Biolek1,2, Jaroslav Kadlec1

Faculty of EE and Communications, Dept. of Microelectronics
Brno University of Technology, Czech Republic
1,2

Faculty of Military Technologies, Dept. of EE
University of Defence, Brno, Czech Republic
1

Outline
•Why PSiM (PSpice Simulation Manager)
•PSiM Conception

•PSiM Features
•Demonstrations
•Conclusions

Why PSiM
OrCAD PSpice limitations:
•ICL (Interactive Command Language) is not implemented
•No possibility to work in so-called sequential mode
•Results of the analysis cannot be input data of the following analysis

circuit file
header
netlist
commands
.end

PSpice
pspice.exe
psp_cmd.exe

user

analysis results
output file
Probe files
...

PSiM Conception
circuit file
header
netlist
commands
.end

PSpice

psp_cmd.exe

SIM

Manager Control File
header
commands
user

analysis results
output file
Probe files
...

PSiM Conception
Manager Control File (MCF)
...
set variable=1
...

psp_cmd.exe

assemblycir x.cir
Extended Circuit File
(ECIR)

...
Rx 1 2 variable
...

x.dat
x.cir

endassembly
.
...
...

run

data from .TRAN, .AC, .DC
data from bias points

re-defining the variables

x.out
x.csd
x.bias

P Spice Circuit File
(P CIR)

PSiM Features
•The PSiM reads the MCF step-by-step, starting from the first line.
•The programming language of the PSiM should support mathematical computations.
•The ECIRs of the circuits being analyzed can appear in the MCF.
•The PCIR can be modified prior to its generation by the PSiM.

•The PSiM is able to process the results of executed simulations.
•All the files generated from all executed simulation runs should be available.
•The PSiM manages commands for program loops and chaining.

Optimization of transistor amplifier

PSiM Demonstrations
Rc design in order to set voltage gain to 10 on a frequency of 1kHz

bat
Vbat
Rc
1.9k

Rb1
180k
c

Cv
in
Vin 10u
1Vac

0

b
Rb2 Q1
33k

0

2N2222
e
Re
200

0

12V

0
Preliminary PSpice analysis:
The gain is approximately 9.

Optimization of transistor amplifier

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:

PSiM Demonstrations
*transistor amplifier
set Rc 1.9k gain 1
while (gain)<=10
assemblycir run.cir
*beginspice
Vbat bat 0 12V
Q c b e Q2N2222
Cv
Rc bat c #$Rc$
in
Re e 0 200
Vin 10u
Rb1 bat b 180k
Rb2 b 0 33k
1Vac
Cv in b 10u
Vin in 0 AC 1
0
.lib
*endspice
genFpoint AMPLI 1k {v([c])}
endassembly
getFpoint AMPLI gain 1
set Rc Rc+20
endwhile

bat
Vbat
Rc
1.9k

Rb1
180k

12V

c
b
Rb2 Q1
33k

0

2N2222
e
Re
200

0
The analysis runs 11 times.
Two last results (Rc, gain):
2100 Ohms, 9.997
2120 Ohms, 10.09

0

AC analysis of SH circuit

PSiM Demonstrations
vin(t)



v(t)

v

1e

t 

t
vin(t)

C

e
v 2 t 

R
v(t)



1

2

1

2

1

2

1

2

1

2

1

2

t
kT

kT+T
kT+T1

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

For k=1..2
*computing coefficients bk
circuit model in phase k, vin=1V, zero initial conditions
TRANSIENT analysis, Tmax =Tk
reading the state variable and saving it to the variable bk
*computing coefficients ak
circuit model in phase k, vin=0V, zero initial conditions
the state variable v = 1
TRANSIENT analysis, Tmax=Tk
reading the state variable and saving it to the variable ak
end

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

Compiling the z-domain equations via behavioral modeling (E-sources)
Solving equations via .AC analysis

PROBE demonstration of frequency responses

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:

*AC analysis of Sample-Hold circuit
set Ron 5k fs 100k T1 0.1/fs T2 1/fs-T1
beginnet SH1
Ron 1 2 #$Ron$
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
beginnet SH2
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
defsim tran1 .TRAN 0 #$T1$ 0 #$T1/100$ skipbp
defsim tran2 .TRAN 0 #$T2$ 0 #$T2/100$ skipbp
defsim AC .AC dec 100 10 #$fs*2$
assemblycir run1.cir
Vin 1 0 1V
use SH1
runsim tran1
endassembly

AC analysis of SH circuit

PSiM Demonstrations
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:

getprobe b tran1 V(3) #$T1$
assemblycir run2.cir
Vin 1 0 0V
use SH1
.IC V(3) 1V
runsim tran1
endassembly
getprobe a1 tran1 V(3) #$T1$
assemblycir run3.cir
use SH2
.IC V(3) 1V
runsim tran2
endassembly
getprobe a2 tran2 V(3) #$T2$
assemblycir run4.cir
Vin 1 0 AC 1
Ec1 c1 x LAPLACE {V(c2)} {#$a1$*exp(-s*#$T1$)}
Ex x 0 value={V(1)*#$b$}
Ec2 c2 0 LAPLACE {V(c1)} {#$a2$*exp(-s*#$T2$)}
runsim AC/nocsdf
endassembly

AC analysis of SH circuit

PSiM Demonstrations
Frequency responses
0

-10

-20

10Hz

100Hz
DB(V(c1))

10KHz
DB(V(c2))
Frequency

200KHz

Conclusions
•PSiM is an independent executable program which controls the OrCAD PSpice.
•It extends significantly the OrCAD PSpice features: Special simulation tasks can be
performed which cannot be done by PSpice alone.

•Currently the PSiM working on the text file level is available.

•The graphical User's Interface (GUI) is developed.


Slide 3

Simulation Manager for OrCAD PSpice
Dalibor Biolek1,2, Jaroslav Kadlec1

Faculty of EE and Communications, Dept. of Microelectronics
Brno University of Technology, Czech Republic
1,2

Faculty of Military Technologies, Dept. of EE
University of Defence, Brno, Czech Republic
1

Outline
•Why PSiM (PSpice Simulation Manager)
•PSiM Conception

•PSiM Features
•Demonstrations
•Conclusions

Why PSiM
OrCAD PSpice limitations:
•ICL (Interactive Command Language) is not implemented
•No possibility to work in so-called sequential mode
•Results of the analysis cannot be input data of the following analysis

circuit file
header
netlist
commands
.end

PSpice
pspice.exe
psp_cmd.exe

user

analysis results
output file
Probe files
...

PSiM Conception
circuit file
header
netlist
commands
.end

PSpice

psp_cmd.exe

SIM

Manager Control File
header
commands
user

analysis results
output file
Probe files
...

PSiM Conception
Manager Control File (MCF)
...
set variable=1
...

psp_cmd.exe

assemblycir x.cir
Extended Circuit File
(ECIR)

...
Rx 1 2 variable
...

x.dat
x.cir

endassembly
.
...
...

run

data from .TRAN, .AC, .DC
data from bias points

re-defining the variables

x.out
x.csd
x.bias

P Spice Circuit File
(P CIR)

PSiM Features
•The PSiM reads the MCF step-by-step, starting from the first line.
•The programming language of the PSiM should support mathematical computations.
•The ECIRs of the circuits being analyzed can appear in the MCF.
•The PCIR can be modified prior to its generation by the PSiM.

•The PSiM is able to process the results of executed simulations.
•All the files generated from all executed simulation runs should be available.
•The PSiM manages commands for program loops and chaining.

Optimization of transistor amplifier

PSiM Demonstrations
Rc design in order to set voltage gain to 10 on a frequency of 1kHz

bat
Vbat
Rc
1.9k

Rb1
180k
c

Cv
in
Vin 10u
1Vac

0

b
Rb2 Q1
33k

0

2N2222
e
Re
200

0

12V

0
Preliminary PSpice analysis:
The gain is approximately 9.

Optimization of transistor amplifier

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:

PSiM Demonstrations
*transistor amplifier
set Rc 1.9k gain 1
while (gain)<=10
assemblycir run.cir
*beginspice
Vbat bat 0 12V
Q c b e Q2N2222
Cv
Rc bat c #$Rc$
in
Re e 0 200
Vin 10u
Rb1 bat b 180k
Rb2 b 0 33k
1Vac
Cv in b 10u
Vin in 0 AC 1
0
.lib
*endspice
genFpoint AMPLI 1k {v([c])}
endassembly
getFpoint AMPLI gain 1
set Rc Rc+20
endwhile

bat
Vbat
Rc
1.9k

Rb1
180k

12V

c
b
Rb2 Q1
33k

0

2N2222
e
Re
200

0
The analysis runs 11 times.
Two last results (Rc, gain):
2100 Ohms, 9.997
2120 Ohms, 10.09

0

AC analysis of SH circuit

PSiM Demonstrations
vin(t)



v(t)

v

1e

t 

t
vin(t)

C

e
v 2 t 

R
v(t)



1

2

1

2

1

2

1

2

1

2

1

2

t
kT

kT+T
kT+T1

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

For k=1..2
*computing coefficients bk
circuit model in phase k, vin=1V, zero initial conditions
TRANSIENT analysis, Tmax =Tk
reading the state variable and saving it to the variable bk
*computing coefficients ak
circuit model in phase k, vin=0V, zero initial conditions
the state variable v = 1
TRANSIENT analysis, Tmax=Tk
reading the state variable and saving it to the variable ak
end

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

Compiling the z-domain equations via behavioral modeling (E-sources)
Solving equations via .AC analysis

PROBE demonstration of frequency responses

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:

*AC analysis of Sample-Hold circuit
set Ron 5k fs 100k T1 0.1/fs T2 1/fs-T1
beginnet SH1
Ron 1 2 #$Ron$
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
beginnet SH2
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
defsim tran1 .TRAN 0 #$T1$ 0 #$T1/100$ skipbp
defsim tran2 .TRAN 0 #$T2$ 0 #$T2/100$ skipbp
defsim AC .AC dec 100 10 #$fs*2$
assemblycir run1.cir
Vin 1 0 1V
use SH1
runsim tran1
endassembly

AC analysis of SH circuit

PSiM Demonstrations
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:

getprobe b tran1 V(3) #$T1$
assemblycir run2.cir
Vin 1 0 0V
use SH1
.IC V(3) 1V
runsim tran1
endassembly
getprobe a1 tran1 V(3) #$T1$
assemblycir run3.cir
use SH2
.IC V(3) 1V
runsim tran2
endassembly
getprobe a2 tran2 V(3) #$T2$
assemblycir run4.cir
Vin 1 0 AC 1
Ec1 c1 x LAPLACE {V(c2)} {#$a1$*exp(-s*#$T1$)}
Ex x 0 value={V(1)*#$b$}
Ec2 c2 0 LAPLACE {V(c1)} {#$a2$*exp(-s*#$T2$)}
runsim AC/nocsdf
endassembly

AC analysis of SH circuit

PSiM Demonstrations
Frequency responses
0

-10

-20

10Hz

100Hz
DB(V(c1))

10KHz
DB(V(c2))
Frequency

200KHz

Conclusions
•PSiM is an independent executable program which controls the OrCAD PSpice.
•It extends significantly the OrCAD PSpice features: Special simulation tasks can be
performed which cannot be done by PSpice alone.

•Currently the PSiM working on the text file level is available.

•The graphical User's Interface (GUI) is developed.


Slide 4

Simulation Manager for OrCAD PSpice
Dalibor Biolek1,2, Jaroslav Kadlec1

Faculty of EE and Communications, Dept. of Microelectronics
Brno University of Technology, Czech Republic
1,2

Faculty of Military Technologies, Dept. of EE
University of Defence, Brno, Czech Republic
1

Outline
•Why PSiM (PSpice Simulation Manager)
•PSiM Conception

•PSiM Features
•Demonstrations
•Conclusions

Why PSiM
OrCAD PSpice limitations:
•ICL (Interactive Command Language) is not implemented
•No possibility to work in so-called sequential mode
•Results of the analysis cannot be input data of the following analysis

circuit file
header
netlist
commands
.end

PSpice
pspice.exe
psp_cmd.exe

user

analysis results
output file
Probe files
...

PSiM Conception
circuit file
header
netlist
commands
.end

PSpice

psp_cmd.exe

SIM

Manager Control File
header
commands
user

analysis results
output file
Probe files
...

PSiM Conception
Manager Control File (MCF)
...
set variable=1
...

psp_cmd.exe

assemblycir x.cir
Extended Circuit File
(ECIR)

...
Rx 1 2 variable
...

x.dat
x.cir

endassembly
.
...
...

run

data from .TRAN, .AC, .DC
data from bias points

re-defining the variables

x.out
x.csd
x.bias

P Spice Circuit File
(P CIR)

PSiM Features
•The PSiM reads the MCF step-by-step, starting from the first line.
•The programming language of the PSiM should support mathematical computations.
•The ECIRs of the circuits being analyzed can appear in the MCF.
•The PCIR can be modified prior to its generation by the PSiM.

•The PSiM is able to process the results of executed simulations.
•All the files generated from all executed simulation runs should be available.
•The PSiM manages commands for program loops and chaining.

Optimization of transistor amplifier

PSiM Demonstrations
Rc design in order to set voltage gain to 10 on a frequency of 1kHz

bat
Vbat
Rc
1.9k

Rb1
180k
c

Cv
in
Vin 10u
1Vac

0

b
Rb2 Q1
33k

0

2N2222
e
Re
200

0

12V

0
Preliminary PSpice analysis:
The gain is approximately 9.

Optimization of transistor amplifier

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:

PSiM Demonstrations
*transistor amplifier
set Rc 1.9k gain 1
while (gain)<=10
assemblycir run.cir
*beginspice
Vbat bat 0 12V
Q c b e Q2N2222
Cv
Rc bat c #$Rc$
in
Re e 0 200
Vin 10u
Rb1 bat b 180k
Rb2 b 0 33k
1Vac
Cv in b 10u
Vin in 0 AC 1
0
.lib
*endspice
genFpoint AMPLI 1k {v([c])}
endassembly
getFpoint AMPLI gain 1
set Rc Rc+20
endwhile

bat
Vbat
Rc
1.9k

Rb1
180k

12V

c
b
Rb2 Q1
33k

0

2N2222
e
Re
200

0
The analysis runs 11 times.
Two last results (Rc, gain):
2100 Ohms, 9.997
2120 Ohms, 10.09

0

AC analysis of SH circuit

PSiM Demonstrations
vin(t)



v(t)

v

1e

t 

t
vin(t)

C

e
v 2 t 

R
v(t)



1

2

1

2

1

2

1

2

1

2

1

2

t
kT

kT+T
kT+T1

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

For k=1..2
*computing coefficients bk
circuit model in phase k, vin=1V, zero initial conditions
TRANSIENT analysis, Tmax =Tk
reading the state variable and saving it to the variable bk
*computing coefficients ak
circuit model in phase k, vin=0V, zero initial conditions
the state variable v = 1
TRANSIENT analysis, Tmax=Tk
reading the state variable and saving it to the variable ak
end

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

Compiling the z-domain equations via behavioral modeling (E-sources)
Solving equations via .AC analysis

PROBE demonstration of frequency responses

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:

*AC analysis of Sample-Hold circuit
set Ron 5k fs 100k T1 0.1/fs T2 1/fs-T1
beginnet SH1
Ron 1 2 #$Ron$
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
beginnet SH2
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
defsim tran1 .TRAN 0 #$T1$ 0 #$T1/100$ skipbp
defsim tran2 .TRAN 0 #$T2$ 0 #$T2/100$ skipbp
defsim AC .AC dec 100 10 #$fs*2$
assemblycir run1.cir
Vin 1 0 1V
use SH1
runsim tran1
endassembly

AC analysis of SH circuit

PSiM Demonstrations
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:

getprobe b tran1 V(3) #$T1$
assemblycir run2.cir
Vin 1 0 0V
use SH1
.IC V(3) 1V
runsim tran1
endassembly
getprobe a1 tran1 V(3) #$T1$
assemblycir run3.cir
use SH2
.IC V(3) 1V
runsim tran2
endassembly
getprobe a2 tran2 V(3) #$T2$
assemblycir run4.cir
Vin 1 0 AC 1
Ec1 c1 x LAPLACE {V(c2)} {#$a1$*exp(-s*#$T1$)}
Ex x 0 value={V(1)*#$b$}
Ec2 c2 0 LAPLACE {V(c1)} {#$a2$*exp(-s*#$T2$)}
runsim AC/nocsdf
endassembly

AC analysis of SH circuit

PSiM Demonstrations
Frequency responses
0

-10

-20

10Hz

100Hz
DB(V(c1))

10KHz
DB(V(c2))
Frequency

200KHz

Conclusions
•PSiM is an independent executable program which controls the OrCAD PSpice.
•It extends significantly the OrCAD PSpice features: Special simulation tasks can be
performed which cannot be done by PSpice alone.

•Currently the PSiM working on the text file level is available.

•The graphical User's Interface (GUI) is developed.


Slide 5

Simulation Manager for OrCAD PSpice
Dalibor Biolek1,2, Jaroslav Kadlec1

Faculty of EE and Communications, Dept. of Microelectronics
Brno University of Technology, Czech Republic
1,2

Faculty of Military Technologies, Dept. of EE
University of Defence, Brno, Czech Republic
1

Outline
•Why PSiM (PSpice Simulation Manager)
•PSiM Conception

•PSiM Features
•Demonstrations
•Conclusions

Why PSiM
OrCAD PSpice limitations:
•ICL (Interactive Command Language) is not implemented
•No possibility to work in so-called sequential mode
•Results of the analysis cannot be input data of the following analysis

circuit file
header
netlist
commands
.end

PSpice
pspice.exe
psp_cmd.exe

user

analysis results
output file
Probe files
...

PSiM Conception
circuit file
header
netlist
commands
.end

PSpice

psp_cmd.exe

SIM

Manager Control File
header
commands
user

analysis results
output file
Probe files
...

PSiM Conception
Manager Control File (MCF)
...
set variable=1
...

psp_cmd.exe

assemblycir x.cir
Extended Circuit File
(ECIR)

...
Rx 1 2 variable
...

x.dat
x.cir

endassembly
.
...
...

run

data from .TRAN, .AC, .DC
data from bias points

re-defining the variables

x.out
x.csd
x.bias

P Spice Circuit File
(P CIR)

PSiM Features
•The PSiM reads the MCF step-by-step, starting from the first line.
•The programming language of the PSiM should support mathematical computations.
•The ECIRs of the circuits being analyzed can appear in the MCF.
•The PCIR can be modified prior to its generation by the PSiM.

•The PSiM is able to process the results of executed simulations.
•All the files generated from all executed simulation runs should be available.
•The PSiM manages commands for program loops and chaining.

Optimization of transistor amplifier

PSiM Demonstrations
Rc design in order to set voltage gain to 10 on a frequency of 1kHz

bat
Vbat
Rc
1.9k

Rb1
180k
c

Cv
in
Vin 10u
1Vac

0

b
Rb2 Q1
33k

0

2N2222
e
Re
200

0

12V

0
Preliminary PSpice analysis:
The gain is approximately 9.

Optimization of transistor amplifier

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:

PSiM Demonstrations
*transistor amplifier
set Rc 1.9k gain 1
while (gain)<=10
assemblycir run.cir
*beginspice
Vbat bat 0 12V
Q c b e Q2N2222
Cv
Rc bat c #$Rc$
in
Re e 0 200
Vin 10u
Rb1 bat b 180k
Rb2 b 0 33k
1Vac
Cv in b 10u
Vin in 0 AC 1
0
.lib
*endspice
genFpoint AMPLI 1k {v([c])}
endassembly
getFpoint AMPLI gain 1
set Rc Rc+20
endwhile

bat
Vbat
Rc
1.9k

Rb1
180k

12V

c
b
Rb2 Q1
33k

0

2N2222
e
Re
200

0
The analysis runs 11 times.
Two last results (Rc, gain):
2100 Ohms, 9.997
2120 Ohms, 10.09

0

AC analysis of SH circuit

PSiM Demonstrations
vin(t)



v(t)

v

1e

t 

t
vin(t)

C

e
v 2 t 

R
v(t)



1

2

1

2

1

2

1

2

1

2

1

2

t
kT

kT+T
kT+T1

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

For k=1..2
*computing coefficients bk
circuit model in phase k, vin=1V, zero initial conditions
TRANSIENT analysis, Tmax =Tk
reading the state variable and saving it to the variable bk
*computing coefficients ak
circuit model in phase k, vin=0V, zero initial conditions
the state variable v = 1
TRANSIENT analysis, Tmax=Tk
reading the state variable and saving it to the variable ak
end

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

Compiling the z-domain equations via behavioral modeling (E-sources)
Solving equations via .AC analysis

PROBE demonstration of frequency responses

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:

*AC analysis of Sample-Hold circuit
set Ron 5k fs 100k T1 0.1/fs T2 1/fs-T1
beginnet SH1
Ron 1 2 #$Ron$
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
beginnet SH2
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
defsim tran1 .TRAN 0 #$T1$ 0 #$T1/100$ skipbp
defsim tran2 .TRAN 0 #$T2$ 0 #$T2/100$ skipbp
defsim AC .AC dec 100 10 #$fs*2$
assemblycir run1.cir
Vin 1 0 1V
use SH1
runsim tran1
endassembly

AC analysis of SH circuit

PSiM Demonstrations
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:

getprobe b tran1 V(3) #$T1$
assemblycir run2.cir
Vin 1 0 0V
use SH1
.IC V(3) 1V
runsim tran1
endassembly
getprobe a1 tran1 V(3) #$T1$
assemblycir run3.cir
use SH2
.IC V(3) 1V
runsim tran2
endassembly
getprobe a2 tran2 V(3) #$T2$
assemblycir run4.cir
Vin 1 0 AC 1
Ec1 c1 x LAPLACE {V(c2)} {#$a1$*exp(-s*#$T1$)}
Ex x 0 value={V(1)*#$b$}
Ec2 c2 0 LAPLACE {V(c1)} {#$a2$*exp(-s*#$T2$)}
runsim AC/nocsdf
endassembly

AC analysis of SH circuit

PSiM Demonstrations
Frequency responses
0

-10

-20

10Hz

100Hz
DB(V(c1))

10KHz
DB(V(c2))
Frequency

200KHz

Conclusions
•PSiM is an independent executable program which controls the OrCAD PSpice.
•It extends significantly the OrCAD PSpice features: Special simulation tasks can be
performed which cannot be done by PSpice alone.

•Currently the PSiM working on the text file level is available.

•The graphical User's Interface (GUI) is developed.


Slide 6

Simulation Manager for OrCAD PSpice
Dalibor Biolek1,2, Jaroslav Kadlec1

Faculty of EE and Communications, Dept. of Microelectronics
Brno University of Technology, Czech Republic
1,2

Faculty of Military Technologies, Dept. of EE
University of Defence, Brno, Czech Republic
1

Outline
•Why PSiM (PSpice Simulation Manager)
•PSiM Conception

•PSiM Features
•Demonstrations
•Conclusions

Why PSiM
OrCAD PSpice limitations:
•ICL (Interactive Command Language) is not implemented
•No possibility to work in so-called sequential mode
•Results of the analysis cannot be input data of the following analysis

circuit file
header
netlist
commands
.end

PSpice
pspice.exe
psp_cmd.exe

user

analysis results
output file
Probe files
...

PSiM Conception
circuit file
header
netlist
commands
.end

PSpice

psp_cmd.exe

SIM

Manager Control File
header
commands
user

analysis results
output file
Probe files
...

PSiM Conception
Manager Control File (MCF)
...
set variable=1
...

psp_cmd.exe

assemblycir x.cir
Extended Circuit File
(ECIR)

...
Rx 1 2 variable
...

x.dat
x.cir

endassembly
.
...
...

run

data from .TRAN, .AC, .DC
data from bias points

re-defining the variables

x.out
x.csd
x.bias

P Spice Circuit File
(P CIR)

PSiM Features
•The PSiM reads the MCF step-by-step, starting from the first line.
•The programming language of the PSiM should support mathematical computations.
•The ECIRs of the circuits being analyzed can appear in the MCF.
•The PCIR can be modified prior to its generation by the PSiM.

•The PSiM is able to process the results of executed simulations.
•All the files generated from all executed simulation runs should be available.
•The PSiM manages commands for program loops and chaining.

Optimization of transistor amplifier

PSiM Demonstrations
Rc design in order to set voltage gain to 10 on a frequency of 1kHz

bat
Vbat
Rc
1.9k

Rb1
180k
c

Cv
in
Vin 10u
1Vac

0

b
Rb2 Q1
33k

0

2N2222
e
Re
200

0

12V

0
Preliminary PSpice analysis:
The gain is approximately 9.

Optimization of transistor amplifier

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:

PSiM Demonstrations
*transistor amplifier
set Rc 1.9k gain 1
while (gain)<=10
assemblycir run.cir
*beginspice
Vbat bat 0 12V
Q c b e Q2N2222
Cv
Rc bat c #$Rc$
in
Re e 0 200
Vin 10u
Rb1 bat b 180k
Rb2 b 0 33k
1Vac
Cv in b 10u
Vin in 0 AC 1
0
.lib
*endspice
genFpoint AMPLI 1k {v([c])}
endassembly
getFpoint AMPLI gain 1
set Rc Rc+20
endwhile

bat
Vbat
Rc
1.9k

Rb1
180k

12V

c
b
Rb2 Q1
33k

0

2N2222
e
Re
200

0
The analysis runs 11 times.
Two last results (Rc, gain):
2100 Ohms, 9.997
2120 Ohms, 10.09

0

AC analysis of SH circuit

PSiM Demonstrations
vin(t)



v(t)

v

1e

t 

t
vin(t)

C

e
v 2 t 

R
v(t)



1

2

1

2

1

2

1

2

1

2

1

2

t
kT

kT+T
kT+T1

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

For k=1..2
*computing coefficients bk
circuit model in phase k, vin=1V, zero initial conditions
TRANSIENT analysis, Tmax =Tk
reading the state variable and saving it to the variable bk
*computing coefficients ak
circuit model in phase k, vin=0V, zero initial conditions
the state variable v = 1
TRANSIENT analysis, Tmax=Tk
reading the state variable and saving it to the variable ak
end

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

Compiling the z-domain equations via behavioral modeling (E-sources)
Solving equations via .AC analysis

PROBE demonstration of frequency responses

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:

*AC analysis of Sample-Hold circuit
set Ron 5k fs 100k T1 0.1/fs T2 1/fs-T1
beginnet SH1
Ron 1 2 #$Ron$
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
beginnet SH2
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
defsim tran1 .TRAN 0 #$T1$ 0 #$T1/100$ skipbp
defsim tran2 .TRAN 0 #$T2$ 0 #$T2/100$ skipbp
defsim AC .AC dec 100 10 #$fs*2$
assemblycir run1.cir
Vin 1 0 1V
use SH1
runsim tran1
endassembly

AC analysis of SH circuit

PSiM Demonstrations
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:

getprobe b tran1 V(3) #$T1$
assemblycir run2.cir
Vin 1 0 0V
use SH1
.IC V(3) 1V
runsim tran1
endassembly
getprobe a1 tran1 V(3) #$T1$
assemblycir run3.cir
use SH2
.IC V(3) 1V
runsim tran2
endassembly
getprobe a2 tran2 V(3) #$T2$
assemblycir run4.cir
Vin 1 0 AC 1
Ec1 c1 x LAPLACE {V(c2)} {#$a1$*exp(-s*#$T1$)}
Ex x 0 value={V(1)*#$b$}
Ec2 c2 0 LAPLACE {V(c1)} {#$a2$*exp(-s*#$T2$)}
runsim AC/nocsdf
endassembly

AC analysis of SH circuit

PSiM Demonstrations
Frequency responses
0

-10

-20

10Hz

100Hz
DB(V(c1))

10KHz
DB(V(c2))
Frequency

200KHz

Conclusions
•PSiM is an independent executable program which controls the OrCAD PSpice.
•It extends significantly the OrCAD PSpice features: Special simulation tasks can be
performed which cannot be done by PSpice alone.

•Currently the PSiM working on the text file level is available.

•The graphical User's Interface (GUI) is developed.


Slide 7

Simulation Manager for OrCAD PSpice
Dalibor Biolek1,2, Jaroslav Kadlec1

Faculty of EE and Communications, Dept. of Microelectronics
Brno University of Technology, Czech Republic
1,2

Faculty of Military Technologies, Dept. of EE
University of Defence, Brno, Czech Republic
1

Outline
•Why PSiM (PSpice Simulation Manager)
•PSiM Conception

•PSiM Features
•Demonstrations
•Conclusions

Why PSiM
OrCAD PSpice limitations:
•ICL (Interactive Command Language) is not implemented
•No possibility to work in so-called sequential mode
•Results of the analysis cannot be input data of the following analysis

circuit file
header
netlist
commands
.end

PSpice
pspice.exe
psp_cmd.exe

user

analysis results
output file
Probe files
...

PSiM Conception
circuit file
header
netlist
commands
.end

PSpice

psp_cmd.exe

SIM

Manager Control File
header
commands
user

analysis results
output file
Probe files
...

PSiM Conception
Manager Control File (MCF)
...
set variable=1
...

psp_cmd.exe

assemblycir x.cir
Extended Circuit File
(ECIR)

...
Rx 1 2 variable
...

x.dat
x.cir

endassembly
.
...
...

run

data from .TRAN, .AC, .DC
data from bias points

re-defining the variables

x.out
x.csd
x.bias

P Spice Circuit File
(P CIR)

PSiM Features
•The PSiM reads the MCF step-by-step, starting from the first line.
•The programming language of the PSiM should support mathematical computations.
•The ECIRs of the circuits being analyzed can appear in the MCF.
•The PCIR can be modified prior to its generation by the PSiM.

•The PSiM is able to process the results of executed simulations.
•All the files generated from all executed simulation runs should be available.
•The PSiM manages commands for program loops and chaining.

Optimization of transistor amplifier

PSiM Demonstrations
Rc design in order to set voltage gain to 10 on a frequency of 1kHz

bat
Vbat
Rc
1.9k

Rb1
180k
c

Cv
in
Vin 10u
1Vac

0

b
Rb2 Q1
33k

0

2N2222
e
Re
200

0

12V

0
Preliminary PSpice analysis:
The gain is approximately 9.

Optimization of transistor amplifier

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:

PSiM Demonstrations
*transistor amplifier
set Rc 1.9k gain 1
while (gain)<=10
assemblycir run.cir
*beginspice
Vbat bat 0 12V
Q c b e Q2N2222
Cv
Rc bat c #$Rc$
in
Re e 0 200
Vin 10u
Rb1 bat b 180k
Rb2 b 0 33k
1Vac
Cv in b 10u
Vin in 0 AC 1
0
.lib
*endspice
genFpoint AMPLI 1k {v([c])}
endassembly
getFpoint AMPLI gain 1
set Rc Rc+20
endwhile

bat
Vbat
Rc
1.9k

Rb1
180k

12V

c
b
Rb2 Q1
33k

0

2N2222
e
Re
200

0
The analysis runs 11 times.
Two last results (Rc, gain):
2100 Ohms, 9.997
2120 Ohms, 10.09

0

AC analysis of SH circuit

PSiM Demonstrations
vin(t)



v(t)

v

1e

t 

t
vin(t)

C

e
v 2 t 

R
v(t)



1

2

1

2

1

2

1

2

1

2

1

2

t
kT

kT+T
kT+T1

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

For k=1..2
*computing coefficients bk
circuit model in phase k, vin=1V, zero initial conditions
TRANSIENT analysis, Tmax =Tk
reading the state variable and saving it to the variable bk
*computing coefficients ak
circuit model in phase k, vin=0V, zero initial conditions
the state variable v = 1
TRANSIENT analysis, Tmax=Tk
reading the state variable and saving it to the variable ak
end

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

Compiling the z-domain equations via behavioral modeling (E-sources)
Solving equations via .AC analysis

PROBE demonstration of frequency responses

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:

*AC analysis of Sample-Hold circuit
set Ron 5k fs 100k T1 0.1/fs T2 1/fs-T1
beginnet SH1
Ron 1 2 #$Ron$
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
beginnet SH2
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
defsim tran1 .TRAN 0 #$T1$ 0 #$T1/100$ skipbp
defsim tran2 .TRAN 0 #$T2$ 0 #$T2/100$ skipbp
defsim AC .AC dec 100 10 #$fs*2$
assemblycir run1.cir
Vin 1 0 1V
use SH1
runsim tran1
endassembly

AC analysis of SH circuit

PSiM Demonstrations
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:

getprobe b tran1 V(3) #$T1$
assemblycir run2.cir
Vin 1 0 0V
use SH1
.IC V(3) 1V
runsim tran1
endassembly
getprobe a1 tran1 V(3) #$T1$
assemblycir run3.cir
use SH2
.IC V(3) 1V
runsim tran2
endassembly
getprobe a2 tran2 V(3) #$T2$
assemblycir run4.cir
Vin 1 0 AC 1
Ec1 c1 x LAPLACE {V(c2)} {#$a1$*exp(-s*#$T1$)}
Ex x 0 value={V(1)*#$b$}
Ec2 c2 0 LAPLACE {V(c1)} {#$a2$*exp(-s*#$T2$)}
runsim AC/nocsdf
endassembly

AC analysis of SH circuit

PSiM Demonstrations
Frequency responses
0

-10

-20

10Hz

100Hz
DB(V(c1))

10KHz
DB(V(c2))
Frequency

200KHz

Conclusions
•PSiM is an independent executable program which controls the OrCAD PSpice.
•It extends significantly the OrCAD PSpice features: Special simulation tasks can be
performed which cannot be done by PSpice alone.

•Currently the PSiM working on the text file level is available.

•The graphical User's Interface (GUI) is developed.


Slide 8

Simulation Manager for OrCAD PSpice
Dalibor Biolek1,2, Jaroslav Kadlec1

Faculty of EE and Communications, Dept. of Microelectronics
Brno University of Technology, Czech Republic
1,2

Faculty of Military Technologies, Dept. of EE
University of Defence, Brno, Czech Republic
1

Outline
•Why PSiM (PSpice Simulation Manager)
•PSiM Conception

•PSiM Features
•Demonstrations
•Conclusions

Why PSiM
OrCAD PSpice limitations:
•ICL (Interactive Command Language) is not implemented
•No possibility to work in so-called sequential mode
•Results of the analysis cannot be input data of the following analysis

circuit file
header
netlist
commands
.end

PSpice
pspice.exe
psp_cmd.exe

user

analysis results
output file
Probe files
...

PSiM Conception
circuit file
header
netlist
commands
.end

PSpice

psp_cmd.exe

SIM

Manager Control File
header
commands
user

analysis results
output file
Probe files
...

PSiM Conception
Manager Control File (MCF)
...
set variable=1
...

psp_cmd.exe

assemblycir x.cir
Extended Circuit File
(ECIR)

...
Rx 1 2 variable
...

x.dat
x.cir

endassembly
.
...
...

run

data from .TRAN, .AC, .DC
data from bias points

re-defining the variables

x.out
x.csd
x.bias

P Spice Circuit File
(P CIR)

PSiM Features
•The PSiM reads the MCF step-by-step, starting from the first line.
•The programming language of the PSiM should support mathematical computations.
•The ECIRs of the circuits being analyzed can appear in the MCF.
•The PCIR can be modified prior to its generation by the PSiM.

•The PSiM is able to process the results of executed simulations.
•All the files generated from all executed simulation runs should be available.
•The PSiM manages commands for program loops and chaining.

Optimization of transistor amplifier

PSiM Demonstrations
Rc design in order to set voltage gain to 10 on a frequency of 1kHz

bat
Vbat
Rc
1.9k

Rb1
180k
c

Cv
in
Vin 10u
1Vac

0

b
Rb2 Q1
33k

0

2N2222
e
Re
200

0

12V

0
Preliminary PSpice analysis:
The gain is approximately 9.

Optimization of transistor amplifier

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:

PSiM Demonstrations
*transistor amplifier
set Rc 1.9k gain 1
while (gain)<=10
assemblycir run.cir
*beginspice
Vbat bat 0 12V
Q c b e Q2N2222
Cv
Rc bat c #$Rc$
in
Re e 0 200
Vin 10u
Rb1 bat b 180k
Rb2 b 0 33k
1Vac
Cv in b 10u
Vin in 0 AC 1
0
.lib
*endspice
genFpoint AMPLI 1k {v([c])}
endassembly
getFpoint AMPLI gain 1
set Rc Rc+20
endwhile

bat
Vbat
Rc
1.9k

Rb1
180k

12V

c
b
Rb2 Q1
33k

0

2N2222
e
Re
200

0
The analysis runs 11 times.
Two last results (Rc, gain):
2100 Ohms, 9.997
2120 Ohms, 10.09

0

AC analysis of SH circuit

PSiM Demonstrations
vin(t)



v(t)

v

1e

t 

t
vin(t)

C

e
v 2 t 

R
v(t)



1

2

1

2

1

2

1

2

1

2

1

2

t
kT

kT+T
kT+T1

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

For k=1..2
*computing coefficients bk
circuit model in phase k, vin=1V, zero initial conditions
TRANSIENT analysis, Tmax =Tk
reading the state variable and saving it to the variable bk
*computing coefficients ak
circuit model in phase k, vin=0V, zero initial conditions
the state variable v = 1
TRANSIENT analysis, Tmax=Tk
reading the state variable and saving it to the variable ak
end

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

Compiling the z-domain equations via behavioral modeling (E-sources)
Solving equations via .AC analysis

PROBE demonstration of frequency responses

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:

*AC analysis of Sample-Hold circuit
set Ron 5k fs 100k T1 0.1/fs T2 1/fs-T1
beginnet SH1
Ron 1 2 #$Ron$
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
beginnet SH2
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
defsim tran1 .TRAN 0 #$T1$ 0 #$T1/100$ skipbp
defsim tran2 .TRAN 0 #$T2$ 0 #$T2/100$ skipbp
defsim AC .AC dec 100 10 #$fs*2$
assemblycir run1.cir
Vin 1 0 1V
use SH1
runsim tran1
endassembly

AC analysis of SH circuit

PSiM Demonstrations
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:

getprobe b tran1 V(3) #$T1$
assemblycir run2.cir
Vin 1 0 0V
use SH1
.IC V(3) 1V
runsim tran1
endassembly
getprobe a1 tran1 V(3) #$T1$
assemblycir run3.cir
use SH2
.IC V(3) 1V
runsim tran2
endassembly
getprobe a2 tran2 V(3) #$T2$
assemblycir run4.cir
Vin 1 0 AC 1
Ec1 c1 x LAPLACE {V(c2)} {#$a1$*exp(-s*#$T1$)}
Ex x 0 value={V(1)*#$b$}
Ec2 c2 0 LAPLACE {V(c1)} {#$a2$*exp(-s*#$T2$)}
runsim AC/nocsdf
endassembly

AC analysis of SH circuit

PSiM Demonstrations
Frequency responses
0

-10

-20

10Hz

100Hz
DB(V(c1))

10KHz
DB(V(c2))
Frequency

200KHz

Conclusions
•PSiM is an independent executable program which controls the OrCAD PSpice.
•It extends significantly the OrCAD PSpice features: Special simulation tasks can be
performed which cannot be done by PSpice alone.

•Currently the PSiM working on the text file level is available.

•The graphical User's Interface (GUI) is developed.


Slide 9

Simulation Manager for OrCAD PSpice
Dalibor Biolek1,2, Jaroslav Kadlec1

Faculty of EE and Communications, Dept. of Microelectronics
Brno University of Technology, Czech Republic
1,2

Faculty of Military Technologies, Dept. of EE
University of Defence, Brno, Czech Republic
1

Outline
•Why PSiM (PSpice Simulation Manager)
•PSiM Conception

•PSiM Features
•Demonstrations
•Conclusions

Why PSiM
OrCAD PSpice limitations:
•ICL (Interactive Command Language) is not implemented
•No possibility to work in so-called sequential mode
•Results of the analysis cannot be input data of the following analysis

circuit file
header
netlist
commands
.end

PSpice
pspice.exe
psp_cmd.exe

user

analysis results
output file
Probe files
...

PSiM Conception
circuit file
header
netlist
commands
.end

PSpice

psp_cmd.exe

SIM

Manager Control File
header
commands
user

analysis results
output file
Probe files
...

PSiM Conception
Manager Control File (MCF)
...
set variable=1
...

psp_cmd.exe

assemblycir x.cir
Extended Circuit File
(ECIR)

...
Rx 1 2 variable
...

x.dat
x.cir

endassembly
.
...
...

run

data from .TRAN, .AC, .DC
data from bias points

re-defining the variables

x.out
x.csd
x.bias

P Spice Circuit File
(P CIR)

PSiM Features
•The PSiM reads the MCF step-by-step, starting from the first line.
•The programming language of the PSiM should support mathematical computations.
•The ECIRs of the circuits being analyzed can appear in the MCF.
•The PCIR can be modified prior to its generation by the PSiM.

•The PSiM is able to process the results of executed simulations.
•All the files generated from all executed simulation runs should be available.
•The PSiM manages commands for program loops and chaining.

Optimization of transistor amplifier

PSiM Demonstrations
Rc design in order to set voltage gain to 10 on a frequency of 1kHz

bat
Vbat
Rc
1.9k

Rb1
180k
c

Cv
in
Vin 10u
1Vac

0

b
Rb2 Q1
33k

0

2N2222
e
Re
200

0

12V

0
Preliminary PSpice analysis:
The gain is approximately 9.

Optimization of transistor amplifier

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:

PSiM Demonstrations
*transistor amplifier
set Rc 1.9k gain 1
while (gain)<=10
assemblycir run.cir
*beginspice
Vbat bat 0 12V
Q c b e Q2N2222
Cv
Rc bat c #$Rc$
in
Re e 0 200
Vin 10u
Rb1 bat b 180k
Rb2 b 0 33k
1Vac
Cv in b 10u
Vin in 0 AC 1
0
.lib
*endspice
genFpoint AMPLI 1k {v([c])}
endassembly
getFpoint AMPLI gain 1
set Rc Rc+20
endwhile

bat
Vbat
Rc
1.9k

Rb1
180k

12V

c
b
Rb2 Q1
33k

0

2N2222
e
Re
200

0
The analysis runs 11 times.
Two last results (Rc, gain):
2100 Ohms, 9.997
2120 Ohms, 10.09

0

AC analysis of SH circuit

PSiM Demonstrations
vin(t)



v(t)

v

1e

t 

t
vin(t)

C

e
v 2 t 

R
v(t)



1

2

1

2

1

2

1

2

1

2

1

2

t
kT

kT+T
kT+T1

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

For k=1..2
*computing coefficients bk
circuit model in phase k, vin=1V, zero initial conditions
TRANSIENT analysis, Tmax =Tk
reading the state variable and saving it to the variable bk
*computing coefficients ak
circuit model in phase k, vin=0V, zero initial conditions
the state variable v = 1
TRANSIENT analysis, Tmax=Tk
reading the state variable and saving it to the variable ak
end

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

Compiling the z-domain equations via behavioral modeling (E-sources)
Solving equations via .AC analysis

PROBE demonstration of frequency responses

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:

*AC analysis of Sample-Hold circuit
set Ron 5k fs 100k T1 0.1/fs T2 1/fs-T1
beginnet SH1
Ron 1 2 #$Ron$
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
beginnet SH2
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
defsim tran1 .TRAN 0 #$T1$ 0 #$T1/100$ skipbp
defsim tran2 .TRAN 0 #$T2$ 0 #$T2/100$ skipbp
defsim AC .AC dec 100 10 #$fs*2$
assemblycir run1.cir
Vin 1 0 1V
use SH1
runsim tran1
endassembly

AC analysis of SH circuit

PSiM Demonstrations
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:

getprobe b tran1 V(3) #$T1$
assemblycir run2.cir
Vin 1 0 0V
use SH1
.IC V(3) 1V
runsim tran1
endassembly
getprobe a1 tran1 V(3) #$T1$
assemblycir run3.cir
use SH2
.IC V(3) 1V
runsim tran2
endassembly
getprobe a2 tran2 V(3) #$T2$
assemblycir run4.cir
Vin 1 0 AC 1
Ec1 c1 x LAPLACE {V(c2)} {#$a1$*exp(-s*#$T1$)}
Ex x 0 value={V(1)*#$b$}
Ec2 c2 0 LAPLACE {V(c1)} {#$a2$*exp(-s*#$T2$)}
runsim AC/nocsdf
endassembly

AC analysis of SH circuit

PSiM Demonstrations
Frequency responses
0

-10

-20

10Hz

100Hz
DB(V(c1))

10KHz
DB(V(c2))
Frequency

200KHz

Conclusions
•PSiM is an independent executable program which controls the OrCAD PSpice.
•It extends significantly the OrCAD PSpice features: Special simulation tasks can be
performed which cannot be done by PSpice alone.

•Currently the PSiM working on the text file level is available.

•The graphical User's Interface (GUI) is developed.


Slide 10

Simulation Manager for OrCAD PSpice
Dalibor Biolek1,2, Jaroslav Kadlec1

Faculty of EE and Communications, Dept. of Microelectronics
Brno University of Technology, Czech Republic
1,2

Faculty of Military Technologies, Dept. of EE
University of Defence, Brno, Czech Republic
1

Outline
•Why PSiM (PSpice Simulation Manager)
•PSiM Conception

•PSiM Features
•Demonstrations
•Conclusions

Why PSiM
OrCAD PSpice limitations:
•ICL (Interactive Command Language) is not implemented
•No possibility to work in so-called sequential mode
•Results of the analysis cannot be input data of the following analysis

circuit file
header
netlist
commands
.end

PSpice
pspice.exe
psp_cmd.exe

user

analysis results
output file
Probe files
...

PSiM Conception
circuit file
header
netlist
commands
.end

PSpice

psp_cmd.exe

SIM

Manager Control File
header
commands
user

analysis results
output file
Probe files
...

PSiM Conception
Manager Control File (MCF)
...
set variable=1
...

psp_cmd.exe

assemblycir x.cir
Extended Circuit File
(ECIR)

...
Rx 1 2 variable
...

x.dat
x.cir

endassembly
.
...
...

run

data from .TRAN, .AC, .DC
data from bias points

re-defining the variables

x.out
x.csd
x.bias

P Spice Circuit File
(P CIR)

PSiM Features
•The PSiM reads the MCF step-by-step, starting from the first line.
•The programming language of the PSiM should support mathematical computations.
•The ECIRs of the circuits being analyzed can appear in the MCF.
•The PCIR can be modified prior to its generation by the PSiM.

•The PSiM is able to process the results of executed simulations.
•All the files generated from all executed simulation runs should be available.
•The PSiM manages commands for program loops and chaining.

Optimization of transistor amplifier

PSiM Demonstrations
Rc design in order to set voltage gain to 10 on a frequency of 1kHz

bat
Vbat
Rc
1.9k

Rb1
180k
c

Cv
in
Vin 10u
1Vac

0

b
Rb2 Q1
33k

0

2N2222
e
Re
200

0

12V

0
Preliminary PSpice analysis:
The gain is approximately 9.

Optimization of transistor amplifier

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:

PSiM Demonstrations
*transistor amplifier
set Rc 1.9k gain 1
while (gain)<=10
assemblycir run.cir
*beginspice
Vbat bat 0 12V
Q c b e Q2N2222
Cv
Rc bat c #$Rc$
in
Re e 0 200
Vin 10u
Rb1 bat b 180k
Rb2 b 0 33k
1Vac
Cv in b 10u
Vin in 0 AC 1
0
.lib
*endspice
genFpoint AMPLI 1k {v([c])}
endassembly
getFpoint AMPLI gain 1
set Rc Rc+20
endwhile

bat
Vbat
Rc
1.9k

Rb1
180k

12V

c
b
Rb2 Q1
33k

0

2N2222
e
Re
200

0
The analysis runs 11 times.
Two last results (Rc, gain):
2100 Ohms, 9.997
2120 Ohms, 10.09

0

AC analysis of SH circuit

PSiM Demonstrations
vin(t)



v(t)

v

1e

t 

t
vin(t)

C

e
v 2 t 

R
v(t)



1

2

1

2

1

2

1

2

1

2

1

2

t
kT

kT+T
kT+T1

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

For k=1..2
*computing coefficients bk
circuit model in phase k, vin=1V, zero initial conditions
TRANSIENT analysis, Tmax =Tk
reading the state variable and saving it to the variable bk
*computing coefficients ak
circuit model in phase k, vin=0V, zero initial conditions
the state variable v = 1
TRANSIENT analysis, Tmax=Tk
reading the state variable and saving it to the variable ak
end

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

Compiling the z-domain equations via behavioral modeling (E-sources)
Solving equations via .AC analysis

PROBE demonstration of frequency responses

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:

*AC analysis of Sample-Hold circuit
set Ron 5k fs 100k T1 0.1/fs T2 1/fs-T1
beginnet SH1
Ron 1 2 #$Ron$
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
beginnet SH2
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
defsim tran1 .TRAN 0 #$T1$ 0 #$T1/100$ skipbp
defsim tran2 .TRAN 0 #$T2$ 0 #$T2/100$ skipbp
defsim AC .AC dec 100 10 #$fs*2$
assemblycir run1.cir
Vin 1 0 1V
use SH1
runsim tran1
endassembly

AC analysis of SH circuit

PSiM Demonstrations
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:

getprobe b tran1 V(3) #$T1$
assemblycir run2.cir
Vin 1 0 0V
use SH1
.IC V(3) 1V
runsim tran1
endassembly
getprobe a1 tran1 V(3) #$T1$
assemblycir run3.cir
use SH2
.IC V(3) 1V
runsim tran2
endassembly
getprobe a2 tran2 V(3) #$T2$
assemblycir run4.cir
Vin 1 0 AC 1
Ec1 c1 x LAPLACE {V(c2)} {#$a1$*exp(-s*#$T1$)}
Ex x 0 value={V(1)*#$b$}
Ec2 c2 0 LAPLACE {V(c1)} {#$a2$*exp(-s*#$T2$)}
runsim AC/nocsdf
endassembly

AC analysis of SH circuit

PSiM Demonstrations
Frequency responses
0

-10

-20

10Hz

100Hz
DB(V(c1))

10KHz
DB(V(c2))
Frequency

200KHz

Conclusions
•PSiM is an independent executable program which controls the OrCAD PSpice.
•It extends significantly the OrCAD PSpice features: Special simulation tasks can be
performed which cannot be done by PSpice alone.

•Currently the PSiM working on the text file level is available.

•The graphical User's Interface (GUI) is developed.


Slide 11

Simulation Manager for OrCAD PSpice
Dalibor Biolek1,2, Jaroslav Kadlec1

Faculty of EE and Communications, Dept. of Microelectronics
Brno University of Technology, Czech Republic
1,2

Faculty of Military Technologies, Dept. of EE
University of Defence, Brno, Czech Republic
1

Outline
•Why PSiM (PSpice Simulation Manager)
•PSiM Conception

•PSiM Features
•Demonstrations
•Conclusions

Why PSiM
OrCAD PSpice limitations:
•ICL (Interactive Command Language) is not implemented
•No possibility to work in so-called sequential mode
•Results of the analysis cannot be input data of the following analysis

circuit file
header
netlist
commands
.end

PSpice
pspice.exe
psp_cmd.exe

user

analysis results
output file
Probe files
...

PSiM Conception
circuit file
header
netlist
commands
.end

PSpice

psp_cmd.exe

SIM

Manager Control File
header
commands
user

analysis results
output file
Probe files
...

PSiM Conception
Manager Control File (MCF)
...
set variable=1
...

psp_cmd.exe

assemblycir x.cir
Extended Circuit File
(ECIR)

...
Rx 1 2 variable
...

x.dat
x.cir

endassembly
.
...
...

run

data from .TRAN, .AC, .DC
data from bias points

re-defining the variables

x.out
x.csd
x.bias

P Spice Circuit File
(P CIR)

PSiM Features
•The PSiM reads the MCF step-by-step, starting from the first line.
•The programming language of the PSiM should support mathematical computations.
•The ECIRs of the circuits being analyzed can appear in the MCF.
•The PCIR can be modified prior to its generation by the PSiM.

•The PSiM is able to process the results of executed simulations.
•All the files generated from all executed simulation runs should be available.
•The PSiM manages commands for program loops and chaining.

Optimization of transistor amplifier

PSiM Demonstrations
Rc design in order to set voltage gain to 10 on a frequency of 1kHz

bat
Vbat
Rc
1.9k

Rb1
180k
c

Cv
in
Vin 10u
1Vac

0

b
Rb2 Q1
33k

0

2N2222
e
Re
200

0

12V

0
Preliminary PSpice analysis:
The gain is approximately 9.

Optimization of transistor amplifier

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:

PSiM Demonstrations
*transistor amplifier
set Rc 1.9k gain 1
while (gain)<=10
assemblycir run.cir
*beginspice
Vbat bat 0 12V
Q c b e Q2N2222
Cv
Rc bat c #$Rc$
in
Re e 0 200
Vin 10u
Rb1 bat b 180k
Rb2 b 0 33k
1Vac
Cv in b 10u
Vin in 0 AC 1
0
.lib
*endspice
genFpoint AMPLI 1k {v([c])}
endassembly
getFpoint AMPLI gain 1
set Rc Rc+20
endwhile

bat
Vbat
Rc
1.9k

Rb1
180k

12V

c
b
Rb2 Q1
33k

0

2N2222
e
Re
200

0
The analysis runs 11 times.
Two last results (Rc, gain):
2100 Ohms, 9.997
2120 Ohms, 10.09

0

AC analysis of SH circuit

PSiM Demonstrations
vin(t)



v(t)

v

1e

t 

t
vin(t)

C

e
v 2 t 

R
v(t)



1

2

1

2

1

2

1

2

1

2

1

2

t
kT

kT+T
kT+T1

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

For k=1..2
*computing coefficients bk
circuit model in phase k, vin=1V, zero initial conditions
TRANSIENT analysis, Tmax =Tk
reading the state variable and saving it to the variable bk
*computing coefficients ak
circuit model in phase k, vin=0V, zero initial conditions
the state variable v = 1
TRANSIENT analysis, Tmax=Tk
reading the state variable and saving it to the variable ak
end

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

Compiling the z-domain equations via behavioral modeling (E-sources)
Solving equations via .AC analysis

PROBE demonstration of frequency responses

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:

*AC analysis of Sample-Hold circuit
set Ron 5k fs 100k T1 0.1/fs T2 1/fs-T1
beginnet SH1
Ron 1 2 #$Ron$
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
beginnet SH2
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
defsim tran1 .TRAN 0 #$T1$ 0 #$T1/100$ skipbp
defsim tran2 .TRAN 0 #$T2$ 0 #$T2/100$ skipbp
defsim AC .AC dec 100 10 #$fs*2$
assemblycir run1.cir
Vin 1 0 1V
use SH1
runsim tran1
endassembly

AC analysis of SH circuit

PSiM Demonstrations
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:

getprobe b tran1 V(3) #$T1$
assemblycir run2.cir
Vin 1 0 0V
use SH1
.IC V(3) 1V
runsim tran1
endassembly
getprobe a1 tran1 V(3) #$T1$
assemblycir run3.cir
use SH2
.IC V(3) 1V
runsim tran2
endassembly
getprobe a2 tran2 V(3) #$T2$
assemblycir run4.cir
Vin 1 0 AC 1
Ec1 c1 x LAPLACE {V(c2)} {#$a1$*exp(-s*#$T1$)}
Ex x 0 value={V(1)*#$b$}
Ec2 c2 0 LAPLACE {V(c1)} {#$a2$*exp(-s*#$T2$)}
runsim AC/nocsdf
endassembly

AC analysis of SH circuit

PSiM Demonstrations
Frequency responses
0

-10

-20

10Hz

100Hz
DB(V(c1))

10KHz
DB(V(c2))
Frequency

200KHz

Conclusions
•PSiM is an independent executable program which controls the OrCAD PSpice.
•It extends significantly the OrCAD PSpice features: Special simulation tasks can be
performed which cannot be done by PSpice alone.

•Currently the PSiM working on the text file level is available.

•The graphical User's Interface (GUI) is developed.


Slide 12

Simulation Manager for OrCAD PSpice
Dalibor Biolek1,2, Jaroslav Kadlec1

Faculty of EE and Communications, Dept. of Microelectronics
Brno University of Technology, Czech Republic
1,2

Faculty of Military Technologies, Dept. of EE
University of Defence, Brno, Czech Republic
1

Outline
•Why PSiM (PSpice Simulation Manager)
•PSiM Conception

•PSiM Features
•Demonstrations
•Conclusions

Why PSiM
OrCAD PSpice limitations:
•ICL (Interactive Command Language) is not implemented
•No possibility to work in so-called sequential mode
•Results of the analysis cannot be input data of the following analysis

circuit file
header
netlist
commands
.end

PSpice
pspice.exe
psp_cmd.exe

user

analysis results
output file
Probe files
...

PSiM Conception
circuit file
header
netlist
commands
.end

PSpice

psp_cmd.exe

SIM

Manager Control File
header
commands
user

analysis results
output file
Probe files
...

PSiM Conception
Manager Control File (MCF)
...
set variable=1
...

psp_cmd.exe

assemblycir x.cir
Extended Circuit File
(ECIR)

...
Rx 1 2 variable
...

x.dat
x.cir

endassembly
.
...
...

run

data from .TRAN, .AC, .DC
data from bias points

re-defining the variables

x.out
x.csd
x.bias

P Spice Circuit File
(P CIR)

PSiM Features
•The PSiM reads the MCF step-by-step, starting from the first line.
•The programming language of the PSiM should support mathematical computations.
•The ECIRs of the circuits being analyzed can appear in the MCF.
•The PCIR can be modified prior to its generation by the PSiM.

•The PSiM is able to process the results of executed simulations.
•All the files generated from all executed simulation runs should be available.
•The PSiM manages commands for program loops and chaining.

Optimization of transistor amplifier

PSiM Demonstrations
Rc design in order to set voltage gain to 10 on a frequency of 1kHz

bat
Vbat
Rc
1.9k

Rb1
180k
c

Cv
in
Vin 10u
1Vac

0

b
Rb2 Q1
33k

0

2N2222
e
Re
200

0

12V

0
Preliminary PSpice analysis:
The gain is approximately 9.

Optimization of transistor amplifier

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:

PSiM Demonstrations
*transistor amplifier
set Rc 1.9k gain 1
while (gain)<=10
assemblycir run.cir
*beginspice
Vbat bat 0 12V
Q c b e Q2N2222
Cv
Rc bat c #$Rc$
in
Re e 0 200
Vin 10u
Rb1 bat b 180k
Rb2 b 0 33k
1Vac
Cv in b 10u
Vin in 0 AC 1
0
.lib
*endspice
genFpoint AMPLI 1k {v([c])}
endassembly
getFpoint AMPLI gain 1
set Rc Rc+20
endwhile

bat
Vbat
Rc
1.9k

Rb1
180k

12V

c
b
Rb2 Q1
33k

0

2N2222
e
Re
200

0
The analysis runs 11 times.
Two last results (Rc, gain):
2100 Ohms, 9.997
2120 Ohms, 10.09

0

AC analysis of SH circuit

PSiM Demonstrations
vin(t)



v(t)

v

1e

t 

t
vin(t)

C

e
v 2 t 

R
v(t)



1

2

1

2

1

2

1

2

1

2

1

2

t
kT

kT+T
kT+T1

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

For k=1..2
*computing coefficients bk
circuit model in phase k, vin=1V, zero initial conditions
TRANSIENT analysis, Tmax =Tk
reading the state variable and saving it to the variable bk
*computing coefficients ak
circuit model in phase k, vin=0V, zero initial conditions
the state variable v = 1
TRANSIENT analysis, Tmax=Tk
reading the state variable and saving it to the variable ak
end

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

Compiling the z-domain equations via behavioral modeling (E-sources)
Solving equations via .AC analysis

PROBE demonstration of frequency responses

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:

*AC analysis of Sample-Hold circuit
set Ron 5k fs 100k T1 0.1/fs T2 1/fs-T1
beginnet SH1
Ron 1 2 #$Ron$
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
beginnet SH2
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
defsim tran1 .TRAN 0 #$T1$ 0 #$T1/100$ skipbp
defsim tran2 .TRAN 0 #$T2$ 0 #$T2/100$ skipbp
defsim AC .AC dec 100 10 #$fs*2$
assemblycir run1.cir
Vin 1 0 1V
use SH1
runsim tran1
endassembly

AC analysis of SH circuit

PSiM Demonstrations
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:

getprobe b tran1 V(3) #$T1$
assemblycir run2.cir
Vin 1 0 0V
use SH1
.IC V(3) 1V
runsim tran1
endassembly
getprobe a1 tran1 V(3) #$T1$
assemblycir run3.cir
use SH2
.IC V(3) 1V
runsim tran2
endassembly
getprobe a2 tran2 V(3) #$T2$
assemblycir run4.cir
Vin 1 0 AC 1
Ec1 c1 x LAPLACE {V(c2)} {#$a1$*exp(-s*#$T1$)}
Ex x 0 value={V(1)*#$b$}
Ec2 c2 0 LAPLACE {V(c1)} {#$a2$*exp(-s*#$T2$)}
runsim AC/nocsdf
endassembly

AC analysis of SH circuit

PSiM Demonstrations
Frequency responses
0

-10

-20

10Hz

100Hz
DB(V(c1))

10KHz
DB(V(c2))
Frequency

200KHz

Conclusions
•PSiM is an independent executable program which controls the OrCAD PSpice.
•It extends significantly the OrCAD PSpice features: Special simulation tasks can be
performed which cannot be done by PSpice alone.

•Currently the PSiM working on the text file level is available.

•The graphical User's Interface (GUI) is developed.


Slide 13

Simulation Manager for OrCAD PSpice
Dalibor Biolek1,2, Jaroslav Kadlec1

Faculty of EE and Communications, Dept. of Microelectronics
Brno University of Technology, Czech Republic
1,2

Faculty of Military Technologies, Dept. of EE
University of Defence, Brno, Czech Republic
1

Outline
•Why PSiM (PSpice Simulation Manager)
•PSiM Conception

•PSiM Features
•Demonstrations
•Conclusions

Why PSiM
OrCAD PSpice limitations:
•ICL (Interactive Command Language) is not implemented
•No possibility to work in so-called sequential mode
•Results of the analysis cannot be input data of the following analysis

circuit file
header
netlist
commands
.end

PSpice
pspice.exe
psp_cmd.exe

user

analysis results
output file
Probe files
...

PSiM Conception
circuit file
header
netlist
commands
.end

PSpice

psp_cmd.exe

SIM

Manager Control File
header
commands
user

analysis results
output file
Probe files
...

PSiM Conception
Manager Control File (MCF)
...
set variable=1
...

psp_cmd.exe

assemblycir x.cir
Extended Circuit File
(ECIR)

...
Rx 1 2 variable
...

x.dat
x.cir

endassembly
.
...
...

run

data from .TRAN, .AC, .DC
data from bias points

re-defining the variables

x.out
x.csd
x.bias

P Spice Circuit File
(P CIR)

PSiM Features
•The PSiM reads the MCF step-by-step, starting from the first line.
•The programming language of the PSiM should support mathematical computations.
•The ECIRs of the circuits being analyzed can appear in the MCF.
•The PCIR can be modified prior to its generation by the PSiM.

•The PSiM is able to process the results of executed simulations.
•All the files generated from all executed simulation runs should be available.
•The PSiM manages commands for program loops and chaining.

Optimization of transistor amplifier

PSiM Demonstrations
Rc design in order to set voltage gain to 10 on a frequency of 1kHz

bat
Vbat
Rc
1.9k

Rb1
180k
c

Cv
in
Vin 10u
1Vac

0

b
Rb2 Q1
33k

0

2N2222
e
Re
200

0

12V

0
Preliminary PSpice analysis:
The gain is approximately 9.

Optimization of transistor amplifier

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:

PSiM Demonstrations
*transistor amplifier
set Rc 1.9k gain 1
while (gain)<=10
assemblycir run.cir
*beginspice
Vbat bat 0 12V
Q c b e Q2N2222
Cv
Rc bat c #$Rc$
in
Re e 0 200
Vin 10u
Rb1 bat b 180k
Rb2 b 0 33k
1Vac
Cv in b 10u
Vin in 0 AC 1
0
.lib
*endspice
genFpoint AMPLI 1k {v([c])}
endassembly
getFpoint AMPLI gain 1
set Rc Rc+20
endwhile

bat
Vbat
Rc
1.9k

Rb1
180k

12V

c
b
Rb2 Q1
33k

0

2N2222
e
Re
200

0
The analysis runs 11 times.
Two last results (Rc, gain):
2100 Ohms, 9.997
2120 Ohms, 10.09

0

AC analysis of SH circuit

PSiM Demonstrations
vin(t)



v(t)

v

1e

t 

t
vin(t)

C

e
v 2 t 

R
v(t)



1

2

1

2

1

2

1

2

1

2

1

2

t
kT

kT+T
kT+T1

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

For k=1..2
*computing coefficients bk
circuit model in phase k, vin=1V, zero initial conditions
TRANSIENT analysis, Tmax =Tk
reading the state variable and saving it to the variable bk
*computing coefficients ak
circuit model in phase k, vin=0V, zero initial conditions
the state variable v = 1
TRANSIENT analysis, Tmax=Tk
reading the state variable and saving it to the variable ak
end

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

Compiling the z-domain equations via behavioral modeling (E-sources)
Solving equations via .AC analysis

PROBE demonstration of frequency responses

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:

*AC analysis of Sample-Hold circuit
set Ron 5k fs 100k T1 0.1/fs T2 1/fs-T1
beginnet SH1
Ron 1 2 #$Ron$
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
beginnet SH2
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
defsim tran1 .TRAN 0 #$T1$ 0 #$T1/100$ skipbp
defsim tran2 .TRAN 0 #$T2$ 0 #$T2/100$ skipbp
defsim AC .AC dec 100 10 #$fs*2$
assemblycir run1.cir
Vin 1 0 1V
use SH1
runsim tran1
endassembly

AC analysis of SH circuit

PSiM Demonstrations
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:

getprobe b tran1 V(3) #$T1$
assemblycir run2.cir
Vin 1 0 0V
use SH1
.IC V(3) 1V
runsim tran1
endassembly
getprobe a1 tran1 V(3) #$T1$
assemblycir run3.cir
use SH2
.IC V(3) 1V
runsim tran2
endassembly
getprobe a2 tran2 V(3) #$T2$
assemblycir run4.cir
Vin 1 0 AC 1
Ec1 c1 x LAPLACE {V(c2)} {#$a1$*exp(-s*#$T1$)}
Ex x 0 value={V(1)*#$b$}
Ec2 c2 0 LAPLACE {V(c1)} {#$a2$*exp(-s*#$T2$)}
runsim AC/nocsdf
endassembly

AC analysis of SH circuit

PSiM Demonstrations
Frequency responses
0

-10

-20

10Hz

100Hz
DB(V(c1))

10KHz
DB(V(c2))
Frequency

200KHz

Conclusions
•PSiM is an independent executable program which controls the OrCAD PSpice.
•It extends significantly the OrCAD PSpice features: Special simulation tasks can be
performed which cannot be done by PSpice alone.

•Currently the PSiM working on the text file level is available.

•The graphical User's Interface (GUI) is developed.


Slide 14

Simulation Manager for OrCAD PSpice
Dalibor Biolek1,2, Jaroslav Kadlec1

Faculty of EE and Communications, Dept. of Microelectronics
Brno University of Technology, Czech Republic
1,2

Faculty of Military Technologies, Dept. of EE
University of Defence, Brno, Czech Republic
1

Outline
•Why PSiM (PSpice Simulation Manager)
•PSiM Conception

•PSiM Features
•Demonstrations
•Conclusions

Why PSiM
OrCAD PSpice limitations:
•ICL (Interactive Command Language) is not implemented
•No possibility to work in so-called sequential mode
•Results of the analysis cannot be input data of the following analysis

circuit file
header
netlist
commands
.end

PSpice
pspice.exe
psp_cmd.exe

user

analysis results
output file
Probe files
...

PSiM Conception
circuit file
header
netlist
commands
.end

PSpice

psp_cmd.exe

SIM

Manager Control File
header
commands
user

analysis results
output file
Probe files
...

PSiM Conception
Manager Control File (MCF)
...
set variable=1
...

psp_cmd.exe

assemblycir x.cir
Extended Circuit File
(ECIR)

...
Rx 1 2 variable
...

x.dat
x.cir

endassembly
.
...
...

run

data from .TRAN, .AC, .DC
data from bias points

re-defining the variables

x.out
x.csd
x.bias

P Spice Circuit File
(P CIR)

PSiM Features
•The PSiM reads the MCF step-by-step, starting from the first line.
•The programming language of the PSiM should support mathematical computations.
•The ECIRs of the circuits being analyzed can appear in the MCF.
•The PCIR can be modified prior to its generation by the PSiM.

•The PSiM is able to process the results of executed simulations.
•All the files generated from all executed simulation runs should be available.
•The PSiM manages commands for program loops and chaining.

Optimization of transistor amplifier

PSiM Demonstrations
Rc design in order to set voltage gain to 10 on a frequency of 1kHz

bat
Vbat
Rc
1.9k

Rb1
180k
c

Cv
in
Vin 10u
1Vac

0

b
Rb2 Q1
33k

0

2N2222
e
Re
200

0

12V

0
Preliminary PSpice analysis:
The gain is approximately 9.

Optimization of transistor amplifier

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:

PSiM Demonstrations
*transistor amplifier
set Rc 1.9k gain 1
while (gain)<=10
assemblycir run.cir
*beginspice
Vbat bat 0 12V
Q c b e Q2N2222
Cv
Rc bat c #$Rc$
in
Re e 0 200
Vin 10u
Rb1 bat b 180k
Rb2 b 0 33k
1Vac
Cv in b 10u
Vin in 0 AC 1
0
.lib
*endspice
genFpoint AMPLI 1k {v([c])}
endassembly
getFpoint AMPLI gain 1
set Rc Rc+20
endwhile

bat
Vbat
Rc
1.9k

Rb1
180k

12V

c
b
Rb2 Q1
33k

0

2N2222
e
Re
200

0
The analysis runs 11 times.
Two last results (Rc, gain):
2100 Ohms, 9.997
2120 Ohms, 10.09

0

AC analysis of SH circuit

PSiM Demonstrations
vin(t)



v(t)

v

1e

t 

t
vin(t)

C

e
v 2 t 

R
v(t)



1

2

1

2

1

2

1

2

1

2

1

2

t
kT

kT+T
kT+T1

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

For k=1..2
*computing coefficients bk
circuit model in phase k, vin=1V, zero initial conditions
TRANSIENT analysis, Tmax =Tk
reading the state variable and saving it to the variable bk
*computing coefficients ak
circuit model in phase k, vin=0V, zero initial conditions
the state variable v = 1
TRANSIENT analysis, Tmax=Tk
reading the state variable and saving it to the variable ak
end

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

Compiling the z-domain equations via behavioral modeling (E-sources)
Solving equations via .AC analysis

PROBE demonstration of frequency responses

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:

*AC analysis of Sample-Hold circuit
set Ron 5k fs 100k T1 0.1/fs T2 1/fs-T1
beginnet SH1
Ron 1 2 #$Ron$
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
beginnet SH2
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
defsim tran1 .TRAN 0 #$T1$ 0 #$T1/100$ skipbp
defsim tran2 .TRAN 0 #$T2$ 0 #$T2/100$ skipbp
defsim AC .AC dec 100 10 #$fs*2$
assemblycir run1.cir
Vin 1 0 1V
use SH1
runsim tran1
endassembly

AC analysis of SH circuit

PSiM Demonstrations
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:

getprobe b tran1 V(3) #$T1$
assemblycir run2.cir
Vin 1 0 0V
use SH1
.IC V(3) 1V
runsim tran1
endassembly
getprobe a1 tran1 V(3) #$T1$
assemblycir run3.cir
use SH2
.IC V(3) 1V
runsim tran2
endassembly
getprobe a2 tran2 V(3) #$T2$
assemblycir run4.cir
Vin 1 0 AC 1
Ec1 c1 x LAPLACE {V(c2)} {#$a1$*exp(-s*#$T1$)}
Ex x 0 value={V(1)*#$b$}
Ec2 c2 0 LAPLACE {V(c1)} {#$a2$*exp(-s*#$T2$)}
runsim AC/nocsdf
endassembly

AC analysis of SH circuit

PSiM Demonstrations
Frequency responses
0

-10

-20

10Hz

100Hz
DB(V(c1))

10KHz
DB(V(c2))
Frequency

200KHz

Conclusions
•PSiM is an independent executable program which controls the OrCAD PSpice.
•It extends significantly the OrCAD PSpice features: Special simulation tasks can be
performed which cannot be done by PSpice alone.

•Currently the PSiM working on the text file level is available.

•The graphical User's Interface (GUI) is developed.


Slide 15

Simulation Manager for OrCAD PSpice
Dalibor Biolek1,2, Jaroslav Kadlec1

Faculty of EE and Communications, Dept. of Microelectronics
Brno University of Technology, Czech Republic
1,2

Faculty of Military Technologies, Dept. of EE
University of Defence, Brno, Czech Republic
1

Outline
•Why PSiM (PSpice Simulation Manager)
•PSiM Conception

•PSiM Features
•Demonstrations
•Conclusions

Why PSiM
OrCAD PSpice limitations:
•ICL (Interactive Command Language) is not implemented
•No possibility to work in so-called sequential mode
•Results of the analysis cannot be input data of the following analysis

circuit file
header
netlist
commands
.end

PSpice
pspice.exe
psp_cmd.exe

user

analysis results
output file
Probe files
...

PSiM Conception
circuit file
header
netlist
commands
.end

PSpice

psp_cmd.exe

SIM

Manager Control File
header
commands
user

analysis results
output file
Probe files
...

PSiM Conception
Manager Control File (MCF)
...
set variable=1
...

psp_cmd.exe

assemblycir x.cir
Extended Circuit File
(ECIR)

...
Rx 1 2 variable
...

x.dat
x.cir

endassembly
.
...
...

run

data from .TRAN, .AC, .DC
data from bias points

re-defining the variables

x.out
x.csd
x.bias

P Spice Circuit File
(P CIR)

PSiM Features
•The PSiM reads the MCF step-by-step, starting from the first line.
•The programming language of the PSiM should support mathematical computations.
•The ECIRs of the circuits being analyzed can appear in the MCF.
•The PCIR can be modified prior to its generation by the PSiM.

•The PSiM is able to process the results of executed simulations.
•All the files generated from all executed simulation runs should be available.
•The PSiM manages commands for program loops and chaining.

Optimization of transistor amplifier

PSiM Demonstrations
Rc design in order to set voltage gain to 10 on a frequency of 1kHz

bat
Vbat
Rc
1.9k

Rb1
180k
c

Cv
in
Vin 10u
1Vac

0

b
Rb2 Q1
33k

0

2N2222
e
Re
200

0

12V

0
Preliminary PSpice analysis:
The gain is approximately 9.

Optimization of transistor amplifier

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:

PSiM Demonstrations
*transistor amplifier
set Rc 1.9k gain 1
while (gain)<=10
assemblycir run.cir
*beginspice
Vbat bat 0 12V
Q c b e Q2N2222
Cv
Rc bat c #$Rc$
in
Re e 0 200
Vin 10u
Rb1 bat b 180k
Rb2 b 0 33k
1Vac
Cv in b 10u
Vin in 0 AC 1
0
.lib
*endspice
genFpoint AMPLI 1k {v([c])}
endassembly
getFpoint AMPLI gain 1
set Rc Rc+20
endwhile

bat
Vbat
Rc
1.9k

Rb1
180k

12V

c
b
Rb2 Q1
33k

0

2N2222
e
Re
200

0
The analysis runs 11 times.
Two last results (Rc, gain):
2100 Ohms, 9.997
2120 Ohms, 10.09

0

AC analysis of SH circuit

PSiM Demonstrations
vin(t)



v(t)

v

1e

t 

t
vin(t)

C

e
v 2 t 

R
v(t)



1

2

1

2

1

2

1

2

1

2

1

2

t
kT

kT+T
kT+T1

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

For k=1..2
*computing coefficients bk
circuit model in phase k, vin=1V, zero initial conditions
TRANSIENT analysis, Tmax =Tk
reading the state variable and saving it to the variable bk
*computing coefficients ak
circuit model in phase k, vin=0V, zero initial conditions
the state variable v = 1
TRANSIENT analysis, Tmax=Tk
reading the state variable and saving it to the variable ak
end

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
Algorithm of the MCF:

Compiling the z-domain equations via behavioral modeling (E-sources)
Solving equations via .AC analysis

PROBE demonstration of frequency responses

v(kT  T1 )  a1v(kT )  b1vin (kT  T1 )
=0

v(kT  T )  a2 v(kT  T1 )  b2 vin (kT  T )

V1  a1V2 z T1 / T  b1Vin,1
V2  a2V1 z T2 / T  b2Vin, 2

AC analysis of SH circuit

PSiM Demonstrations
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:

*AC analysis of Sample-Hold circuit
set Ron 5k fs 100k T1 0.1/fs T2 1/fs-T1
beginnet SH1
Ron 1 2 #$Ron$
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
beginnet SH2
Rs 2 3 10m
C 3 0 1n
Rz 2 0 100k
endnet
defsim tran1 .TRAN 0 #$T1$ 0 #$T1/100$ skipbp
defsim tran2 .TRAN 0 #$T2$ 0 #$T2/100$ skipbp
defsim AC .AC dec 100 10 #$fs*2$
assemblycir run1.cir
Vin 1 0 1V
use SH1
runsim tran1
endassembly

AC analysis of SH circuit

PSiM Demonstrations
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:

getprobe b tran1 V(3) #$T1$
assemblycir run2.cir
Vin 1 0 0V
use SH1
.IC V(3) 1V
runsim tran1
endassembly
getprobe a1 tran1 V(3) #$T1$
assemblycir run3.cir
use SH2
.IC V(3) 1V
runsim tran2
endassembly
getprobe a2 tran2 V(3) #$T2$
assemblycir run4.cir
Vin 1 0 AC 1
Ec1 c1 x LAPLACE {V(c2)} {#$a1$*exp(-s*#$T1$)}
Ex x 0 value={V(1)*#$b$}
Ec2 c2 0 LAPLACE {V(c1)} {#$a2$*exp(-s*#$T2$)}
runsim AC/nocsdf
endassembly

AC analysis of SH circuit

PSiM Demonstrations
Frequency responses
0

-10

-20

10Hz

100Hz
DB(V(c1))

10KHz
DB(V(c2))
Frequency

200KHz

Conclusions
•PSiM is an independent executable program which controls the OrCAD PSpice.
•It extends significantly the OrCAD PSpice features: Special simulation tasks can be
performed which cannot be done by PSpice alone.

•Currently the PSiM working on the text file level is available.

•The graphical User's Interface (GUI) is developed.