LTSpice - comparing 2 simulations

Hey guys, maybe someone knows how to do this.
In LTSpice, is there a way to compare two simulation runs?
For example, say you do a step response and plot the voltage of the node of interest. Then you make a tweak to the circuit and run the simulation again. Now I would like to visually compare the waveform of the previous step response to the current one. Is there a way to do this?
It would be super helpful.

Thanks a bunch!
- Sandro
 

Mooly

Administrator
Paid Member
2007-09-15 8:14 am
You can use the 'copy function' on the work-space to duplicate your circuit. It is the symbol next to the scissors on the function bar and is used to draw around the area you want to duplicate.

Having done that, delete all the duplicated commands and rename any duplicate nodes such as Vout making them say Vout_1 and V_out2

Now you can run the sim and probe each version.
 

Attachments

  • 1.jpg
    1.jpg
    333.1 KB · Views: 285
  • 2.jpg
    2.jpg
    350.7 KB · Views: 276
  • 3.jpg
    3.jpg
    294.7 KB · Views: 279
  • 4.jpg
    4.jpg
    358.4 KB · Views: 275
Hi Mooly and Knutn,
Thanks guys! Knutn's solution is more like what I am looking for. While still a bit clunky, I think it is better than copying the whole circuit twice, specially as circuits become big. I wish LTSpice had an option to allow you to save say the last 5 simulation runs without having to go to the file explorer and change the name of the raw files manually. For example, you could have an option that said save the last 5 simulations. Then LTspice would create: - circuit_1.raw, circuit_2.raw ... circuit_5.raw.
Once it reaches the 5th, it would start overwriting them.
Some day...
Thanks!
- Sandro
 
If you are looking for a visible comparison between two probe runs, the only thing you'll have to do, is to rename the first run (e.g. from amp.raw to ampfirst.raw) and compare it to the next run (e.g amp.raw). From the file menu, you can open the first run (e.g. ampfirst.raw).

Thanks! Just tried it, works, but I cannot put the two waveforms on the same plot window. I.e. ampfirst.raw is on one window, and amp.raw on another window. Is it possible to plot both waveforms on the same window and same plot pane?
 
Why not use .step param command (if the circuit topology has not been changed) ??
Something like last answer on this site:

ltspice - How to use .step param with more than two parameters in LTSpiceIV - Electrical Engineering Stack Exchange

RajkoM, This is great for certain situations, thanks for sharing! In the exact case I am testing right now it does not work (I am testing the circuit with different components), but I can see using it for other things.
Thanks again!
 
How to merge raw files...

I found the following post in a thread on another forum at electronics cad, Possible to overlay plots from different sims? (LTSpice). The answer is from Mike Engelhard, who wrote and maintains LTspice:

> I have discovered that I can open the .raw files from past sims, and
> compare the plots of old and new sims that way, but there doesn't seem
> to be a way to get a trace from an old .sim onto the same plot as traces
> from a new sim.
> This forces me to build two copies of the same circuit sometimes, to sim
> them simultaneously with different component values, so I can compare
> plots on the same set of axes.
> Is there a better way? Is there any way to do specifically what I'm
> hoping for in LTSpice?

You can merge .raw files from different simulations with a free 3rd
party utility that Helmut Sennewald wrote. That is available from
the independent users' group Yahoo! Groups.

Another approach would be to parameterize the circuit and use a .step
command. For example, change the value of a component from a hard-wired
number to {x*5-.01*temp} and and the SPICE directive
".step param x list 1K 2K 3K" to the schematic. The simulation will be
run three times and be overlaid in one plot. There's other examples
in the examples/Educational directory that do this.

--Mike

N.B. The LTspice users' group is in the process of moving to LTspice@groups.io | Home as Yahoo is closing down all groups. It is no longer possible to post at the old Yahoo group, and all postings, files and members are in the process of being moved to groups.io.

To access the files section of the group you need to be a member, so I recommend that you join the users' group at its new location to initiate a search for the utility. Helmut Sennewald is the owner of the group, incidentally, and will answer any questions you post (including Help! where is this utility?).

Stephen
 

Dave Zan

Member
2010-11-21 7:12 am
...the circuit with different components...

Hi Sandro.
It is possible to parameterise the component identifier and use STEP PARM to run different component types.
The trick is that STEP PARAM can only step numeric values.
So the component identifiers need to be numbers, for example 797 not AD797.
With this trick and resistors stepped from a nano-ohm to a tera-ohm to rewire a circuit almost any comparison is possible.
Sorry if this is a bit late for an answer, I have been more at work on speakers lately rather than SPICE.
My email is in my profile if you wish to contact me, my private mailbox here is full but email works.

Best wishes
David
 
Last edited:
Hi Sandro.
It is possible to parameterise the component identifier and use STEP PARM to run different component types.
The trick is that STEP PARAM can only step numeric values.
So the component identifiers need to be numbers, for example 797 not AD797.
With this trick and resistors stepped from a nano-ohm to a tera-ohm to rewire a circuit almost any comparison is possible.
Sorry if this is a bit late for an answer, I have been more at work on speakers lately rather than SPICE.
My email is in my profile if you wish to contact me, my private mailbox here is full but email works.

Best wishes
David

Thanks David, will do. I actually wanted to contact you about the dual Tian probe that was discussed in a number of threads. I sent you a PM earlier today, but it bounced back since indeed your PM box is full.

Regarding the topic of this thread, this is what I have concluded:
- The functionality that I would like to have does not exist in LTSpice. You don't have access to a previously run simulation if you re-netlist.
- There are ways to hack your way around this lack of functionality by using the step command. I have only used step in the most basic way, so I am sure I am not using it to its full potential. I get your idea of changing resistor values from say 1n to 1T to wire in and out components... nice hack.

Things I don't know how to do (due to lack of research and necessity):
- How to use step in part numbers to change sub-circuits
- How to nest step commands i.e. a step within a step
- How to use the table command, I learned there is such a thing today

Another interesting thing I want to look into is how to store variables.
Say, you ran 4 AC sims using the step command and are interested in -3dB BW. Can I store the measured variable and then plot it vs. the stepped variable? I am you can, just need to research how to do it.

Anyway, thanks for responding and volunteering to help... I'll be contacting you :cheerful:

Best, Sandro