the present invention provides a method for controlling a linear motor with a number of improvements over the prior art . firstly it has a reduced size compared to the conventional linear motor of the type described in u . s . pat . no . 4 , 602 , 174 and thus reduces the cost . this change keeps the efficiency high at low to medium power output at the expense of slightly reduced efficiency at high power output . this is an acceptable compromise for a compressor in a household refrigerator which runs at low to medium power output most of the time and at high power output less than 20 % of the time ( this occurs during periods of frequent loading and unloading of the refrigerator contents or on very hot days ). secondly it uses a control strategy which allows optimally efficient operation , while negating the need for external sensors , which also reduces size and cost . while in the following description the present invention is described in relation to a cylindrical linear motor it will be appreciated that this method is equally applicable to linear motors in general and in particular also to flat linear motors see for example our co - pending international patent application no . pct / nz00 / 00201 the contents of which are incorporated herein by reference . one skilled in the art would require no special effort to apply the control strategy herein described to any form of linear motor . it will also be appreciated that the present invention will be applicable in any form of compressor . while it is described in relation to a free piston compressor it could equally be used in a diaphragm compressor for example , without any special modifications . one embodiment of the present invention , shown in fig1 involves a permanent magnet linear motor connected to a reciprocating free piston compressor . the cylinder 9 is supported by a cylinder spring 14 within the compressor shell 30 . the piston 11 is supported radially by the bearing formed by the cylinder bore plus its spring 13 via the spring mount 25 . the bearings may be lubricated by any one of a number of methods as are known in the art , for example the gas bearing described in our co - pending international patent application no . pct / nz00 / 00202 , or the oil bearing described in international patent publication no . wo00 / 26536 , the contents of both of which are incorporated herein by reference . equally the present invention is applicable to alternative reciprocation systems . for example while below a compressor is described with a combined gas / mechanical spring system , an entirely mechanical or entirely gas spring system can be used with the present invention . the reciprocating movement of piston 11 within cylinder 9 draws gas in through a suction tube 12 through a suction port 26 through a suction muffler 20 and through a suction valve port 24 in a valve plate 21 into a compression space 28 . the compressed gas then leaves through a discharge valve port 23 , is silenced in a discharge muffler 19 , and exits through a discharge tube 18 . the compressor motor comprises a two part stator 5 , 6 and an armature 22 . the force which generates the reciprocating movement of the piston 11 comes from the interaction of two annular radially magnetised permanent magnets 3 , 4 in the armature 22 ( attached to the piston 11 by a flange 7 ), and the magnetic field in an air gap 33 ( induced by the stator 6 and coils 1 , 2 ). a two coil embodiment of present invention , shown in fig1 and in isolation in fig2 has a current flowing in coil 1 , which creates a flux that flows axially along the inside of the stator 6 , radially outward through the end stator tooth 32 , across the air gap 33 , then enters the back iron 5 . then it flows axially for a short distance 27 before flowing radially inwards across the air gap 33 and back into the centre tooth 34 of the stator 6 . the second coil 2 creates a flux which flows radially in through the centre tooth 34 across the air gap axially for a short distance 29 , and outwards through the air gap 33 into the end tooth 35 . the flux crossing the air gap 33 from tooth 32 induces an axial force on the radially magnetised magnets 3 , 4 provided that the magnetisation of the magnet 3 is of the opposite polarity to the other magnet 4 . it will be appreciated that instead of the back iron 5 it would be equally possible to have another set of coils on the opposite sides of the magnets . an oscillating current in coils 1 and 2 , not necessarily sinusoidal , creates an oscillating force on the magnets 3 , 4 that will give the magnets and stator substantial relative movement provided the oscillation frequency is close to the natural frequency of the mechanical system . this natural frequency is determined by the stiffness of the springs 13 , 14 and mass of the cylinder 9 and stator 6 . the oscillating force on the magnets 3 , 4 creates a reaction force on the stator parts . thus the stator 6 must be rigidly attached to the cylinder 9 by adhesive , shrink fit or clamp etc . the back iron is clamped or bonded to the stator mount 17 . the stator mount 17 is rigidly connected to the cylinder 9 . in a single coil embodiment of the present invention , shown in fig3 current in coil 109 , creates a flux that flows axially along the inside of the inside stator 110 , radially outward through one tooth 111 , across the magnet gap 112 , then enters the back iron 115 . then it flows axially for a short distance before flowing radially inwards across the magnet gap 112 and back into the outer tooth 116 . in this motor the entire magnet 122 has the same polarity in its radial magnetisation . experiments have established that a free piston compressor is most efficient when driven at the natural frequency of the compressor piston - spring system . however as well as any deliberately provided metal spring , there is an inherent gas spring , the effective spring constant of which , in the case of a refrigeration compressor , varies as either evaporator or condenser pressure varies . the electronically commutated permanent magnet motor already described , is controlled using techniques including those derived from the applicant &# 39 ; s experience in electronically commutated permanent magnet motors as disclosed in international patent publication no . wo01 / 79671 for example , the contents of which are incorporated herein by reference . when the linear motor is controlled as described in wo01 / 79671 it is possible that the compressor input power increases to a level where the excursion of the piston ( 11 , fig1 ) results in the collision with the cylinder ( 9 , fig1 ). when this occurs ( the first collision 302 ) the piston reciprocation period 300 is reduced compared to the filtered or smoothed value 308 . more importantly because the piston period is made up of two half periods 304 , 306 , between bottom dead centre and top dead centre , the half periods are not symmetrical . the half period moving away from the head 304 is shorter than the half period moving towards the head 306 , although both half periods are reduced in time whenever a piston collision occurs ( second collision 310 ). in the preferred embodiment of the present invention the half period times are monitored and when any reduction in the half period times is detected the input power is reduced in response . it will also be appreciated the present invention is equally applicable to a range of applications . it is desirable in any reciprocating linear motor to limit or control the maximum magnitude of reciprocation . for the present invention to be applied the system requires a restoring force eg : a spring system or gravity , causing reciprocation , and some change in the mechanical or electrical system which causes a change in the electrical reciprocation period when a certain magnitude of reciprocation is reached . in the preferred embodiment of the present invention , shown in fig4 back emf detection is used to detect the electrical period of reciprocation . as already described the current controller 208 receives inputs from the compressor 210 , the back emf detector 204 and the collision detector 206 . while in the preferred embodiment of the present invention the current controller 208 , the back emf detector 204 and the collision detector 206 are implemented in software stored in the microprocessor 212 , they could equally be implemented in a single module or in discrete analogue circuitry . the collision detector 206 receives the electrical period data from the back emf detector 204 allowing it to detect overshoot , or more specifically collision of the piston with the cylinder . the current controller 208 adjusts the maximum current through the duty cycle applied by the drive circuit 200 to the stator winding 202 . example waveforms in a linear motor employing the present invention are seen in fig6 . the stator winding voltage is fully positive 400 for a time t on ( ex ) during the beginning of the expansion stroke . with the voltage removed the current 402 decays to zero over time t off1 ( ex ) , with the stator winding voltage forced fully negative 403 by the current flowing in the windings . for the remainder of the expansion stroke , time t off2 ( ex ) the winding voltage represents the back emf 404 , and the zero crossing thereof zero velocity of the piston at the end of the expansion stroke . a similar pattern occurs during the compression stroke , rendering a time t off2 ( comp ) relating to the zero crossing of the back emf 406 during compression , from which the reciprocation time can be calculated . the process the collision detector 206 uses in the preferred embodiment to detect a collision is seen in fig5 . using the back emf zero crossing data successive half period times are stored 504 and a smoothed or filtered value for each half period is calculated 500 , 502 . these averages are summed 506 and the sum is monitored for an abrupt reduction 508 . because of a signal noise caused for various reasons it is not safe to consider one transient reduction as indicative of a piston collision . accordingly the variable b is preferably set at five successive cycles . the threshold difference value a is preferably set at 30 microseconds . when a collision is detected ( 510 , fig5 ), the current controller ( 208 , fig4 ) decreases the current magnitude . the reductions to the current and thus input power to the motor are reduced incrementally . once the collisions stop , the current value is allowed to slowly increase to its previous value over a period of time . preferably the period of time is approximately 1 hour . alternatively the current will remain reduced until the system variables change significantly . in one embodiment where the system in wo01 / 79671 is used as the main current controller algorithm , such a system change might be monitored by a change in the ordered maximum current . in that case it would be in response to a change in frequency or evaporator temperature . in the preferred embodiment the combination of that algorithm with the present invention providing a supervisory role provides an improved volumetric efficiency over the prior art .