The star simulator was designed to simulate the physical characteristics of real stars. Due to the different color temperatures and magnitudes of different stars, in order to simulate stars more realistically, a starlight source simulation system was required to achieve large-scale high-precision adjustment of color temperature and magnitude. The system consisted of an integrating sphere, light source module, control module and fiber spectrometer to form a closed-loop light source simulation system. In order to ensure the uniformity of the emitted light, a bromotungsten lamp and a variety of monochromatic LED mixed light were used as the light source, and the output brightness of the LED was controlled by constant current driving. The quantum behavior particle swarm algorithm was introduced as the spectrum matching algorithm to solve the LED coefficient ai. As the number of iterations increases, and the value of the fitness function reached the minimum, the simulation error of color temperature and magnitude became smaller. Experimental verification: The range of color temperature was 3 000, 4 300, 5 500, 6 500, 7 600, 20 000 K, the color temperature matching error was better than ±10%; the range of simulated magnitude was +2-+8.5 Mi, and the magnitude matching error was better than ±6%.