FELICITAS PCBSIM – RELIABILITY OF SIMULATION RESULTS INTRODUCTION Spice circuit simulation has now been around for more than 40 years. To my experience a simulation saves usually at least one re-spin and lots of time. Furthermore, a circuit fine tuned in simulation is very cost efficient and stable. Despite this, many engineers do not use simulation on a regular basis. We often hear doubts about the accuracy of simulation. This article will cover aspects which influence the accuracy of simulation and will give practical guidelines about what results can be trusted. FELICITAS PCBSIM The following examples have been done with Felicitas PCBSim. This is a SPICE circuit simulator which is seamlessly integrated into CadSoft EAGLE. It is activated directly from the schematic editor of EAGLE and adds context menu entries and specific dialogs for the simulation parameters of all components. The schematic is transferred to PCBSim with a single button. All simulation settings are stored within the schematic of EAGLE. Nevertheless, the following results and conclusions are valid for most other SPICE simulators. Figure 1: Felicitas PCBSim Circuit Simulator SPICE ALGORITHM The first version of SPICE (Simulation Program with Integrated Circuit Emphasis) was created by the Berkeley University of California back in 1973. The source code was later released to the public and is now the basis for many different Simulators. Spice uses Kirchhoff's circuit laws to create a set of equations which represents the circuit. Kirchhoff's junction rule state that the sum of currents must be zero for each node (in Figure 2it would be applied to nodes NODE1, NODE2 and GND). Kirchoff's voltage law says that the sum of voltages must be zero for each closed loop (for Figure 2: voltages across V1, R1 and D1). Figure 2: Forward Biased Diode For each circuit this leads to n equations for n unknown voltages. If the circuit is linear, solving these equations is straight forward. For non-linear circuits, Spice deploys an iterative process (Newton-Raphson approximation). Simply put, node voltages are guessed and currents and calculated. If the sum of currents for a node is not zero, the node voltage is adjusted. If it all sums up, the solution is found. The simulation starts at time zero and iterates with small time steps forward. For each time step the solution of the previous time step is taken as a first guess to the algorithm. Voltages across capacitors are calculated by integrating the current flowing into them. Inductors are treated similarly. If Spice knows exactly how the current through D1 depends on the voltage across D1, the simulation results will be absolutely exact. More generally, the simulation results will be exact if the simulation model for each device is exact. We will now cover the accuracy which can be expected from commonly used simulation models. SIMULATION MODELS FOR PASSIVE COMPONENTS Ideal passive components are of course known to SPICE and do not need a simulation model, just a value. Felicitas PCBSim directly uses the component values from EAGLE and understands the usual electronic notation, like 3k3 or 4u7. The parasitics are the interesting part for the simulation. Felicitas PCBSim allows to directly add these to the component. Many times it will not be necessary to do this. For example resistors and ceramic capacitors will behave like ideal resistors and capacitors respectively in most applications. Electrolytic capacitors are a different story. They have fairly large serial resistance and also leakage. Both effects can easily be covered by the simulation and should be added to the simulation parameter of the component (see Figure 3). The parasitics of inductors can be added likewise, here the series resistance is most important. Figure 3: Parasitics of a Capacitor Therefore, the vast majority of passive components can be accurately simulated without adding information on parasitics. Only a few passive key components of each circuit usually need more attention. Then the simulation will also cover effects like inrush current, LC-filter bandwidth, capacitor losses, ripple current and voltages, etc. SIMULATION MODELS FOR SEMICONDUCTORS Figure 4: 1N4007 forward current at different temperatures Since Spice was originally designed to simulate integrate circuits, it has very precise simulation models for different kinds of semiconductors. Diodes and transistors (including JFETs and MOSFETs) are usually simulated very exactly. See figure 3 for an example of the forward dc characteristic of 1N4007, a silicon rectifier diode. Usually the models reflect - dc characteristic - junction and gate capacitances, voltage dependent - temperature dependence of forward voltages - current gain, resistance between source and drain This allows very precise simulation of these semiconductors including frequency response, non-linear effects and temperature drift. Other semiconductors (thyristors, triacs, zener diodes, dual-gate MOSFETs,...) are modeled as small sub-circuits. They are very accurate as well, but sometimes do not reflect temperature dependency precisely. The following section about integrated circuits apply to these semiconductors as well. SIMULATION MODELS FOR INTEGRATED CIRCUITS Integrated circuits can be modeled in two ways: the Spice simulation model can directly represent the internal schematic of the integrated circuit. This approach leads to very exact models but they are also very large and therefore slow to simulate. Furthermore the model reveals all the internal details of the integrated circuit and so allows competitors to easily copy the circuit. A second approach is the so called macro-model. These models describe integrated circuits as artificial building blocks. The main amplifier of an operational amplifier could for example be modeled as a voltage - controlled voltage source with high gain. This approach usually leads to faster simulations, but often do not reflect all aspects of an integrated circuit (for example supply current characteristics or temperature dependency). Still both approaches are valid and most of the available models yield very accurate simulation results. If in doubt it is easy to verify a simulation model. A small circuit from the data sheet of the component can be copied and simulated. Comparing the results with the data sheet already gives a high level of confidence in the simulation model. The small signal step response of an AD8038 from Analog Devices has been verified in this way: Figure 3: AD8038: Comparison Between Data Sheet and Simulation The result shows that the simulation model is very accurately reflecting the real behavior of the operational amplifier. INFLUENCE OF THE BOARD LAYOUT In some cases the board layout has a strong influence on the performance of the circuit. This is especially true for high-frequency applications. Even before the layout is done, the influence of parasitic capacitances can be tested by just adding them to the simulated circuit. In this way it can be checked whether these parasitic capacitances have noticeable influence and how to compensate for them. As a practical guideline, this should be considered with frequencies above 10MHz for sensitive amplifiers, above 100MHz otherwise. Even short PCB tracks behave like transmission lines with very fast analog or digital signals. There is a special SPICE component “Transmission Line” to simulate this. Felicitas PCBSim's Transmission Line Calculator allows you to comfortably derive the properties of the transmission lines from the PCB track geometry. Delay times, reflections and even losses can be analyzed prior to the actual board layout. A 5cm track for example should be considered as a transmission line for frequencies higher than 300MHz or slopes faster than 1ns. Figure 6: Transmission Line Calculator Checking the influence of coupling capacitors and transmission lines improves the accuracy of the simulation results for sensitive high-frequency circuits substantially. The result of all these tests is also a much more detailed specification on how to do the board layout which of course increases the chance of a first-time-right prototype considerably. WHAT IF A SIMULATION MODEL CAN'T BE FOUND? Felicitas PCBSim already comes with a large number of simulation models. Most vendors do supply simulation models for their components. Usually, the models are written for a certain simulator. Felicitas PCBSim has an integrated Universal Spice Parser which is able to import simulation models targeted for a number of popular simulators. In this way most of the available models can be used. If there is no simulation model for a certain device available (or if it is encrypted), it is often possible to use models for similar parts from other vendors. If none can be found, either the vendor or Felicitas Customized Engineering will be able to create such a model on request. PRACTICAL EXPERIENCE I have done or helped with the simulation of many different designs, like - Amplifiers (HF/NF, low power, high power, precision) - DC/DC Converters - NF/HF Filters - Charge pumps - Oscillators - Modulators - Demodulators In the vast majority of cases the simulation was spot on and reflected the performance of the prototype including frequency response, power consumption and efficiency. CONCLUSION A simulation is as good as the simulation models it uses and in most cases very accurate models are available today. The simulation then allows to test and optimize a design before the first prototype is built. It gives unique insight into the design which would be very hard or even impossible to obtain with real hardware. Usually, the first prototype will work right from the start. Simulation therefore saves weeks and months of valuable design time.