Hi all,
I want to draw this
I want to try Circuits.jl
and try simple example first, but unable to use it, I do not know how to plot it, or is my code is wrong…
using Circuits, Plots
c = @circuit a:(0,0) --> Inductor(9e-3) --> b:(0,1) --> Resistor(11) --> c:(1,1) --> Capacitor(1.455e-6) --> d:(1,0)
plot(c)
Cannot convert Circuit to series data for plotting
Stacktrace:
** [1] error(s::String)**
** @ Base ./error.jl:33**
** [2] _prepare_series_data(x::Circuit)**
** @ RecipesPipeline ~/.julia/packages/RecipesPipeline/OXGmH/src/series.jl:8**
** [3] _series_data_vector(x::Circuit, plotattributes::Dict{Symbol, Any})**
** @ RecipesPipeline ~/.julia/packages/RecipesPipeline/OXGmH/src/series.jl:35**
** [4] macro expansion**
** @ ~/.julia/packages/RecipesPipeline/OXGmH/src/series.jl:135 [inlined]**
** [5] apply_recipe(plotattributes::AbstractDict{Symbol, Any}, #unused#::Type{RecipesPipeline.SliceIt}, x::Any, y::Any, z::Any)**
** @ RecipesPipeline ~/.julia/packages/RecipesBase/qpxEX/src/RecipesBase.jl:289**
** [6] _process_userrecipes!(plt::Any, plotattributes::Any, args::Any)**
** @ RecipesPipeline ~/.julia/packages/RecipesPipeline/OXGmH/src/user_recipe.jl:36**
** [7] recipe_pipeline!(plt::Any, plotattributes::Any, args::Any)**
** @ RecipesPipeline ~/.julia/packages/RecipesPipeline/OXGmH/src/RecipesPipeline.jl:70**
** [8] _plot!(plt::Plots.Plot, plotattributes::Any, args::Any)**
** @ Plots ~/.julia/packages/Plots/FCUr0/src/plot.jl:231**
** [9] plot(args::Any; kw::Base.Pairs{Symbol, V, Tuple{Vararg{Symbol, N}}, NamedTuple{names, T}} where {V, N, names, T<:Tuple{Vararg{Any, N}}})**
** @ Plots ~/.julia/packages/Plots/FCUr0/src/plot.jl:106**
** [10] plot(args::Any)**
** @ Plots ~/.julia/packages/Plots/FCUr0/src/plot.jl:100**
** [11] top-level scope**
** @ In[11]:5**
** [12] eval**
** @ ./boot.jl:373 [inlined]**
** [13] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)**
** @ Base ./loading.jl:1196**
Then another tryout:
c = @circuit begin
b:(0,0) --> VoltageSource(3) --> (1,0) --> Resistor(4) --> Inductor(2) --> (1,1) --> a:(0,1)
:a --> Capacitor(1) // Inductor(4) --> :b
end
show(io,mime,c,shownodes=true)
LoadError: Coordinate // doesn’t exist
in expression starting at In[12]:1
Stacktrace:
** [1] error(s::String)**
** @ Base ./error.jl:33**
** [2] push_stuff!(e::Symbol, coord::Dict{Union{Int64, Symbol}, Union{Expr, Symbol}}, comp::Vector{Expr})**
** @ Circuits ~/.julia/packages/Circuits/0lstw/src/Circuits.jl:177**
** [3] push_stuff!(e::Expr, coord::Dict{Union{Int64, Symbol}, Union{Expr, Symbol}}, comp::Vector{Expr})**
** @ Circuits ~/.julia/packages/Circuits/0lstw/src/Circuits.jl:146**
** [4] push_stuff!(e::Expr, coord::Dict{Union{Int64, Symbol}, Union{Expr, Symbol}}, comp::Vector{Expr})**
** @ Circuits ~/.julia/packages/Circuits/0lstw/src/Circuits.jl:120**
** [5] push_stuff!(e::Expr, coord::Dict{Union{Int64, Symbol}, Union{Expr, Symbol}}, comp::Vector{Expr})**
** @ Circuits ~/.julia/packages/Circuits/0lstw/src/Circuits.jl:121**
** [6] generate_circuit(arg::Expr)**
** @ Circuits ~/.julia/packages/Circuits/0lstw/src/Circuits.jl:90**
** [7] var"@circuit"(source::LineNumberNode, module::Module, args::Vararg{Any})**
** @ Circuits ~/.julia/packages/Circuits/0lstw/src/Circuits.jl:77**
** [8] eval**
** @ ./boot.jl:373 [inlined]**
** [9] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)**
** @ Base ./loading.jl:1196**
Can anyone help me on this? Thanks~!!