• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
        • Vwsim-users-guide
          • Vwsim-tutorial
          • Vwsim-output
          • Vwsim-input
          • Vwsim-build-and-setup
          • Vwsim-commands
            • Vwsim-command
              • Vw-output-command
              • Vw-plot-command
              • Vw-output-all-command
              • Vw-assoc-command
        • Isar
        • Wp-gen
        • Dimacs-reader
        • Pfcs
        • Legacy-defrstobj
        • Proof-checker-array
        • Soft
        • C
        • Farray
        • Rp-rewriter
        • Instant-runoff-voting
        • Imp-language
        • Sidekick
        • Leftist-trees
        • Java
        • Taspi
        • Bitcoin
        • Riscv
        • Des
        • Ethereum
        • X86isa
        • Sha-2
        • Yul
        • Zcash
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Poseidon
        • Where-do-i-place-my-book
        • Axe
        • Bigmems
        • Builtins
        • Execloader
        • Aleo
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Vwsim-commands

    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:

    1. a string containing the path to a ".cir" file.
    2. a LISP-style VWSIM netlist.
    3. 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.