In order to ensure that the NOx and NH3 emissions of diesel engines comply with the Euro VII emission standards, this paper optimizes the urea injection using a SCR model combined with the interior point method. First, the equations of the higher-order SCR model were simplified by the variable substitution method and the line method and solved by the backward difference formula to improve computational accuracy. The Levenberg-Marquardt algorithm was used to calibrate the chemical reaction rate parameters to optimize model performance. Second, an optimization cost function was designed to optimize the upstream NH3 concentration in combination with the interior point method and the higher-order SCR model to meet the requirements of Euro VII emission standards. Third, the model effect was verified by performing WHTC hot-start testing on an engine complying with the National VI emission standard. The results show that the average error between the measured NOx concentration and the calculated is 1.49 ppm, which verifies the high accuracy of the model. Finally, the effects of the interior point method, NSGA-II, and MOPSO algorithms in optimizing the upstream NH3 concentration were compared. The results showed that the interior point method outperformed the other algorithms in terms of optimization time and effect, with an optimization time of 149 s, a NOx conversion rate of 97.36 %, and an average downstream NH3 concentration of 4.65 ppm. This achieved a high NOx conversion rate and low NH3 slip in accordance with the requirements of the Euro VII regulation.