12-15-2008 07:13 AM
With toolkit you can :
So you can replace components and change some values... of a existing circuit...
Can you send me your project??
12-15-2008 10:12 AM
Hi Rahairi, I think you are on the right track here. And thanks D3PO for answering.
Here's my input on your question. I'm attaching a recently developed tutorial, which is part of the samples kit that we will release for this toolkit once Express VIs are ready as well, in this tutorial you will do a simple test of how the SPICE Command Line simulation will work. Please follow the tutorial so you get an overall idea of how running a SPICE netlist works from LabVIEW.
The way I see this may work (and I have not tried it though) is this:
Option 1 - You do not need a SPICE netlist
If you are planning not to use a SPICE Netlist, and you just need the input and the response from the circuit to calculate the transfer function using LV VIs, you can just do a simple transient analysis using the toolkit (after you have changed the component values). With the response -and the stimulus- you can then proceed to calculate the transfer function, I believe there were some VIs for this purpose from the Control Design or System ID toolkit of LabVIEW. Attached you will find "Quick Demo" just select File Path In to point to the included file (RLCCircuit.ms10) on the zip, then Run the VI and it should return with a response (after it launches Multisim and runs the simulation - 60 seconds maybe).
Option 2 - You do need a SPICE netlist
If you are planning to use a SPICE netlist, then with the attached tutorial you will get an idea of how to create a SPICE nutmeg command file (Step 4 of the tutorial), creating the Netlist from the circuit is quite simple with the Report VIs of the toolkit, export the netlist after you have changed the value of the components, then run the SPICE command line. The tutorial talks about a transient analysis, however, there is a Transfer Function analysis in Multisim that returns only a DC tranfer value (not time or frequency domain function). If that is helpful for you it might make your analysis simpler. Otherwise, after running the transient, you can parse the results file in order to bring the response of the circuit and continue from there to calculate the transfer function with LabVIEW.
Let me know if you have more questions about this, I'll be glad to help you in understanding how to program the toolkit.
12-16-2008 11:17 PM
Thanks Nestor for the help and attached files. They are very useful and helping me a lot. I went through the tutorial and they're seem good untill the error occured said that demo.raw file is not found. So my question is the about command "write-and-destroy-iplot". Do we need to have that particular raw file or just state the location of the file? Does the file exist before we perform the simulation or the file will be create after the simulation?
p/s : sorry for my poor english....
12-17-2008 07:53 AM - edited 12-17-2008 07:54 AM
If I'm not mistaken, I believe that the SPICE engine does not likes spaces in the filepath. If you look carefully at the tutorial that I sent you, the file path to demo.raw is in DOS notation with no spaces.
The name demo.raw can be any name, I chose demo.raw.
Let me know how that goes.
12-17-2008 10:22 AM
It's true...it works...thanks a lot...
Can you explain more detail about the subvi that you create (file parser)?.. actually, what type of data that multisim provide to labview from the simulation....
Is there any spice command exist to get the transfer function expression?
12-17-2008 11:08 AM
Hi Rahairi, I'm glad that worked out. That subVI that is parsing the file is actually quite simple, as long as you are familiar with LabVIEW string manipulation VIs.
When the SPICE engine runs, it calculates all results into memory, then with the "write and destroy" command you are telling the engine, "hey, please save your results into this file"... open that file in Notepad, is just an ASCII file, and you will see how the data is organized. With the subVI that is parsing the data I'm just jumping over to where the exact info is, and then stripping down the X and Y values. If you are not familiar with the LV string functions, CTRL+H will bring the context help in LV, and just hover the mouse on top of each function and you will see what it does, you can make up as a pseudocode the flow of the parser.
I don't believe there is a full featured "calculate the transfer function" analysis in SPICE, there is one in Multisim, go to the Simulate menu, Analyses, and look at the Transfer Function analysis. However, this is a DC only calculation, is not going to bring up a time or frequency domain transfer function. Play with it so you see what it is for. To calculate a time or frequency domain transfer you will most likely need LV to compare the stimulus vs the response..
12-18-2008 08:20 PM
one more problem...maybe i'm the only person facing this problem.... multisim program encounter an error and need to be closed when the second simulation is done...it's seem like multisim is not closed properly after the first simulation... when i closed labview program, multisim is still running at process in window task manager...any solution? because i'm going to do the multisim simulation hundred maybe thousand of times...
12-19-2008 07:43 AM - edited 12-19-2008 07:44 AM
It depends how you are closing or stopping the simulation. The best thing to do when you have brought the data you need and you want to move on to a new simulation is:
1. Stop the simulation.
2. Clear inputs and outputs.
3. Then change component values if you wanted to.
4. Set, request and/or reserve (whatever your need is) inputs and outputs.
5. Run a new simulation.
Once you are completely done with all simulations, do 1 and 2, then disconnect.
Please note that you do not need to Connect and Disconnect every single time. You do this only once, at the beginning of your program and once at the end of your program before you exit it all.
If you are doing the SPICE Command simulation, then the steps are instead:
1. If simulation is running, stop it.
2. Load a new file (this clears the previous file reference and memory)
3. Configure and run the new SPICE command line.
Post your project if you are getting errors, list the exact software versions you have. Just as FYI, we do daily batch simulations as part of our testing for Multisim here, so we run many many simulations one after the other to test outputs and looking for errors.