# What's wrong with my code that it's figure is not matched with simulation

Dear friends. I am a newbie and I asked many questions to simulate a full-bridge rectifier through ACME.jl and the circuit is as follows:

and the current is as follows

my code using ACME.jl package in julia as follows :
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, 310sin.(2πfsig . t’))

plot(t, y’)
and the amplitude of current as follows is not 70 and it is only 22 A

Use triple backtick fences to format your code.

How did you get the first graph/why are you expecting 70?

3 Likes

Dear friend,

Thanks for the answer and suggesteion to format my code. I didn’t know that

I got the first graph from simulation in EMTP-RV which is an electrical engineering software for transient study and I am sure the amplitude shuld be 70 ampere.
RLC paramters in code are matched with simulation but diode is different.
I also changed the diode paramteres but it doesn’t impact current amplitude