2

What is the best way to simulate a big circuit for a huge number of times?

I have a big resistive network (lets say 100x100). I want to run it about 10 million times. What is the best way for that?

I am using HSPICE, but it is so slow and it takes days to run those number of simulations.

Shannon
  • 151
  • 1
  • 9
  • Are you expecting different results each time? Are you adjusting parameters each run? – Ron Beyer Oct 30 '17 at 23:09
  • Just write the code for it, then. It's ***really*** easy to do and you can optimize it as you see fit. Given your VERY SHORT description, I'd recommend the "checkerboard" technique as this works for everything from computing charge distribution on complex metal surfaces and antennae to the infinite resistor grid problem (which is what yours sounds like to me.) And/or write at least partially in F# as it will allow you to spawn it off to fill all of your cores (trivially easy.) Otherwise, buy a Sunway TaihuLight from China. That's "best." – jonk Oct 30 '17 at 23:12
  • @RonBeyer, yes, I am changing the voltage each time. – Shannon Oct 30 '17 at 23:39
  • @jonk I already have the code, but it takes a lot of time for it. It's been ~3h and ~55k simulations are done. – Shannon Oct 30 '17 at 23:42
  • 2
    Provide more details. I think the answer isn't a computer but instead better code design. – jonk Oct 30 '17 at 23:46
  • 1
    They're linear resistors? Then just simulate once and scale the output to the input value. – The Photon Oct 31 '17 at 02:50
  • Multiple sources? Simulate once per source, again scale and use superposition to find the result for any combination of inputs. – The Photon Oct 31 '17 at 02:50
  • It's common to use a simulated function generator, to test a circuit with a variety of 'input' values. Would that help, having a range of values by sweeping through them in a single simulation? – Whit3rd Oct 31 '17 at 05:41
  • @The Photon, there are multiple inputs and outputs, so I cannot just assume it is a fixed resistive network. – Shannon Oct 31 '17 at 08:09
  • @Whit3rd, I am not sweeping, I am either connecting them or disconnecting them (float, not zero). – Shannon Oct 31 '17 at 08:10
  • 1
    Without a better description of what you are doing, I doubt there are any answers, or even valid suggestions. To be honest, it sounds like you yourself are unclear as to your goals/requirements. – R Drast Oct 31 '17 at 10:15
  • So you want to simulate **different** circuits. As in you make a change, simulate, repeat. – StainlessSteelRat Oct 31 '17 at 12:04
  • If all the resistors in the network are linear, it's a linear network no matter how many inputs and outputs it has. – The Photon Oct 31 '17 at 14:44
  • I'm flummoxed why the OP doesn't just provide more details. We've just learned that resistors are removed and added, to change the circuit. But that's not much of a complication. It's just changing a conductance value between 0 and a non-0 value at a matrix cell. If one wants to avoid sparse matrix inversion (for some reason) then checkerboarding a few iterations may get close enough, simulation-wise. Submitting to Spice each time means that Spice also has to create the matrix every time, which is completely wasted effort I think. But I can't tell because the OP won't say more. – jonk Oct 31 '17 at 17:36
  • @StainlessSteelRat. Yes, it is the same structure with different input-outputs. Basically, you can assume that we have a resistive black box with M inputs and N outputs. In each run, I am applying voltage to some of Ms and read some of Ns. I am not sure if it is called as the same circuit or not. – Shannon Nov 01 '17 at 19:29
  • @ThePhoton When the sources are disconnected (not grounded), can I still use superposition? – Shannon Nov 01 '17 at 19:30
  • @jonk, do you mean me by OP? I explained it. I do not add or remove resistors. I have a fixed blackbox which is resistive. The inputs and outputs change. Can you explain how I can use checkerboard? – Shannon Nov 01 '17 at 19:33
  • You set up a large grid (matrix.) Each cell of the grid represents a state (voltage?) for a node. You set up a rule for computing the next state of a node (this will involve your resistors which adjoin cells (probably another matrix for that to indicate values, or lack thereof.) You then treat the cells like a white/black checkerboard, processing all white cells and computing their values, then processing all black cells and computing their values. Repeat. External conditions (voltages at inputs) are represented as voltage cells with values that cannot be changed each iteration. That's all. – jonk Nov 01 '17 at 19:47
  • @jonk I will try to see if I can use/implement what you said. Thanks a lot for your explanations. – Shannon Nov 01 '17 at 20:31
  • @Shabnam If you edit your question so that there is a small subset *detailed* example of something similar to but a lot smaller than what you are trying to do, I'll be happy to write an answer showing you the code that would achieve it. It's very easy to write. – jonk Nov 01 '17 at 20:38
  • @Shabnam One added note, though. Because each computation (white or black cell) is isolated and only involves "nearby" cell values, the checkerboard approach lends itself instantly to parallelism. If you have a multi-core CPU, or a fancy 1000-core parallel processor available, and a decent compiler for same, then this whole thing just "spreads itself" out beautifully for parallel processing. It's practically made for it. Another beauty. F# is a perfect fit for this kind of thing. That's why I just think this is a coding/compiler/OS issue. Trivial with the right toolset. – jonk Nov 01 '17 at 20:45

0 Answers0