1. A computer-implemented method for identifying model parameters including system parameters and Kalman gain parameters in a dynamic model of a building system, the method comprising: receiving, at a controller for the building system, training data including input data and output data, wherein the input data includes a setpoint applied as a controlled input to the building system, wherein the output data measures a state or linear combination of states of the building system in response to both the setpoint and an extraneous disturbance, wherein the extraneous disturbance comprises an uncontrolled thermal input to the building system that affects the state or linear combination of states measured by the output data; performing, by the controller, a two-stage optimization process to identify the system parameters and the Kalman gain parameters, the two-stage optimization process comprising: a first stage in which the controller filters the training data to remove an effect of the extraneous disturbance from the output data and uses the filtered training data to identify the system parameters, wherein the system parameters describe energy transfer characteristics of the building system, and a second stage in which the controller uses the non-filtered training data to identify the Kalman gain parameters, wherein the Kalman gain parameters account for the extraneous disturbance; and using the dynamic model to generate, by the controller, a new setpoint for the building system, wherein the building system uses the new setpoint to affect the state or linear combination of states measured by the output data.