Camshaft is one of the key components of vehicle engines. In this paper, an independent optimization and simulation module for camshaft grinding was developed. First an optimization algorithm based on the least square method was proposed according to the constant linear velocity mathematical model of the camshaft. The algorithm can be used to smooth speed curves and improve machining efficiency and accuracy. Then the real time dynamic simulation of the camshaft grinding process was finished to perform the machining status according to the optimized motion path of the process system components.