If Vh is positive, the switch shows hysteresis, as if it was controlled by a Schmitt trigger with trip points at Vt - Vh and Vt + Vh. If Vh is zero, the switch is always completely on or off depending upon whether the input voltage is above the threshold. The switch has three distinct modes of voltage control, depending on the value of the hysteresis voltage, Vh. There’s also a “level 2” of which is slightly more complicated: But I didn’t see such a function in the ngspice manual so I just took Vh out completely. I typically use a similar function in LTspice, where if you set Vh to a negative value it fits the discontinuity to a polynomial. used to always talk about how the old SPICE versions had diode breakdown voltage discontinuities and/or non-differentiable corners. R106 Net-_D101-Pad2_ Net-_R106-Pad2_ 100kĪnd you can find the schematic and other models here:Īh, I knew in the back of my head that might cause an issue like that. include "/home/lev/git/library/electronic/model/mosfet/irfr1205.LIB" include "/home/lev/git/library/electronic/model/diode/SBR10U40CT.LIB" include "/home/lev/git/library/electronic/model/OPA/uopamp.lib" include "/home/lev/git/library/electronic/model/BJT/BCP56.LIB" include "/home/lev/git/library/electronic/model/BJT/BCP53.LIB" ![]() ![]() Although, if you use a lot of parameters with the text visible it could cause a bunch of clutter on the schematic. You can do this when selecting the model in the Spice Model Editor, or you can make the “Spice_Model” field visible on the schematic and edit the text like any other text. Overriding the parameters from the defaults requires you to type them in after the model name. These models should work with any KiCad opamp symbol, provided the “Alternate node sequence” is properly mapped as defined in the library comments. Maybe I’ll update it later along with a few other improvements, but I’m releasing this as is for now.īelow are a few screenshots of the models in action, particularly showing the GBW and Vrail parameters working. The only parameter that’s missing between my version and the LTspice version is slew-rate, which I’m still not certain the best way to implement while retaining fast simulation speed. I structured the text such that it’s easier to read the comments and parameter descriptions when selecting the subcircuit model within Eeschema. I’ve tested both models in LTspice and KiCad 5.1.4 (for Windows). I removed all semiconductors and replaced all the diodes with voltage-controlled switches. The Level 2 is loosely based on the app note PDF I linked above. I attached a library file of my own “Universal Opamp” models, which include both Level 1 and Level 2. You just need to plug in a few datasheet values into the subcircuit parameters to get a rough approximation to the opamp you want to model. Not only is this type of behavioral model faster and has less convergence issues than semiconductor-based models, it can also be used when no model is available from the opamp manufacturer. Level 2 adds quite a bit of functionality since it includes the voltage rails in the netlist.Īnyway, to get back on topic here, I wanted to create something similar to Level 2 which can be used in ngspice so people can use it in KiCad. ![]() Level 1 is the same as the model I described above without voltage rail consideration. The first two levels are the most practical, and I constantly use them. ![]() I typically use LTspice and it has a handy built-in device called the “UniversalOpamp2” which has 4 different levels of models to pick from using a drop-down menu. However, there are times where I need to consider saturation due to the voltage rails, mainly in comparator applications. I use this model frequently in my own work since it’s fast and gets you decent results as long as you are aware of the limitations. I’ve been intending to do this for a while now, but haven’t really gotten the chance to figure it out until some recent toilet reading of this PDF: Ī while back, I posted a super simple opamp subcircuit which is purely linear and doesn’t take the voltage rails into account.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |