feat(solvers): add max_wall_time for solver timeout handling
Description
This PR introduces a max_wall_time parameter to the BaseSolver class, with support extended to child classes like CasadiSolver and IDAKLUSolver. The parameter enables wall-clock timeout handling to stop solver steps if they exceed a set time limit, avoiding prolonged hangs. It is optional (default None, meaning no limit) and specified in seconds. When enabled, the solver records the start time and checks elapsed time in BaseSolver.step() using time.time(). If the limit is reached, it raises a SolverError ("Wall time limit exceeded during step") and retains partial Solution objects for analysis. Users can set it during solver creation (e.g., CasadiSolver(max_wall_time=3600)) or pass it via **kwargs in Simulation.solve(). In experiment runs, the _solve_steps() method re-raises timeout errors for clear handling, while logging others as standard.
No specific issue is resolved; this is a new enhancement for solver stability.
Fixes #5161
Type of change
This is an enhancement adding timeout functionality to solvers and simulations.
max_wall_time parameter to BaseSolver.init() (propagated to child solvers CasadiSolver and IDAKLUSolver), enabling optional wall-clock timeout checks in BaseSolver.step() using time.time(); raises SolverError on exceedance while preserving partial Solution objects for analysis; supports setting via Simulation.solve(**kwargs) and clean re-raising in Simulation._solve_steps() for experiments
Important checks:
- [x] No style issues:
nox -s pre-commit - [x] All tests pass:
nox -s tests - [x] Tests added that prove fix is effective or that feature works (new
TestWallTimeTimeoutclass with 3 tests: normal SPM run without timeout, timeout via solver init on long experiment, timeout viasolve()kwarg—all pass withpytest -v)