spice parameter sweep

Discussion in 'General Electronics Chat' started by pretty_fly, Jan 18, 2016.

  1. pretty_fly

    Thread Starter New Member

    Feb 2, 2015
    18
    0
    Hi

    currently I am working on an amplifier circuit simulation for optimum RC constant by using LTspice. I want to vary 6 (R and C) parameters and save the resulting output of my amplifier but ltspice let me change only 3 of them. Then I need to change variable value manually for the other configurations.

    directives ı used:
    .step param R1 list 1k 10k 22k
    .step param C1 list 1p 10p 22p
    ...
    similiarly up to R6 and C6

    Do you have any idea how to do that with LTspcie? Or any other spice simulator suggestion to do that?

    Hope it is clear ...
    Thank you :)
     
  2. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,804
    1,105
    If each parameter can take 3 values then LTS will need to run 3^6 = 729 sims. Won't that take up a lot of memory? How much memory have you allowed LTS to use for Fast Access Conversion (the default is 20% of RAM)?
     
  3. pretty_fly

    Thread Starter New Member

    Feb 2, 2015
    18
    0
    Alec_t thank you for your response :)

    Actually I didnot allowed any memory specifically. Do you mean it is a memory problem?
    The error message says "only three dimensions can be .STEP'ed "
     
  4. eetech00

    Active Member

    Jun 8, 2013
    650
    112

    For LTspice, use tables to define params. Like this:

    .params R=tbl(n, 1,1k, 2,10k, 3, 22k)
    .params C=tbl(n, 1,1p, 2,10p, 3,22p)

    use {C} as cap value and {R} as resistor value

    Then use step command
    .step param n list 1,2,3
     
  5. pretty_fly

    Thread Starter New Member

    Feb 2, 2015
    18
    0
    eetech00 thank you for your response but the result is the same. This is another version of what I've given above.
     
  6. WBahn

    Moderator

    Mar 31, 2012
    17,760
    4,800
    If I understand what he wants, he has 6 resistors and 6 capacitors, or 12 components, each of which he wants to take on 3 different values. So that would be 3^12 = 531,441 simulations. Even if each simulation only took one second, that would take over six days of continuous running time. Then he would have to sift through all of the data.
     
  7. WBahn

    Moderator

    Mar 31, 2012
    17,760
    4,800
    But this wouldn't vary the parameters independently. For instance, in this case he would end up with three simulations covering just three of the nine possible combinations of R and C values. He would need to enumerate the tables for all nine possibilities. Doable for two parameters, but for twelve each table would need over half a million entries.
     
  8. Veracohr

    Well-Known Member

    Jan 3, 2011
    552
    76
    You appear to have come up against a limitation.

    Check out the mess that results from three stepped parameters with three steps each. Do you really want more?

    Screen Shot 2016-01-18 at 10.48.07 AM.png
     
  9. pretty_fly

    Thread Starter New Member

    Feb 2, 2015
    18
    0
    WBahn you got what i mean :) little bit more detail...

    I want to vary R1, C1, R2, C2, R3, C3 for same three values: 1k, 10k 22k & 5p, 10p, 22p

    So out of very long simulation time is there any possiblity of doing this??

    Veracohr, yes the graphical view is complicated. After finishing the simulation I am going to make selection depending on output signal width and amplitude. Thus the graphical view is not that much important for me.

    At the end when I get the best configuration I want to concentrate on the PCB design etc ...
     
    Last edited: Jan 18, 2016
  10. WBahn

    Moderator

    Mar 31, 2012
    17,760
    4,800
    Will R1, R2, and R3 always be equal, or do you want all of the possible 27 ways of combining them?

    How long does a single simulation take currently?
     
  11. eetech00

    Active Member

    Jun 8, 2013
    650
    112
    Hi

    While it may not be what you wanted, it is not the same

    the version I've shown will execute three runs.
    the version you've shown will execute nine runs.
     
  12. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,804
    1,105
    In that case I doubt you can increase the number of parameters to six, if LTS has deliberately set a predetermined limitation.
     
  13. ifixit

    Distinguished Member

    Nov 20, 2008
    639
    108
    You could try copying the circuit you are testing multiple times and place within the same schematic. It will be placed with different component designations. Route the same test signal to each circuit. Each run will now test a set of component values at the same time.

    How large is your circuit?
    Are you doing AC analysis or transient?

    Fixit
     
  14. WBahn

    Moderator

    Mar 31, 2012
    17,760
    4,800
    I don't think it's going to be practical unless he significantly reigns in the scope of the search space. He's talking about over half a million simulations
     
  15. eetech00

    Active Member

    Jun 8, 2013
    650
    112


    I was under the impression you had 6 components you want to set to three different values for each run.
    How about showing a schematic?
     
  16. WBahn

    Moderator

    Mar 31, 2012
    17,760
    4,800
    I think this is the key thing he said in the OP that indicates it is a total of twelve components:

    Other places it is a lot more ambiguous and depends on how you parse what was written.
     
  17. pretty_fly

    Thread Starter New Member

    Feb 2, 2015
    18
    0
    For three components (e.g R1,R2,R3) 27 simulations take almost 30 sec.

    Well it seems predetermined. I thought maybe there is a "paid version" or someone can suggest another simulator capable to do this. I've checked for multisim on the web but can't see a word about such a limitation. Then I'll try it by installing and doing sim.

    I'll try

    yes sure I have limited the num. of varying com. to 6 (R1,R2,R3 and C1,C2,C3) at first but still seeking for increasing the limit more than 3 components

    It is just a very simple op-amp based amplifier circuit with R&C feedback and serial C&R connected to inv. input. Also
    there is +V ref voltage connected to non-inv. input. thats all.
     
  18. WBahn

    Moderator

    Mar 31, 2012
    17,760
    4,800
    Then how are you coming up with six resistors and six capacitors that you want to sweep?
     
  19. pretty_fly

    Thread Starter New Member

    Feb 2, 2015
    18
    0
    There are three stages of same circuit.
     
  20. WBahn

    Moderator

    Mar 31, 2012
    17,760
    4,800
    Ah. I see. But that opens up some possibilities. Map out each stage separately (now you are dealing with just four components and running three simulation sets that each map out across three components is pretty straightforward).
     
Loading...