Generation of Co-simulation Algorithms Subject to Simulator Contracts