Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PSpice start and end signals

Status
Not open for further replies.

fugifox

Newbie level 3
Newbie level 3
Joined
Nov 28, 2006
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,309
how to write programs by pspice

Does anyone know how the PSpice (in winxp) alerts the end of a simulation
and also how can I call it to start one?
To be more specific I built a Java program which produces a netlist and the reads the output results of Spice.
Program works fine but the problem is that I have to run the simulation manually.
So instead of pressing the run button myself I'm looking for a more automated process.
Making netlist, calling Spice simulator, waiting until end of simulation and then reading the results.
That's why I need the start and end signals.
Any ideas would be far more than just appreciable.
Thx in advance
 

pspice batch simulation

Hi.
How do you start the simulation?
Some years ago I wrote a program sismilar to yours, but for MS-DOS with TurboPascal and TurboVision. It was very easy, because in MS-DOS there are no threads and I always know, when my program gets control.
If you are using only Windows, you have to know that the process of PSpice was finished.

I see two steps:
1. The best way is to use Windows API functions OpenProcess and WaitForSingleObjects. Look in google for these functions.

I've forun a small example , but it's in VB. It's very easy so I think you will undrstand it.
http://vbnet.mvps.org/index.html?code/faq/waitforsingleobject2.htm

2. Not very good but it's very easy if you have no access to Windows API. (I actually don't know if you have Windows API in Java). You can run not the spice by it's self, but write a small .bat file, which runs spice and at the end of this bat file write a command to create a some temp file. For example 123.log. And in you main program you have just to check in loop, when this file apperas. this will be the sign that simulation finished.

Hope this helps.
 

spice simulation java

To my knowledge there's no spice for non windows systems,
if there was a linux spice things would be by far easier.

Anyway I think the second solution you suggest is practically better,
no need to get confused with windows api,
and it's really smart i can tell.

I'll try it and come with feedback, thnx
 

java spice simulation

fugifox said:
To my knowledge there's no spice for non windows systems,
if there was a linux spice things would be by far easier.

I think you should visit ngspice homepage :
http://ngspice.sourceforge.net/

It's a next-generation SPICE as it written in this page. That means that they supports SPICE file formats. Try it, may be it's what you need.
 

    fugifox

    Points: 2
    Helpful Answer Positive Rating
dos spice command line only

_TopGun_ said:
2. Not very good but it's very easy if you have no access to Windows API. (I actually don't know if you have Windows API in Java). You can run not the spice by it's self, but write a small .bat file, which runs spice and at the end of this bat file write a command to create a some temp file. For example 123.log. And in you main program you have just to check in loop, when this file apperas. this will be the sign that simulation finished.

Hope this helps.

I've just tried the above solution, after a little necessary refreshing on my knowledge about batch files, but it doesn't work because spice doesn't "send" a signal to the dos shell that the simulation is finished and dos shell freezes in a waiting mode.
I run the simulation with the /R option which caused spice to open and run the specified simulation like
pspice.exe /R "C:\foo\simfile.sim".
When I run the .bat file the simulation is starting and finishing but the
dos shell stays in the last command which is obviously the
pspice.exe /R "C:\foo\simfile.sim".
Only after manually closing pspice, the following commands of the .bat files are being executed.
 

pspice api

It looks for me very strange that pspice doesn't finish correctly.
Looks like we have different versions of pspice, because my version (it could be very old) doesn't understand "/R" option in command line.

I wrote a simple program in C++ (sorry, I do not write programs in java. Actually I tried to write some programs in java, but it was about 5 years ago so my knowledge of this language is not very good). So you can try it with my pspice and then try with yours.

In this attached archive there is folder pspice. In this folder there are 7 files:
pspice1.exe - my version of pspice
probe.exe - graphs visualiser (DOS, VGA)
probe.dev - "devices" file for probe.exe
sample1.cir - simple circuit, resistive divider
run_pspice.bat - DOS .bat file to run simulation and create file
run_pspice.exe - my program
main.cpp - my program source

Run in console "run_pspice.exe" and watch for the result :)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top