You need to use EasyEDA editor to create some projects before publishing
the netlist from easyeda can not use in ngspice
2362 1
zhiweili188 7 years ago
I use easyeda and create a schematic,and then run. I get the netlist. I save the netlist in local file called test.cir.Then I use ngspice to run test.cir in command line, it result error. the ngspice result is: Circuit: new schematic Doing analysis at TEMP = 27.000000 and TNOM = 27.000000 Initial Transient Solution -------------------------- Node Voltage ---- ------- xvm1_1 0 +5v 0 vxa1#branch 9.52495e-047 No. of Data Rows : 1008 probe: no such command available in ngspice =========================================== Note: No ".plot", ".print", or ".fourier" lines; no simulations run the netlist as following: Untitled XS1 XVM1_1 GND SPST_ON VXA1 +5V GND 0v D1 +5V GND LED .param pi = 3.141593 .func LIMIT(x, y, z) {min(max(x, min(y, z)), max(z, y))} .func PWR(x,a) {(MAX(ABS(x), 1e-313))**a} .func PWRS(x,a) {sgn(x) * PWR(x,a)} .func stp(x) {u(x)} .func log10(x) {ln(x)/ln(10)} .func SQRT(x) {(MAX(x, 1e-313))**0.5} .func INT(x) {sgn(x)*floor(ABS(x))} .func URAMP(x) {max(x,0)} .func POW(x,a) + {(((a-(int(a)))==0)||(sgn(x)>=0))*( max(exp(ln(uramp(x))*a),0) + + (2*(0.5-ABS((int(a))-2*int(a/2))))*max(exp(ln(uramp(-1*x))*a),0) )} * a res with very small value .subckt SPST_ON 1 2 r 1 2 2u .ENDS .MODEL LED D + IS=661.43E-24 + N=1.6455 + RS=4.8592 .control tran 1u 1m 0 probe V(XVM1_1)-V(+5V) I(VXA1) quit .endc .END my project address is https://easyeda.com/editor#id=Fr0YI4cWi
Comments
andyfierman 7 years ago
Hi Zhiweili188, Welcome to EasyEDA. Sorry but I think you have posted a link to a private file. Your public project is here: https://easyeda.com/zhiweili188/test-sqjBTN5nF Your public files are here: https://easyeda.com/editor#id=d1xPJ1icu and here: https://easyeda.com/editor#id=mr1BbnWUS * My first question is why do you want to run this simulation in a local copy of ngspice from the command line? You are of course perfectly free to do so but you can run any simulation schematic in ngspice directly from EasyEDA. Just click on the green **Simulate...** button or enter **CTRL+R**. To understand how to run simulations in EasyEDA please have a read through of the EasyEDA Simulation eBook and a play with the examples in there: https://docs.google.com/document/u/1/d/1OWZVVFRAe_2NW3WratpkA_SGuHa5AcRow5ZRfvcoVTU/pub (The Google link above is to the original copy of the Simulation eBook which you can also find at: https://easyeda.com/Doc/Simulation-eBook/ but the table of contents in the EasyEDA copy is broken and misses out some sections. We are working to fix it but in the meanwhile the copy published to the web from Google Drive works just as well.) * So how do you make your netlist run in ngspice? Firstly, the copy of the netlist you have posted to the forum has been trashed by Markdown. * To paste a netlist into a forum post, please use the `Code Sample` button (paste in then select the text and click the button or enter `CTRL+K`) However, undoing the damage wrought by Markdown shows that the netlist does not appear to represent a complete or well formed circuit. 1. There is no supply voltage source: naming a net +5V does not automatically invoke a voltage source. You must place it explicitly. 2. The net +5V may cause problems with ngspice. Non-aplhabetic prefixes are best avoided in ngspice! 3. The net `XVM1_1` suggests that there is a voltmeter connected somewhere but this is absent from the netlist. Hence this net (the top end of a very low value resistance representing a fixed, closed SPST switch) is floating. 4. `VXA1` represents an Ammeter. It is connected directly across the +5V and GND nets and so represents a dead short across what presumambly was intended to be a 5V supply. 5. D1 is also connected directly across the +5V and GND nets. Assuming that the +5V net was intended to be a 5V supply, in a real circuit D1 would be destroyed. Here is an example of a netlist that is similar to perhaps what you intended and which should run OK in native ngspice: ****************************** * Untitled (just to add a header) * V5V P5V GND 5 ; 5V supply. NOTE: non-aplhabetic prefixes are best avoided in ngspice! VXA1 P5V SWITCH 0v ; 0V source acting as Ammeter (BTW: could just measure the negative current through V5V source) XS1 SWITCH RES SPST_ON ; fixed ON SPST switch RLIM RES LEDA 1k ; LED current limiting resistor D1 LEDA GND LED * .param pi = 3.141593 .func LIMIT(x, y, z) {min(max(x, min(y, z)), max(z, y))} .func PWR(x,a) {(MAX(ABS(x), 1e-313))**a} .func PWRS(x,a) {sgn(x) * PWR(x,a)} .func stp(x) {u(x)} .func log10(x) {ln(x)/ln(10)} .func SQRT(x) {(MAX(x, 1e-313))**0.5} .func INT(x) {sgn(x)*floor(ABS(x))} .func URAMP(x) {max(x,0)} .func POW(x,a) + {(((a-(int(a)))==0)||(sgn(x)>=0))*( max(exp(ln(uramp(x))*a),0) + + (2*(0.5-ABS((int(a))-2*int(a/2))))*max(exp(ln(uramp(-1*x))*a),0) )} * * a res with very small value .subckt SPST_ON 1 2 r 1 2 2u .ENDS * .MODEL LED D + IS=661.43E-24 + N=1.6455 + RS=4.8592 * .control tran 1u 1m 0 probe V(P5V)-V(LEDA) I(VXA1) quit .endc * .END ****************************** * Note that EasyEDA runs all simulations inside a: .control .ends control structure. This is why: 1. You can omit the `.` in front of analysis directives such as tran, ac and so on; 2. You can omit the `.` in front of a `probe` directive; However: * If you wish to run the netlist above directly by pasting it into EasyEDA then you must delete (not just comment out) the `.control`, `quit` and `.endc` statements. * If you wish to run the netlist above directly by pasting it into ngspice.com then you must delete (not just comment out) the `.control`, `quit` and `.endc` statements, add a `.` in front of the `tran` statement and comment out and move the nets referred to in the statement into the **Plots** section of the ngspice window then it will run OK: http://www.ngspice.com/index.php?public_circuit=upKlDE * Note also that the `~` (tilde) and ` (backtick) symbols cannot be used in a netlist to be run in EasyEDA because they are reserved characters used in the parsing of files into JSON format. The tilde character is particularly important because it is used in most of the in-house logic device models so although they work in EasyEDA when invoked from a schematic symbol, pasting a netlist generated from such a schematic back into EasyEDA will not work. If you want to run an ngspice netlist in EasyEDA by pasting it into an EasyEDA schematic then you must check that the netlist does not use the tilde character anywhere (usually as a shorthand way of inverting a logic signal in an XSPICE logic gate). If it does contain a tilde character then the part of the netlist using it must be rewritten to replace the implicit logic inversion with an explicit inverter function. If you encounter this issue please post to support for help.
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 -mockplus- -mockplus- -mockplus- -mockplus- -mockplus- -mockplus- -mockplus- -mockplus-@1x -mockplus-

Cookie Notice

Our website uses essential cookies to help us ensure that it is working as expected, and uses optional analytics cookies to offer you a better browsing experience. To find out more, read our Cookie Notice