Modelling cosmic ray electron physics in cosmological smoothed particle hydrodynamics simulation