PyBaMM icon indicating copy to clipboard operation
PyBaMM copied to clipboard

[Bug]: TypeError: must be real number, not BoundaryValue when using a callable controller in CustomStepExplicit

Open leigedove opened this issue 7 months ago • 2 comments

PyBaMM Version

25.1.1

Python Version

3.10.16

Describe the bug

Hi PyBaMM team, thanks for your fantastic work on this project.

I’m experimenting with custom control strategies using CustomStepExplicit, where the current is determined by a user-defined callable function that depends on variables like voltage.

However, I'm encountering the following error when running the simulation: TypeError: must be real number, not BoundaryValue

do not yield plain Python floats, but instead return symbolic objects (likely of type BoundaryValue or similar), which cannot be directly consumed by downstream numerical libraries.

Are there any solutions for these problems?

Thank you!

Relevant log output


leigedove avatar May 16 '25 14:05 leigedove

@leigedove Can you post a minimum working example and the error?

I would also recommend upgrading to pybamm 25.4.2

kratman avatar May 19 '25 19:05 kratman