# Command line simulation using pspice

I'd like to use OrCAD Pspice's "psp_cmd" to do three simulations using only one .cir file.

The problem is that execution of

psp_cmd mycircuit.cir

creates only one data file named mycircuit.dat containg the data alltogether.

I'd like psp_cmd to export three different simulation runs into three different data files. Is this possible?

Note that each job in the cir file is separated from the others with an .end.

-
What do you mean by "export to three different data files". Are you talking about data separation (aka. putting data of particular nodes into seperate files) or different file formats? –  suha May 29 '12 at 12:05
Each different simulation corresponds to a different simulation schematic (and profile consequently). I'd like the results of each schematic to be output to different data files, like it would happen if I run three different times psp_cmd circuit_i.cir (i=1,2,3) –  niels May 29 '12 at 12:35

It is possible to automate simulation runs with (p)spice. The magic keyword is "shell scripting". This is easy to do on Linux, but a bit harder with PSpice on Windows. If the PowerShell in Windows is not your cut of tea, you may want to look into Python (windows shell script howto here). If you don't need flow control, you can write a batch file. My advise for tasks to be automated: switch to Linux and use the original spice, ngspice or gnucap.

-
Its kinda difficult to switch to linux right now. I can always run three different times the psp_cmd command with three different .cir file as its argument, but I'd like to be able to call only one file for speed purposes –  niels May 30 '12 at 7:59
@niels as i said, write a shellscript/batchfile which calls PSpice for each simulation. –  suha May 30 '12 at 8:07
yes ok, but that script should contain 3 different calls to psp_cmd (thus obtain 3 times a license -> time waste, that's why i'd like only one call to psp_cmd to do all simulations at once) –  niels May 30 '12 at 8:11
@niels i always forget about the license hassle in the proprietary software world. Sorry. Sure it is not worth running Linux (in a VM)? I am no expert in PSpice, but i could try to help porting the stuff over to Linux. Write me an email and i will get to it over the next weeks. (Hello fellow SE users: I will of course update you on any progress) –  suha May 30 '12 at 9:46
Unfortunately no (even in a VM), there is a "weird" background (which I haven't written about) in this problem and some consequent constraints that make the use of Pspice obligatory. I'd be very happy to get rid of Pspice and use something more robust, but unfortunately I can't. –  niels May 30 '12 at 10:03