Add forward simulation method
Closed this issue · 0 comments
BradyPlanden commented
Feature description
Add a simple simulation class for synthetic data generation used in tests and benchmarking.
Motivation
No response
Possible implementation
Built in BaseModel
, this would provide functionality for the pybamm models; however, internal models such as a future EHM implementation would need their own definition of the pybamm.Simulation
class. Given pybop follows the pybamm model class structure, it might be relavently simplistic to use the pybamm.Simulation class (will be brittle to pybamm changes though).
def sim(self, experiment=None, parameter_set=None):
"""
Simulate the model
"""
self.parameter_set = parameter_set or self.parameter_set
if self._built_model is None:
raise ValueError("Model must be built before simulating")
return pybamm.Simulation(
self._built_model,
experiment=experiment,
parameter_values=self.parameter_set
)
Example usage:
model = pybop.model.lithium_ion.spm()
synthetic_sim = model.sim()
term_V =synthetic_sim.solve()["Terminal voltage [V]"].data
Additional context
No response