Vwsim-command
Perform simulation of a circuit.
The VWSIM command
General Form:
(vwsim input [keyword options])
Description
vwsim is the top-level simulation command.
Usage and Arguments
Options Defaults
:sim-type 'voltage
:equations nil
:spice-print nil
:global-nodes nil
:time-step nil
:time-stop nil
:time-start 0
:output-file nil
:save-var nil
:save-sim nil
:save-sim-shortp nil
:concat-char #\|
:return-records nil
:load-sim nil
where all arguments, which are described below, are evaluated.
Required arguments
input - one of the following options:
- a string containing the path to a ".cir" file.
- a LISP-style VWSIM netlist.
- a string containing the path to a ".lisp" file.
Optional arguments
:sim-type - the simulation mode; select 'voltage or 'phase.
:equations - when non-NIL, return the symbolic simulation
equations. Otherwise, perform the numerical simulation.
:spice-print - when non-NIL, the output file should contain only
the values requested in the SPICE file.
:global-nodes - a list of globally-defined nodes (wires) in the
circuit.
:time-step - when non-NIL, the simulation time step in seconds as
a rational number. Otherwise, the time step is expected to be provided
by input.
:time-stop - when non-NIL, the simulation stop time in seconds as
a rational number. Otherwise, the stop time is expected to be provided
by input.
:time-start - when non-NIL, the simulation start time in seconds
as a rational number. Otherwise, the start time is expected to be
provided by input.
:output-file - when non-NIL, the csv file to write the requested
SPICE simulation values.
:save-var - when non-NIL, the simulation result is saved as an
alist in the global variable symbol specified by save-var.
:save-sim - when non-NIL, the filename to save the simulation state
for resuming the simulation later.
:save-sim-shortp - when non-NIL and :save-sim is non-NIL,
the simulation results will be writen to the file as
single-precision (32-bit) instead of double-precision (64-bits)
floats.
:concat-char - SPICE heirarchical circuit concatentation
character for PRINT statements. This is typically the character |.
:return-records - when t, the simulation results are returned in an
alist, where the keys are all of the simulation variables. If
symbol-listp, only the variables in the list will be keys in the
alist.
:load-sim - when non-NIL, input is expected to be a file
that stores a previous VWSIM simulation and does not have extension
".lisp". The previous simulation will be loaded and resumed.
Example Forms
(vwsim
;; Input SPICE (.cir) file
"Testing/test-circuits/cirs/rc-circuit.cir")
(vwsim
;; Input SPICE (.cir) file
"Testing/test-circuits/cirs/rc-circuit.cir"
:spice-print t
:output-file "Testing/test-circuits/csvs/rc-circuit-output.csv")
To see an example of running the simulator on a circuit, see vwsim-tutorial.