Questions about SWCAD potentiometer example.

  • Thread starter Thurston Phoremost
  • Start date
T

Thurston Phoremost

Guest
Just a couple of questions about the SWCAD potentiometer demo that's
been posted here a few times.

This is the subckt file -

-----------------
* This is the potentiometer
* _____
* 1--|_____|--2
* |
* 3
*
..SUBCKT potentiometer 1 2 3
..param w=limit(wiper,1m,.999)
R0 1 3 {Rtot*(1-w)}
R1 3 2 {Rtot*(w)}
..ENDS
--------------------

Question 1.

I'm interested in line 8 -

..param w=limit(wiper,1m,.999)


I can't find this "limit" function documented in the help file, and I
would like to know if there are any other potentially useful functions
like this that aren't documented?


Question 2.

In the associated schematic file there is this line -

text 168 420 Left 0 !.STEP LIN PARAM p2 0 1.0 0.1

Before I ran this, I expected to see a stair-step waveform as the
potentiometer was turned up one tenth, left for a while, then turned
up another tenth, etc. Instead, what I see is a voltage which rises
linearly from 0 to 100 %. However many or however few steps you have,
it never displays the expected stair steps.

Am I doing something wrong? Or is there something different that I
have to do in order to simulate the effects of turning the
potentiometer up in increments?

Oh... did I happen to mention that I am a newbie at all this?

TIA.
 
"Thurston Phoremost" <thurston_phoremost@hotmail.com> schrieb im Newsbeitrag
news:acb7fa96.0309081836.790e8bae@posting.google.com...
Just a couple of questions about the SWCAD potentiometer demo that's
been posted here a few times.

This is the subckt file -

-----------------
* This is the potentiometer
* _____
* 1--|_____|--2
* |
* 3
*
.SUBCKT potentiometer 1 2 3
.param w=limit(wiper,1m,.999)
R0 1 3 {Rtot*(1-w)}
R1 3 2 {Rtot*(w)}
.ENDS
--------------------

Question 1.

I'm interested in line 8 -

.param w=limit(wiper,1m,.999)


I can't find this "limit" function documented in the help file, and I
would like to know if there are any other potentially useful functions
like this that aren't documented?
Hello Thursten,
I have not seen it together with the explanation of .PARAM,
but the same function limit() is described in the LTSPICE help page under
Help -> LTSPICE -> Circuit Elements -> B. Arbitr...
or very similar here
Help -> Waveform Viewer -> Waveform Arithmetic

Only Mike knows really which functions are possible together with the
..PARAM command. Sometimes the PSPICE reference manual gives an answer.
I hope he will answer here too. I don't know why he has not answered
up to now. Maybe he has a bad(guilty) conscience about the missing
documentation.


Question 2.

In the associated schematic file there is this line -

text 168 420 Left 0 !.STEP LIN PARAM p2 0 1.0 0.1

Before I ran this, I expected to see a stair-step waveform as the
potentiometer was turned up one tenth, left for a while, then turned
up another tenth, etc. Instead, what I see is a voltage which rises
linearly from 0 to 100 %. However many or however few steps you have,
it never displays the expected stair steps.
You see the linear interpolated curve which is just a straight line in
this case. You can make the real calculated points visibile with
Plot Settings -> Mark Data Points

Alternatively you could take a look into the output file( .raw).
If you set ASCII output in the Control Panel, then the result is readable
with any ASCII editor. You see exactly 11 data sets (0, 0.1, 0.2, ...).
Please don't use ASCII output as standard, because it needs up to ten
times more storage as the binary file.

Am I doing something wrong? Or is there something different that I
have to do in order to simulate the effects of turning the
potentiometer up in increments?
If you have a loaded potentiometer, then you haven't a straight line.
You would then increase the number of steps to get a smoother curve.
.STEP LIN PARAM p2 0 1.0 0.01

Best Regards
Helmut
 
Just a couple of questions about the SWCAD potentiometer demo that's
been posted here a few times.

This is the subckt file -

-----------------
* This is the potentiometer
* _____
* 1--|_____|--2
* |
* 3
*
.SUBCKT potentiometer 1 2 3
.param w=limit(wiper,1m,.999)
R0 1 3 {Rtot*(1-w)}
R1 3 2 {Rtot*(w)}
.ENDS
--------------------

Question 1.

I'm interested in line 8 -

.param w=limit(wiper,1m,.999)

I can't find this "limit" function documented in the help file, and I
would like to know if there are any other potentially useful functions
like this that aren't documented?

I have not seen it together with the explanation of .PARAM,
but the same function limit() is described in the LTSPICE help page
under Help -> LTSPICE -> Circuit Elements -> B. Arbitr...
or very similar here Help -> Waveform Viewer -> Waveform Arithmetic

Only Mike knows really which functions are possible together with the
.PARAM command. Sometimes the PSPICE reference manual gives an answer.
I hope he will answer here too. I don't know why he has not answered
up to now. Maybe he has a bad(guilty) conscience about the missing
documentation.
Helmut, you're correct on all accounts.

--Mike
 
"Helmut Sennewald" <HelmutSennewald@t-online.de> wrote in message news:<bjlc0u$7l1$05$1@news.t-online.com>...
"Thurston Phoremost" <thurston_phoremost@hotmail.com> schrieb im Newsbeitrag
news:acb7fa96.0309081836.790e8bae@posting.google.com...
snip

I can't find this "limit" function documented in the help file, and I
would like to know if there are any other potentially useful functions
like this that aren't documented?



Hello Thursten,
I have not seen it together with the explanation of .PARAM,
but the same function limit() is described in the LTSPICE help page under
Help -> LTSPICE -> Circuit Elements -> B. Arbitr...
or very similar here
Help -> Waveform Viewer -> Waveform Arithmetic

Yep, there it is! With a lot of other useful functions too. Now, why
the heck couldn't I see that when I was looking for it?



Only Mike knows really which functions are possible together with the
.PARAM command. Sometimes the PSPICE reference manual gives an answer.
I hope he will answer here too. I don't know why he has not answered
up to now. Maybe he has a bad(guilty) conscience about the missing
documentation.
Another thing I found interesting is that it seems you can use the
command .param and also the command .params plural, and SWCAD doesn't
complain or notice a difference. Both versions of the command seem to
do the same thing. Perhaps this is for compatibility between different
versions of SPICE? I do wonder if there's any nasty bugs lurking to
bite someone who types .params instead of .param?


Question 2.

In the associated schematic file there is this line -

text 168 420 Left 0 !.STEP LIN PARAM p2 0 1.0 0.1

Before I ran this, I expected to see a stair-step waveform as the
potentiometer was turned up one tenth, left for a while, then turned
up another tenth, etc. Instead, what I see is a voltage which rises
linearly from 0 to 100 %. However many or however few steps you have,
it never displays the expected stair steps.


You see the linear interpolated curve which is just a straight line in
this case. You can make the real calculated points visibile with
Plot Settings -> Mark Data Points

Alternatively you could take a look into the output file( .raw).
If you set ASCII output in the Control Panel, then the result is readable
with any ASCII editor. You see exactly 11 data sets (0, 0.1, 0.2, ...).
Please don't use ASCII output as standard, because it needs up to ten
times more storage as the binary file.

Am I doing something wrong? Or is there something different that I
have to do in order to simulate the effects of turning the
potentiometer up in increments?

If you have a loaded potentiometer, then you haven't a straight line.
You would then increase the number of steps to get a smoother curve.
.STEP LIN PARAM p2 0 1.0 0.01
It's no big deal, I have no pressing need for a stair-step waveform, I
was just curious, that's all.

If ever I need a stair-step, anyway, I can just put in a voltage
source and tack something like the following onto it -

PWL(0 0 1 0 1.0001 1 2 1 2.0001 2 3 2 3.0001 3 4 3 4.0001 4 5 4 5.0001
5 6 6 6.0001 6)

Thanks again Helmut for your assistance.

T
 

Welcome to EDABoard.com

Sponsor

Back
Top