-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/MaximeVH/EquivalentCircui…
- Loading branch information
Showing
6 changed files
with
157 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,30 @@ | ||
using EquivalentCircuits, CSV | ||
using CSV | ||
using DataFrames | ||
using EquivalentCircuits | ||
|
||
""" | ||
Circuitidentification is done with the circuitevolution function. This function can take several keyword arguments, | ||
allowing users to tune the circuitidentification if necessary. These can be found in the function documentation. | ||
The measurements and frequencies should be provided either as a CSV file, or as arrays. | ||
Circuit identification is done with the `circuit_evolution` function. This function can take | ||
several keyword arguments, allowing users to tune the circuit identification if necessary. | ||
These can be found in the function documentation. The measurements and frequencies should | ||
be provided either as a CSV file, or as arrays. | ||
""" | ||
#Measurements input as CSV file with as columns: real impedances, imaginary impedances and frequencies. | ||
circuitevolution("example_measurements.csv") | ||
# Example 1: Input is CSV file with as columns: Re(Z), Im(Z), frequencies measurements | ||
circuit = circuit_evolution("example_measurements.csv") | ||
|
||
#Example of input as arrays. | ||
data = readdlm(raw"C:\Users\Dell\Documents\EquivalentCircuits.jl\example_measurements.csv",',') | ||
measurements = data[:,1] .+ data[:,2]im | ||
frequencies = data[:,3] | ||
circuitevolution(measurements,frequencies) | ||
# Example 2: Input is an array with as columns: Re(Z), Im(Z), frequencies measurements | ||
data = CSV.read("example_measurements.csv", DataFrame) | ||
Z = data[:, 1] .+ data[:, 2]im | ||
freq = data[:, 3] | ||
@time circuit = circuit_evolution(Z, freq) | ||
|
||
""" | ||
When the equivalent circuit to be used is known, its parameters can be fit using the parameteroptimisation function. | ||
When the equivalent circuit to be used is known, its parameters can be fit using the | ||
`parameteroptimisation` function. | ||
""" | ||
p = parameteroptimisation("[[C1,R2]-R3,P4]", Z, freq) | ||
|
||
parameteroptimisation("[[C1,R2]-R3,P4]", measurements, frequencies) | ||
""" | ||
If you want to generate multiple candidate circuits, you can use the `circuit_evolution_batch` | ||
function. This function is parallelised on all available cores. | ||
""" | ||
circuits = circuit_evolution_batch(Z, freq; generations=30, population_size=100, iters=6); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.