A framework for the co-simulation of engine controls and task scheduling