A method of controlling an electric linear motor with a control apparatus, which electric linear motor comprises a longitudinal stator beam; at least one mover (24, 26) adapted to move along the stator beam; which stator beam comprises at least two side faces (6A, 6B; 6C, 6D) located at opposite sides of the stator beam, each of the side faces (6A, 6B; 6C, 6D) carrying ferromagnetic poles spaced apart by a pitch, and which mover comprises at least two counter-faces (7A, 7B; 7C, 7D) facing the respective side faces (6A, 6B; 6C, 6D) of the stator beam, wherein the mover has in at least one of said counter-faces (7A, 7B; 7C, 7D) at least one rotor unit (2, 3, 4, 5) having at least one winding (74, 76) and at least one permanent magnet, which are arranged to co-act with the ferromagnetic poles of the respective side face (6A, 6B; 6C, 6D) of the stator beam, and which control apparatus comprises at least one drive unit (9, 10, 11, 12) configured to supply electrical power to the respective at least one rotor unit (2, 3, 4, 5) of the mover (24, 26), the method comprising - obtaining position information (X act) of the mutual position of the ferromagnetic poles and the at least one rotor unit (2, 3, 4, 5) facing said ferromagnetic poles, the position information being obtained in the travelling direction (x) of the rotor unit (2, 3, 4, 5) - representing d, q -coordinate system of said at least one rotor unit (2, 3, 4, 5) by means of the position information (X act) such that the d-axis of said rotor unit is in the direction of the ferromagnetic poles facing the rotor unit and the q-axis is orthogonal to the d-axis - obtaining information of length of air gap (Y act) between the ferromagnetic poles and the at least one rotor unit (2, 3, 4, 5) facing said ferromagnetic poles - supplying, by means of the at least one drive unit (9, 10, 11, 12) a d-axis current component to the at least one winding of the at least one rotor unit (2, 3, 4, 5) to adjust the length of air gap towards given reference value (Y ref), wherein the d-axis current component is established based on the difference between air gap reference value (Y ref) and obtained air gap length information (Y act) - obtaining travel position information and / or travel speed information of the mover (24, 26) - feeding with the at least one drive unit (9, 10, 11, 12) to the at least one winding of the at least one rotor unit (2, 3, 4, 5) a q -axis current component based on the difference between travel position reference (x ref) and obtained travel position information (X act) and / or travel speed reference (v ref) and obtained travel speed information (v act) to adjust the travel position and / or speed towards said position and / or speed reference (x ref,v ref) - changing at least one of d-axis current component (i d) and q-axis current component (i q) of a rotor unit (2, 3, 4, 5) responsive to change of at least one of travel position information x act, travel speed information (v act) and air gap length information (Y act) characterised by: - when changing the at least one of d-axis current component (i d) and q-axis current component (i q), providing at the same time a correction term to the other of the d-axis current component (i d) and the q-axis current component (i q) to compensate the effect of change to the attraction force and / or propulsion force of the mover. - obtaining position information (X act) of the mutual position of the ferromagnetic poles and the at least one rotor unit (2, 3, 4, 5) facing said ferromagnetic poles, the position information being obtained in the travelling direction (x) of the rotor unit (2, 3, 4, 5) - representing d, q -coordinate system of said at least one rotor unit (2, 3, 4, 5) by means of the position information (X act) such that the d-axis of said rotor unit is in the direction of the ferromagnetic poles facing the rotor unit and the q-axis is orthogonal to the d-axis - obtaining information of length of air gap (Y act) between the ferromagnetic poles and the at least one rotor unit (2, 3, 4, 5) facing said ferromagnetic poles - supplying, by means of the at least one drive unit (9, 10, 11, 12) a d-axis current component to the at least one winding of the at least one rotor unit (2, 3, 4, 5) to adjust the length of air gap towards given reference value (Y ref), wherein the d-axis current component is established based on the difference between air gap reference value (Y ref) and obtained air gap length information (Y act) - obtaining travel position information and / or travel speed information of the mover (24, 26) - feeding with the at least one drive unit (9, 10, 11, 12) to the at least one winding of the at least one rotor unit (2, 3, 4, 5) a q -axis current component based on the difference between travel position reference (x ref) and obtained travel position information (X act) and / or travel speed reference (v ref) and obtained travel speed information (v act) to adjust the travel position and / or speed towards said position and / or speed reference (x ref,v ref) - changing at least one of d-axis current component (i d) and q-axis current component (i q) of a rotor unit (2, 3, 4, 5) responsive to change of at least one of travel position information x act, travel speed information (v act) and air gap length information (Y act) - when changing the at least one of d-axis current component (i d) and q-axis current component (i q), providing at the same time a correction term to the other of the d-axis current component (i d) and the q-axis current component (i q) to compensate the effect of change to the attraction force and / or propulsion force of the mover.