Modeling and test of an absolute four-degree-of-freedom (DOF) grating encoder