LTspice.jl provides a julia interface to LTspiceTM. Several interfaces are provided.
- A dictionary like interface to access parameters and measurements by name.
- An array interface, which is primarily for measurements of stepped simulations.
- Simulations can be called like functions.
LTspice.jl is currently unregistered. It can be installed using Pkg.clone
.
Pkg.clone("https://github.com/cstook/LTspice.jl.git")
The julia documentation section on installing unregistered packages provides more information.
LTspice.jl is compatible with julia 1.0
Import the module.
using LTspice
Create an instance of LTspiceSimulation.
example1 = LTspiceSimulation("example1.asc",tempdir=true)
Access parameters and measurements using their name as the key.
Set a parameter to a new value.
example1["Rload"] = 20.0 # set parameter Rload to 20.0
Read the resulting measurement.
loadpower = example1["Pload"] # run simulation, return Pload
Circuit can be called like a function
loadpower = example1(100.0) # pass Rload, return Pload
Use Optim.jl to perform an optimization on a LTspice simulation
using Optim
result = optimize(rload -> -example1(rload)[1],10.0,100.0)
rload_for_maximum_power = example1["Rload"]
LTspice.jl works on windows and linux with LTspice under wine. Osx is not supported.
Latest documentation is here.
The Linear TechnologyTM website