Solenoid valves are widely used in mechatronics, robotic systems and industrial occasions. An accurate model is very important for the design and control of a solenoid valve. The dynamical model of the solenoid valve is difficult to obtain due to the complexity of the structure and the interaction of multiple physical fields. This paper proposes two kinds of model of solenoid valve: grey box model and black box model, on the basis of experimental data. ARX model is selected as the basic structure of the grey box model. After clustering the data with the fuzzy c-means algorithm, the overall experimental data is divided into several local linear sub-models, and the model coefficients of the local linear model are obtained by partial least square regression. The overall expression of the model is obtained by combining the local sub-models with membership degree. For the black box model, support vector regression algorithm is used to identify. On the basis of selecting the appropriate parameters, we obtain the black box model of solenoid valve based on data. For the above two models, we carry out experimental verification and error analysis, and compare with the traditional modelling method. According to the results, it can be seen that on the basis of the experimental data, using the data-driven method to construct the model has many advantages, avoiding complex physical analysis, and has high accuracy. The model with high precision will be used in the accurate control and observing estimation of the solenoid valve.