::SpiceGenTcl::Ngspice::SimulatorsTop, Main, Index
ClassesTop, Main, Index
Batch [::SpiceGenTcl::Ngspice::Simulators]Top, Main, Index
Method summary
constructor | Constructor for the class. |
configure | Configure properties. |
getLog | See ::SpiceGenTcl::Simulator.getLog |
readData | Reads raw data file, create RawFile object and return it's reference name. |
readLog | Reads log file of last simulation and save it's content to Log variable. |
run | See ::SpiceGenTcl::Simulator.run |
runAndRead | Runs netlist circuit file. |
Properties
Readable: -data
, -log
, -name
, -runlocation
Writable: -data
, -log
, -name
, -runlocation
Superclasses
Subclasses
constructor [::SpiceGenTcl::Ngspice::Simulators::Batch]Batch, Top, Main, Index
Creates batch ngspice simulator that can be attached to top-level Circuit.
Batch create OBJNAME name ?runLocation?
Batch new name ?runLocation?
Batch new name ?runLocation?
Details
Parameters
name | Name of simulator object. |
runLocation | Location at which input netlist is stored and all output files will be saved, default is current directory. Optional, default . . |
method constructor {name {runLocation .}} { # Creates batch ngspice simulator that can be attached to top-level Circuit. # name - name of simulator object # runLocation - location at which input netlist is stored and all output files will be saved, # default is current directory my configure -name $name my variable Command global tcl_platform if {[string match -nocase {*windows nt*} $tcl_platform(os)]} { ##nagelfar nocover set Command ngspice_con } else { set Command ngspice } my configure -runlocation $runLocation }
readData [::SpiceGenTcl::Ngspice::Simulators::Batch]Batch, Top, Main, Index
Reads raw data file, create RawFile object and return it's reference name.
OBJECT readData
Details
method readData {} { # Reads raw data file, create RawFile object and return it's reference name. my variable data set data [::SpiceGenTcl::RawFile new [file join [my configure -runlocation] ${LastRunFileName}.raw] * ngspice] return }
readLog [::SpiceGenTcl::Ngspice::Simulators::Batch]Batch, Top, Main, Index
Reads log file of last simulation and save it's content to Log variable.
OBJECT readLog
Details
method readLog {} { # Reads log file of last simulation and save it's content to Log variable. set logFile [open [file join [my configure -runlocation] ${LastRunFileName}.log] r+] set log [read $logFile] close $logFile return }
runAndRead [::SpiceGenTcl::Ngspice::Simulators::Batch]Batch, Top, Main, Index
Runs netlist circuit file.
OBJECT runAndRead circuitStr ?-nodelete?
Details
Parameters
circuitStr | Top-level netlist string. |
-nodelete | Flag to forbid simulation file deletion. |
method runAndRead {circuitStr args} { # Runs netlist circuit file. # circuitStr - top-level netlist string # -nodelete - flag to forbid simulation file deletion # Synopsis: circuitStr ?-nodelete? set arguments [argparse { -nodelete }] my variable Command set firstLine [@ [split $circuitStr \n] 0] set runLocation [my configure -runlocation] set cirFile [open [file join $runLocation ${firstLine}.cir] w+] puts $cirFile $circuitStr close $cirFile set rawFileName [file join $runLocation ${firstLine}.raw] set logFileName [file join $runLocation ${firstLine}.log] set cirFileName [file join $runLocation ${firstLine}.cir] exec {*}[list $Command -b -r $rawFileName -o $logFileName $cirFileName] set LastRunFileName $firstLine my readLog my readData if {![info exists nodelete]} { file delete $rawFileName file delete $logFileName file delete $cirFileName } }
BatchLiveLog [::SpiceGenTcl::Ngspice::Simulators]Top, Main, Index
Method summary
configure | Configure properties. |
getLog | See ::SpiceGenTcl::Simulator.getLog |
readData | See Batch.readData |
readLog | See Batch.readLog |
run | See ::SpiceGenTcl::Simulator.run |
runAndRead | Runs netlist circuit file. |
Properties
Readable: -data
, -log
, -name
, -runlocation
Writable: -data
, -log
, -name
, -runlocation
Superclasses
runAndRead [::SpiceGenTcl::Ngspice::Simulators::BatchLiveLog]BatchLiveLog, Top, Main, Index
Runs netlist circuit file.
OBJECT runAndRead circuitStr ?-nodelete?
Details
Parameters
circuitStr | Top-level netlist string. |
-nodelete | Flag to forbid simulation file deletion. |
method runAndRead {circuitStr args} { # Runs netlist circuit file. # circuitStr - top-level netlist string # -nodelete - flag to forbid simulation file deletion # Synopsis: circuitStr ?-nodelete? set arguments [argparse { -nodelete }] my variable Command my variable LastRunFileName set firstLine [@ [split $circuitStr \n] 0] set runLocation [my configure -runlocation] set cirFile [open [file join $runLocation ${firstLine}.cir] w+] puts $cirFile $circuitStr close $cirFile set rawFileName [file join $runLocation ${firstLine}.raw] set logFileName [file join $runLocation ${firstLine}.log] set cirFileName [file join $runLocation ${firstLine}.cir] set command [list $Command -b $cirFileName -r $rawFileName] set chan [open "|$command 2>@1"] set logData {} while {[gets $chan line] >= 0} { puts $line set logData [join [list $logData $line] \n] if {[eof $chan]} { close $chan } } close $chan set LastRunFileName ${firstLine} my configure -log $logData my readData if {![info exists nodelete]} { file delete $rawFileName file delete $logFileName file delete $cirFileName } }