0
\$\begingroup\$

Suppose I have a resistor and I want to simulate process variation on it.
When I was reading online, I noticed that Monte Carlo simulation is used for this purpose. I also noticed that HSPICE has this option.
However, I like to use Python for this purpose. I wanted to generated different resistance using Python random number generator (such as Gaussian distribution). I was wondering if these two methods (HSPICE or Python) are conceptually the same procedure.

\$\endgroup\$
1
\$\begingroup\$

Yes you can. No they are not the same.

a) You have to model your circuit in python, using transfer function rules (e.g. for voltage dividers, opamps etc...), and vary the components (randomly) to update the transfer function.

OR

b) generate a spice netlist with selected (random) component values and run it in spice. This is not efficient, as you generate a new netlist for each case, but gives you most control through Python and the easiest circuit analysis through spice.

Using the transfer function approach is not the same as performing circuit analysis. Although both will arrive at the same outcome for linear circuits, any non-linearity (e.g. semiconductors, inductor core saturation) is not captured in the transfer function approach.

\$\endgroup\$
0
\$\begingroup\$

As long as you can accurately simulate the effects of the resistance variation in Python, yes.

Monte Carlo simulation isn't a SPICE thing -- its a general simulation thing that tends to get used a lot in SPICE because it happens to be a good way of predicting whether a circuit board design will work in practice.

\$\endgroup\$
1
  • \$\begingroup\$ thanks for your response. Yes, I understand what you mean. I am assuming a Gaussian distribution with specific mean and sigma (that matches some assumption for actual variation). Then, take sample from distribution. \$\endgroup\$ – Shannon Nov 14 '18 at 20:17
0
\$\begingroup\$

Simulating one resistor is easy, but you're typically looking for the effect that variation has on a functional circuit. If you can describe the transfer function of the parameters you want to look at relative to the parameter(s) you want to vary, you can do it in any programming language. For something simple like this divider, it's not difficult to work out, but it's far easier to let the software work that out on a more complex circuit. (This one is in LTSpice, with Gaussian distributions used rather than the mc function that uses a flat distribution)

enter image description here

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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