1. A method for generating code for a closed-loop controller, comprising: receiving input for a simulation model in a data processing system, the simulation model including a sensor; concurrently executing the simulation model and control code for a simulated physical controller in the data processing system, the control code interacting with the simulation model according to a state of the sensor; generating revised control code, by the data processing system, based on the executed simulation model and control code; generating controller-specific control code based on the revised control code by the data processing system; and executing the simulation model and the controller-specific control code, the controller-specific control code interacting with the simulation model.