Skip to content

How to simulate multiple drive cycles? #3712

Answered by TomTranter
JaeHyeonL asked this question in Q&A
Discussion options

You must be logged in to vote

Using the new step syntax is the recommended way to handle drive cycles

import pybamm
import pandas as pd
import os
import numpy as np

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(
"input/drive_cycles/US06.csv", comment="#", header=None
).to_numpy()

drive_step = pybamm.step.current(value=drive_cycle)
experiment = pybamm.Experiment(operating_conditions=[drive_step])

# create and run simulation using the CasadiSolver in "fast" mode, remember…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@JaeHyeonL
Comment options

@lappemic
Comment options

@TomTranter
Comment options

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