Simulation-driven optimization of real-time control tasks