ผมเชื่อว่าไม่มีอะไรยากเกินกว่าที่มนุษย์คนหนึ่งจะทำได้ ถึงแม้ ผมจะตายไปแล้ว ผมเชื่อว่า Blog ที่ดีนี้จะยังคงอยู่
Showing posts with label LTspice. Show all posts
Showing posts with label LTspice. Show all posts
PWL file =mydata.txt
in mydata should data
time1 data1
time2 data2
timen datan
Easy to use.
Greetings:
I have done a .step (with 4 parameter values) on a .tran simulation.
When viewing a trace in LTspice (ver. 2.23r) with the expression for ex.:
v(N001)
all of the simulation steps are plotted with different colors. Ok.
Then if I plot just one step of the data runs for this node voltage:
v(N001)@3 for ex.,
I see a single trace, but on close inspection it appears to be actually
4 traces overlaid very closely, each displayed in a different color.
Even wierder, when I plot two steps individually:
v(N001)@2
v(N001)@3 for ex.,
Then each trace appears to be 4 overlaid traces of the same color.
v(N001)@2 might be 4 overlaid traces in green, while v(N001)@3 appears
as 4 overlaid traces in blue.
When a single step selection is plotted along with the set such as:
v(N001)
v(N001)@3
Then the individual traces within v(N001) no longer take different
colors, but are all plotted in the same color.
Does anyone know what is going on here?
I have done a .step (with 4 parameter values) on a .tran simulation.
When viewing a trace in LTspice (ver. 2.23r) with the expression for ex.:
v(N001)
all of the simulation steps are plotted with different colors. Ok.
Then if I plot just one step of the data runs for this node voltage:
v(N001)@3 for ex.,
I see a single trace, but on close inspection it appears to be actually
4 traces overlaid very closely, each displayed in a different color.
Even wierder, when I plot two steps individually:
v(N001)@2
v(N001)@3 for ex.,
Then each trace appears to be 4 overlaid traces of the same color.
v(N001)@2 might be 4 overlaid traces in green, while v(N001)@3 appears
as 4 overlaid traces in blue.
When a single step selection is plotted along with the set such as:
v(N001)
v(N001)@3
Then the individual traces within v(N001) no longer take different
colors, but are all plotted in the same color.
Does anyone know what is going on here?
how to create a variable resistor whose resistance could be changed in an arbitrary way, say sine wave, square wave and etc. Thanks.
Here's an example. Let's say you want a resistor to vary its resistance sinusoidally between 500 ohms and 1500 ohms at a frequency of 1 Hz. All you do is add a resistor to the schematic as you would do normally but instead of specifying the resistor with a fixed value use this function instead:
R=1000+500*SIN(2*PI*TIME)
Look for .PARAM in the help topics for more functions you could try.
I tried
.param RN=10+sin(400k*pi*time)
and I defined the value of the R1 is RN
the simulation shows warning that
"can't solve .param RN=10+sin(400k*pi*time)"
also I tried to set the resistor value directly as
sin(400k*pi*time)
then it react as"can not find the definition of model sin"
------------------------------------------------------------------------
For a resistance value, use a variable name enclosed in
curly braces (to solve the variable before each run), e.g.
{RV}. Then add a parameter step command to the schematic,
e.g. .step param RV 1 10k 1k
using the Edit, Spice directive menus.
To make a potentiometer, define the values the two halves of
the pot (on each side of the wiper) with a position formula
in curly braces), e.g. {1+Rtotal*position} and
{1+Rtotal*(1-position)}.
Then add a parameter to define Rtotal,
..param Rtotal=10k
and a step command for the position,
..step param position 0 1 .1
The extra ohm in the formulas prevents the section
resistance from reaching zero ohms which blows the math up,
and sort of represents the wiper resistance.
If you want to run single position runs, add a position
parameter definition
..param position=.5
and comment out the step position by right clicking on the
command and clicking the comment button.
Later you can comment out the position parameter and
uncomment the position step command, if needed.
------------------------------------------------------------------------

Credit :
http://www.edaboard.com/ftopic265765.html
http://www.electronicspoint.com/ltspice-t102411.html
http://forum.allaboutcircuits.com/showthread.php?t=24018
Here's an example. Let's say you want a resistor to vary its resistance sinusoidally between 500 ohms and 1500 ohms at a frequency of 1 Hz. All you do is add a resistor to the schematic as you would do normally but instead of specifying the resistor with a fixed value use this function instead:
R=1000+500*SIN(2*PI*TIME)
Look for .PARAM in the help topics for more functions you could try.
I tried
.param RN=10+sin(400k*pi*time)
and I defined the value of the R1 is RN
the simulation shows warning that
"can't solve .param RN=10+sin(400k*pi*time)"
also I tried to set the resistor value directly as
sin(400k*pi*time)
then it react as"can not find the definition of model sin"
------------------------------------------------------------------------
For a resistance value, use a variable name enclosed in
curly braces (to solve the variable before each run), e.g.
{RV}. Then add a parameter step command to the schematic,
e.g. .step param RV 1 10k 1k
using the Edit, Spice directive menus.
To make a potentiometer, define the values the two halves of
the pot (on each side of the wiper) with a position formula
in curly braces), e.g. {1+Rtotal*position} and
{1+Rtotal*(1-position)}.
Then add a parameter to define Rtotal,
..param Rtotal=10k
and a step command for the position,
..step param position 0 1 .1
The extra ohm in the formulas prevents the section
resistance from reaching zero ohms which blows the math up,
and sort of represents the wiper resistance.
If you want to run single position runs, add a position
parameter definition
..param position=.5
and comment out the step position by right clicking on the
command and clicking the comment button.
Later you can comment out the position parameter and
uncomment the position step command, if needed.
------------------------------------------------------------------------

Credit :
http://www.edaboard.com/ftopic265765.html
http://www.electronicspoint.com/ltspice-t102411.html
http://forum.allaboutcircuits.com/showthread.php?t=24018
Free PDF File for Start LTspice
Link :http://tech.groups.yahoo.com/group/LTspice
Link :http://tech.groups.yahoo.com/group/LTspice
LTspice comes with lots of nifty circuit components, but there will be many times that you want to simulate a part that isn't in the default libraries. LTspice makes this very easy for the vast majority of models that you will get from vendors.
We'll use the National LF411 opamp as an example. Go here and download LF411.MOD to your schematic directory to make the part available only to that schematic, or place it in C:\Program Files\LTC\SwCADIII\lib\sub to make it available to any schematic in the future. Open it up in a text file and look for a line that says
This line tells SPICE that the name of this object is LF411/NS, and also describes the what each pin means. We'll need this name to reference the part later on. Back in LTspice, press 's' to insert a SPICE directive. In the textbox type
This tells SPICE to treat that file as a library that contains model definitions. Then insert the part called opamp2. We'll use this as the symbol for the model we just imported. Right click on the opamp and change the Value to LF411/NS (Remember I told you that name would be important?). There could just as well be several different models within a single library file, each with a unique model name.
And that's all there is to using models!
Credit : http://ltspicelabs.blogspot.com/
We'll use the National LF411 opamp as an example. Go here and download LF411.MOD to your schematic directory to make the part available only to that schematic, or place it in C:\Program Files\LTC\SwCADIII\lib\sub to make it available to any schematic in the future. Open it up in a text file and look for a line that says
.SUBCKT LF411/NS 1 2 99 50 28This line tells SPICE that the name of this object is LF411/NS, and also describes the what each pin means. We'll need this name to reference the part later on. Back in LTspice, press 's' to insert a SPICE directive. In the textbox type
.include LF411.MODThis tells SPICE to treat that file as a library that contains model definitions. Then insert the part called opamp2. We'll use this as the symbol for the model we just imported. Right click on the opamp and change the Value to LF411/NS (Remember I told you that name would be important?). There could just as well be several different models within a single library file, each with a unique model name.
And that's all there is to using models!
Credit : http://ltspicelabs.blogspot.com/