I’ve created a new C-block component called logger.
It is designed to be used in a simulation schematic (or Netlist) to replace trigger directives in .meas directives. It collects your requested data into a comma-delimited file format for later analysis. It is collected as the simulation is executed.
In effect, it replaces transient .meas command that uses TRIG.
I have included a datasheet that describes how to use it and when it can be very useful.
I’ve attached 4 versions of the logger with 3, 4, 5 and 6 data inputs. Each version has the .cpp source file, the pre-compiled .dll and a symbol file (.qsym) for easy drag and drop into your schematic.
I’ve also included two simulation test schematics. One a non-stepped and the second a stepped version.
Here’s a list of the files included:
|Column 1 | Column 2|
|— | —|
|logger(V1.0).pdf | Datasheet|
|logger3.cpp | C++ Source|
|logger3.dll | Pre-compiled DLL|
|logger3.qsym | Symbol File|
|logger4.cpp | C++ Source|
|logger4.dll | Pre-compiled DLL|
||ogger4.qsym | Symbol File|
|logger5.cpp | C++ Source|
|logger5.dll | Pre-compiled DLL|
|logger5.qsym | Symbol File|
|logger6.cpp | C++ Source|
|logger6.dll | Pre-compiled DLL|
|logger6.qsym | Symbol File|
|logger_step_test.qsch | Stepped Schematic Test file|
|logger_test.qsch | Non-stepped Schematic Test file|
Download the attached file and remove the .txt extension.
This Component is free to use for Public or Commercial use. Please do good with it.
There is no warranty expressed or implied.
logger.zip.txt (1.2 MB)
Should be really helpful for those who arent really into programming.
Today I ran a 2D sweep, with total of 400 variations. I feel like the total time to do that .meas and plot is about as long as the simulation time itself.
While I am just doing LLC tank gain verification (which I wont do often) so I just stick with .meas and some manual data arrangement.
But, if I need to do it often, I will definitely do the same function in my c block
I’m glad to be of help.
As I explain in my datasheet for the component, this special C-block was created out of necessity to achieve specific data results as fast as possible. In my simulation (30K steps), it would take and extra 2+ hours to generate the .meas analysis on just three values. This is mostly because the .qraw file generated from the 30K step sim was over 28 GB!!!
My component eliminated this time.
As a secondary note: There is a way to eliminate generating the .qraw file altogether. Which in my case is not a problem.
I created a batch job of the sim and sent the .qraw output to NUL.
Sadly, this did not reduce the sim execution time. Oh well.
I decided to do exactly the same function as you did there.
The reason is I need to do FRA, and I believe meas fra is more accurate than BODE, but then it crashed my PC after finishing all the transient analysis (with 279 total steps and 126GB .qraw).
so, I decided to do the fourier myself with sine cosine and idt block. then I C-block to capture the final data and store the result in txt file.
My question is, can you share me how to not store any data in .qraw? (1 or 2 steps are ok, but not the whole 279 steps). I read the batch sim guide from KSKelvin but still not very clear.
Here is the batch file I use for one of my sims.
“C:\Program Files\QSPICE\QSPICE64.exe” SIm_circuit.cir -binary -o log.txt -r NUL
Remember to save the above with the .bat extension.
There are a few things I need to do to get this working correctly.
- Open the .qsch in QSpice.
- Select “View/Netlist” from the top menu bar.
- Perform a “Save”. This will save the netlist as a .cir.
- Open a “Command Prompt” window.
- Enter the command "CD =directory where your sim is found=
- Enter the batch file name. This will run the .bat file.
- The “-r NUL” redirects the .qraw output to NUL which is to go NOWHERE. It probably still processes the data but the stdout for this is NUL.
- The “-o log.txt” redirects the output window contents to log.txt. You can set the file to NUL instead. However, creating a log file will inform you if any run errors appear and it also displays the execution time which I find convenient.
- Once you run the sim, I have not found a way to abort it aside from going into the “Task Manager” and ending the task. Not elegant. Also, I don’t know if residual damage might be done this way. Let me know if you find a proper way to abort the sim.
Really appreciate your directive but its some extra steps that I am not really fond of. Sorry for that…
I just realized, that I can simply change the .tran directives to avoid storing the qraw data when its unnecessary. Because today I just made 126GB for FRA with .meas fra at 31 freq steps + 9 different circuit config… Only to find that the software crashes as it needs to run the .meas
So, I noticed that the .tran has option for starting time to start storing data into qraw.
So what I did was simply changing from .tran 100m into .tran 0 100m 99.999m 1. This way the qspice only store the transient data for the last 1us which is nothing.
Thus the .qraw size changed from 126GB to mere kilobytes
Good deal! Yes. If you don’t need the .qraw you can use the .tran directive in that mode.