Git Product home page Git Product logo

ltspice.jl's Introduction

LTspice.jl

Build Status Coverage Status Build status

LTspice.jl provides a julia interface to LTspiceTM. Several interfaces are provided.

  1. A dictionary like interface to access parameters and measurements by name.
  2. An array interface, which is primarily for measurements of stepped simulations.
  3. Simulations can be called like functions.

Documentation

Installation

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"]

Supported Platforms

LTspice.jl works on windows and linux with LTspice under wine. Osx is not supported.

Additional Information

Latest documentation is here.

Introduction to LTspice.jl

The Linear TechnologyTM website

The LTspice Yahoo Group

LTwiki

ltspice.jl's People

Contributors

cstook avatar michaelhatherly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ltspice.jl's Issues

basic example fails

Screenshot from 2019-06-12 17-34-23

Using linux + wine + LTspice

Screenshot from 2019-06-12 17-37-02

Same error on 1.1.1. All examples from within spice work fine. Any ideas?

Support for .MEAS AC simulations

It seems that measuring ac analysis isn't (well or at all) supported. For example, a simple LRC circuit's .asc file is below:
Version 4
SHEET 1 1020 680
WIRE 80 48 -48 48
WIRE 144 48 80 48
WIRE 256 48 224 48
WIRE 256 80 256 48
WIRE 256 208 256 144
WIRE -48 272 -48 48
WIRE 256 288 256 272
WIRE 256 304 256 288
FLAG 256 304 0
FLAG -48 352 0
FLAG 80 128 0
DATAFLAG 32 48 ""
DATAFLAG 256 176 ""
DATAFLAG -48 224 ""
SYMBOL res -64 256 R0
SYMATTR InstName R2
SYMATTR Value 2
SYMBOL voltage 256 192 R0
WINDOW 123 24 124 Left 2
WINDOW 39 0 0 Left 0
SYMATTR Value2 AC 1
SYMATTR InstName V2
SYMATTR Value 1
SYMBOL cap 240 80 R0
SYMATTR InstName C1
SYMATTR Value 100m
SYMBOL ind 64 32 R0
SYMATTR InstName L1
SYMATTR Value {LVal}
SYMBOL res 240 32 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R1
SYMATTR Value 1m
TEXT 328 136 Left 2 !.op
TEXT 472 104 Left 2 !.ac lin 1000 1 100
TEXT 456 152 Left 2 !.param LVal = .01\n.meas AC IOut FIND mag(I(R1)) AT 10

This cannot be solved and the error message is:

Byte sequence 0xb0292061742031300d0a0a0a446174653a204d6f6e204a756c2031392032313a35323a313220323032310a546f74616c20656c61707365642074696d653a20302e343439207365636f6e64732e0a0a746e6f6d203d2032370a74656d70203d2032 is invalid in source encoding or cannot be represented in target encoding
in top-level scope at LTSpiceJL_Test.jl:5
in at LTspice\YKMNe\src\LTspiceSimulation.jl:361
in measurementvalues at LTspice\YKMNe\src\LTspiceSimulation.jl:153
in run! at LTspice\YKMNe\src\LTspiceSimulation.jl:406
in run! at LTspice\YKMNe\src\LTspiceSimulation.jl:417
in parselog! at LTspice\YKMNe\src\ParseLogFile.jl:160
in open at base\io.jl:323
....

OSX support

Is there anything that can be done to support OSX? The README says that it's unsupported, and while I can read LTSpice files, simulation causes Julia to hang until interrupted.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.