[Charcoal Treasure Says] Visual Simulation of EIS Test Process
Release time:
2023-06-20
Electrochemical impedance spectroscopy (EIS) is a transient test method often used in electrochemical research, which can give many process details in the frequency domain. However, due to the operation of complex numbers, the expression is not very intuitive, and the drawing is more complicated. The real and imaginary parts of the impedance are usually used as Nyquist diagrams, but the frequency cannot be displayed. It is difficult to horizontally associate the Nyquist diagram with the Bode diagram, and the impedance change process cannot be displayed globally. This paper provides a simulation method of EIS test process, and the dynamic visualization of different physical quantities, can directly observe the internal relationship between the physical quantities, deepen the understanding of the test results.
Electrochemical impedance spectroscopy (EIS) is a transient test method often used in electrochemical research, which can give many process details in the frequency domain. However, due to the operation of complex numbers, the expression is not very intuitive, and the drawing is more complicated. The real and imaginary parts of the impedance are usually used as Nyquist diagrams, but the frequency cannot be displayed. It is difficult to horizontally associate the Nyquist diagram with the Bode diagram, and the impedance change process cannot be displayed globally. This paper provides a simulation method of EIS test process, and the dynamic visualization of different physical quantities, can directly observe the internal relationship between the physical quantities, deepen the understanding of the test results.
1. Implementation Code
Or use the animation module mentioned last time.
import matplotlib.animation as animation
In order to show the Nyquist diagram of EIS test and the Bode diagram of the modulus, real part, imaginary part and phase angle with frequency change at the same time, five sub-diagrams are defined on the canvas.
fig=plt.figure(figsize=(15,8))
ax1=fig.add_subplot(231)
ax2=fig.add_subplot(232)
ax3=fig.add_subplot(233)
ax4=fig.add_subplot(223)
ax5=fig.add_subplot(224)
Ax1.plot (Z.real,-Z.imag,'r-')
Ax2.plot (f,-Z.imag,'b-')
Ax3.plot (f,Z.real,'c-')
Ax4.plot (f,abs(Z),'g-')
Ax5.plot (f,-np.angle(Z)/np. pl * 180,'m-')
Take a point for the curve of each subgraph, and then show the EIS test process by changing the coordinates of these points.
Point1,=ax1.plot(np.real(Z)[0],-np.imag(Z)[0],'ro')
Point2,=ax2.plot(f[0],-np.imag(Z)[0],'bo')
point3,=ax3.plot(f[0],np.real(Z)[0],'co')
Point4, = ax4.plot(f[0],abs(Z)[0],'go')
Point5, = ax5.plot(f[0],-np.angle(Z)[0]/np. ft * 180,'mo')
The following is the update function,
def update(num):
N = int(num *(len(f)/40))
Point1.set_data(np.real(Z)[n-1],-np.imag(Z)[n-1])
point2.set_data(f[n-1],-np.imag(Z)[n-1])
point3.set_data(f[n-1],np.real(Z)[n-1])
point4.set_data(f[n-1],abs(Z)[n-1])
point5.set_data(f[n-1],-np.angle(Z)[n-1]/np.pi*180)
return [point1,point2,point3,point4,point5]
Generate dynamic gjf graphs and store them,
ani = animation.FuncAnimation(fig=fig,func=update,blit=True,frames=np.arange(0,41),interval=1000)
ani.save('R2-C01.gif', writer="pillow")
2. Various circuit components EIS process display
2.1 RC series circuit,

R=2 #ohm
C=0.1 #F
F = np.logspace(5,-2,80) # HZ
W = 2 *np.pi*f
Z = R 1/(1j * w * C)
The EIS process is as follows,
With the decrease of the test frequency, there is no obvious change in the initial stage due to the concentration of the test points in the Nyquist diagram. It can be seen on the Bode diagram that the mode, imaginary part and phase angle of the impedance are basically unchanged with the decrease of the frequency. But when the frequency is low to a certain extent, it begins to increase rapidly.
2.2 RC parallel circuit

R=2 #ohm
C=0.1 #F
F = np.logspace(5,-2,80) # HZ
W = 2 *np.pi*f
Z = 1/(1/R 1j * w * C)
A semicircle is shown on the Nyquist chart. It is quite interesting to look at the changes of various parameters on the Bode chart and then link it with the Nyquist chart in real time.
Fixed R to change the value of C, that is, to change the time constant, to see what changes have taken place,

R=2 #ohm
C=0.01 #F
F = np.logspace(5,-2,80) # HZ
Z = 1/(1/R 1j * w * C)
2.3 two RC parallel circuits
Look at what it looks like when there are two time constants in the circuit,

R1=2 #ohm
C1=0.1 #F
R2=0.5 #ohm
C2=0.01 #F
F = np.logspace(5,-2,80) # HZ
W = 2 *np.pi*f
Z = R1/(1 1j * w * R1 * C1) R2/(1 1j * w * R2 * C2)
The amount of information is relatively large, so there is not much explanation. If EIS is measured frequently, it will feel very familiar.
2.4 CPE components
In order to be as close as possible to the actual test data, the CPE element is introduced on the basis of the ideal capacitor to see its impedance performance,

Q0=0.05
n=0.8
F = np.logspace(5,-2,80) # HZ
W = 2 *np.pi*f
Z = 1/(Q0 * e. g. power(1j * w,n))
2.5 CPE in parallel with R

R1=5
Q0=0.05
n=0.8
F = np.logspace(5,-2,80) # HZ
W = 2 *np.pi*f
Z_cpe = 1/(Q0 * e. g. power(1j * w,n))
Z = 1/(1/R1 1/Z_cpe)

Because there are many frames in each moving picture, the picture is a bit large and the display is not very complete, the effect will be better on the computer side, or you can use the above code to generate and store gjf yourself.
It's okay to stare at it more, it will be very rewarding.

Circuit elements describing the diffusion process as well as the EIS process for several common circuits will be presented later.

400-992-0709