Wave energy is a renewable clean and resources for ships. According to the rolling characteristics of merchant ships, this research designs an energy recovery device installed on the ship deck to harvest the energy generated by waves. And a typical 50,000-ton ship is selected as the experimental platform of the device. The mathematical model is established and solved by Newmark-β method, and a simulation platform is built in MATLAB. By simulating the movement of the slider in the device, it shows that the slider can realize reciprocating motion when the ship rolls continuously. Then, the relevant parameters in different combinations of natural frequency and damping ratio ε are calculated, the power output of the device and the motion law of the slider are analyzed, and parameters' variable curves are drawn in figures. A reasonable combination of =1.225 Hz, ε =0.0612 and a relatively ideal average power (174.11 W) are found by comparing amounts of simulated results from typical sea conditions. It is indicated that four main factors affecting the power generation of the device include the elasticity coefficient K, effective damping coefficient C in the device, the ship rolling period and rolling angle. Besides, the device can still output power continuously by simulation in complex sea condition. Based on the research, it is proved that the device mentioned in this study has good feasibility in generating electric energy during ship rolling, which can provide valuable ideas for the application of wave energy in ships on voyage.