Tuesday, October 20, 2009

6. Simulating switching circuits

Simulation with "ideal" components is not a new idea. Spice always had problems with switching circuits: SMPS (switching mode power supplies), switched capacitors, etc. In many cases, detailed and accurate simulation of switching process is not needed: a simple "On/Off" transistor model (i.e. ideal switch) with instant switching is quite appropriate to accurately predict circuit behavior. This is definitely a case when simplifying a component, rather then making it more real, is the only way to obtain a reliable result.

This approach has been described in many papers since 80's. However, there is no any real, reliable, publicly available tool so far. Why? Probably because there is a long way from an idea and a method, usually designed and tested for specific circuits only, to a software with convenient, user-friendly GUI, simulating any arbitrary schematic. Also, there is a mistaken belief that simulating circuits with simplified "ideal" components is easier than "real". This is not true: there are many problems, specific to "ideal" components, and simulation tool should be able to handle all of them.

Although Spice is doing much better now (I'd rather say: faster), it still fails on simple switching circuits. It actually does something, but results are wrong. Of course, there are some "knobs" (simulation and component parameters) you can adjust to make everything work right. However, as I said before, you have to realize a result is wrong, you have to know what to change, and how to change.

Monday, October 19, 2009

5. NL5 - "Concept Simulation" tool

This is an excerpt from NL5 presentation:

Concept Simulation is a process where design ideas are evaluated and iterated using fast and simple simulation tool. The result of this process is a schematic which is more complete and is ready for the rigorous and detailed SPICE simulation. This allows your SPICE simulation stage to be shorter and much more efficient.

In the Concept Simulation stage many iterations are performed in a short period of time, concurrent to the engineer’s thinking. A tool used for Concept Simulation should provide the
response extremely fast, preferably before the next idea comes into engineer’s mind. It needs to allow instantaneous modification of the design and starting of a new simulation with minimal delay. Under no circumstances should the simulator be a frustrating “bottleneck” in the process. The Concept Simulation tool must complement the engineer’s thinking, literally being a seamless and efficient add-on to the engineer’s brain.

NL5 meets all of these requirements well: it is easy to use, fast, and reliable, substantially due to its ability to work with ideal components.

Friday, October 16, 2009

4. NL="Never Lies". Why?

There are two sorts of "lie" in simulation world.

Number one is "not intentional": simulator "thinks" it does everything right, but due to many reasons the result is not correct. The reasons could be: approximation error of numerical integration method, arithmetic rounding errors, wrong simulation time step or other simulation parameters, etc. The only way to determine if the result is correct is to know upfront, or at least approximately expect, what correct result is, based on your knowledge, practical experience, and even common sense. Not a big deal for many engineers, but could be a real trouble for students. Of course, it would be not honest declaring NL5 "never lies" that way. However, many problems common for Spice do not exist, or significantly reduced in NL5. 1) Basically, except very rare situations, calculation step is the only simulation parameter user should set up. If result is in question, just run simulation several times (it's fast!) with different steps: repeatable and stable result is most likely right. 2) Most of wrong results happen at switching points, where voltages and currents are rapidly changing and very often show erroneous oscillations and overshoots. In NL5, with true instant switching of ideal components, this almost never happens. 3) It is much easier to predict how correct result should look like for a schematic with ideal components rather than complex "real" models.

Number two is "intentional". Due to limitations of Spice algorithm, it is not able to simulate arbitrary schematic with arbitrary component parameters. For instance, many simulators do not allow capacitors connected in parallel, inductors connected in series, floating schematics, etc. To solve the problem, some very small or very high resistors are added into schematic, and those "hidden" features are not indicated on the schematic. This might be OK as long as those additions do not affect results much, or you are familiar with the tool and know what to expect (and where in the program all the settings are located). Otherwise you may have a hard time to find out why results do not correspond to schematic. NL5 does not add anything into schematic and simulates exactly what you ask for: "what you see is what you get".

I've probably exaggerated those problems a bit... But I believe that for efficient and fast design everything you do must be clear and "transparent". There should be nothing "hidden" your have to remember or always keep in mind, especially if it is critical to simulation process. Any "hidden" thing is a potential source of error and misinterpreting, and if it may happen, some time it will.

Thursday, October 15, 2009

3. NL="No Limits". Why?

As a "concept simulation tool", NL5 is able to simulate any schematic ideas generated by engineer. First, there are "no limits" on circuit topology: you can do anything you want, and NL5 should successfully perform simulation even if such a schematic can not be implemented in real life. Second, there are "no limits" on component parameters: almost all of them can be set to zero, infinity, negative or positive values, and NL5 should handle that as well. And third, there are "no limits" on schematic operating range: voltage, current, time, and frequency. There are no any absolute or relative tolerance settings: picoamps and megaamps, nanovolts and gigavolts may exist in the same schematic at the same time.

In other words, NL5 does not expect engineer to do "right" things, and it does not limit engineer in what he is able to do. Instead, it allows evaluating any "silly" and "crazy" ideas with components that do not exist (at least today, but who knows about tomorrow...), and parameters that may not make sense in real life. While Spice simulation is very often limited by real world "rules and conditions", and thus it may easily fail if something is "not-real", NL5 is designed and optimized for "ideal" world of your imagination. It does not care what you do, it just gives you true results on schematic you entered. No questions asked.

I believe such a "no limits" capability is exactly what is needed for initial design process: quickly evaluate and iterate any "non-real" design ideas, and finally converge to "real" schematic, ready for rigorous Spice analysis.

Tuesday, October 13, 2009

2. Why ideal components?

As I already said, when engineer "evaluates" a new circuit idea in his mind, he is using ideal components. Why? Because it is much easier than dealing with real components. Although human's brain is quite powerful, it is more "optimized" for solving problems other than circuit simulation.

However, even with a computer capable to do real simulation, using ideal components would be very beneficial at the initial stage of a project. Why?

First, even if calculations are done by computer, an analysis of the simulation results will be performed by a human. With simple ideal components it would be much easier to understand how schematic is supposed to work, how parts of the schematics and individual components interact with each other, and how each component (or component's parameter) affects circuit functionality.

Second, even NL is not a perfect tool: all simulation algorithms and methods have some limitations and may introduce some inevitable errors while converting "real world" into numbers, manipulating those numbers, and finally presenting results. With real components, separating math "artifacts" from actual schematic problem could be a very difficult task. With ideal components, any "strange", non-expected schematic behavior could be analyzed better.

Third: although new Spice simulators are extremely fast, using simple components could definitely accelerate simulation a lot (of course, if simulator can handle ideal components properly). Engineer is designing a new schematic still in his head, using simulator as an external "add-on tool" to evaluate ideas. For productive work, simulator should be literally as fast as human's brain is: providing response as fast as possible and not to be a "bottleneck" in the design process.

Fourth:.. we'll find out more reasons later, while discussing what NL5 is.

Thursday, October 8, 2009

1. NL is not a Spice! (cont.)

1.3. What does NL5 do? I can imagine only 3 reasons why Spice could not simulate a schematic:
1) Schematic topology is absolutely wrong;
2) Schematic is correct, but component parameters are wrong;
3) Everything is correct, but Spice can not simulate...

NL can't do anything with #3: it is Spice responsibility to do things right. As for #1 and #2: a responsible party here is an engineer, who invents schematic, selects parts, and must guarantee workable solution for further Spice simulation. NL can help engineer to do this job quick and efficient.

How does engineer create a new schematic? Mostly in his head. Or on the sheet of paper with pencil and eraser. Or on the blackboard. In any case, all the calculations and evaluations are done in his brain in the form: "this diode is close, current goes here, capacitor is charged, switch opens...". Just note: no real parts here, only "diode", "switch", "OpAmp". Advantage of using NL on this stage of the project is that it is designed to do reliable simulation of schematics with ideal components: "diodes", "switches", "OpAmps", etc., and most of the time it does it well. Spice simulators can't do that reliably just because their algorithm is not designed for ideal components. Although some simulators claim that they can, very often they are failing at very simple schematics.

Wednesday, October 7, 2009

1. NL is not a Spice!

First of all, NL is not a Spice. Not only because the algorithm is different. In fact, the whole idea and purpose of NL is different.

1.1 What's the problem with Spice simulators? All Spice based simulators are designed for accurate simulation of schematics with real components, or at least what they think are real components. There are hundreds of libraries, thousands of component models, and an intention is: draw schematic with real parts, start simulation, and immediately see how your "real" prototype would work. This is definitely a very important step of the design process: it saves a lot of money, resources, and time.

Unfortunately, there are a lot of problems with Spice simulators: and don't trust anybody who says there are not. You may get used to it, you may learn how to avoid those problems, but they always exist.

The main problem is that when you enter a real schematic and try to simulate it, very often it does not work, or gives you a wrong result. Ok, ok: sometimes it does not work. But for some people: often; for me: very often; and I know people for whom it never works at first run. And for some types of schematics - 100% never works. Then you have to do a "magic": tweaking component values, simulation parameters, usually without understanding what you are doing, just to make it work. And when you see a wrong result, how do you know, is it a schematic problem, or Spice problem? Without experience, you don't. When you change some "tolerance" parameters and see different results, how can you trust those results at all? This is funny: you have to know what a correct result is in order to trust simulation results!

1.2 You still need Spice! Despite all those scary things, you still need Spice: when you have your schematic working as expected, Spice is a very good tool to do accurate analysis with parts variation, in required temperature range, etc. The question is: how to make your schematic work in Spice without doing much "magic"? How to get results you would trust? How to make Spice simulation stage of a project very efficient? This is exactly what NL was designed for.

to be continued...