1. A system for controlling the movements of an industrial robot during a work cycle, wherein the robot visits and performs work on a plurality of workstations in a work cell during the work cycle, the system comprising: hardware configured to store a library of predefined workstations, wherein each of said predefined workstations comprises: a model of a real workstation including a specific type of machine or equipment at each workstation, preprogrammed code designed to control the robot so that the robot carries out a defined task at the workstation, wherein the code is related to the specific type of machine or equipment at the workstation, an entry point defining an entrance position to the real workstation, and at least one predefined path to be followed by the robot when carrying out the task at the real workstation, and a user interface configured to provide information about the predefined workstations and to permit an operator to select a set of workstations from the predefined workstations and to specify, before execution of the work cycle, a desired part flow between the selected workstations, and a scheduling unit that carries out during execution of the work cycle: scheduling an execution order for the selected workstations based on the desired part flow and information about external events, wherein the system is configured to receive information about external events during execution of the work cycle and adapt the scheduling of the execution order based on the information about external events during the work cycle, and controlling the movements of the robot based on the scheduled execution order and said predefined paths for the selected workstations.