Use of IF keyword in controlled source

34 views
Skip to first unread message

fre...@oz.net

unread,
Oct 17, 2014, 1:31:10 PM10/17/14
to xyce-...@googlegroups.com
I have a vendor-supplied model for an IC (under NDA, so I can't share it).  It uses some behavioral sections as well as some detailed device sections.
   
In implementing behavioral sections of a schematic for simulation, one of the idioms or cliche's that people use is illustrated by this short netlist:

V1 1 0 sin(5 5 100k)
V2 2 0 1
Etest 3 0 value={IF(V(1)>2.5,1,0)}
R1 3 0 1k
*
.tran 10n 100u
.print tran FORMAT=RAW V(*)
.end

Xyce does not like the IF statement in the controlled voltage source line - it runs up to the point where the condition changes, and then changes the time step until it reaches the minimum, and gives up.

This isn't surprising - that statement doesn't allow for any kind of a "gradual" transition from one voltage to another, which gives the time-stepping algorithm fits.  Many available versions of SPICE apparently don't even allow that kind of statement, and those that do (for example, PSPICE and LTSpice) seem to deal with that by proprietary modifications to the simulator code.
   
You might want to consider a note in the documentation to the effect that while it is OK syntax, it won't work properly.  Or, of course, you could modify the code - but I'm sure that's not a quick task, or even a desired one.
   
Finally, thanks again for all your great work on Xyce!
   
Fred

xyce-users

unread,
Oct 17, 2014, 1:40:01 PM10/17/14
to xyce-...@googlegroups.com
Fred: you are absolutely correct, this needs to be in the documentation.

Please see page 14 of the Xyce 6.1 release notes for exactly the sort of note you were thinking of.  For many years it was included in the Release Notes as a "known defect" with an assigned bug number ("772-SRN").  When we finally stopped pretending we'd fix it the bug got closed as "Won't Fix,"  and this "known defect" mistakenly got moved to "Fixed Defects" section of  the release notes for 6.1, and in the upcoming 6.2 release notes it is missing entirely.

We're going to need to put that text into the expression library documentation for Xyce 6.3 (it is too late to put it into the 6.2 documentation, as 6.2 will probably be released on Monday).  We might be able to get it into the web site "FAQ": quickly, though.  Thank you for pointing this out. 

xyce-users

unread,
Oct 17, 2014, 1:49:54 PM10/17/14
to xyce-...@googlegroups.com, xyce-...@googlegroups.com


On Friday, October 17, 2014 11:40:01 AM UTC-6, xyce-users wrote:
Fred: you are absolutely correct, this needs to be in the documentation.

Please see page 14 of the Xyce 6.1 release notes for exactly the sort of note you were thinking of.  For many years it was included in the Release Notes as a "known defect" with an assigned bug number ("772-SRN").  When we finally stopped pretending we'd fix it the bug got closed as "Won't Fix,"  and this "known defect" mistakenly got moved to "Fixed Defects" section of  the release notes for 6.1, and in the upcoming 6.2 release notes it is missing entirely.

We're going to need to put that text into the expression library documentation for Xyce 6.3 (it is too late to put it into the 6.2 documentation, as 6.2 will probably be released on Monday).  We might be able to get it into the web site "FAQ": quickly, though.  Thank you for pointing this out. 

Just for reference,  when Xyce 6.0.1 was released this issue was still listed as a "known defect" in the release notes, and had a "Workaround" section.  It wasn't especially helpful since it didn't provide an example of how to work around the issue, but here's what it said:

Workaround: Do not use step-function or other infinite-slope transitions dependent on variables other than time. Smooth the transition so that it is more easily integrated through.

Crafting an altered "if" statement that lets the transition be smooth may not be the nicest approach, but it is the most robust.

We'll try to construct more explicit guidance for the expression section of the 6.3 reference guide.

Again, thank you for pointing this out.

Reply all
Reply to author
Forward
0 new messages