In a method and a device for determining a reference position of a locking part moved by an electric motor, the locking part is moved in the direction of the closed state thereof, until the same reaches a stop position. At that location the meter reading of a position meter describing the stop position is detected and buffered. Subsequently a movement of the locking part is carried out in the direction of the opened state thereof. The locking part is then moved again in the direction of the closed state thereof, until it again reaches a stop position. At that location a meter reading describing the stop position is detected, and compared to the buffered meter reading. If both meter readings agree, the first stop position is determined as the reference position. The method and device can be utilized, for example, for power window lifts and sunroofs of motor vehicles.

CROSS-REFERENCE TO RELATED APPLICATIONS 
       [0001]    This application is a U.S. National Stage Application of International Application No. PCT/EP2008/064591 filed Oct. 28, 2008, which designates the United States of America, and claims priority to German Application No. 10 2008 003 580.7 filed Jan. 9, 2008, the contents of which are hereby incorporated by reference in their entirety. 
     
    
     TECHNICAL FIELD 
       [0002]    The invention relates to a method and a device for determining a reference position of a locking part moved by an electric motor. 
       BACKGROUND 
       [0003]    This locking part typically involves a side window of a motor vehicle driven by an electric motor or the sliding roof of a motor vehicle or a garage door driven by electric motor. 
         [0004]    Window lift systems and sliding roof system of motor vehicles are often equipped with an anti-trap mechanism. The function of this mechanism is for example to avoid a hand of a person becoming trapped or to limit the closing force. This anti-trap mechanism includes a mechanical system and control electronics in each case. 
         [0005]    Position information is determined during a movement of the locking part in the direction of its opened or its closed state. This information is typically determined using Hall sensors, which detect the rotation of the rotor shaft of the electric motor driving the locking part and output the rotational speed pulses to the control electronics. 
         [0006]    In order to obtain a reference position for the position determination specified above, it is already known that the locking part can be moved for example in the direction of its closed state until it reaches a stop position and this stop position can be used as the reference position. 
         [0007]    To enable this type of system to be constructed in a simple and cost-effective manner often only a stop position on one side is used, corresponding for example to the closed state of the locking part. 
         [0008]    With such a system the problem arises of ensuring that the stop of the looking part actually involves a stop at a mechanical resistance defining the closed position of the locking part and not the locking part stopping against a foreign body, for example a hand of a person. If the stop involves the stop at a foreign body then an incorrect position is fixed as the reference position. This leads to the movement path of the locking part assumed by the control device differing from the actual existing movement path. This can lead to a malfunction of the system, with damage or even destruction of mechanical and/or electrical components of the system also occurring as a result of this malfunction. Injuries to a person whose hand for example gets in the way of a closing motor vehicle window can also not be excluded if the reference position is incorrectly fixed for position measurement. 
         [0009]    A method for operating an electric motor-driven window lift for a motor vehicle is known from DE 44 32 955 C2. With this known method, after a button is pressed for the window lift movement the reaching of the window closed position is determined by a motor-stopped sensor. Furthermore an automatic surplus force limitation is provided which on activation initiates stopping and reversing of the direction of the window lift movement. Furthermore in special operating cases such as the end of a power failure for example, signals are generated to restore normal operation. In addition, to make do without a further button for establishing normal operation, first signals which represent the special operation cases and second signals which represent predetermined sequences of actuations of the button for restoring normal operation are fed to a motor controller with memory facilities. 
       SUMMARY 
       [0010]    According to various embodiments, a method and a device for determining a reference position of a locking part moved by an electric motor can be specified in which an incorrect fixing of a reference position is avoided. 
         [0011]    According to an embodiment, a method for determining a reference position of a locking part moved by an electric motor, may comprise the following steps: S 1 : Moving the locking part in the direction of its closed state while simultaneously changing the counter state of a position counter until a first stop position of the locking part is reached, S 2 : Detecting and buffering the counter state of the position counter describing the first stop position, S 3 : Moving the locking part in the direction of its opened state, S 4 : Moving the locking part in the direction of its closed state again until a second stop position is reached, S 5 : Detecting a counter state of the position counter describing the second stop position, S 6 : Checking whether the counter states describing the two stop positions match, and S 7 : Fixing the first stop position as the reference position if a match between the counter states is recognized. 
         [0012]    According to a further embodiment, a match between the counter states can be recognized as existing if the difference between the two counter states is less than a predetermined threshold value. According to a further embodiment, According to a further embodiment, an anti-trap mechanism can be activated before the locking part is moved in the direction of its closed state. According to a further embodiment, the movement of the locking part in the direction of its closed state until a stop is reached may be repeated a number of times. According to a further embodiment, the movement of the locking part in the direction of its closed state until it reaches a stop may be repeated a number of times with changed parameters of the anti-trap mechanism, before the reference position is fixed. According to a further embodiment, the method may be ended if there is no match between the two counter states. According to a further embodiment, the method may be executed again if the two counter states do not match. According to a further embodiment, the method may be executed again with changed parameters of the anti-trap mechanism if the two counter states do not match. 
         [0013]    According to another embodiment, in a device for determining a reference position of a locking part moved by an electric motor, with a motor movement detection device, a position counter and a control unit, the control unit can be provided for controlling the following steps: S 1 : Moving the locking part in the direction of its closed state while simultaneously changing the counter state of a position counter until a first stop position of the locking part is reached, S 2 : Detecting and buffering the counter state of the position counter describing the first stop position, S 3 : Moving the locking part in the direction of its opened state, S 4 : Moving the locking part in the direction of its closed state again until a second stop position is reached, S 5 : Detecting a counter state of the position counter describing the second stop position, S 6 : Checking whether the counter states describing the two stop positions match, and S 7 : Fixing the first stop position as the reference position if a match between the counter states is recognized. 
         [0014]    According to a further embodiment of the device, the control unit may recognize a match between the counter states as being present if the difference between the two counter states is less than a predetermined threshold value. According to a further embodiment of the device, the control unit may activate an anti-trap mechanism before moving the locking part in the direction of its closed state. According to a further embodiment of the device, the control unit may repeat the movement of the locking part in the direction of its closed state until it reaches a stop a number of times. According to a further embodiment of the device, the control unit may repeat the movement of the locking part in the direction of its closed state until it reaches a stop a number of times with changed parameters of the anti-trap mechanism before fixing the reference position. According to a further embodiment of the device, the control unit may end the method if there is no match between the two counter states. According to a further embodiment of the device, the control unit may carry out the method again if there is no match between the two counter states. According to a further embodiment of the device, the control unit may carry out the method again with changed parameters of the anti-trap mechanism if there is no match between the counter states. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0015]    Further advantageous characteristics of the invention emerge from explanation of examples which refer to the figures. The figures show: 
           [0016]      FIG. 1  a block diagram of a device for determining the reference position of a locking part of a motor vehicle moved by an electric motor and 
           [0017]      FIG. 2  a flow diagram to illustrate a method for determining a reference position of a locking part of a motor vehicle moved by an electric motor. 
       
    
    
     DETAILED DESCRIPTION 
       [0018]    The advantages of the various embodiments lie especially in the fact that setting an incorrect reference position is prevented. Furthermore the various embodiments make possible the use of an anti-trap system even during determination of the reference position. The method according to various embodiments can execute automatically. No user activity is required for executing the method, in particular a button does not need to be pressed. For example the method can be activated automatically within the framework of a diagnostic task in automotive plants and motor vehicle workshops. A method in accordance with various embodiments can also be executed in conjunction with learning processes of the force curves of window lift systems and sliding roof systems, with these learning processes able to be carried out in the plant but also as part of a subsequent visit by the motor vehicle to a workshop. 
         [0019]    To cater for any slight tolerances which may arise, in the claimed method a matching of the counts of the position counter is recognized as being present if the difference between the counts compared to one another is less than a predetermined threshold value. 
         [0020]    To increase the security of a correct fixing of the reference position the locking part is advantageously moved a number of times in the direction of its closed state and the associated counter state of the position counter on reaching the respective stop is evaluated. 
         [0021]    This repeated movement of the locking part in the direction of its closed state can advantageously be repeated a number of times with changed parameters of the anti-trap system especially with anti-trapping which increases from closing process to closing process. This means that the probability of the occurrence of injuries to a person placing their hand in the path of the locking part is reduced. 
         [0022]    If in the claimed method, as part of the check as to whether the counter states of the position counter compared to one another match, no match is determined, then this method can be ended or automatically carried out once again or carried out once again with changed parameters of the anti-trap mechanism. 
         [0023]      FIG. 1  shows the block diagram of a device for determining a reference position of a locking part of a motor vehicle moved by an electric motor. In the exemplary embodiment shown this locking part involves the window pane provided in the driver's door of the motor vehicle. The raising and lowering of this window pane is undertaken by means of an electric motor which has a stator and a rotor. 
         [0024]    The rotor contains a rotor shaft  1  to which a generator wheel  1   a  is fixed non-rotationally. The generator wheel  1   a  has coding sectors or poles. When the rotor shaft with the generator wheel attached to it is turned impulse signals are detected by a sensor array  2  and fed to a control unit  3  which is formed by a microcomputer. The control unit  3  changes the position count stored in a position counter  4  each time an impulse is received so that the count of the position counter  4  always exactly describes the instantaneous position of the window pane. 
         [0025]    The control unit  3  is connected via a bus  7  to one or more further control units of the motor vehicle. 
         [0026]    Furthermore the device shown features a first memory  5 . This memory  5  is a non-volatile memory, for example an EEPROM. Data is stored in this first memory  5  which corresponds to a force-travel reference curve. This data has already been determined during the manufacturing of the motor vehicle in the plant and is stored in non-volatile form in the first memory  5 . This data is individually assigned to the respective window lift drive and contains information about the force which must be applied by the motor at a particular window position to close the respective window pane. 
         [0027]    Furthermore the device shown in the figure has a second memory  6 . This can involve a volatile memory, for example a RAM or the main memory of the control unit  3  realized as a microcomputer. Stored in the second memory  6  is a force-travel actual value curve determined during motor vehicle operation for each opening and closing of the window pane. 
         [0028]    The control unit  3  uses the force-travel reference curve stored in the first memory  5  and the force-travel actual value curve stored in the second memory  6  to check whether counter errors have occurred during operation in relation to the counting of the pulses output by the sensor array  2 , which have led to an incorrect count state of the position counter  4 . If such a count error is detected it is compensated for by the control unit  3 . 
         [0029]    As an alternative, actual values determined can also be compared with the stored reference curve in order to establish whether count errors have occurred. 
         [0030]    To determine the said force-travel reference curve a normalization of the system is first required, i.e. a determination of a reference position of the window pane moved by the electric motor. This reference position at which the counter state of the position counter  4  is preferably set to the value 0, is the closed state of the window pane in the exemplary embodiment shown. 
         [0031]    The starting point for the determination of this reference position is for example the open state of the window pane and this will be explained in greater detail below with reference to  FIG. 2 . 
         [0032]    Starting from the open state of the window pane, under control by the control unit  3  in a step S 1  the window pane is moved in the direction of its closed state until such time as it reaches a first stop position. During this closing movement of the window pane the counter state of the position counter  4  is reduced depending on the position impulses provided by the sensor array  2 . 
         [0033]    If the first stop position is reached the control unit  3  detects in a step S 2  the counter state of the position counter  4  describing the first stop position and stores this counter state in a buffer. This buffering of the counter state describing the first stop position is undertaken for example in a main memory of control unit  3 . 
         [0034]    After this buffering of the counter state describing the first stop position, in a step S 3 , the control unit  3  controls a movement of the locking part in the direction of its opened state. This movement can be undertaken until the opened state is reached. During this opening movement of the window pane the counter state of the position counter  4  is increased depending on the position impulses provided by the sensor array  2 . 
         [0035]    Then, in a step S 4 , the control unit  3  controls a renewed movement of the window pane in the direction of its closed state until such time as a second stop position is reached. During this renewed closing movement of the window pane the counter state of the position counter  4  is again reduced depending on the position impulses provided by the sensor array  2 . 
         [0036]    If the second stop position is reached, the control unit  3  detects in a step S 5  the counter state of the position counter  4  describing the second stop position. 
         [0037]    Then the control unit  3  checks in a step S 6  whether the counter state belonging to the first stop position matches the corresponding counter state of the second stop position or not. Within the framework of this checking a small tolerance is preferably permitted, which is expressed by a predetermined threshold value. If the control unit  3  detects that the difference between the two counter states is smaller than the predetermined threshold value, it then recognizes a match between the two counter states and in accordance with a subsequent step S 7  it fixes the first stop position as a reference position. This reference position is assigned a new counter state  0  by the control unit  3 . This new counter state  0  is also transferred as a reference counter state into position counter  4  and serves as an initial counter state for all subsequent window movements. 
         [0038]    The method then moves to step S 8  which represents the end of the method. 
         [0039]    If the control unit  3  detects in step S 6  however that the counter state corresponding to the first stop position does not match the counter state corresponding to the second stop position, a branch is made directly to step S 8  which represents the end of the method. 
         [0040]    The method described above has the following effects on the determination of the reference position of a locking part of a motor vehicle moved by an electric motor: 
         [0041]    If in step S 1  the locking part is moved into its closed state without encountering an obstacle beforehand, then the first stop position corresponds to the closed state of the locking part. If the locking card is then moved after execution of steps S 2  and S 3  in step S 4  anew into its closed state, without encountering an obstacle beforehand, then the result of the check conducted in step S 6  is that the two stop positions match and the control unit  3  fixes the first stop position which matches the second stop position in the correct manner as the reference position. 
         [0042]    If on the other hand an obstacle, for example the hand of a mechanic or any other undesired obstacle, gets in the way of the closing window pane, then the first stop position does not involve the desired closed state of the locking part. This undesired obstacle can be pulled out of the path of the locking part during or after the execution of step S 3 . A result of this is that in step S 4  the locking part arrives at a second stop position which corresponds to the desired closed state of locking part. In this case the second stop position is assigned a counter state other than that assigned to the first stop position. This is detected by the control unit  3  in step S 6 , so that the method branches directly from step S 6  to step S 8 , i.e. to the end of the method. The result advantageously achieved by this is that no incorrect position is fixed as the reference position. 
         [0043]    To avoid injury if the hand of the mechanic becomes trapped or to avoid damage to the mechanics of the motor vehicle if any other obstacle becomes trapped, in an advantageous manner the movement of the locking part in the direction of its closed state in steps S 1  and/or S 4  can be undertaken with an anti-trap facility controlled by the control unit  3  whereby for a movement of the locking part with a closing force movement no motor blocking must occur in the event of coming up against a stop 
         [0044]    Furthermore in accordance with an embodiment, the closing and opening processes of the window as well as the subsequent checking by the control unit can be undertaken several times in succession in order to further reduce the probability of the reference position not being correctly fixed. With this multiple execution of the closing and opening processes of the window the anti-trapping can be increased from step to step up to a desired final value. 
         [0045]    In accordance with the exemplary embodiment described above, in the event of the two counter states not matching in step S 6 , a branch has been made to step S 8  in order to end the method. In accordance with another exemplary embodiment not depicted in the figures, the control unit  3  in the event of the two counter states not matching, can also initiate an automatic restart of the method. This can if necessary be undertaken with changed parameters of the anti-trap mechanism.