Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drive cycle in experiment syntax? #1788

Closed
TomTranter opened this issue Nov 6, 2021 · 2 comments · Fixed by #1793
Closed

Drive cycle in experiment syntax? #1788

TomTranter opened this issue Nov 6, 2021 · 2 comments · Fixed by #1793

Comments

@TomTranter
Copy link
Contributor

Is this the right syntax?
it results in the following error

File "c:\users\tom\code\pybamm\pybamm\simulation.py", line 350, in set_up_model_for_experiment_new
if op_cond["electric"] not in self.op_conds_to_model_and_param:

TypeError: unhashable type: 'numpy.ndarray

import pybamm
import os
import pandas as pd
os.chdir(pybamm.__path__[0]+'/..')

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

experiment = pybamm.Experiment(operating_conditions=['Run US06 (A)'],
                               drive_cycles={'US06':  drive_cycle})
chemistry = pybamm.parameter_sets.Chen2020
parameter_values = pybamm.ParameterValues(chemistry=chemistry)

sim = pybamm.Simulation(model=pybamm.lithium_ion.SPM(),
                        parameter_values=parameter_values,
                        experiment=experiment)
@valentinsulzer
Copy link
Member

That is the intended API, but it has not yet been fully implemented (I think the experiment can be set up but not solved), and I'm open to suggestions for a different API

@TomTranter
Copy link
Contributor Author

I'm happy with the api, just wondered if I'd got it wrong because of the error. I can take a look at getting it to work in pybamm. Was trying to use it for liionpack but might just circumvent the experiment and allow you to pass drive-cycle in directly

brosaplanella added a commit that referenced this issue Nov 9, 2021
brosaplanella added a commit that referenced this issue Nov 9, 2021
brosaplanella added a commit that referenced this issue Nov 9, 2021
brosaplanella added a commit that referenced this issue Nov 9, 2021
brosaplanella added a commit that referenced this issue Nov 9, 2021
brosaplanella added a commit that referenced this issue Nov 9, 2021
brosaplanella added a commit to aabills/PyBaMM that referenced this issue Mar 29, 2023
brosaplanella added a commit to aabills/PyBaMM that referenced this issue Mar 29, 2023
brosaplanella added a commit to aabills/PyBaMM that referenced this issue Mar 30, 2023
brosaplanella added a commit that referenced this issue Jun 21, 2024
* fix

* fix exception

* added a Newfile

* pseudo

* #1778 add heat of mixing option

* #1778 fixed indentation

* #1778 fixed test

* #1778 fixed test

* #1788 added heat of mixing tests

* First commit

* #1778 fixed test

* First iteration

* #1788 try to fix diff of U

* first push from mac

* Fixed full broadcast

* Fixed domain in the integral

* #1778 fix parameter values example

* Added children[0].children[0]

* Added half cell

* style: pre-commit fixes

* #1788 revert some unrelated changes

* change ocv hack

* Revert "change ocv hack"

This reverts commit 3ad0c75.

* #1778 fix heat of mixing

* #1839 fix thermal submodels to take x_average

* #1778 add example heat of mixing

* ruff

* style: pre-commit fixes

* #1778 fix lead acid models

* fix SPM with the right broadcast of temperature

* #1778 refactor heat of mixing

* style: pre-commit fixes

* Add Richardson2021 citation for heat of mixing

* Fixed heat of mixing sign

* Rewritten heat of mixing example, added comparison plot to compare with the paper

* Fixed ruff formatting errors in the heat of mixing example script

* #1778 fix x-full

* #1778 fix tests

* #1778 improve coverage

* style: pre-commit fixes

* #1778 Valentin's suggestion to remove the dUdsto function and compute the derivative in the model directly instead

* #1778 fix failing test

* #1778 add heat of mixing to CHANGELOG

---------

Co-authored-by: Alec Bills <48105066+abillscmu@users.noreply.github.com>
Co-authored-by: smitasahu2 <smitasahuiitd@gmail.com>
Co-authored-by: Afgr1087 <andres.galvis@fem.unicamp.br>
Co-authored-by: Ferran Brosa Planella <Ferran.Brosa-Planella@warwick.ac.uk>
Co-authored-by: Ivan Korotkin <i.korotkin@soton.ac.uk>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
js1tr3 pushed a commit to js1tr3/PyBaMM that referenced this issue Aug 12, 2024
* fix

* fix exception

* added a Newfile

* pseudo

* pybamm-team#1778 add heat of mixing option

* pybamm-team#1778 fixed indentation

* pybamm-team#1778 fixed test

* pybamm-team#1778 fixed test

* pybamm-team#1788 added heat of mixing tests

* First commit

* pybamm-team#1778 fixed test

* First iteration

* pybamm-team#1788 try to fix diff of U

* first push from mac

* Fixed full broadcast

* Fixed domain in the integral

* pybamm-team#1778 fix parameter values example

* Added children[0].children[0]

* Added half cell

* style: pre-commit fixes

* pybamm-team#1788 revert some unrelated changes

* change ocv hack

* Revert "change ocv hack"

This reverts commit 3ad0c75.

* pybamm-team#1778 fix heat of mixing

* pybamm-team#1839 fix thermal submodels to take x_average

* pybamm-team#1778 add example heat of mixing

* ruff

* style: pre-commit fixes

* pybamm-team#1778 fix lead acid models

* fix SPM with the right broadcast of temperature

* pybamm-team#1778 refactor heat of mixing

* style: pre-commit fixes

* Add Richardson2021 citation for heat of mixing

* Fixed heat of mixing sign

* Rewritten heat of mixing example, added comparison plot to compare with the paper

* Fixed ruff formatting errors in the heat of mixing example script

* pybamm-team#1778 fix x-full

* pybamm-team#1778 fix tests

* pybamm-team#1778 improve coverage

* style: pre-commit fixes

* pybamm-team#1778 Valentin's suggestion to remove the dUdsto function and compute the derivative in the model directly instead

* pybamm-team#1778 fix failing test

* pybamm-team#1778 add heat of mixing to CHANGELOG

---------

Co-authored-by: Alec Bills <48105066+abillscmu@users.noreply.github.com>
Co-authored-by: smitasahu2 <smitasahuiitd@gmail.com>
Co-authored-by: Afgr1087 <andres.galvis@fem.unicamp.br>
Co-authored-by: Ferran Brosa Planella <Ferran.Brosa-Planella@warwick.ac.uk>
Co-authored-by: Ivan Korotkin <i.korotkin@soton.ac.uk>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants