Author Topic: SPICE for Linux  (Read 5876 times)

0 Members and 1 Guest are viewing this topic.

Offline WaveyDipole

  • Frequent Contributor
  • **
  • Posts: 444
  • Country: gb
SPICE for Linux
« on: August 25, 2017, 10:33:27 pm »
I needed to draw up a circuit diagram this afternoon with a view to doing a simmulation at some point. Ordinarily in Windows I would have probably done this using an older version of Simetrix. I didn't exactly get on with LTSpice which seems to be limited to small library of LT's components and which I found highly frustrating to work with. That aside, I have recently switched to Linux for most part and have been given to understand that Xcircuit is de-facto for circuit drawing. This seems quite rudimentary for drawing (I couldn't find any IC objects for example) and does not have simmulation features. So what is the de-facto tool on Linux for not only circuit drawing but also simmulation?

I have, for the present installed Simetrix under Wine, but was wondering whether there is a better native Linux option?
 

Offline eugenenine

  • Frequent Contributor
  • **
  • Posts: 812
  • Country: us
Re: SPICE for Linux
« Reply #1 on: August 25, 2017, 10:53:50 pm »
For simulation or just drawing?

http://qucs.sourceforge.net/ I've seen mentioned for sim, I haven't tried it yet myself.
 

Offline hermit

  • Frequent Contributor
  • **
  • Posts: 484
  • Country: us
Re: SPICE for Linux
« Reply #2 on: August 26, 2017, 12:16:47 am »
I'm not sure there is a 'good option' at the moment.  NGSpice is part of the gEDA suite.  Steep learning curve.  I tried to like it but unless  you are a coder and join the mailing list it could be a dead end.

I've switched to KiCAD but they are just now integrating SPICE and I think you have to compile from a nightly build to get that working.  KiCAD does have an active community forum though so there would be plenty of help which was the biggest shortcoming of gEDA.



 

Offline firewalker

  • Super Contributor
  • ***
  • Posts: 2348
  • Country: gr
Re: SPICE for Linux
« Reply #3 on: August 26, 2017, 05:52:12 am »
FYI, LtSpice is designed to work on GNU/Linux with W.I.N.E.

Alexander.
Become a realist, stay a dreamer.

 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 8181
Re: SPICE for Linux
« Reply #4 on: August 26, 2017, 07:39:56 am »
It depends whether you need to share your work with friends or colleagues who aren't Linux users.   Linux purism will NOT help you. LTspice is the de-facto standard on many electronics related fora and on the USENET electronics groups because its free (with a licence that permits immediate use without registration by *ANYONE* except commercial semiconductor manufacturers), has a simple Windows installer and it uses a plain text file format for simulations, symbols and user generated models and libraries.

Its schematic drafting UI deficiences are fairly easy to overcome if you have a five or more button mouse and a utility that lets you bind key stroke sequences to various button combinations on a per application basis.

Its limited component library as originally installed is not a major issue - there are a lot of extras on the LTwiki and the LTspice Yahoo group, and it can use most PSPICE models with no changes, either with an existing symbol or 'roll your own'.  The only real problem is keeping track of which extra parts you have permanently installed so you can either direct your collaborators to the download links for the models and symbols, or copy them to the simulation folder so you can package the sim with its support files as a ready to run zipped folder.

« Last Edit: August 26, 2017, 07:43:06 am by Ian.M »
 

Online Siwastaja

  • Super Contributor
  • ***
  • Posts: 2181
  • Country: fi
Re: SPICE for Linux
« Reply #5 on: August 26, 2017, 08:04:50 am »
I use LTSpice on Windows XP virtual machine on linux. Why VM instead of Wine? Because I run PCB design software in the same VM, so I need it anyway. (PCB tools of my choice do not work in Wine.)

I don't find the setup too cumbersome, because the mouse, clipboard etc. works through the VM like the applications would be locally running.

The Wine solution solves the licencing issue. You don't need to pay anything to Microsoft, or pirate anything.
 

Offline WaveyDipole

  • Frequent Contributor
  • **
  • Posts: 444
  • Country: gb
Re: SPICE for Linux
« Reply #6 on: August 26, 2017, 11:20:51 am »
Yes I have heard that gEDA is not the way to go. I now have both simetrix and LT Spice in W.I.N.E in Linux. I don't consider myself a Linux purist. I have used several operating systems over a number of years but after Windows 10 failed on me for a 3rd time I decided to explore other options and Linux Mint seems to work very well for most things I do. I do still have a puchased version of Windows 7 Pro that I can use as a fall back. At some point I will want to get into circuit board layout design with a view to using one of the online ordering PCB services, provided there is one available at reasonable cost in the UK. Regarding draw vs simmulation, I need to be able to do both.

Its limited component library as originally installed is not a major issue - there are a lot of extras on the LTwiki and the LTspice Yahoo group, and it can use most PSPICE models with no changes, either with an existing symbol or 'roll your own'.

Since the opinion seems to be that LTspice is the most commonly used software on may electronics fora, I decided to have another play with it this morning and put this to the test. The circuit that I wish to simmulate contains a MC34063AP IC and there are some spice files on On Semiconductor - I have downloaded the PSPICE version. Although I have successfully installed the .lib file, it would seem that LT spice does not recognize the .sym symbol file, although it does read the .cir file. So for now, I do not have a symbol that I can place on a new schematic and attach the .lib to. I have therefore been trying to make one based on the information provided by ON using the symbol editor and have saved a .asc file and placed it in the symbol hierarchy, but alas, when I open the dialog its not listed.
So far, having spent around 2 hours trying to get my PSPICE model into LT Spice I have accomplished very little. Most of the LT and third party tutorials seem to assume prior knowledge and at present I need to take it step by step. I'm getting a little frustrated so I'm going to have a break and a cup of tea, but in the meantime, if anyone could point me to some useful tutorial information it would be appreciated.

Its schematic drafting UI deficiences are fairly easy to overcome if you have a five or more button mouse and a utility that lets you bind key stroke sequences to various button combinations on a per application basis.

Interesting approach, but unfortunately mine is a humble two button mouse with scroll wheel. Made me laugh though!

UPDATE: Breakthrough! I just found a video that shows how to auto generate the symbol from the .cir file. let's see if i can now get this circuit drawn!


« Last Edit: August 26, 2017, 11:55:30 am by WaveyDipole »
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 8181
Re: SPICE for Linux
« Reply #7 on: August 26, 2017, 01:41:48 pm »
Start with a copy of LTspiceIV\lib\sym\Misc\DIP8.asy, which is the symbol for a generic 8 pin DIP laid out to match the physical pinout.  Save it as MC33063.asy in your LTspice working directory.
Open the model .lib file and find where the pin order is described:
Code: [Select]
.SUBCKT MC33063 swc    swe    ct    90    2    vdd    isns    drc
*               SW-col SW-em  Ct    gnd    cinv vdd    isns    drive col
consult the datasheet for the pinout and match them to the pin order.

Yippee!!  :-+ they are already in the correct order for the symbol so you don't have to go through reordering them.  :-+
For each pin on the symbol, right click it and edit the name to add a brief abbreviation to the existing number with a space in between.   Right click the <Value> below the symbol and change the text to MC33063 (because there's only one model for both chips).

Next open the Symbol Attributes Editor dialog (menu: Edit: Attributes: Edit Attributes), DO NOT enter anything on the SpiceModel line, and  enter the name (with extension, but without path) of the file containing the model on the ModelFile line.  You should also put something meaningful on the Description line as this will be shown in the component browser.

Save it and you should have a usable symbol.

However that's all moot because the OnSemi MC33063 subcircuit model uses the ? ternery operator which LTspice doesn't support, so if you dont want to have to wade through the model translating it line by line, you'd do better to find a model in native LTspice syntax. e.g. https://www.eevblog.com/forum/beginners/simulate-mc34063-on-ltspice/


 

Offline WaveyDipole

  • Frequent Contributor
  • **
  • Posts: 444
  • Country: gb
Re: SPICE for Linux
« Reply #8 on: August 26, 2017, 02:40:10 pm »
Ian, thanks. In the meantime I found a video detailing a similar approach except without using the 8-dil package first. I drew my diagram and trried to simmulate it and ran into problems, because as you point out, the ON Semt model has unsupported parameters so I discovered and used the same one you pointed out. Fortunately the file was already attached in the post - I couldn't download it from Yahoo - just got a timeout.

I initially had some problems with trying to run the Simmulation due to a couple of newbie errors but have now sorted it out and the simulation is running. The one component with an unknown value is the inductor, and which is wound on ferrite. For now I have used the symbol for an ordinary inductor as I can't find the symbol for one with ferrite. I now seem to be getting a simmulation which seems to be pruducing the correct result in terms of output voltage. I couldn't see it in the specs of the IC, but I presume the 2.1s startup time must be normal for a circuit this type? It has taken me another couple of hours to get this far - all good learning experience though! Phew! I haven't been well for the last couple  of weeks so have plenty of time on my hands at the moment. This has given me something useful to do!

« Last Edit: August 26, 2017, 03:28:57 pm by WaveyDipole »
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 8181
Re: SPICE for Linux
« Reply #9 on: August 26, 2017, 03:36:13 pm »
If you want a Ferite Cored Inductor symbol, make a copy of the standard 'ind' symbol, and edit it! (This forum doesn't like .asy files so remove the .txt extension ;) )
« Last Edit: August 26, 2017, 03:39:14 pm by Ian.M »
 

Offline WaveyDipole

  • Frequent Contributor
  • **
  • Posts: 444
  • Country: gb
Re: SPICE for Linux
« Reply #10 on: August 26, 2017, 03:55:37 pm »
Thanks. Just replaced the inductor with your symbol. Will bear in mind in the future that symbols can be copied and edited though.
Have joined the two Yahoo groups for future reference as well.
« Last Edit: August 26, 2017, 04:09:15 pm by WaveyDipole »
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 8181
Re: SPICE for Linux
« Reply #11 on: August 26, 2017, 04:03:36 pm »
The other option is to simplly draw the lines for the core onto the schematic.  Tha't the way to do it if you are using coupled inductors (K statement) to simulate a transformer as you will want to indicate multiple windindings on the same core.

N.B. if you are using custom symbols and model files its advisable to make a folder for your project and keep them all in one place so you can zip the folder with all the files required to reproduce the simulation or schematic for easy sharing. (Remove .raw files and .log files to keep the zip file size down.)
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 13421
  • Country: gb
  • 0999
Re: SPICE for Linux
« Reply #12 on: August 26, 2017, 09:36:00 pm »
I prefer to just draw the lines on to the schematic.

One of my pet peeves about LTSpice is it was never designed for collaboration. There's no way to embed custom symbols in the schematic. The only way is to use a zip file but that's clunky and can pose security issues, as it's easy to include nasty things such as executables, containing malware.

Fortunately it's possible to embed models, but you're stuck with the generic symbols, which come with LTSpice. Here's an example with the TL431. It doesn't look very good and the pin numbers aren't as per the 8 pin package on the data sheet, but it's functional.
« Last Edit: August 26, 2017, 09:37:34 pm by Hero999 »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf