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?


1 Answer 1


Unless I misunderstood, you can step subcircuits provided their names are numerals, so that the .STEP command can properly evaluate the variable.

For example:


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.

  • \$\begingroup\$ OK - that makes sense. I'm not sure it fully solves the problem I'm up against, though; allow me to try and extend your simplified example: You've defined R1 to have a subcircuit name of {X}. Instead, let's give R1 a fixed name of "my_resistor". There are two library files provided by "my_resistor's" vendor; with the concept being that you ".INCLUDE" the library which contains the subcircuit properties you want to use. I'd like to step through a list of those libraries. (BONUS: Those libraries are then also dependent on a secondary .s netlist file of your choice, which also need to be .INC) \$\endgroup\$
    – aosborne
    Jun 17, 2019 at 13:35
  • \$\begingroup\$ @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. \$\endgroup\$ Jun 17, 2019 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.