# \[ANN\] EquivalentCircuits.jl for impedance spectroscopy analysis in Julia

**URL:** <https://discourse.julialang.org/t/ann-equivalentcircuits-jl-for-impedance-spectroscopy-analysis-in-julia/94133>\
**Category:** Package Announcements\
**Tags:** package\
**Created:** [February 6, 2023, 12:00pm UTC](https://discourse.julialang.org/t/ann-equivalentcircuits-jl-for-impedance-spectroscopy-analysis-in-julia/94133 "2023-02-06T12:00:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaximeVH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maximevh/32/46176_2.png) [@MaximeVH](https://discourse.julialang.org/u/MaximeVH)\
**Post date:** [February 6, 2023, 12:00pm UTC](https://discourse.julialang.org/t/ann-equivalentcircuits-jl-for-impedance-spectroscopy-analysis-in-julia/94133/1 "2023-02-06T12:00:11Z")

</div>

To my knowledge, Julia has no other libraries for conducting equivalent electrical circuit-based electrochemical impedance spectroscopy (EIS) data analysis.

EquivalentCircuits.jl 0.3.0 is a package allowing users to fit the parameters of equivalent electrical circuit models to EIS measurements. The circuit parameter fitting functionality uses differential evolution (which does not require an initial guess of the parameters), followed by Nelder-Mead Simplex fine-tuning. For more involved circuit fitting procedures, there is the option to add weights (thus adding more importance to specific regions of the frequency range during fitting), as well as the option to fix some of the parameters (which can be used for sequential fitting of parameter subsets).

Additionally, the package can recommend plausible equivalent circuit configurations, given a set of measurements. The latter is done either by evaluating a number of circuits collected from the literature within the application area of interest or through an evolutionary algorithm that searches for the simplest equivalent circuit model capable of fitting the measurements.

EquivalentCircuits.jl is my first Julia package, so feedback and suggestions are welcome. For future work, I am considering implementing other important EIS data analysis methods, such as the Distribution of Relaxation Times (DRT) method and data validation strategies (e.g., Kramers-Kronig transform).

Link to the Github repository: [GitHub - MaximeVH/EquivalentCircuits.jl: A julia package to either fit the parameters of a specified equivalent electrical circuit to electrochemical impedance data, or to suggest a plausible circuit configuration for a given set of measurements (either through a comparison of circuits from the literature, or through an evolutionary algorithm approach).](https://github.com/MaximeVH/EquivalentCircuits.jl)

---

<div class="post-metadata">

**Author:** ![Jian\_ZUO](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jian_zuo/32/33738_2.png) [@Jian\_ZUO](https://discourse.julialang.org/u/Jian_ZUO)\
**Post date:** [February 7, 2023, 7:58pm UTC](https://discourse.julialang.org/t/ann-equivalentcircuits-jl-for-impedance-spectroscopy-analysis-in-julia/94133/2 "2023-02-07T19:58:30Z")

</div>

Hello, thank you very much for sharing such an interesting library.  
I am curious about the target application of your library. For example, the  
equivalent circuits of fuel cells and lithium batteries differ. Do we have  
a specific one here or can this package include all these application scenarios?

---

<div class="post-metadata">

**Author:** ![MaximeVH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maximevh/32/46176_2.png) [@MaximeVH](https://discourse.julialang.org/u/MaximeVH)\
**Post date:** [February 8, 2023, 7:51am UTC](https://discourse.julialang.org/t/ann-equivalentcircuits-jl-for-impedance-spectroscopy-analysis-in-julia/94133/3 "2023-02-08T07:51:41Z")

</div>

Hi, thanks for your interest in the library.

This package works for a range of application areas, including fuel cells and lithium-ion batteries.

That being said, I have once encountered a complex equivalent circuit that required a more bespoke parameter optimization procedure. This is why I’ve added an optional keyword argument (to be included in the next release), allowing users to adjust the optimization method for those rare cases where the differential evolution + simplex method isn’t sufficient.

---

<div class="post-metadata">

**Author:** ![Jian\_ZUO](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jian_zuo/32/33738_2.png) [@Jian\_ZUO](https://discourse.julialang.org/u/Jian_ZUO)\
**Post date:** [February 8, 2023, 8:30am UTC](https://discourse.julialang.org/t/ann-equivalentcircuits-jl-for-impedance-spectroscopy-analysis-in-julia/94133/4 "2023-02-08T08:30:17Z")

</div>

Thanks!  
Cool! Looking forward to your future work and I will try it on Fuel cells (this is what I mainly working on).

---

<div class="post-metadata">

**Author:** ![gustaphe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gustaphe/32/18174_2.png) [@gustaphe](https://discourse.julialang.org/u/gustaphe)\
**Post date:** [February 8, 2023, 8:44pm UTC](https://discourse.julialang.org/t/ann-equivalentcircuits-jl-for-impedance-spectroscopy-analysis-in-julia/94133/5 "2023-02-08T20:44:54Z")

</div>

Nice. I haven’t looked at it properly yet, so I don’t know if there’s any overlap but if you want you can have anything off [GitHub - gustaphe/Circuits.jl](https://github.com/gustaphe/Circuits.jl) 🙂

---

<div class="post-metadata">

**Author:** ![MaximeVH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maximevh/32/46176_2.png) [@MaximeVH](https://discourse.julialang.org/u/MaximeVH)\
**Post date:** [February 8, 2023, 10:31pm UTC](https://discourse.julialang.org/t/ann-equivalentcircuits-jl-for-impedance-spectroscopy-analysis-in-julia/94133/6 "2023-02-08T22:31:54Z")

</div>

Thanks, it seems our packages serve different purposes, though I’m a fan of your generation of circuitikz figures in Julia :))

---

<div class="post-metadata">

**Author:** ![ellocco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ellocco/32/31331_2.png) [@ellocco](https://discourse.julialang.org/u/ellocco)\
**Post date:** [February 16, 2023, 9:47am UTC](https://discourse.julialang.org/t/ann-equivalentcircuits-jl-for-impedance-spectroscopy-analysis-in-julia/94133/7 "2023-02-16T09:47:37Z")

</div>

Thank you so much Maxime! 🙂

I have used the package for the fitting of a complex EC-structure:

```julia
"R1-L2-[P3,R4]-[P5,R6]-[P7,R8]"

```

`P` stands for [constant phase element](https://en.wikipedia.org/wiki/Constant_phase_element).

The well established Python package [impedance.py](https://impedancepy.readthedocs.io/en/latest/getting-started.html) failed to provide a suitable fit.  
But with this package in combination with the package [BlackBoxOptim](https://github.com/robertfeldt/BlackBoxOptim.jl) it was possible to find a suitable fit, even better then the one proposed by a commercial SW.

P.S.:  
One example of an interactive plot based on this package that can be compiled as a standalone application can be found [here](https://github.com/StefanPofahl/Stefans_Julia_RePo/tree/main/AppDir).

Followup:  
Current Status of the compiled project is: [its only operational on the build machine](https://github.com/JuliaLang/PackageCompiler.jl/issues/789) ☹
