A method of determining a motor-dependent commutation model for an electromagnetic motor, whereby the electromagnetic motor comprises a first member comprising a coil array comprising at least M coils, and a second member comprising an array of magnets configured to generate a spatially alternating magnetic field, whereby the first member and the second member are configured to displace relative to each other in N degrees of freedom, N<M, by supplying the at least M coils with respective at least M currents Im, thereby generating forces in the N degrees of freedom, the method comprising:
- obtaining a commutation model G for the electromagnetic motor, the commutation model G providing a relationship between desired forces Fc in the N degrees of freedom and the at least M currents Im applied to the coil array by Im=G*Fc;
- defining an N×N motor-dependent compensation matrix A;
- operating the electromagnetic motor by performing a predetermined displacement by:
- determining the desired forces Fe to realise the predetermined displacement;
- determining the at least M currents Im for the coil array by Im=G*Fc;
- and
- applying the at least M currents Im to perform the predetermined displacement;
- determining actual forces Fm in the N degrees of freedom occurring during the predetermined displacement;
- determining the compensation matrix A based on Fc=A*Fm;
- and
- obtaining the motor-dependent commutation model as G*A,
- wherein performing the predetermined displacement comprises performing a displacement at a substantially constant speed along a predetermined trajectory and superimposing a substantially sinusoidal force variation during the displacement.