Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jagot/circuits.jl
https://github.com/jagot/circuits.jl
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jagot/circuits.jl
- Owner: jagot
- License: other
- Created: 2019-01-01T13:22:39.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-03T20:59:04.000Z (about 6 years ago)
- Last Synced: 2024-11-15T18:35:01.793Z (2 months ago)
- Language: Julia
- Size: 26.4 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
- License: LICENSE.md
Awesome Lists containing this project
README
#+TITLE: Circuits.jl
#+AUTHOR: Stefanos Carlström
#+EMAIL: [email protected]#+PROPERTY: header-args:julia :session *julia-README*
* Usage
#+BEGIN_SRC julia :exports none
using Pkg
Pkg.activate(".")
#+END_SRC#+BEGIN_SRC julia :exports code
using Circuits
using TikzPictures
using Unitful
#+END_SRC#+RESULTS:
: nothing#+BEGIN_SRC julia
R1 = Resistor(1u"Ω")
R2 = Resistor(1u"Ω")
C = PolarCapacitor(1u"F")
S = Switch()
D = Diode()
#+END_SRC#+RESULTS:
: D₁
#+BEGIN_SRC julia :exports both :results verbatim
c = Circuit()
push!(c, R1)
push!(c, R2)
push!(c, C)
push!(c, S)
push!(c, D)
connect!(c, R1, 1, C, "+")
connect!(c, C, "+", S, 2)
connect!(c, S, 1, R2, 2)
connect!(c, R2, 1, R1, 2)
connect!(c, R2, 2, D, "+")
connect!(c, C, "-", D, "-")
unique_labels!(c)
#+END_SRC#+RESULTS:
: Circuit with 5-element Array{Element,1}:
: R₁(1 Ω)
: R₂(1 Ω)
: C⁺₁(1 F)
: S₁(off)
: D₁#+BEGIN_SRC julia :exports code
save(SVG("test_circuit"), c)
#+END_SRC#+RESULTS:
: nothing[[file:test_circuit.svg]]