-
Notifications
You must be signed in to change notification settings - Fork 20
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
Easy distinction between PyBOP parameters and PyBaMM parameters #396
Comments
I think what you are proposing is effectivly re-parameterising some base model to create a new model. I would suggest the best way to do this is to allow users to easily create and use a custom pybamm model with pybop. Taking your 2nd case, this might look something like: custom_model = pybamm.SPM()
custom_model.substitute(pybamm.Parameter("C"), pybamm.Parameter("tau") / pybamm.Parameter("R"))
pybop_model = pybop.create_model(custom_model)
# ... use pybop_model to do the fitting (note |
Thanks Martin, this seems like an intuitive solution to the problem! Two questions:
|
There is a bunch of simplification code in pybamm, not sure it would work (i.e. cancel the R's) in this particular example. Something to look at and test I think.
Yea that would be nice. You could do it but it would require storing the args of custom_model = pybamm.SPM()
pybop_model = pybop.create_model(custom_model)
pybop_model.substitute(pybamm.Parameter("C"), pybamm.Parameter("tau") / pybamm.Parameter("R"))
# ... use pybop_model to do the fitting |
Sounds good! Thanks |
Hi, I've written an example (building on #533) that replaces the parameter I don't think the timescale is identifiable from this constant discharge data however, so to compare the numerical performance we would need to use more dynamic data (e.g. the pulse in this notebook). @MarkBlyth, I believe this example resolves case 2 (above) and that the method can be extended to the other cases as well, what do you think? |
Feature description
Okay slightly strange one here, but bare with me... It would be useful if it were possible to take the parameters proposed by PyBOP, and post-process them into the parameter set that PyBaMM sees. So, PyBOP optimises over a set of parameters, a post-processor does something to them, and the results are fed into a PyBaMM model.
There's ways around this already, eg. use a custom / standalone model, or subclassing a PyBOP model and overriding the
simulate
function to postprocess the parameters before they go off to PyBaMM. Neither of these are particularly convenient though, so it would be good to have the structure in PyBOP to natively handle this sort of parameter processing.Motivation
Three cases where I've found myself trying to do this, all in the context of fitting Thevenin models:
r0_at_soc_1
,r0_at_soc_0d9
, ..., and have a postprocessor build these into apybamm.Interpolant
from the pairs(SOC=1, R0=r0_at_soc_1)
,(SOC=0.9, R0=r0_at_soc_0d9)
, etc. This is useful for fitting linear interpolation flavoured functional parameters, since PyBOP can't optimise over apybamm.Interpolant
and the PyBaMM model doesn't natively take series resistance R0s as a list of scalars. Instead, the post-processor can act as a layer between PyBOP and PyBaMM, to close this gap.GaussianLogLikelihood
method. PyBOP can be used to identify the RC resistancePossible implementation
Something like an optional callback function in the optimiser class. Takes a dict of named PyBOP parameters, and outputs a dict of named PyBaMM parameters.
Additional context
No response
The text was updated successfully, but these errors were encountered: