LtSpice Netlists

Thread Starter

richbrune

Joined Oct 28, 2005
126
I recently downloaded LTSpice XVII. I saved one of the educational examples (dimmer.asc) under another name (tinker_with_dimmer.asc) and then proceeded to try to edit the netlist in MS notepad and then open it with LTSpice, and I couldn't figure out why it always reverts to the original netlist. I just wanted to try deleting the last two .step numbers to see how to edit netlists.
 

Attachments

eetech00

Joined Jun 8, 2013
3,949
I recently downloaded LTSpice XVII. I saved one of the educational examples (dimmer.asc) under another name (tinker_with_dimmer.asc) and then proceeded to try to edit the netlist in MS notepad and then open it with LTSpice, and I couldn't figure out why it always reverts to the original netlist. I just wanted to try deleting the last two .step numbers to see how to edit netlists.
To which "netlist" are you referring?
 

Thread Starter

richbrune

Joined Oct 28, 2005
126
I guess which ever one that influences the simulation--this stuff:

* C:\---------------------\LTspiceXVII\examples\Educational\tinker_with_dimmer.asc
XQ1 P001 N002 DIAC VK=30
V1 A 0 SINE(0 166 60)
R1 N002 A 1k
C1 N002 0 .062µ
Rload A B 135
XU1 B P001 0 TRIAC
B1 N001 0 V=V(A,B)*I(Rload)
R2 LoadPower N001 50K
C3 LoadPower 0 1µ
.tran .3
.subckt DIAC T1 T2
* default parameters
.param RS=10 ; series resistance
.param VK=20 ; breakdown voltage
Q1 N002 N001 T2 0 PN
Q2 N001 N002 N005 0 NP
R1 N002 N004 {20K*(VK-1)}
R2 N004 T2 9.5K
R3 N002 N005 9.5K
Q3 N004 N003 N005 0 PN
Q4 N003 N004 T2 0 NP
R4 T1 N005 {RS}
.model PN NPN Cjc=10p Cje=10p
.model NP PNP Cjc=10p Cje=10p
.ends DIAC
.subckt TRIAC MT2 G MT1
.param R=10K
Q1 N001 G MT1 0 NP
Q2 N001 N002 MT2 0 NP
Q3 N002 N001 MT1 0 PN
Q4 G N001 MT2 0 PN
R1 MT2 N002 {R}
R2 G MT1 {R}
.model PN NPN Cjc=10p Cje=10p
.model NP PNP Cjc=10p Cje=10p
.ends TRIAC
.step param Rdim list 1K 50K 100K 200K 300K 325K
* This example schematic is supplied for informational/educational purposes only.
* Light Bulb
.backanno
.end
 

Papabravo

Joined Feb 24, 2006
21,225
It is the case that an LTspice ".asc" contains a netlist, but it's not in a form that can be conveniently read by mere mortals. You are much better off editing the text on the schematic. If you want to get familiar with netlists, I suggest using the View | SPICE Netlist option in the schematic window. Highlight the contents of the window and copy them to the clipboard with a Ctrl-C. Open your favorite text editor, or Notepad in a pinch, and paste the clipboard contents into your editor window. Now you have the netlist contents without the graphical description of the schematic. This is one way you can make subcircuits from a schematic.
 

Thread Starter

richbrune

Joined Oct 28, 2005
126
It is the case that an LTspice ".asc" contains a netlist, but it's not in a form that can be conveniently read by mere mortals. You are much better off editing the text on the schematic. If you want to get familiar with netlists, I suggest using the View | SPICE Netlist option in the schematic window. Highlight the contents of the window and copy them to the clipboard with a Ctrl-C. Open your favorite text editor, or Notepad in a pinch, and paste the clipboard contents into your editor window. Now you have the netlist contents without the graphical description of the schematic. This is one way you can make subcircuits from a schematic.
Yes that seems to be my problem I can cut and paste and text file and all that--but can't seem to get changes back into LTSpice except by right click on the grapic window. Seems like there should be a way to modify text files and have LTSpice read them. It would be nice.
 

Papabravo

Joined Feb 24, 2006
21,225
Yes that seems to be my problem I can cut and paste and text file and all that--but can't seem to get changes back into LTSpice except by right click on the grapic window. Seems like there should be a way to modify text files and have LTSpice read them. It would be nice.
LTspice can read text files that are used to describe subcircuits or models and you can edit those netlist and model files in the LTspice editor or another text editor like Notepad++ or Programmer's Notepad. What you cannot readily do is edit the ".asc" files or the ".asy" files directly. I mean you can if you are bound and determined, but I would not recommend it. Especially when an entire subcircuit description ends up on one single line. That is a real PITA.

When pasting text into a schematic it can be tagged as either a comment or a SPICE directive. Here is an example with a model, placed explicitly into a ".asc" file. Like in these two files:
 

Attachments

Last edited:

Thread Starter

richbrune

Joined Oct 28, 2005
126
LTspice can read text files that are used to describe subcircuits or models and you can edit those netlist and model files in the LTspice editor or another text editor like Notepad++ or Programmer's Notepad. What you cannot readily do is edit the ".asc" files or the ".asy" files directly. I mean you can if you are bound and determined, but I would not recommend it. Especially when an entire subcircuit description ends up on one single line. That is a real PITA.

When pasting text into a schematic it can be tagged as either a comment or a SPICE directive. Here is an example with a model, placed explicitly into a ".asc" file. Like in these two files:
Thanks! That worked. I just openened with notepad changed, saved, and opened with LTSpice and ran. Don't know what I was doing wrong
 

eetech00

Joined Jun 8, 2013
3,949
Yes that seems to be my problem I can cut and paste and text file and all that--but can't seem to get changes back into LTSpice except by right click on the grapic window. Seems like there should be a way to modify text files and have LTSpice read them. It would be nice.
If you want to edit the netlist, you must open the schematic .asc file at least once in LTspice.
Then, either run the simulation one time, or select "View netlist". Either of these operations will create a netlist file in the same folder as the schematic file. You can "select all" and copy the text in the "View netlist" pane, then paste and save it in notepad.
The other method is to copy the .net file and save it. The file will be have a .net file extension. Be aware that .net file is automatically removed if you close the schematic and/or exit LTspice.

Once you have the netlist file you can open, edit and run it with LTspice, or you can edit with your favorite editor, then open and run it with LTspice
 
Top