Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions about support of transmission line models #7

Open
scotelong2 opened this issue Sep 4, 2024 · 2 comments
Open

Questions about support of transmission line models #7

scotelong2 opened this issue Sep 4, 2024 · 2 comments

Comments

@scotelong2
Copy link

Hi,

I am very excited to find that this package can be used to simulate JPAs. I am just curious if this package support models of transmission lines. For example, simulating the well-known wideband IMPA design with a quarter wave and a half wave transmission line would require transmission line models.

Thanks,
Scote

@kpobrien
Copy link
Owner

kpobrien commented Sep 4, 2024

JosephsonCircuits.jl doesn't have a transmission line element, but does support user defined complex impedances which can be used to realize a transmission line. When using this in a nonlinear simulation be sure to include an absolute value of the frequency as some idlers have negative frequencies in this simulation method. You can calculate these impedances by comparing the ABCD matrix for impedances in a T or Pi configuration with the ABCD matrix for a transmission line. You can also discretize the transmission line into an LC ladder. For this, I suggest selecting the capacitance and inductance per unit cell to minimize the number of unit cells required while keeping the cutoff frequency above your band of interest (for all pumps, pump harmonics, signals, and idlers).

Below is a simulation of a mismatched transmission line using (a) user defined impedances, (b) discretization, and (c) ABCD matrices.

Simulations of a JPA with a transmission line such as an IMPA comparing methods (a) and (b) would make a great example, if you're interested in contributing that.

using JosephsonCircuits
using Plots

# the transmission line properties
neff = sqrt((9.8+1)/2)
c = 2.998e8
l1 = 20.0e-3

Z0 = 50.0
Z1 = 25.0
# Z1 = 25

Z2 = 50
Rshort = 1e-9

# define the frequency
ws=2*pi*(0.001:0.1:10)*1e9

## User defined impedance 
# the transmission line equations
Zshunt(w) = im*Z1*sin(neff*abs(w)/c*l1)/(cos(neff*abs(w)/c*l1)-1)
Zseries(w) = im*Z1*sin(neff*abs(w)/c*l1)

@variables w R1 R2 L0 C0
@register_symbolic Zshunt(w)
@register_symbolic Zseries(w)

circuitdefs = Dict(R1 => 50.0, R2 => 50.0)


circuit = Tuple{String,String,String,Num}[]
push!(circuit,("P$(1)_$(0)","1","0",1))
push!(circuit,("R$(1)_$(0)","1","0",R1))
j=1
push!(circuit,("R$(j)_$(j+1)","$(j)","$(j+1)",Rshort))
j+=1
push!(circuit,("Rtl1$(j)_$(j+1)","$(j)","$(j+1)",Zseries(w)))
push!(circuit,("Rtl1$(j)_$(0)","$(j)","$(0)",Zshunt(w)))
push!(circuit,("Rtl1$(j+1)_$(0)","$(j+1)","$(0)",Zshunt(w)))
j+=1
push!(circuit,("R$(j)_$(j+1)","$(j)","$(j+1)",Rshort))
j+=1
push!(circuit,("R$(j)_$(0)","$(j)","$(0)",R2))
push!(circuit,("P$(j)_$(0)","$(j)","$(0)",2))
@time sol_userdefinedZ = hblinsolve(ws, circuit, circuitdefs, symfreqvar = w);

p1 = plot(
    ws/(2*pi*1e9),
    10*log10.(abs2.(sol_userdefinedZ.S((0,),1,(0,),1,:))),
    label="S11 user defined Z",
    ylim=(-20,0.1),
    xlabel="Signal Frequency (GHz)",
    legend=:bottomright,
    title="Scattering Parameters",
    ylabel="dB",
)

plot!(
    ws/(2*pi*1e9),
    10*log10.(abs2.(sol_userdefinedZ.S((0,),2,(0,),1,:))),
    label="S21 user defined Z",
)


### Discretized transmission line

@variables Rleft Rright C L
circuit = Tuple{String,String,String,Num}[]

# port on the input side
push!(circuit,("P$(1)_$(0)","1","0",1))
push!(circuit,("R$(1)_$(0)","1","0",Rleft))
N=500
#first half cap to ground
push!(circuit,("C$(1)_$(0)","1","0",C/2))
#middle caps and jj's
push!(circuit,("L$(1)_$(2)","1","2",L)) 

j=2
for i = 2:N-1
    
    push!(circuit,("C$(j)_$(0)","$(j)","$(0)",C))
    push!(circuit,("L$(j)_$(j+1)","$(j)","$(j+1)",L))

    # increment the index
    j+=1

end

#last jj
push!(circuit,("C$(j)_$(0)","$(j)","$(0)",C/2))
push!(circuit,("R$(j)_$(0)","$(j)","$(0)",Rright))
# port on the output side
push!(circuit,("P$(j)_$(0)","$(j)","$(0)",2))

circuitdefs = Dict(
    L => neff*Z1/c*l1/N,
    C => neff/(c*Z1)*l1/N,
    Rleft => 50.0,
    Rright => 50.0,
)
@time sol = hblinsolve(ws, circuit, circuitdefs)

plot!(ws/(2*pi*1e9),
    10*log10.(abs2.(sol.S(
            outputmode=(0,),
            outputport=2,
            inputmode=(0,),
            inputport=1,
            freqindex=:),
    )),
    label="S21 discretized",
)

plot!(ws/(2*pi*1e9),
    10*log10.(abs2.(sol.S((0,),1,(0,),1,:))),
    label="S11 discretized",
)



### ABCD matrices
@time sol_abcd = JosephsonCircuits.ABCDtoS.(JosephsonCircuits.ABCD_tline.(neff*ws/c,Z1,l1));

plot!(
    ws/(2*pi*1e9),
    10*log10.(abs2.([S[1,1] for S in sol_abcd])),
    label="S11 ABCD",
    linestyle=:dash,
)

plot!(
    ws/(2*pi*1e9),
    10*log10.(abs2.([S[2,1] for S in sol_abcd])),
    label="S21 ABCD",
    linestyle=:dash,
)

image

@kpobrien
Copy link
Owner

kpobrien commented Sep 4, 2024

and one note: please make sure to update to v0.4.8 before running the above code. The ABCD and other network parameter conversions are only available in the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants