I have problem with sampling Frequency when I use ACME.jl

It’s best to format your code example using back quotes . See: Please read: make it easier to help you

I never actually used this package (never knew it existed, but it’s really cool!) but I don’t think you placed the current probe correctly in order to measure D1 current. I tried this configuration, with the current probe between D1- and D2-:

using ACME
using Plots
plotly()
Plots.PlotlyBackend()

circ = @circuit begin
    j_in = voltagesource()
    l1 = inductor(1e-3)
    d1 = diode(;is=1e-12, η = 1)
    d2 = diode(;is=1e-12, η = 1)
    d3 = diode(;is=1e-12, η = 1)
    d4 = diode(;is=1e-12, η = 1)
    c1 = capacitor(1e-3)
    r1 = resistor(20)
    i_out = currentprobe()

    j_in[+] ⟷ l1[1]
    j_in[-] ⟷ gnd
    l1[2] ⟷ d1[+] ⟷ d4[-]
    gnd ⟷ d2[+] ⟷ d3[-]
    d1[-] ⟷ i_out[+]
    i_out[-] ⟷ d2[-] ⟷ r1[1] ⟷ c1[1]
    d4[+] ⟷ d3[+] ⟷ r1[2] ⟷ c1[2]
end

fs = 44100;
fsig = 1000;
dt = 1/fs
t = 0:dt:1
model = DiscreteModel(circ, 1/fs)
y = run!(model, 10*sin.(2*π*fsig .* t'))

plot(t, y')

If you mess around with the frequencies or components, your simulation will not converge. I’m not sure why, but it converges if I lower the sine amplitude.

Is this a homework?

Also, please avoid double posting. It only clutters the discourse dashboard and makes responses harder to track.

1 Like