How to create a Spice component with the SUBCKT model embedded?
411 17
jmgonet 8 months ago
Hi, I've designed this circuit for simulation (find the circuit here [https://easyeda.com/jmgonet/high-side-pmos-driver):](https://easyeda.com/jmgonet/high-side-pmos-driver) The simulation runs as I intended, but I had to place a big text area with the content of the .SUBCKT model in the schematics. Actually, there are two active components in the: * The BC547C, which exist in the System Library an Spice Component, and I could directly use in my circuit. * The IB9343, which doesn't exist. So I took the "GENERIC SPICE .SUBCKT PMOSFET SYMBOL (ENHANCEMENT)" from the System Library, then I changed the model name, and I pasted the .SUBCKT file that I downloaded from Infineon. So this is my question: How can I create a new "Spice Component" and embed the .SUBCKT model in it, so I (or anyone) can use it without further manipulation, just like the BC547C? Regards,   Jean-Michel ![easyeda-spice-component-simulation-subckt.png](//image.easyeda.com/pullimage/hBRX6xDV4kSwvV05crU04nT37AeMPVbW0PeXKrx2.png)
Comments
andyfierman 8 months ago
If you study the sections on Device Models and on Schematic symbols: prefixes and pin numbers, this explains ways to do what you want. To make a permanent part please post a link to the spice model and I'll build a symbol and put the model in the system library. :)
Reply
andyfierman 8 months ago
There are now spice symbols with associated spice subckts for: [IRLRU9343](infineon.com/cms/en/product/power/mosfet/20v-250v-p-channel-power-mosfet/irlr9343/) [IRLIB9343](https://www.infineon.com/cms/en/product/power/mosfet/20v-250v-p-channel-power-mosfet/irlib9343/) in the library.
Reply
andyfierman 8 months ago
![image.png](//image.easyeda.com/pullimage/Jp898rA5cBNF5kX5pgUWGtYjeENTHqGxz7OGVlM6.png)
Reply
jmgonet 8 months ago
Wow, thank you! That was helpful. I'm impressed: each time I had a problem with simulation, there you were to help me out. Best regards,   Jean-Michel.
Reply
Pierre H 2 months ago
Hi, I've read the sections on Device Models and on Schematic symbols: prefixes and pin numbers, but I don't see how you can add a model or a subcircuit to a symbol other than added a spice text label to the schema. I've tried to add the model inside the symbol, but that doesn't work.
Reply
andyfierman 2 months ago
@pierrehavelaar, What device is it that you would like to simulate? If you can post the datasheet and a link to a model then I can put it into the library.
Reply
Pierre H 2 months ago
@andyfierman thanks for your quick reply. There isn't a specific device I have in mind, rather I am trying to learn how to simulate and build components myself. I'm am currently experimenting by trying to simulate a high power DC-DC converter, so I will need high power mosfets to do that. I have been just getting in to simulators and have been going back and forth between PartSim, KiCad and EasyEDA to find out which is the easiest to work with. And the ability to make component libraries is an important criteria.
Reply
Pierre H 2 months ago
For instance is it possible to import existing .lib files?
Reply
Pierre H 2 months ago
Found it! ![Screenshot 2020-05-15 at 18.33.27.png](//image.easyeda.com/pullimage/foJ7tRbEPGFcRlZuBQLKsNxLhE2cqyCfmxtVUQ3e.png) Still interested to hear about importing .lib files
Reply
Pierre H 2 months ago
Hmm seems like I spoke too soon. It worked for .model definitions but not .SUBCKT ![Screenshot 2020-05-15 at 18.54.30.png](//image.easyeda.com/pullimage/WGjc1PeacgWRYITavtGuTErzr1gNLMdX4NbmxSzM.png)
Reply
Pierre H 2 months ago
I had some limited success with a simpler model, but the simulation quickly ends up running too long and it gives up. ``` .SUBCKT BSO220N03MD_L0  drain  gate  source Lg     gate  g1    3n Ld     drain d1    1n Ls     source s1   0.8n Rs      s1    s2   2.62m Rg     g1    g2     1.3 M1      d2    g2    s2    s2    DMOS    L=1u   W=1u .MODEL DMOS NMOS ( KP= 51.5  VTO=2.4  THETA=0  VMAX=1.5e5  ETA=0.011  LEVEL=3) Rd     d1    d2    12.27m TC=7m Dbd     s2    d2    Dbt .MODEL     Dbt    D(BV=38   M=0.3  CJO=0.64n  VJ=0.9V) Dbody   s2   21    DBODY .MODEL DBODY  D(IS=3.6p  N=1.11  RS=0.97u  EG=1.12  TT=3n) Rdiode  d1  21    4.08m TC=10m .MODEL   sw    NMOS(VTO=0  KP=10   LEVEL=1) Maux      g2   c    a    a   sw Maux2     b    d    g2    g2   sw Eaux      c    a    d2    g2   1 Eaux2     d    g2   d2    g2   -1 Cox       b    d2   0.14n .MODEL     DGD    D(M=0.6   CJO=0.14n   VJ=0.5) Rpar      b    d2   1Meg Dgd       a    d2   DGD Rpar2     d2   a    10Meg Cgs     g2    s2    0.59n .ENDS  BSO220N03MD_L0 ```
Reply
andyfierman 2 months ago
Can you make an example of your simulation public? Or share it privately by adding me to your team?
Reply
andyfierman 2 months ago
@pierrehavelaar, If there are specific devices you would like adding to the library then just post a link to a datasheet and a spice model and it can usually be added to the library in a day or two. It is possible to do that with a library of models and subckts but that will take longer to check and cross refer any duplicate names etc. * You can add a model to a spicesymbol using: ![Screenshot 2020-05-15 at 18.33.27.png](https://image.easyeda.com/pullimage/foJ7tRbEPGFcRlZuBQLKsNxLhE2cqyCfmxtVUQ3e.png) but you have to wrap it up in a subcircuit declaration. .subckt ... \| \| .ends * The problem with this way of adding a subckt to a spice symbol is that although the symbol will be public (unless it is within a Team) the subckt attached to is only local to you. * At present there is no way for a user to upload a whole library in a .lib file, only individual .models and .subckts either directly into the schematic or using the Spice Model... feature. * A limitation of EasyEDA's simulation at the moment is that it will run out of resources for complex simulations, which makes it hard to simulate things like switch mode PSU, Class D amplifier and PLL circuits. * Because however EasyEDA uses LTspice as the simulation engine, it is possible to create any circuit in the Schematic Capture tool in Sim mode and then download the LTspice netlist and run it in a local installation of LTspice (which runs natively on OSX). This is effectively how things like gEDA, Kicad and Design Spark handle simulation. Very early on in it's life EasyEDA did support importing LTspice .asc files but for a number of reasons this was dropped several years ago (I have asked for it to be reintroduced but it is a long way down the ToDo list!). * Partsim is a nice idea but sadly has had little or no development input since sometime in December 2015. It is also sadly not linked in any way to Schemeit or any PCB tools.
Reply
andyfierman 2 months ago
It is possible to generate an LTspice netlist to download and run locally even without the models being available in EasyEDA: you just have to ignore all the warnings about missing models and subckts.
Reply
Pierre H 2 months ago
@andyfierman thank you for your elaborate reply. I was hoping a locally installed EasyEDA wouldn't have the same resource restrictions, but that doesn't seem to be the case. It's a pity that the Spice Model... feature doesn't store the model in the public library. That seems to me a great way to grow the component library organically. So far I'm really liking EasyEDA, except for when you run in to issue's with the simulation. It seems hard to track down what is causing the issue. I'm wondering how LTspice can run a simulation without the models?
Reply
andyfierman 2 months ago
"I'm wondering how LTspice can run a simulation without the models?" Not sure I understand your question. There are two main libraries of models. There's the original library that was slowly built up for Ngspice (and which is LTspice compatible or is being converted to be). I have access rights to add new models to this. The other set of libraries is run like the normal LTspice libraries but I don't have direct access to it. I can and do build models and libraries that are added to those but that takes longer to happen. The are some models that were in the original Ngspice library which have had to be completely rewritten to run in LTspice which is taking a while to do and debug but in fact most of them are now way better than they were. :) All the native LTspice models are available in EasyEDA but at present there is no way to show and select them within EasyEDA as there is in a local LTspice installation. There are also none of the dedicated  native symbols in EasyEDA that exist in a local installation to call the models up.
Reply
andyfierman 2 months ago
Maybe I see your point. I hadn't really thought about this before. Models in the old Ngspice library are pulled into the net list so they can run on a local LTspice installation. Models from the LTspice libraries (native or added by EasyEDA) do not so there's a issue that needs to be thought about
Reply
Login or Register to add a comment
goToTop
你现在访问的是EasyEDA海外版,使用建立访问速度更快的国内版 https://lceda.cn(需要重新注册)
如果需要转移工程请在个人中心 - 工程 - 工程高级设置 - 下载工程,下载后在https://lceda.cn/editor 打开保存即可。
有问题联系QQ 3001956291 不再提醒
svg-battery svg-battery-wifi svg-books svg-more svg-paste svg-pencil svg-plant svg-ruler svg-share svg-user svg-logo-cn svg-double-arrow
We use cookies to offer you a better experience. Detailed information on the use of cookies on this website is provided in our Privacy Policy. By using this site, you consent to the use of our cookies.