In order to increase the efficiencies of petroleum production machines, a compound motor with double speeds has been developed in this paper. The compound motor is composed of a primary unit motor and an auxiliary unit motor in the same shaft, and can provide six grades of power. This is achieved by phase shift pole-changing, and by combining the operations of two unit motors. The performances in the four single operating states, and the two combining operating states must be taken together in the design. The mathematical model of the optimal design for the compound motor was established in the light of the nonlinear programming theory, and the Simulated Annealing Algorithm (SAA) is improved in this paper according to the practice of motor design. The model and the algorithm are applied to the practical calculation and excellent results have been achieved. The application shows that the method used in the paper can speed up the searching process of the optimization and thus be more useful for practical engineering.