Resistor example 1D - DC solve explanation: Difference between revisions
(New page: This page explains the following code snipped from the 1D Resistor example: DC solve / plot I-V as output set Win [CreateGraphWindow] set bias 0.0 for {set bias 0.0} {$bias < 1.01} {s...) |
No edit summary |
||
Line 10: | Line 10: | ||
AddtoLine $Win I $bias $cur | AddtoLine $Win I $bias $cur | ||
} | } | ||
==== tcl channels ==== | |||
This line is rather complicated in floods: | |||
set Win [CreateGraphWindow] | |||
The command "CreateGraphWindow" opens a new window for plotting (it'll be a blank set of axes until you write to it). The [] brackets around the [CreateGraphWindow] command mean, "execute this command now." The CreateGraphWindow command actually returns a channel number that you don't see and stores it in the tcl variable "Win". This is so that, in the future, when you want to send data to your plot, you can send it through the channel named "Win". | |||
==== "Ramping," or consecutive DC solves ==== | |||
Please note from this line: | |||
set bias 0.0 | |||
that "bias" is a tcl variable, and not some complex thing that floods already knows about. The "for" loop you see above is how you write a for loop in tcl. The [] brackets mean "evaluate this now and put the result here," and the "$" means "access this string and put what's stored in it here," just like in the rest of our tcl code. | |||
contact name=VSS supply = $bias | |||
is an alagator command, and is being used the same way the it was used in the initial guess section |
Revision as of 18:01, 4 November 2010
This page explains the following code snipped from the 1D Resistor example:
DC solve / plot I-V as output
set Win [CreateGraphWindow] set bias 0.0 for {set bias 0.0} {$bias < 1.01} {set bias [expr $bias+0.1]} { contact name=VSS supply = $bias device set cur [expr abs([contact name=VSS sol=Elec flux] - [contact name=VSS sol=Hole flux])] AddtoLine $Win I $bias $cur }
tcl channels
This line is rather complicated in floods:
set Win [CreateGraphWindow]
The command "CreateGraphWindow" opens a new window for plotting (it'll be a blank set of axes until you write to it). The [] brackets around the [CreateGraphWindow] command mean, "execute this command now." The CreateGraphWindow command actually returns a channel number that you don't see and stores it in the tcl variable "Win". This is so that, in the future, when you want to send data to your plot, you can send it through the channel named "Win".
"Ramping," or consecutive DC solves
Please note from this line:
set bias 0.0
that "bias" is a tcl variable, and not some complex thing that floods already knows about. The "for" loop you see above is how you write a for loop in tcl. The [] brackets mean "evaluate this now and put the result here," and the "$" means "access this string and put what's stored in it here," just like in the rest of our tcl code.
contact name=VSS supply = $bias
is an alagator command, and is being used the same way the it was used in the initial guess section