Maker Pro
Maker Pro

PSpice Global parameters time and temperature

O

Oliver Friedrich

Jan 1, 1970
0
Hallo,

can I access the simulated temperature and time (Global variable?) from
outside a model description?.

E.g. I want to use the temperature within a formula or within a
PSPICETEMPLATE line. What are the names of th Globals for temperature and
time.

Thank you

Oliver Friedrich
 
M

Mike Engelhardt

Jan 1, 1970
0
Oliver,
can I access the simulated temperature and time (Global variable?)
from outside a model description?.

E.g. I want to use the temperature within a formula or within a
PSPICETEMPLATE line. What are the names of th Globals for
temperature and time.

At least not as a parameter for parameterized models or circuit
elements because of a bug in PSpice that reads "temp" to be 27,
not the temperature. For example, in the attached deck, V(1) and
V(2) should be the same as they are in LTspice, but PSpice gives
the wrong answer.

--Mike

* V(1) should be equal to V(2)
..param tc=.01
I2 0 1 1m
R1 1 0 1K tc={tc}

I3 0 2 1m
R3 2 0 {1K*(1+(temp-27)*tc)}

..temp 100
..tran 1 1
..probe
..end
 
J

Jim Thompson

Jan 1, 1970
0
Hallo,

can I access the simulated temperature and time (Global variable?) from
outside a model description?.

E.g. I want to use the temperature within a formula or within a
PSPICETEMPLATE line. What are the names of th Globals for temperature and
time.

Thank you

Oliver Friedrich

Oliver, There's a way to do it... I just do it so rarely that I'll
have to dig thru my archives... I've used it in the past to bracket
10K and 100K ECL testing versus temperature.

When Mikey is not picking on Kevin he likes to throw stones at
PSpice... unfortunately he's really not very well versed in PSpice
notation.

...Jim Thompson
 
M

Mike Engelhardt

Jan 1, 1970
0
Jim,
Oliver, There's a way to do it... I just do it so
rarely that I'll have to dig thru my archives...
I've used it in the past to bracket 10K and 100K
ECL testing versus temperature.

Oh, do please post how to access the circuit
temperature(not the number 27) from inside a
parameterized expression. I'm dying to see
it.
When Mikey is not picking on Kevin...

I don't pick on Kevin. He starts it. But
I shouldn't get involved with him or I just
get irritated when I even tell him exactly
how to write a SPICE that runs as well as
mine and he's nothing but insults for it.
It's impossible.
he likes to throw stones at PSpice...

That's not true, you just take it personal.
I don't waste any time looking for muck
on PSpice, I just get decks e-mailed to
me that run differently between LTspice
and PSpice so I have a library of PSpice
bugs, since as often as not, a PSpice
bug is the cause of the discrepancy.
unfortunately he's really not very well
versed in PSpice notation.

I'm not? Isn't that a well known PSpice
bug? Modeling people I know are
disappointed by not being able to
parameterize models by temperature
outside of a few special tc's and tce's,
some of which those don't work right
either. Anyway, isn't the bug clearly
demonstrated by this deck?

* V(1) should be equal to V(2)
..param tc=.01
I2 0 1 1m
R1 1 0 1K tc={tc}
I3 0 2 1m
R3 2 0 {1K*(1+(temp-27)*tc)}
..temp 100
..tran 1 1
..probe
..end

--Mike
 
C

Charles Edmondson

Jan 1, 1970
0
Jim said:
Oliver, There's a way to do it... I just do it so rarely that I'll
have to dig thru my archives... I've used it in the past to bracket
10K and 100K ECL testing versus temperature.

When Mikey is not picking on Kevin he likes to throw stones at
PSpice... unfortunately he's really not very well versed in PSpice
notation.

...Jim Thompson

Hi Jim,
Mike is pretty much correct in this. The variable TEMP only works in
ABM expressions, not model definitions. The model definitions are set
at model read in, AFAICT, so they just get the ambient at the beginning
of the simulation. (Actually, it may just be the default of 27, the
temperature may not be changed for the simulation until after model read
in, but I am an engineer, not a coder, so I don't know for sure...)

As I understand it, there is a request to change this (from Linear Tech,
of all places!) but the request got lost during the pogrom.

Charlie
Edmondson Engineering
Unique Solutions to Unusual Problems
 
J

Jim Thompson

Jan 1, 1970
0
Hallo,

can I access the simulated temperature and time (Global variable?) from
outside a model description?.

E.g. I want to use the temperature within a formula or within a
PSPICETEMPLATE line. What are the names of th Globals for temperature and
time.

Thank you

Oliver Friedrich

From Charlie's post, looks like Mikey is correct, though it's not a
"bug", PSpice only supports passing those parameters to ABM blocks and
not device models.

So, for now, build your models/subcircuits from EVALUE or GVALUE.

I'll bug support to add expressions inside of model declarations.

...Jim Thompson
 
M

Mike Engelhardt

Jan 1, 1970
0
Jim,
From Charlie's post, looks like Mikey is
correct, though it's not a "bug"...

Really, not a "bug"? "Temp" is recognized in
this deck but it is evaluated as 27 and not
100, as it should. While most any old
software error is called a bug, this definately
fits what's called a bug in software because
it's an unanticipated failure mode precipitated
by consequenses of the design of the
implementation.

Here's another example just to hammer in the
inevitable view that it is nothing less than
a bug. In this deck. V(1) should equal v(2)
as it does in LTspice.

*
V1 1 0 {temp}
E1 2 0 value={temp}
..temp 100
..op
..end

Charles, this is a serious bug, it means that you
can't easily parameterize models for arbitrary
temperature dependence. This is a fundamental
utility for SPICE. Please use this post to
underscore the significance of getting this
fixed.

--Mike
 
A

Active8

Jan 1, 1970
0
[snip]
I don't pick on Kevin. He starts it. But
I shouldn't get involved with him or I just
get irritated when I even tell him exactly
how to write a SPICE that runs as well as
mine and he's nothing but insults for it.
It's impossible.

that's damn nice of you to try to help like that. um, if you won't tell
him, could you please tell me what command line arguments are suported
by LTSpice or where i can find the info? i googled it and it looks like
no one knows how to do this. i'd like to have LT running under wine on
my linux box and send it a netlist from whatever i may be using on
either OS. for good reason, too. when i run a PSpice sim that eats up
time, PSpice must set a higher thread priority 'cause my winders box
turns into a real slug if i try to work in another app when the sim's
running or rather crawling.
That's not true, you just take it personal.
I don't waste any time looking for muck
on PSpice, I just get decks e-mailed to
me that run differently between LTspice
and PSpice

that's comforting... not. one would need a 3rd spice to figure out which
one's wrong.

TIA,
mike
 
M

Mike Engelhardt

Jan 1, 1970
0
Active8,
... could you please tell me what command line
arguments are suported by LTSpice or where i can find the
info?

If your deck is called myfile.cir then the command line

scad3.exe -b myfile.cir

will run the deck and leave the data in myfile.raw and
the error/account information in myfile.log. When you
run the command in that manner, it doesn't operate like
a Windows program, i.e., it never creates a window, shows
up on the status bar, starts the message pump, or go
multi-threaded.
i googled it and it looks like no one knows how to do
this....

I thought this was documented somewhere. Many people use
it anyway. It's been discussed in the independent users'
group http://groups.yahoo.com/group/LTspice.
...for good reason, too. when i run a PSpice sim that
eats up time, PSpice must set a higher thread priority
'cause my winders box turns into a real slug if i try
to work in another app when the sim's running or rather
crawling.

I wouldn't guess that this is PSpice's fault. Having a
live machine while a compute-bound task is running in
the background is a latency issue. The true crime of
MS Windows is that it has terrible latency.

--Mike
 
K

Kevin Aylward

Jan 1, 1970
0
Mike said:
Active8,


If your deck is called myfile.cir then the command line

scad3.exe -b myfile.cir

will run the deck and leave the data in myfile.raw and
the error/account information in myfile.log. When you
run the command in that manner, it doesn't operate like
a Windows program, i.e., it never creates a window, shows
up on the status bar, starts the message pump, or go
multi-threaded.

Is there a switch to output in ascii format, or does it support
something like

..control
set filetype=binary
..endc

What about the standard -r output_file_name.out switch?

Kevin Aylward
[email protected]
http://www.anasoft.co.uk
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.
 
A

Active8

Jan 1, 1970
0
Active8,


If your deck is called myfile.cir then the command line

scad3.exe -b myfile.cir

are there any other switches? i noticed that i can't get the text output
setting to persist when i close the program (haven't updated in a while,
either. i'd like to do the command line deal *and* get a text output.

tnx,
mike
 
M

Mike Engelhardt

Jan 1, 1970
0
Mike,
are there any other switches? i noticed that i can't get the
text output setting to persist when i close the program (haven't
updated in a while, either.

Not all control panel settings are persistent, but are hard-
wired defaults that can be accessed for diagnostic reasons.
i'd like to do the command line deal *and* get a text output.

Check out Helmut's utility in the user file section of the
users' group.

--Mike
 
H

Helmut Sennewald

Jan 1, 1970
0
Active8 said:
are there any other switches? i noticed that i can't get the text output
setting to persist when i close the program (haven't updated in a while,
either. i'd like to do the command line deal *and* get a text output.

tnx,
mike


Hello Mike,
you could use my utility program to convert the rawfile in a
second step from binary to ASCII. You can download this program
"ltsputil.exe" from the LTSPICE user's group.
http://groups.yahoo.com/group/LTspice

scad3.exe -b myfile.cir
ltsputil -coa myfile.raw myfile.dat

This works when I do it manually from the command line. When I try both
commands in a batchfile(.bat), then the output file contains not all data.
The reason seems to be that "scad3" exits before the .raw-file is fully
written to the hard disk. So the "ltsputil" catch the partially written
output file.

Hello Mike Engelhardt,
could you change "scad3" in a way that it exits only after the output
file has been written fully to the hard disk?

The next problem I discovered is the control of the compression mode.
I have tried a .TRAN analysis and got the following number of data
points.

Binary, full compression(.options plotwinsize=300) 59
Binary, Full compression(.options plotwinsize=3) 507
Binary, all compression off 5042
ASCII mode 5043

The last two modes have exactly the same data except the difference
that there is one more data point at the end(time=5.0001sec) of the
ASCII rawfile. The SPICE command has been ".tran 0 5 0 1m" .
Ok, this one point more is not really an issue.

Now the important request.
I would like to have the behaviour that the LTSPICE command
.options plotwinsize=0
switches off all compression modes. This improvement is necessary
for best results in a post FFT analysis.

Best Regards
Helmut
 
K

Kevin Aylward

Jan 1, 1970
0
Helmut said:
Hello Mike,
you could use my utility program to convert the rawfile in a
second step from binary to ASCII. You can download this program
"ltsputil.exe" from the LTSPICE user's group.
http://groups.yahoo.com/group/LTspice

scad3.exe -b myfile.cir
ltsputil -coa myfile.raw myfile.dat

So, whats the catch in the LT binary file Helmut? If I manually turn off
LT compression, but keep LT in binary mode, SS can not read this binary
file, although SS reads a
standard spice binary file no problem. So, at the moment I'm limited to
the LT
ascii format.

Kevin Aylward
[email protected]
http://www.anasoft.co.uk
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.
 
H

Helmut Sennewald

Jan 1, 1970
0
Kevin Aylward said:
So, whats the catch in the LT binary file Helmut?

Hello Kevin,
there is no difference in the data format in the LTSPICE binary output
file regardless which compression level is set in LTSPICE.
Shure, the data ordering and format differs slightly from the ASCII output
format.
I will not tell anybody this format, because I promised Mike to keep it
secret.
If I manually turn off
LT compression, but keep LT in binary mode, SS can not read this binary
file, although SS reads a
standard spice binary file no problem. So, at the moment I'm limited to
the LT
ascii format.

Do you have any idea how I can detect in my "ltsputil.exe" program whether
a file is still open for writing from another program?
I will take a look into the C help files too. This would solve the problem
that "ltsputil.exe" opens the LTSPICE raw file before the OS(operating
system)
has written it fully to the hard disk. I am using WIN98SE.

Best Regards
Helmut
 
K

Kevin Aylward

Jan 1, 1970
0
Helmut said:
Hello Kevin,
there is no difference in the data format in the LTSPICE binary output
file regardless which compression level is set in LTSPICE.
Shure, the data ordering and format differs slightly from the ASCII
output format.
I will not tell anybody this format, because I promised Mike to keep
it secret.

I suppose I could try some trial and error. Just compare some very small
files with the spice3 format.
Do you have any idea how I can detect in my "ltsputil.exe" program
whether a file is still open for writing from another program?

Yes...keep trying to open it in write mode, it should fail, assuming
hope Mike didn't do anything daft when he wrote his open routines.


Kevin Aylward
[email protected]
http://www.anasoft.co.uk
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.
 
M

Mike Engelhardt

Jan 1, 1970
0
Helmut,
could you change "scad3" in a way that it exits only
after the output file has been written fully to the
hard disk?

The only way to do this is by puttting in a delay.
LTspice does call the OS to flush and close all open
files, but the OS doesn't actually do it for awhile.
I'll add a 500ms delay, which should catch most of
the problems.
Now the important request. I would like to have
the behaviour that the LTSPICE command

.options plotwinsize=0

switches off all compression modes. This improvement
is necessary for best results in a post FFT analysis.

Thank you, good idea. That will be released next week.

--Mike
 
H

Helmut Sennewald

Jan 1, 1970
0
Mike Engelhardt said:
Helmut,


The only way to do this is by puttting in a delay.
LTspice does call the OS to flush and close all open
files, but the OS doesn't actually do it for awhile.
I'll add a 500ms delay, which should catch most of
the problems.


Thank you, good idea. That will be released next week.

Hello Mike,
I already tried the advice from Kevin to open the raw file first
in write mode, but this doesn't help.
I have written now a small delay program "waitsec". The full batch
program will then look like

This batch job runs a SPICE file and converts the raw file to ASCII format.

scad3.exe -b myfile.cir
waitsec 1
ltsputil -coa myfile.raw myfile.asc


The "WaitSec.exe" program:

Syntax: waitsec time
Example: waitsec 2.5

The delay program waitsec.exe can be downloaded from the LTSPICE users
group.
It is in the same directory as Ltsputil.exe.

I am not shure it is worth that you add 0.5sec delay to your program,
because who knows how long the OS needs.
Maybe somebody else knows any OS function to check the file status.

Best Regards
Helmut
 
K

Kevin Aylward

Jan 1, 1970
0
Helmut said:
Hello Mike,
I already tried the advice from Kevin to open the raw file first
in write mode, but this doesn't help.
I have written now a small delay program "waitsec". The full batch
program will then look like

This is strange. This issue was something I thought might happen way
back when I started SS. SS starts the engine, then polls a handle to see
when it has exited. SO far, I have never seen any problems in loading in
the file.

Kevin Aylward
[email protected]
http://www.anasoft.co.uk
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.
 
Top