# LTspice Monte Carlo with different model libraries

I'm trying to figure out how to do my first Monte Carlo analysis in LTspice. I have a very simple schematic that includes the SPICE model for PN 74LVC3G17DC (vendor link).

The distribution from the vendor includes 3 library files, 1 for fast/nominal/slow performance of the part. (There are also multiple netlist files for the performance of the different IC packages available).

I want to run a Monte Carlo where not only are my resistors/capacitors varying, but also the performance of the IC varies (as defined in the different libraries provided). Right now I have a spice .INCLUDE directive at the top level that defines which library to use; and then I run the simulation multiple times to compare. There has to be a better way... right?

Unless I misunderstood, you can step subcircuits provided their names are numerals, so that the .STEP command can properly evaluate the variable.
R1 is defined as a subcircuit (has the X prefix, not R), and its name is parametric, {x}, allowing for a definition through the .PARAM statements. There are two subcircuit definitions, one with the name 1 (inside, a simple 0.8Ω resistor), and the other with the name 2 (inside a simple 0.7Ω resistor). The .STEP directive steps the variable x through a list with the numbers 1 and 2, corresponding to the names f the subcircuit definitions. The plot shows the values of the voltage given the stepped load.
• @aosborne This is why I said provided their names are numerals, because you'll have to change the names of the subcircuits (in both the definitions and the schematic) in order for this small trick to work. That is the price to pay. – a concerned citizen Jun 17 at 16:25