With the changes of composition about railway freight and car, the development process from small to big was experienced to many marshalling stations. Various possible schemes were faced when stations were expanded, how to choose so as to minimize the total investment for all stages was concerned by the decision makers. Based on the actual development, the dynamic planning model was built. Minimizing the total investment in the design stages was the objective function, subject to three groups: first is the sorting capacity was to meet the demand, second was the utilization of sorting capacity was not too low, the last was the capacity was larger and larger. Taking into account the difficulty of solving model directly, this model is transformed into shortest path model. The specific solution is expounded through an example application, the use area of the model is described in the end.