Skip to content

Simple initial SOC feature #25

@larer

Description

@larer

There is a long example in your package about how to set the SOC. But I found a way to do do it much easier.
I added an input to the EISSimulation class in the constructor "init function" I added a line 49:
initial_soc=1.0,

Then in the build line 65 I added a feature to pass initial_soc to the build function.
sim.build(initial_soc=initial_soc)

This gives the same result as the more complex example, that is provided in the package.
I think the initial_soc feature in the build() is easy to use.

PS I am a beginner, learning both PyBAMM and Python so this suggestion might be a bad way to do it but it did the trick for me.

Now I am running the example using the following code

import matplotlib.pyplot as plt
import numpy as np
import pybamm

import pybammeis

# Load model
model = pybamm.lithium_ion.SPM(options={"surface form": "differential"})

# Set up parameters with cell SOC as an input parameter
parameter_values = pybamm.ParameterValues("Chen2020")

# Create simulation
# Choose frequencies and calculate impedance, looping over input parameter values
# and adding the results to a Nyquist plot
frequencies = np.logspace(-4, 4, 100)
_, ax = plt.subplots()
SOC_list=[0.01, 0.1, 0.5, 0.9, 0.99]
for z in SOC_list:
    eis_sim = pybammeis.EISSimulation(model, parameter_values=parameter_values, initial_soc=z)
    eis_sim.solve(frequencies)
    eis_sim.nyquist_plot(ax=ax, label=f"SOC = {z}")
ax.set_xlim([0, 0.08])
ax.set_ylim([0, 0.08])
ax.legend()
plt.show()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions