Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

.include syntax and put parameters into a separate file

19 views
Skip to first unread message

zhengqi gao

unread,
Aug 8, 2024, 2:20:47 PM8/8/24
to xyce-users
Hi, 

I want to put all parameters definition '.param xxx=1.0' into a separate file, and then at run-time let the netlist to simulate with these parameters. I think in Hspice, we can use .Include syntax, but it seems Xyce's .include syntax is only used for library model?

I wonder if there is a way to do it. Otherwise, I can put parameters definition into the netlist as well, but it just looks a bit unclear to me :-) Any suggestions?

Thanks
-Zhengqi

xyce-users

unread,
Aug 8, 2024, 2:26:57 PM8/8/24
to xyce-users


Xyce supports both .INC and .LIB, and they mean the same thing as they do in other simulators.

.INC includes the other file unconditionally, while .LIB just includes the specific library being invoked.


So, for example you can do this with .INC:

------  parFile ----
* parameter file
.param res=1.0
.param cap=1.0
.param src=1.0
-----------------------

-----test.cir-----
* test netlist
.INC parFile

R 1 0 {res}
C 1 2 {cap}
V 2 0 {src}

.OP
.print dc v(*)
-----------------------


thanks,
Eric

zhengqi gao

unread,
Aug 8, 2024, 2:45:07 PM8/8/24
to xyce-users
Thanks Eric! I think I know where I did wrong. Using the examples you provided, I found if I put .INC directly at the first line of the file, then it will raise errors saying unrecognized parameters. But if I put .INC at the second line (or other lines below), it works fine. Is this an intended behavior or a bug? 

-Zhengqi

Tom Russo

unread,
Aug 8, 2024, 2:47:49 PM8/8/24
to zhengqi gao, xyce-users
Just as in SPICE, the very first line of a netlist file is *always* considered a comment.

In SPICE, that first line is used to label the console output as a title.  In Xyce it is simply ignored.

If you literally put your ".inc" line as the first line of the file, then this is why it was ignored.

--
You received this message because you are subscribed to the Google Groups "xyce-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xyce-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xyce-users/7abf3899-7a7f-421d-9d18-f8707797217en%40googlegroups.com.


--
Tom Russo    KM5VY 
Tijeras, NM 

 echo "prpv_a'rfg_cnf_har_cvcr" | sed -e 's/_/ /g' | tr [a-m][n-z] [n-z][a-m]

zhengqi gao

unread,
Aug 8, 2024, 2:49:37 PM8/8/24
to xyce-users
Thanks for the clarification!  Sorry for my rusty circuit simulator usage knowledge. I haven't used them for a while. -Zhengqi

xyce-users

unread,
Aug 8, 2024, 3:28:35 PM8/8/24
to xyce-users
Ah.  The behavior you describe has to do with the first line of a traditional SPICE netlist.    The first line is always treated as a comment, even if the comment delimiter (like an * symbol) isn't used.

I think that is an artifact of the early days of SPICE, in which circuits were described using punch cards.

thanks,
Eric

xyce-users

unread,
Aug 8, 2024, 3:31:40 PM8/8/24
to xyce-users

PS, I replied before I saw Tom's reply.  Sorry for being redundant!

Eric
Reply all
Reply to author
Forward
0 new messages