.IC Setting initial condition to a capacitor or voltage node

999 views
Skip to first unread message

Roshni Uppala

unread,
Jun 4, 2014, 12:32:55 PM6/4/14
to xyce-...@googlegroups.com
Does .IC set the initial condition to a capacitor or a voltage node to a parameter ?

Like .IC V(xs)=x2

where .PARAM x2=0.1

When I do this, the initial condition starts at 0 instead of 0.1 .



Roshni Uppala

unread,
Jun 4, 2014, 5:03:03 PM6/4/14
to xyce-...@googlegroups.com
I have also tried to include UIC in the .tran statement but it still starts from the default value=0 . Is there a way to set the default value?

xyce-users

unread,
Jun 5, 2014, 12:33:03 AM6/5/14
to xyce-...@googlegroups.com


On Wednesday, June 4, 2014 10:32:55 AM UTC-6, Roshni Uppala wrote:
Does .IC set the initial condition to a capacitor or a voltage node to a parameter ?

Roshni: 


This is related to an earlier question of yours, and the answer is unfortunately related.  In Xyce, parameters cannot be used everywhere that numbers may be used, only in a small number of contexts -- device instance parameters, model parameters, print lines, and a very small number of specialized uses.  .IC, .TRAN, .HB, and other control cards generally do not support use of expressions or parameters.

.IC lines support only numbers as values to the right of the equals sign.

 

Thomas Russo

unread,
Jun 5, 2014, 10:54:33 AM6/5/14
to xyce-...@googlegroups.com, xyce-...@googlegroups.com


On Wednesday, June 4, 2014 10:33:03 PM UTC-6, xyce-users wrote:


On Wednesday, June 4, 2014 10:32:55 AM UTC-6, Roshni Uppala wrote:
Does .IC set the initial condition to a capacitor or a voltage node to a parameter ?

Roshni: 


This is related to an earlier question of yours, and the answer is unfortunately related.  In Xyce, parameters cannot be used everywhere that numbers may be used, only in a small number of contexts -- device instance parameters, model parameters, print lines, and a very small number of specialized uses.  .IC, .TRAN, .HB, and other control cards generally do not support use of expressions or parameters.

.IC lines support only numbers as values to the right of the equals sign.

For future reference, the contexts in which expressions are permitted are enumerated in the reference guide in section 2.2, page 82.

What might not be clear in the documentation is that  using a single parameter is just a trivial use of an expression --- since use of a parameter invokes the expression package, parameters may only be used where expressions are valid.

Roshni Uppala

unread,
Jun 5, 2014, 5:11:15 PM6/5/14
to xyce-...@googlegroups.com
Ok. This is what I exactly did :

In a subckt I defined the initial state of a capacitor as .IC V(sv)=0.3 . And in the .tran I have specified the UIC option. When I run the simulation, it spits out something like this :

IC: Nodes specified on .IC line, but not present in circuit. (ignoring)
And simulates with the default '0' values.

The node I have mentioned on .IC line very much is present though.

Thank you.


--
You received this message because you are subscribed to a topic in the Google Groups "xyce-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/xyce-users/O2dumki-vM8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to xyce-users+...@googlegroups.com.
To post to this group, send email to xyce-...@googlegroups.com.
Visit this group at http://groups.google.com/group/xyce-users.
For more options, visit https://groups.google.com/d/optout.

xyce-users

unread,
Jun 6, 2014, 1:41:08 PM6/6/14
to xyce-...@googlegroups.com

Roshni,

Unfortunately, the .IC specification in Xyce isn't smart enough to know about sub circuit context and resolve local names.  It currently is only set up to handle fully resolved names.

So, for example, you would need to use .IC lines that look like this:

V(XN13:VC2)=5

where XN13 is the name of the sub circuit and VC2 is the name of the node within that sub circuit.

This is something we should fix, as it is very difficult for users to know how to resolve sub circuited names.



xyce-users

unread,
Jun 6, 2014, 2:33:04 PM6/6/14
to xyce-...@googlegroups.com, xyce-...@googlegroups.com

Roshni,

If you want to use .IC with full-resolved node names, you can find out what they are by using the "-namesfile" command line option with Xyce.

Simply do this:  

Xyce -namesfile [netlist]

and Xyce will, instead of running the net list, produce a text file that contains all the node names of the circuit.   The file will have namesMap_ as a prefix attached to the original net list name.  So, for example, if the net list was called res.cir, the names file name will be namesMap_res.cir.txt.


Roshni Uppala

unread,
Jun 6, 2014, 3:17:21 PM6/6/14
to xyce-users
Ok Xyce -namesfile [netlist] works but it doesnot help to resolve the subcircuit issue as subckt node names are not listed.

Now there are two different I tried  :

1.

XU1 1 2 3 device_XYZ

.SUBCKT A B C device_XYZ

<body>

.IC V(device_XYZ:C)=5

.ENDS

.TRAN 1n 100n UIC

and also with just .TRAN 1n 100n

So when I do this V(3) still starts with default 0.

2.

When .IC is outside the .SUBCKT  , the V(3) starts with '5' irrespective of whether I use UIC or not.

The thing I am trying to point out is that :

  - Mentioning UIC on tran for using .IC probably makes no difference.
  - .IC from inside a subckt probably doesnot work ?


Is there a way to solve this, as I am using a lot of devices derived from a subckt and initializing its voltage from its subckt will make it much simpler !


xyce-users

unread,
Jun 6, 2014, 4:54:18 PM6/6/14
to xyce-...@googlegroups.com


On Friday, June 6, 2014 1:17:21 PM UTC-6, Roshni Uppala wrote:
Ok Xyce -namesfile [netlist] works but it doesnot help to resolve the subcircuit issue as subckt node names are not listed.

Nodes local to subcircuits should be  in the names file.  But the nodes on the .subckt line are just aliases, and so they are not real nodes.

Now there are two different I tried  :

1.

XU1 1 2 3 device_XYZ

.SUBCKT A B C device_XYZ

<body>

.IC V(device_XYZ:C)=5

.ENDS


As you have found, this will not work.  The "C" subcircuit node is a placeholder node that is not really part of the circuit topology.  By the time the .IC is processed, this node has been replaced by the name of the node on the X line that is in the "C" position.  So the correct way would be:

 
XU1 1 2 3 device_XYZ

.IC V(3)=5

.SUBCKT A B C device_XYZ

<body>

.ENDS





When .IC is outside the .SUBCKT  , the V(3) starts with '5' irrespective of whether I use UIC or not.

Xyce always uses initial conditions you specify, with or without UIC.  UIC, however, does not perform an operating point calculation, it starts the nodes at the initial conditions you give and lets the transient run.  This is different than what SPICE does, but an early design decision was that Xyce should always apply initial conditions.


The thing I am trying to point out is that :

  - Mentioning UIC on tran for using .IC probably makes no difference.

It does make a big difference, just not the difference that other SPICE-like simulators use.  Without UIC, the initial conditions given are used to help the DCOP converge (giving a better initial guess than the default).  With UIC, no operating point is performed and the initial condition is used directly as the initial state for a transient.
 
  - .IC from inside a subckt probably doesnot work ?

It sort of works, but not the way you're trying.  And it is definitely not working the way it should -- if you specify a subcircuit interface node then it complains that the node doesn't exist (because the name of the node on the .subckt line is really just a dummy argument, and the real name of the node is the one that's used in that place on the X line.  If you specify an internal subcircuit node without the full "path" as given in the names file, then it appears to accept the line and then silently ignore it (that is NOT what should happen, but clearly it is).
 

Is there a way to solve this, as I am using a lot of devices derived from a subckt and initializing its voltage from its subckt will make it much simpler !

Well, there may be several workarounds.  One workaround is to set the initial condition on the node using the name of the node on the X line instead of trying to use the name of the node on the .subckt line.  This could become tedious, especially if your netlist is very hierarchical and the nodes you want to set are deep in the hierarchy.

On the other hand, if you're just trying to set the initial voltage drop across a particular device in the subcircuit, you might be better off using that devices "IC=" instance parameter, if it has one.  In your first email you mentioned wanting to set a capacitor initial condition --- the capacitor happens to be one of the devices that supports IC= on its instance line.  If that's all you're trying to do, then you should probably just add "IC=<voltage>" to the capacitor instance line, and that works just fine inside subcircuits.

Not all devices have IC instance parameters, though.  You'll have to check the reference guide to see which do and which don't.

By the way, if a device has an "IC" instance parameter, than you CAN use expressions and parameters to set that parameter.  Device instance parameters are allowed to take expression values.

Roshni Uppala

unread,
Jun 9, 2014, 11:20:34 AM6/9/14
to xyce-users
Ok Got it. Thank you.


Reply all
Reply to author
Forward
0 new messages