Model-based design for seizure control by stimulation