Electronics - Simulation and Judgement
Created; 14/04/2016, Changed; 09/02/2019, 24/02/2020
Old this webpage; http://ww1.andrew-lohmann.me.uk/engineer/electronics/electronics-simulation-judgement/
Previous page; Electronics - Minimum design for Electromagnetic Compatibility and Electrostatic Discharge
I use spreadsheets and other tools provided by wound component and switch mode power supply IC makers and they are very good. This and linked pages show my evaluation of spice simulation tools for general circuit modelling. I have been recommended simulation tools in places that I have worked but I observe that they will mislead an engineer if he has not thought through the circuit, PCB layout parasitics and what is required. In another case a spice tool was recommended to me for power handing and therefore thermal modelling. I agree that spice tools can be good but taking care with the result. I have also been advised that simulation would do things that I have not seen so far, instead of using a calculator, spreadsheet or mental arithmetic and figuring out before I apply myself to putting any part in to a draft circuit. Then I would most likely go straight to circuit and PCB design to figure layout parasitics and component package shape implications these things being very important.
CAD tool used in the examples on this page is LT Spice IV;
- This tool claims to be a better tool for a number of reasons such as it is less likely to obscure circuit instability compared with other spice tools. LT Spice simulates in a more comprehensive way than others and does that faster than others but the way it works is also different so overall it is not slower. The claims and seems to be correct. Users can use LT Spice's own models or run most manufactures models if they are of a good quality and not encoded. The consequence is that although the tool is not restricted but I found that a Microchip Technology inc. op-amp models caused an error to occur but something similar though less severe could also happen with SiMetrix tool using the same Microchip op-amp model. I have also used models from other manufactures and they all work. It is reasonable to use a similar op-amp if there is a problem but an alternative suggested given to me was to use an ideal op-amp model that is provided. The first two circuits below gave very similar results with other modelling tools. It is not easy to check that a models virtual pin numbers coincide with the symbol's numbers but I found that no problems arose. You can create your own symbols and check for agreement.
- LT Spice Yahoo Group The yahoo LTspice group supports this tool and there are discussion on models that have been created for non-LT parts and how to create or more often fix other not Linear Technology models. This group is very helpful https://groups.yahoo.com/neo/groups/LTspice. Also see http://ltwiki.org
- There are problems on laptops with LTspice XVII that after installing, running sync to update libraries then loading a circuit that many standard parts used are missing. There is a dialogue box before the circuit opens with a list of missing parts but when that is closed and the circuit is visible there is little clue to what was in the gaps.
- I've observed the issue on different PC's to different degrees but does not occur on a desktop with Windows 7 or Windows 10.
- Web updates in a few minutes on a desktop (HP Compaq), 64bit; (Jan 2019)
- Windows 7 - Was quick and only needed to download under 2MB.
- Windows 10 - Was slower to synchronise, and download much more data.
- Web update takes hours on a laptop and then fails. But it might work a bit because some of the library data base download again has saved correctly. The whole 27MB is download it seem as if what came with the installation was not installed either.
- These are the Laptops I use to test;
- Samsung R50, 32 bit;
- Windows 7 (SP1 no updates) - Works (01-2019) but did not work previously after Windows updated.
- Windows 10 - Version 1607 (the highest version this computer will support 01-2019) - does not work. Version 1607 worked with different updates completed (02-2019).
- Linux Mint Cinnamon Wine - installed but not completed setting up - appears to work using the pre-loaded libraries and examples.
- Toshiba T1250 186MHz, 32 bit;
- Windows 10 - did not work before now works fine (Jan 2019)
- Toshiba Satelite C500' 64 bit;
- Windows 10 - LTspice XVII synchronisation is very slow, completes all the stages and is then found to have failed (previously and in Jan2019).
- Linux Ubuntu running Windows 10 in a Virtual machine - is impractically slow running but LTspice XVII works fine and synchronisation is quick. (Jan 2019)
- Samsung R50, 32 bit;
- These are the Laptops I use to test;
- Laptop issue - ADI website support request suggests re-installation should fix the issue but it does not since last looking at this issue in April 2018 and re-looking again after many windows updates in January 2019.
- ADI promote both LTspice and ADIsimPE (SiMetrix) there is no indication that one will be dropped since ADI purchased Linear Technology in 2018.
- The Yahoo LTspice group support simulation and seem unaware of the laptop issues. They are otherwise very helpful. I have not modelled anything using LTspice XVII.
- Running LTspice XVII in WINE on Linux seems to work but it is inflexible and depends on the implementation of WINE. WINE is not fixable if it goes wrong and installation does not always work out well!
- Web updates in a few minutes on a desktop (HP Compaq), 64bit; (Jan 2019)
- You can use a text viewer/editor to examine the schematic (which is readable with a text viewer) and see what is missing. This is when the LTspice yahoo group comes in useful and the LTspice wiki does not seem to have an answer?
- I've observed the issue on different PC's to different degrees but does not occur on a desktop with Windows 7 or Windows 10.
- There are problems on laptops with LTspice XVII that after installing, running sync to update libraries then loading a circuit that many standard parts used are missing. There is a dialogue box before the circuit opens with a list of missing parts but when that is closed and the circuit is visible there is little clue to what was in the gaps.
- Do bare in mind that simulation does not figure in parasitic reactances,
- Capacitance is usually most significant you can try adding components to simulate it.
- Similarly RF design could be difficult because Electromagnetic fields (EM fields) predominate the design unless the design is very small in size.
- If the circuit is stable with by adding 5-100pF say, less or more depending on PCB layout. It is worth revising the component values when the real circuit board is made but before you finalise the Bill-Of-Materials. Therefore reassessing the values of the lower value capacitors empirically (trial and error).
The group helped me through creating models for example;
- The prefix X is used with any model that has .SUBCKT ... END. This is called a sub-circuit.
That is true even if the model also has .MODEL statement. If you use the wrong one you will only use part of the model and its behaviour will be wrong.
- The Prefix is not X if there is only a .MODEL statement but not a .SUBCKT ... END statement.
In that case the prefix depends on the part such as QN or QP for BJT and MN or MP for a MOSFET and U for and IC. Load one of the pre-made parts to see which prefix should be used.
Design example that may use a circuit similar to one of those below; http://blog.andrew-lohmann.me.uk/p/electronics.html
Playing and finding out about modelling Electronics;
I have discussed elsewhere electromagnetic compatibility where the traditional ways once more-or-less swept aside have returned but improved on. It is often necessary to try things again that did not work once may work another time if done slightly differently.
Start by drawing your circuit using any components to hand then do some arithmetic to find substitute parts that are correctly sized. With a simulation tool you can do that but try and see rather than do much calculation. This is like what I would do when I was age 10 but there is always some try and see when a solution is complex and humans can get a good knack for doing that.
The vibration sensing solutions by clever design and modelling below, that I have developed, are very unnecessary for example a 3 axis or 6 axis motion sensor with I2C bus does the job well such as; FXOS8700CQR1 NXP, LIS3DH ST, FXLS8471Q NXP. LSM303AH ST, are low powered and nearly interchangeable with each other.
--------------------------------------------------------------------------------------------------
Peak detector worked through from my blog discussion; Electronics - Robust design methods - Theoretical example outdoor
Positive and negative Peak detector;
I conclude that a conventional solution with variations is usually best. Those exercises do not include buffer amplifiers at the output and in any case the if the micro-controller’s Analogue to digital converter is used infrequently then the input current can be kept low. The next exercise I have added the output buffer to the model and also tried another variant to see if I can find a solution that operates with a lower supply voltage.
On the opening page I discuss starting out with a more complex design but does all that is required. So that you have something in front of you to consider. This is what I have done but where I have shown an external digital buffer (DMA and RAM, FIFO or dual port RAM say) there are many micro-controllers with built in DMA (pseudo DMA) channels. Even so the function block in the diagram is useful for discussion.
Alternative and more developed vibration monitor; electronics-vibration-monitor and what happens if the simulation circuit is big - it will be slow to simulate and you will need to change settings to get it to work.
--------------------------------------------------------------------------------------------------------------------
To speed up the simulation in another circuit (switch mode amplifier that is not shown) that could not be minimised so instead I ticked; "Skip find initial point solution".
More features of simulation tools. (also see; Electronics - Control Loops)
The circuit above is a Class D amplifier (AL-0021-03A) there is another variant of this circuit at; Electronics control loops Simulated using LTspice IV.
In practice an engineer would not use all the test features, shown in this diagram, at the same time. They are shown to illustration some of what else is available. The circuit is too big to simulate fully or quickly and should be spilt up and the smaller parts simulated individually having said that some simulation is possible if you leave a 64 bit PC running all night. Different options and circuit variations can also be used to speed up simulation.
- Parameters can be changed automatically and tested using the .step function which in this case runs simulation's with different output loads. Pulse response is not good as testing shows and the filter rings briefly after each pulse.
- .tran Transient simulation runs the circuit in the way it will be used normally but the alternative .ac is used to test the frequency response. Either graph can show M3/U2's temperature but the axis is labelled V or dB rather than 'C with the AC simulation.
- The simpler circuits at Electronics control loops fully test the function of this circuit without the difficult I had with this circuit;
- The LTC4444 driver works but an 5EDL05x06 Infineon does not require L1 but there was no spice model for that part. There is a spice model for IR2109 which is an older version of the part.
- I was given help from the LTspice yahoo group and I was shown that the IR2109 driven by an oscillator confirmed that the output stages shoot-through-current was reasonable using the alternate simulation engine. This aspect though depended on some other options being set and I also observed very high shoot-through current of 1,000A at 1nS with another settings but the alternate engine simulate did not show these high current pulses.
- Another adviser retained most of the circuit but replaced the centre tapped power supply with a large value capacitor. Functionally about the same and made the simulation work.
Features of the circuit;
- The output low pass filtering is not part of the feedback loop and therefore keeps the feedback simple. Consequently the circuit should be optimal as a low distortion but not particularly voltage accurate audio amplifier. The circuit can be described is a relaxation oscillator with an output filter. Coilcraft also stock a range of chokes for Class-D amplifiers with a flat magnetic curve but I have not select one of those.
- The simulation is fine driving a sine wave at 2V and 20A Pk-Pk but there is some ringing with a square wave input which can be resolved by slowing the edges to say 100uS. By comparison SiMetrix will show you the power consumption of any component by simply marked that component for power measurement.
- The circuit is stable with the resistive loads shown.
- The circuit is simple but it requires the use of comparatively large output inductors and there is a lot of power circuiting in the first inductor with continuous losses. Even so this compromise is worthwhile in an audio amplifier in which minimal distortion would be the most important parameter. The circuit in any case consumes less power that a linear amplifier would.
- The circuit is variable frequency with the maximum frequency of about 200KHz with 50% of supply voltage out and no minimum frequency determined by the propagation delay of the comparators which thereby setting a the minimum pulse width <2uS. The circuit has been found by simulation to operate at 100KHz with an output of 20% or 80% of supply voltage.
Out standing design work;
- The MOSFETs are not necessary the most suitable although they work for simulation well enough. Selecting parts from the LT library is not easy particularly when looking for a part that also has the thermal model. There are two parts for the one transistor on the circuit show (it is not one part) and that is why two references and two part numbers are show.
- With LT Spice an N-channel MOSFET with thermal modelling outputs can be selected from the component library. Then select a similar P-channel complementary device but there are no p-channel thermal model parts.
- It is important to not over or undersized these transistors to achieve optimal efficiency. Therefore do not constrain a design to use parts that are included in the library unlike what I have shown here.
- Comparator; The propagation delay of this part is a significant parameter in setting the operating frequency. The data sheet for TS3704 or TSX3702 does not give the variation in propagation delay over the components temperature range. But looking at other parameters the figure may be; 1uS in 10uS (the design's period) gives better 10% frequency accuracy over the likely operating temperature range which is good because the LC resonance of the output filter is 50KHZ and 25KHz so frequency change expected should be accommodated well by the output filter.
- These comparators are better that using a 20MHz op-amp LT1768 as a comparator but using a much faster LT1711 comparator would make the circuit's operating frequency virtually independent of the comparator's own parameters but the circuit would also require an output level translator. The desired operating frequency is set accurately enough without changing the comparator though.
- I found that the ST' Micro's model for TS3704 worked but in some situations the TSX3702 model did not work. Both parts are similar enough to be interchangeable though.
- The circuit could be implemented more cheaply with better control using a small micro-controller instead of the operational amplifier and comparator. There may be an HCS08 8 pins with pins; +V, 0V, debug/program, reset, PWM, 2x analogue input, 1 spare port pin for example?
- The output drive could be replaced by a full bridge power driver IC and http://www.st.com such as L6208 may be a suitable IC designed for stepper motor drive. But this may not be a cheaper solution but these types of ICs have various overload protection features built in.
- I was not able to simulate a variation of this circuit which included a 4013 as an R and S latch plus a level translator such as 5EDL05 Infineon without a small stepping error occurring and other problems with the models I used arising. But these options would isolate the high and low power power supplies usefully and also have maintained the constant frequency and tight feedback from the output.
There is a variation of the first circuit AL-0021-01E shown in Electronics control loops to make the circuit operate at fixed frequency. Add a triangle wave 100KHz to the comparator -in of less that 100% (50% works) of the triangle wave from the integrator. The comparator also needs to be changed to a faster type such as an Analogue Devices AD8561 pspice model works but the auto-generated symbol is not user friendly and it would be beneficial to draw your own. I found that LTspice could not carry out .ac test of bandwidth though. Consequently the lower operating frequency at 50% output resulted in higher output ripple as would be expected.
An LT1711 comparator probably will simulate faster and more reliably even when simulated operating at 10V, which is above the maximum supply voltage than the Analogue Devices part. So using LT parts to demonstrate an idea is reasonable if you wish to use LTspice rather than another simulator tool.
------------------------------------------------------------------------------------------------------------------
Conclusion
Modelling tools allow an engineer to try more variations without damaging a PCB that traditional prototyping method would tolerate easily. I have shown some cases where modelling looks useful but in most cases a design would either be trivial or an engineer would not pursue such a marginal design anyway. For example there are refinements in the conventional peak detector that I have played with but I would not be pursued at work but were useful play to evaluate simulation.
I probably would not use the novel peak detector circuits with either BJT or feedback steering, that I have not included but work. In playing with those idea some useful features of some components are demonstrated. Simulation tools are beneficial in for calculating power dissipation in switch mode power output circuits, snubber networks for switch mode inductive part and gate series resistors to minimisation shoot through current in CMOS type drive. The simulation gives an ideal case without circuit board parasitic capacitance and inductance. But a circuit performance depends on good PCB design and tolerant circuit design. Do break and simplify the circuit into small sections and simulate each sections that needs simulation or else the simulation time will be very long or impossible.
The simulation can not be is good as doing the worse case design and if necessary prototyping. Simulation needs to be used wisely the variants of the two Class-D amplifier's at Electronics control loops worked very successfully some decades ago and it did not need prior simulation to fathom out what the circuit was likely to do I developed the best hybrid of the two circuits to give good linearity and outer 2 term control.
Theoretical design example with the circuits above; http://blog.andrew-lohmann.me.uk/p/electronics.html
Alternative discussion; https://mewe.com/join/electronics_-_analogue_electronics Or follow the link to my blog.
Next page (blog); http://blog.andrew-lohmann.me.uk/2016/02/electronics-dicussion.html
Back to the main;Electronics page