Skip to content

How to simulate multiple drive cycles? (using the modulo function) #1293

Answered by valentinsulzer
anandmy asked this question in Q&A
Discussion options

You must be logged in to vote

The following example repeats the US06 drive cycle 3 times (for 1800s instead of 600s):

import pybamm
import pandas as pd
import os

os.chdir(pybamm.__path__[0] + "/..")

pybamm.set_logging_level("INFO")

# load model and update parameters so the input current is the US06 drive cycle
model = pybamm.lithium_ion.SPMe({"thermal": "lumped"})
param = model.default_parameter_values


# import drive cycle from file
drive_cycle = pd.read_csv(
    "pybamm/input/drive_cycles/US06.csv", comment="#", header=None
).to_numpy()

# create interpolant
timescale = param.evaluate(model.timescale)
# in the following line we use % 600 to repeat the drive cycle every 600 seconds
current_interpolant = pybamm.In…

Replies: 3 comments 13 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
12 replies
@ssingh-ipa
Comment options

@valentinsulzer
Comment options

@asifsultan-THD
Comment options

@valentinsulzer
Comment options

@asifsultan-THD
Comment options

Answer selected by brosaplanella
Comment options

You must be logged in to vote
1 reply
@agriyakhetarpal
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
7 participants