Login| Sign Up| Help| Contact|

Patent Searching and Data


Title:
CONTROL SYSTEM FOR DIRECT-CURRENT ELECTRICS MOTORS
Document Type and Number:
WIPO Patent Application WO/2005/019946
Kind Code:
A2
Abstract:
System for control of brush DC motors, with reversible operation, based on the determination of the angular or linear, absolute or relative position of the mobile device (2) moved by the motor (1) through direct and continous reading of motor´s electrical current in converter (3) and processing it directly by a specific software running on a microcontroller (4) or microprocessor, to give processor decision (8) to the actuator (7), bringing a more precise control of the movement to the mobile device (2) including the determination of the residual and fractional movement during motor braking, during motor starting, providing also a more precise and fast detection of obstacles to the movement to anti-pinch and motor protection.

Inventors:
LOSS LUIS HENRIQUE (BR)
Application Number:
PCT/BR2004/000146
Publication Date:
March 03, 2005
Filing Date:
August 09, 2004
Export Citation:
Click for automatic bibliography generation   Help
Assignee:
JCAE DO BRASIL LTDA (BR)
LOSS LUIS HENRIQUE (BR)
International Classes:
G01P3/44; H02P5/00; G05B; (IPC1-7): G05B/
Domestic Patent References:
WO2003063318A12003-07-31
Foreign References:
EP0582966A11994-02-16
EP1306511A12003-05-02
US20020180389A12002-12-05
Attorney, Agent or Firm:
LLC INFO CONNECTION LTDA. (RM 312, -001 RIO DE JANEIRO, BR)
Download PDF:
Claims:
CLAIMS
1. System for control of movement and/or positioning through DC brush electric motors (1), with the determination of angular or linear, relative or absolute position, of device (2) moved by motor (1), through the direct and continuous reading of the current sunk from this motor (1) and processing of this analogical current information, characterized for being processed directly by software (6) at a microprocessor or microcontroller (4) and an internal or external analog to digital converter, allowing the precise control of the movement and/or positioning of device moved (2) by this motor (1), the detention of eventual obstacles to prevent crushing and protection of the motor (1), this system is constituted by the elements: . A direct. current electric motor (1) of reversible turn, multipolar and brushed; . A mobile device (2), driven by the motor, such as mechanisms of automotive electric window, solar ceilings, adjustable back mirrors, adjustable seats, screens of DVD or monitors, gates and electric doors, sliding doors of elevators, windows, as well as any device set moved by DC electric motor (1); . A way (3) to convert the motor current into electric signal readable by an analog to digital converter; . A microcontroller or microprocessor (4) with memory (6) and analogical to digital converter (5) which receives proportional electric signal from the motor current (1) ; . An actuator circuit (driver) (7) that supplies positive or negative voltage to the motor (1), controlled or not directly from the microcontroller/ microprocessor (4); . A way (8) to command the toward or backward movement of the electric motor (1) in order to move the mobile device (2) ; . A resident software in the memory (6) that controls the hardware, based on the algorithms (1) to (6), being able to switch on or off the motor (1) in response to the commands from the keyboard keys of movement motor (8), monitoring the continuous movement of the mobile device (2), calculating its precise position, until its final or initial course, with fast and efficient anti. crushing, taking as input data only the continuous and fast motor (1) current reading ;.
2. System, in accordance to claim 1, characterized by the fact that the undulation measurement and moved device position is obtained entirely through the algorithms described here, running on the software at memory (6).
3. System, in accordance to claim 2, characterized by, an algorithm 1 (floating histeresys) which, after the departure and before the braking of the motor, keeps a monitoring and counting to each moment that the analogical signal of undulation current motor (1) changes more than a pre. stablished value (histeresys) in relation to the last positive or negative peak, updading the displacement of the mechanism (2).
4. System, in accordance to claim 1, characterized by the accurate position determination of the mobile device (2) based on the number of current undulations of motor (1) through the algorithm 1 and algorithm 2.
5. System, in accordance to claim 4, characterized by an algorithm that calculates the displacement on departure of motor (1) based on an initial constant acceleration.
6. System, in accordance to claim 4, characterized by an algorithm (6) that calculates the relative position of the mechanism (2) in relation to the reference, taking the displacements of each movement (start + movement + braking).
7. System, in accordance to claim 1, characterized by the fact that the crushing detection and protection is based on the variation of current of the motor (1) compared to a minimum slope and time, adjusted by constants K1 and K2, through algorithm 2.
8. System, in accordance to claim 7, characterized by the algorithm that quickly detects variations at current level by means of comparisons with the immediately previous current levels, and if it variation has increased by a rate above a pre. defined limit, it immediately commands the inversion of the direction of movement to release the crunched object.
9. System, in accordance to claim 7, characterized by the use of security routines in order to guarantee that the system finds the crushing condition through the algorithm 2 steps 140 to 156.
10. System, in accordance to claim 1, characterized by the control of the braking of the electric motor (1) stopping the mobile device (2) in the accurate position desired by the device operator, by means of the command of the keyboard keys of motor movement (8) or directly by microprocessor or microcontroller (4) in the situations of upper and lower course of device (2) or crushing, through the algorithms 3, 5 and 6.
11. System, in accordance to claim 10, characterized by an algorithm that calculates the residual displacement of the braking through linear interpolation of the current curve and by the addition fraction parcels of displacement.
Description:
CONTROL SYSTEM FOR DIRECT-CURRENT ELECTRICS MOTORS SUMARY System for control of brush DC motors, with reversible operation, based on the determination of the angular or linear, absolute or relative position of the device moved by the motor trought direct and continous reading of motor's electrical current and processing it directly by a specific software running on a microcontroller or microprocessor, bringing a more precise control of the movement and device position, including the determination of the residual and fractional movement during motor braking, during motor starting, providing also a more precise and fast detection of obstacles to the movement to anti-pinch and motor protection.

FIELD OF INVENTION This invention proposal describes a system intended to control mechanisms of electric windows windows movement of automobiles, solar ceilings, back mirrors, adjustments of seats, screens of DVD or monitors, gates and electric doors, doors of elevators, sliding windows, as well as any device controllable by brush DC motors with reversible operation, through the continuous and direct monitoring of the electrical current level sinked by the motor from its departure until its stopping.

Besides eliminating the necessity of position and/or speed sensors, this system is implemented using electronic components and electromechanical products available at the market (commodities), and can be implemented by several different ways, as the processing and control is carried through by programs systems (software) resident at the microcontroller or microprocessor.

This system of control and positioning of mechanical devices moved by direct current brush motor works based on special techniques of arithmetical and logical treatment of the motor current behavior. This technique allows a more accurate determination of the trajectory of the device moved for the motor if compared the systems of counting of pulses of current oscilation (fluctuation or ripple) provided by dedicated hardware, as described in the document of patent PI 9504970-3, especially during the braking of the motor, where these pulses are unreadable or weak. The direct reading of current and its interpretation also allows a faster and more accurate reaction in systems with anti- crushing.

The commercial approach of this system, object of the present invention, consist on the fact that the system do not need external sensors to measure the movement; and is less expensive, as it uses an available and free information from the motor, its electrical current.

The State of Art of this system makes possible to determine the relative displacement of the mobile device, and not directly the absolute position of this. For systems where the absolute position is mandatory, the mechanism must have a mechanical end of course, in one or both the directions, where, through detection of blocking of the motor at these points, based on specific blocking current behavior, the system can take it as absolute reference.

While this absolute reference is not taken, the system can only determine the relative movement, being then necessary an explicit procedure of reference taking, also called as calibration procedure.

The application of the system, object of the present invention, includes any mechanical control done by electric DC brush motor, with the possibility of have control on motor speed trough voltage applied to it. Examples of

application of these systems are positioning of mechanical, industrial or residential devices, or in automobiles, windows lifters, electric back mirrors, solar ceiling and seat adjustment.

The availability of the electric current information also allows to measure the level of effort or torque that the motor is applying in the mobile device, or itself against some inserted obstacle in its passage. That is useful when the system must include protection against crushing of objects found along the way of the mobile device, e. g. a human hand or arm. A typical device requiring this protection are window lifters or solar ceiling in automotives vehicles, with express movement (automatic)- which must performs anti-crushing protection, where the motor must revert its sense as soon as an object is detected along the movement.

In these systems with anti-crushing protection, the control must know accurately the position of the mobile device, as the protection cannot be effective along all the extension of movement, specifically at the end of course. In the application of window-lifters, to protect even small objects as fingers of children, the unprotected region before the end of course is relatively small, demanding a great precision in the determination of the position of the windows. Then, the objective of the present invention is to presents a control system of DC brush motor, able to determine the moved part position based on mathematical and logical procedures interpreting the motor's electrical current behavior, without necessity of external sensors to the motor and neither dedicated and expensive hardware for the treatment of electrical current undulations and control of the motor. The interpretation of electrical current behavior and translation it to motor or moved part position are done by software, which includes special procedures to

identify crushing of objects fast and accurately. So this systems is cheaper, flexible and more trusty than the solutions of today's State of Art.

STATE OF THE ART Usually mechanical devices controlled by electrical motors uses rotational or linear sensors coupled to the motor axis or to the moved device, which produces electrical pulses at a rate proportional to the system speed, as stated at patents US 4,504, 881 and US 5,440, 944.

Is such way the mechanical displacement is obtained by counting those pulses, as well as the system speed is proportional to the signal frequency.

By knowing the device position related to a reference through pulse counting it is possible to know the absolute position of the device. If some unexpected deacceleration could be detected before the end of course, through pulse rate or frequency reduction, it can performs the anti- crushing feature, by stopping the movement followed by a short reversion to relief the object.

The disadvantage in the need of a sensor coupled to the motor, which can be hall-effect type, optical, variable reluctance or another one. This sensor and the associated harness added represents a significant cost to the system.

Another disadvantage on this system is the intrinsic delay on crushing detecting through pulse rate analysis because of the necessary time to have a steady information of speed-specially if the pulses are far from each other or have some jitter (irregular period between them)-which limits the response time to reaction (reversing and relief of object being crushed) and compromises the object protection due to higher force applied to it.

To optimize the control system, reducing it cost, is was possible to eliminate the external sensor connected to

the system, replacing it by a reading and counting the motor electrical current oscilation, a subtle change on its value each time the brush switch from one contact to the next, in rotor winding contacts. This oscilation is intrinsic to every DC brush motor, and is caused by changes on rotor resistance and/or inductance while the brush is connected to two contacts of the motor.

This characteristic was initially for control and protection of motors, as offered by SGS-Thomson Microelectronics with its dedicated integrated circuit L9324 -Window Lift Controller'by SGS-Thomson Microelectronics (See Databook-Automotive Products-1 edition of October, 1989 pgs 125 to 131). This integrated circuit detects the presence of undulations to identify if the motor is in movement or not, disconnect it, at the and of course where the motor is blocked and the current undulation stops, protecting the motor against overload.

The undulations also can be transformed into electric pulses through electronic amplifiers, filters and comparators. In this case it is necessary a special circuit to execute this function, generating digital pulses that can be counted, stored and compared on a microcontroller as if it were an external sensor-patent document published PI 9504970-3 in 04, April 1996.

The disadvantages on this system are the need of some electronic device to convert current undulation into pulses, and the difficulty on reading these undulations during system braking, where the undulation are absent or too weak to be reliably read.

At motor starting there are also some difficulty to detect the undulations due to increase current of the motor to reach the inertia of the system, and the mechanical movement of the system is not uniform because the initial acceleration, therefore the speed is not constant.

These difficulties can cause propagation of errors which may not warrant a reliable moved device determination of its position.

A system with direct reading of analogical signal current undulation of the motor and software processing, similar as the proposed in the subject of this patent, have already been proposed at US 4,527, 101 patent. This system is based on Fast Fourier Transformation (FFT) application to the current signal and its undulation, obtaining the frequency spectral of the signal. From the frequency domain the motor speed is obtained and displayed properly. However this system is intended only to provide a visible indication of motor speed and is not appropriate neither fast and precise enough to give the moved device position by integrating speed information.

BRIEF DESCRIPTION OF THE INVENTION The objectives of this invention are: - To propose a cheaper control system of positioning mechanical devices based on DC brush reversible multipolar, more flexible, more reliable and with faster anti-crushing protection; - To eliminate the necessity of position or speed sensors, like hall-effect, optic, reluctance, etc ; - To eliminate the need of end of course sensors; - To eliminate complex, expensive and dedicated circuits intended to convert current undulation into pulses.

This invent will be described using as example, however not restrict to, an automotive window lifter module with the option of automatic movement and anti-crushing features, based on reversible brush DC motors.

The analysis of current signals and the system control are performed at a central microcontroller or

microprocessor. The software reads directly the current undulation and converts it in motor movement and position calculation, reads current increasing detecting crushing performing the fast protection, and has special logical and mathematical procedures to calculate the residual movement of the system during system braking, avoiding propagation of errors.

For convenience, the reference to counting pulses- the zero pulses position-is that one where the windows is totally closed. From that, opening the window the position counts positively and closing counts negatively.

Any obstacle to the closing movement can be identified through variation on current of motor, if the current grown above a specific rate along a specific time. After the detection the protective feature occurs, reverting the motor sense for a short period of time, enough to relief the obstacle.

The software is also responsible to read the user switches and takes the appropriated action of starting one movement, closing or opening the window, with automatic movement (the movement stops only at a new switch is pressed, an obstacle is found, or the end of course is reached) or manual movement (the movement lasts while the key is pressed). The system can also responds to a remote or local request of closing all opened windows to completely lock the vehicle and arm the anti-theft alarm.

This invent will be now explained in detail.

FIGURES DESCRIPTION - Fig. 1-It presents a diagram of functional blocks, and its interelations, as an example of a typical configuration of features available on this system.

Fig. 2-Shows some typical topologies of electronic feeding of DC motors, with motor reversion and motor current reading.

Fig. 3-The behavior of the current signal of motor in some conditions are shown. Figure 3A is the motor current along a complete cycle of turn on to braking. 3B is a zoomed representation of the current, showing undulation of current due to brush switching. 3C zoomed the current present at the motor during its braking. Here we see the current inversion as the motor acts like a generator during the braking.

Fig. 4-It shows some possible algorithms of pulse discrimination for movement counting. 4A is comparison of signal with its average level, 4B is comparison of derivative of signal with zero level, and 4C shows the floating hysteresis method.

Fig. 5-It shows details of current signal at braking. In 5A it is seen a cadence of counting undulations, represented for vertical lines, and the cadence during deceleration and braking of motor. 5B shows a typical MOSFET bridge to drive the motor, which was chosen to describe the present patent. It shows also some voltages and current signals relevant to the circuit. 5C emphasizes the subtle and hardly detectable undulation during the braking, as well as inductive effect of motor (b) at the signal generated by itself.

Fig. 6-It shows how the software samples the current signal along the braking.

Fig. 7-Sample points adjustments due to linear interpolation.

-Fig. 8-It illustrates the data regarding mathematical procedure of compensating pulses for motor starting.

Fig. 9-Anti-crushing algorithm.

Fig. 10-Algorithm 1-Floating Histeresys Method in detail, used at the implementation of this system, object of this invention.

Fig. 11-Algorithm 2-Update of position step by step, register of initial intervals time to departure compensation, and anti-crushing detection.

Fig. 12-Algorithm 3-Preparation data for braking data sampling.

Fig. 13-Algorithm 4-Preparation data for compensation of motor starting compensation.

Fig. 14-Algorithm 5-Braking data sampling.

Fig. 15-Algorithm 6-Linearization and interpolation of braking curve, calculation of braking trajectory, and calculation of departure compensation.

DETAILED DESCRIPTION OF THE INVENTION This control system typically can be part of a topology, as fig. 1, which includes a motor (1), attached to mobile device (2) by means of gears, straps or reducers, a way to convert electric signal from motor current (3), a processor (microprocessor or microcontroller) (4) an A/D converter (analogical to digital) (5) for reading of current, software routines at a memory (6) which performs the techniques for processing this signal of current and determination of motor trajectory, commands to drive the motor (7), which could be commanded by user switches or from processor decision (8).

The current signal capturing (3) can be made by several ways such as: voltage drop on a resistive element (shunt) in

series with the motor, hall sensor, voltage drop along an active FET, FET with current mirror. Depending on A/D converter resolution (5) it could be necessary and of the voltage level obtained as current signal (1), it could be necessary an amplifying stage before the A/D input (5). The processor (4) reads the current signal at a high rate (more than 5000 samplings for second has being satisfactory) and processes it at real time to compute the motor movement, to have a fast anti-crushing detection, to calculate the extra movement during the braking, and for compensation of starting. The actuator (7) must supply positive or negative tension at motor to allow it turns in both senses. This drive can be made by relays, FETs, bipolar transistors, solid state relays, or even a hybrid solution, as in fig. 2.

Relays are usually cheaper but they are slow. Its state transition can take up to 10ms where the current of motor is interrupted, and consequently, the reading. Although it can be estimate with a certain margin of error, some hybrid solution (fig. 2-D) solves this problem using relays only to select the movement direction, while the commutation is done by a transistor. For a reading even after the braking the solutions 2-B and 2-C are more convenient as they allow to read the current generated by the motor during braking. For better performance the 2-C was chosen. The current is measured at the voltage drop along the lower MOSFETs. When one MOSFET is on it RDS acts as a low resistance shunt resistor.

Movement Counting The current of a brush motor along from its starting to stop looks like fig. 3-A.

At 3-B we see a closer view of current undulation caused by variation of rotor reluctance and/or resistance during its contact exchanges. There are as many undulation

pulses per motor turn as many poles the motor is made with.

So, this undulation is synchronized with rotation of motor, with proportional frequency to speed of this. For determination of a mechanical trajectory provided by the motor, the software has a counter synchronized with undulation signal. The counting must increase for one direction of movement, and decrease to another. For counting, some software techniques can be used to convert the undulations (pulses) into numbers, as exemplified at fig. 4.

Figure 4-A illustrates the technique of comparison with average level-the counting occurs at signal crossing between the original signal and integrated signal (average level). The average level is the integration of original signal, under some constant of time. The advantage is simplicity, but small noises pulses can cross the averaged level causing wrong counts-the motor can generate undesired noise. The noise immunity can be improved by filtering the original signal. Anyway this technique is time constant dependent, which can restrict the range of acceptable frequencies (speeds). 4-B shows the method of zero-crossing of first derivative. Also a simply solution but the derivation (differentiation) reinforce higher frequency noises, and still time constant dependent. 4-C is the technique of floating hysteresis. Here, a counting takes place every time the signal leaves the last peak (positive or negative) by a predefined distance, called hysteresis.

The techniques 4-A and 4-B are easily implemented by the hardware, using comparators and RC circuits. The technique 4-C would demand complex circuits, however it is easily implemented by software, and it shows great immunity to noise and independence of signal frequency (absence of time constants). The value of hysteresis must be lower than the lower peak-to peak undulation signal (half of peak-to-peak

would be ideal). By the other hand, hysteresis must be high enough to have good noise immunity. This is the technique used in the system proposed here, as illustrated on algorithm 1 in Fig. 10.

During normal movement (excluding braking and starting), the position counting is done in unitary steps, as algorithm 2 on Fig. 11. A fractionary part of the position is present after the calculation of braking residual movement, and then rounded to integer after motor restarting.

It was stated a positive counting for opening window (down movement) and negative counting for closing window (up movement), so the closed window means position zero.

Determination of Braking Residual Movement Those state of the art systems where measurement of movement is made by counting whole numbers of undulation pulses obtained by hardware, it is hard to quantify the braking movement due to absence or weakness of undulation during braking (fig. 5-C). In practice the braking represents 2 to 20 or more undulation pulses. For these systems the solution is to insert pulses based on a previous statistical mapping of window behavior in several positions and speeds. This create potential errors as the door friction to the window changes along the time (presence of water, dust, wearing).

With the integral reading of the signal generated for the motor during braking, its residual trajectory can be calculated, without mappings. During braking the motor is not fed, and could be in short circuit to a faster braking.

Through reading of tension generated to motor at opened circuit, or the current generated while in short circuit, the motor speed can be tracked, as it is proportional to the signal generated from this (current or tension). From the

integration (area) of this braking signal, based on previous motor speed, the trajectory can be calculated.

After disconnection or short-circuiting, the motor acts as generator and current flow inverts, as seen at figure 5- A.

With a full MOSFETs bridge, as at figure 5-B, and with two current signals il and i2 obtained from voltage drop on each grounded transistor, which could be read by individual A/D inputs. At fig. 5-C detail e, the weak undulation is represented. For braking calculation it will not be used.

If the motor inductance effect were negligible, the generated signal during braking would be as fig. 5-C detail c, however, with current inertia caused for motor inductance, we have a profile like b. The calculation of residual movement at braking is based on tracking the motor speed variation, now represented proportionally at graph c, of 5-C figure. It is necessary to determine point d, and to associate it point, proportionally, to the immediately previous average speed before braking. The effective trajectory during braking corresponds to area f at figure 5- C. The method for calculation of braking trajectory is explained at figure 6, and is detailed at algorithm 3 of figure 12 and in algorithm 5 at figure 14.

After a request of motor stop, only at the next unitary counting (pulse) the motor is effectively switched off, so an unitary value of counting step has elapsed. Before switching off the motor, it had a speed represented for 1/tl. After switching off, the signal is sampled at a rate 1/tl, starting at a time t1/2 after the effective switching off (algorithm 6-figure 15). A linear interpolation is used to find the equation of straight line that best fits to the first sampled points (algorithm 6-figure 15). This interpolation must ignore the initial points that are below the highest point, so pi is ignored because it is below of

P2. These points must be ignored because they belong to the effect of motor inductance. For interpolation it is preferable to use points above 1/3 of higher point, or either, P2 to p9. It is to not include the points at the region where the current approaches to zero because these points belong to an inflexion of the curve. So, the points pi to p9, in the example, are replaced by interpolated points (fig. 7) pl'to pg'.

Each point Pi'means a fractional motor movement (less than 1) numerically equivalent to pi/d. The value of braking trajectory will be the sum of all pi'divided for d. This total will have to be added (or subtracted, depending on direction of turn motor) to the position counter. After the braking finish, the position will be represented by an integral value plus one fractional part.

Corrections Related To Motor Starting The moments where unitary change on position occurs (from the floating hysteresis algorithm) are moments where the fractional part of the position is null. After a bracking and its calculationit is usual to have some fractional on the position data (counter). Following a new starting, after the first countings, this fractionary part must be cancelled by rounding it to the nearest integer. A rounding scheme must be chosen to avoid propagation of error of one or more integral units. The rounding can be done after the first unitary countings at starting, where the coherence of the acceleration is observed since the turning on, or it calculation can be left to be done after the stop of the motor. By the analysis of the interval between the first pulses it is calculated where theoretically would be situated the instant of speed zero as fractionary trajectory before the first counting, being based on the hypothesis of

a constant initial acceleration. The mathematical deductions are based on figure 8.

The instant to is the turning on of motor. Instants tl, t2, t3... are the initial unitary countings. The area of graphical speed = f (tempo) is the displacement. The unit of speed considered here is the area between each unitary count equal 1, in other words, the area is equal to unitary addition at the counter. From the starting of motor, to, the first unitary counting is identified at t1. The P area, between to and tl, necessarily does not represent an unitary value of movement, and could be higher than 1 (when the first unitary counting cannot be read). For the rounding, the P area must be calculated based on the hipotesys of constant acceleration until t3 : v1, 5 = (v1+v2)/2 = 1/(t2-t1) = 1/#t1 (Eq. 01) v2, 5= (v2+v3)/2 = 1/ (t3-t2) = 1/#t2 (Eq. 02) a = (V2, 5-VI, 5)/ (t2, 5-tl, 5) (Eq. 03) t1, 5 = (tl+t2)/2 (Eq. 04) t2,5 = (t2+t3)/2 (Eq. 05) a = 2.(#t1-#t2)/] #t1. #t2. ( to = ti, 5-v1, 5/a (Eq. 07) v1 = r1, 5-a. At1/2 (Eq. 08) P = vl. (tl-to)/2 = vl. Ato/2 (Eq. 09) P = #t0.{1/#t1-(#t1-#t2)/[#t2.(#t1+#t2)]}/2 (Eq. 10) P must be added (or deducted, depending on direction of motor turn) to the position counter, that has already a fractionary part from the last braking.

As more next to a whole number will be the result, as more probably the calculations of braking counting and starting were correct. After, the value of the counter must be rounded off to the nearest whole number. The implementation of these operations is detailed at algorithm 5 :

(fig. 14) -Data initialization to capture the intervals times-Ato, At1 and At2, at algorithm 2; (fig. 11) -capture of time intervals-Ato, At1 and At2 ; algorithm 6 (fig. 15) -calculation of the compensation of position for motor starting.

Considerations about Reversion of Direction When the turn direction is reverted, we can expect to have a fixed fractional error at counting due to the fact of points (position mechanics of motor and mobile device), where unitary counts occurs, are different for a direction of turn and for another one. This error depends also on the algorithm chosen for undulation counting (delay of phase) and a possible phase delay generated at the motor. In fact it is not a propagated error because it is added when it passes from a direction turn to the other, and is subtracted when it returns to the previous direction.

Propagation of Errors and Definition of Position The potential propagable errors are because: imprecision at reading and alignment (interpolation to a straight line, removing the undulation residues) of braking signal; error at point d determination (figure 5-C) when the braking is too fast or it has much undulation; errors due to non constant acceleration at motor starting that reduce precision of calculations; errors at accurate determination of instants of unitary counting due to inclination of current signal at the departure moment; loss of pulses due the noises. At practical the noise level does not have been a source of false pulses and the low rate of false pulses out lost pulses does not compromise the performance of system. At the window lifter application it is usual to fix a maximum number of individual movements without taking reference in the end of course. After this limit is reached

it is obligatory to do explicit procedure of reference taking (calibration). The displacement will be considered positive at an specific direction and negative at opposite direction. From the reference the algorithm will determine the position of mechanism by calculating the movements as detailed before. After that it can be defined regions of protection for motor and for the user (anti-crushing) monitoring the changes of current at these regions, as will be described next. This system of current undulation counting is not perfect, it has some errors that are propagated along the movements. The proposal of the system described here is to show the use of that techniques that minimize these errors, in comparison with other systems for counting pulses generated by hardware.

Anti-Crushing Detection The anti-crushing, in automotive window lifters, must have a performance that satisfy three main requirements: 1-To press the object with the minimum of possible effort (maximum of 100N according to security rules); 2-Do not interpret as pressed obstacle, the possible variations of effort from potential mechanical irregularities or friction changes along the window guide; 3-Do not interpret as obstacle, the effort applied on the windows due to vibration of vehicle when it passes over an irregular ground. The algorithm must be fast and intelligent, but also it needs a minimum period of confirmation, to avoid return of windows from any variation of short duration, as occurs on situations of vibration of vehicle at passing over irregular ground.

The crushing detection based on relative motor current rising can be faster and more accurate than from measuring undulation frequency and comparing it to an average, due to:

1-At system of comparison frequencies the measure of frequency is based on the measure of interval time between consecutive undulation pulses (ripple). It's needs at least two readings to be gotten, which means a small delay at decision.

2-Due to the presence of noise on undulation signal, the measured time interval have a significant and random variation between them. For the information be validated is necessary: - an integration of time or frequency what means more delay; - or a higher tolerance on comparison of frequency what means less sensitivity For crushing detection by current reading, the undulations can be ignored. For such system, we can record, at each cycle of undulation, its minimum peak, its maximum peak, the average between minimum and maximum, or the average of the complete cycle. These values obtained from each undulation also have a random and small variation between them, but in lower degree.

The verification of current increasing is explained by algorithm 2, illustrated at Fig. 11 and will be described next. It has a very good performance, which means fast response, good immunity to signal noise and vibration, and produces an effort over the crunched object of less than 100N.

Algorithm: Every 10ms, a 10ms current average I is pushed on a 5 positions FIFO. The last position (the most recent) is compared with the first one (40ms before) at form: S-Io-I4-K2. S will be positive if-To current is higher than I4 + K2. K2 is one of two constants that adjusts the sensitivity, and represents the minimum positive current slope along 40ms to consider as a crushing. So, K2 adjusts the sensitivity, the effort of crushing, and immunity to

soft changes on friction at the window mechanical guide. A counter counts how many times sobsequents S were greater than 0. The anti-crushing detection occurs if this count is greater than K1, the second adjustable constant, which is related to the time necessary to validate as a crushing. Ka control the compromise between how fast is the detection, which means less effort against the crunched object, and how immune is the system to window vibration (irregular ground) or short strokes on windows against it movement.

The best values for and K2 must be obtained experimentally.

If a crushing is detected and the window is located within the protected area, the system will do the anti- crushing procedure, the interruption and reversion of motor the movement.

This system cannot be compared to the simpler protective system where the motor current is compared to an absolute limit to decide if some object is blocking the movement. It could be useful, with some restrictions, to switch off the motor when it is blocked due to reaching the end of course, protecting the motor from overloads. The system proposed here analyses the motor current relative variation in accordance to a specialized algorithm to anticipate the protective reaction against objects crusning.

I such way, in opposition to the absolute limit system, this system doesn't depend on particular characteristics or friction (electrical current) that could change between different targets.

DESCRIPTION OF ALGORITHMS Description of variable and involved functions Position-it is a 24 bits fixed point counter, 16 bits for the whole part and 8 for the fractionary part. It represents the position of the mechanism, in units of pulses

or undulations. For window lifters we adopt zero as window closed and positive values means opened window.

MotorDown and MotorUp are the state of hardware output logical pins that control the MOSFET bridge. They can be set or reset, controlling the motor movement, and can be read to know motor state. MotorDown=O and MotorUp=O means motor stopped ; MotorDown=l and MotorUp=0 means window opening ; MotorDown=O and MotorUp=l means window closing. ad-it's where the 8 bit AD readings are stored. Its value is proportional to the motor current. adl-is an auxiliary storage for AD readings used on the floating histeresys algorithm. It stores the last maximum or minimum AD value read.

ReadAdMotorUp (J-function that returns the voltage drop at the MOSFET conducting the motor current for closing window. If the window is opening this reads battery voltage and if motor is stopped it reads zero.

ReadAdMotorDown ()-function that returns the voltage drop at the MOSFET conducting the motor current for opening window. If the window is closing this reads battery voltage and if motor is stopped it reads zero.

UpFlag-This flag memorizes the last direction of movement. After the braking the motor is stopped and the residual braking movement is calculated. This flag decides if it is to add or to subtract the result to/from Position. flagl-This tells if the verification of hysteresis overtake is being above of the minimum value or below of the maximum value of current.

Histeresys-This constant helps undulations counting.

For best discrimination its value must be between maximum level of noise and minimum peak-to-peak of undulation.

FlagSwitchOff-A request of braking, produced, for example, from manual command on user switches, is signaled

through this flag to postpone the motor switching off synchronizing it to the moment of unitary position counting. timer-It is a hardware counter that helps time interval measurements and periodic interrupts generation. It is used to store At1, At2 and At3 at starting ans as s time control for braking current sampling. The 16 bits timers available on almost all microcontrollers are suitable. They must have an overflow period (complete rolling) superior to double of biggest interval between unitary countings. At practical, it must be superior to 20ms. tim-It is a temporary storage for the value read from timer. oldtimer-This variable holds the previous reading of timer, at the previous unitary counting. It is used to measure the time interval between the last unitary counting and the previous one, which is the variable dif below. dif-As said above, dif = tim-oldtimer. difm-It is same as dif but averaged by a time constant of 16 countings. Will be used as base of time for the sampling of braking. Averaging: for each new dif, difm = (15xdifm+dif)/16. cntStart-Cleared at motor starting, it is incremented at each unitary count, indexing the storage of to, t1, t2 and t3. flagl0ms-This flag is set by a timer interrupt every 10ms, signalizing and synchronizing, at the main loop, the algorithm of anti-crushing detention. A fixed time base for the algorithm makes it undependable of window speed-the crush force and reaction tim would not depend of window speed. The anticrushing routine recognizes this flag, erases it and executes its synchronized functions. fifo [O] to fifo [4]-It is a 5 position vector, working as a fifo (first to enter first to leave). Each position

stores measured current in 10ms intervals. Used by anti- crushing detection. a, b and c-are auxiliary storages.

CalibratedFlag-it is set if the system has already took the zero reference of superior limit of windows (closed). If it is not set the anti-crushing is disabled.

K1 and K2-are the constants that sets the sensitivity and speed of the anti-crushing algorithm. As explained before, K1 controls the minimum time of confirmation of current increasing to decide for anti-crushing, and K2 sets the minimum necessary slope of current to interprets it as a crushing.

WINMIN and WINMAX-are constants that sets the area of anti-crunch protection. Only between these two points the protection is enabled. Usually it is set between a few millimeters before total window closure (WINMIN) and about 20 cm of window opening (MINMAX).

FlagReturn-This flag is set when a anti-crushing detention occurs, signalizing that, after braking and starting calculations, the motor must be reverted to liberate the crunched object.

Vector/'OJ to Vector [22]-This vector stores the first 23 readings of current during braking for posterior processing and determination of the braking trajectory.

SumSamples-This variable accumulates the sum of current readings during braking, after filling the Vector described above.

NumSamples It is the index to Vector.

NextRead-This defines the moment of the next AD reading during braking and Vector filling. NextRead is set in advance to Timer, so when both matchs a current sample is done and another value to NextRead is set. This matching between Timer and NextRead can be done by software pooling

or a hardware resource called output-compare, available on some microcontrollers.

BrackingCorrection It is the result from the calculation of the residual braking movement and will be used to correct the Position.

StartingCorrection-Here is stored the result of the calculation of start position compensation and will be used to correct the Position.

Algorithms Algorithm 1-Method of the Floating Histeresys (figure 10).

It is designed to sample the undulation signal and identify each individual undulation and count them, as illustrated at figure 4-C. The sample rate must be as high as possible. In the practical implementation, this algorithm was inserted at main loop, whose cycle time (101) found was less than 200us, which was acceptable for maximum undulation rate found (lms/undulation). For each loop cycle (101) a current reading is done, (103) and (116), the current that flows through the active (on) FET transistor, by reading the voltage drop between its drain and the grounded source (figure 5-B). The histeresys detection occurs when the current (103) (116) reaches a numeric value far from adl by Histeresys units. Flagl (104) (117) identifies if the verification is now being done at the positive or negative slope of current. For negative slope (current decreasing) Flagl=false (zero or clear) the algorithm is looking for the lowest value of current, store it in adl, then look if a current higher than this minimum (adl) for Histeresys units.

When it happens flagl changes to true meaning now a positive slope (current increasing). While flagl=true the algorithms do the opposite. It looks for the maximum value, stores it in adl, then looks for a current lower then this maximum

(adl) by histeresys units, than changes flagl to false again.

Every change in flagl (113 or 126) it is called an appropriated routine, IncrementPosition (J (109), if the window is closing (going down), or DecrementPosition () (122), if the window is closing (going up). These routines will change the position counter by one positive or negative unit.

Algorithm 2-Unitary counting of position (figure 11) IncrementPosition () (109) and DecrementPosition () (122) These functions are invoked by algorithm 1 of floating histeresys to update window position by one unit on every undulation. It also registers the initial intervals of time for compensation of departure, and also performs the anti- crushing. The two functions have distinct entry points (109) or (122), but the body of the algorithm is the same. The difference between each one is the direction of window movement, increasing (add 1) (127) or decreasing (subtract 1) (128) to position. Than it is verified flagReqStop (129) which means that a switch off request is pending (130). It is normally set by the user through a touch on the control button to stop the movement. This flag (129) serves to delay the requested switching-off to synchronize it with the moment where a complete unitary counting is done, which is the moment where IncrementPosition () or DecrementPosition () are called. So, if flagReqStop is set the motor is switched off (130), turning off both FET transistors, and is called PrepareBraking () (130) which prepares some variables to the sampling of the braking current signal that will be occur next. After dif (131) is calculated (131) representing the time interval, in units of timer steps, between the this unitary counting and the previous one:

dif=timer-oldtimer and soon after to oldtimer is brought up to date with timer: oldtimer=timer However, as two readings of timer occur, these two readings could have different result due to the elapsed time between each reading. For such, timer is read before and placed at tim variable, and it is be used instead of timer.

Difm is then calculated, which is a stabilization of the value dif, with a time constant of 16 readings. The calculus is a digital filter of one pole: for each reading, difm is re-calculated as a weighed mean with weight 1 to dif and weight 15 to previous difm. The time constant of 16 readings is not critical, but is easier to be implemented by assembly language. So difm represents an average of the last measures of time interval between undulations. This will be used as time base for sampling of currents generated for the motor at braking. The variable a is the difference between dif and the average difm. It is positive if the time intervals between undulations are growing (de-acceleration). It is preserved on a only the most significant bits as only the signal of a is important to anti-crushing algorithm. The most important information to anti-crushing is the increasing of motor current. The signal of a is also used to confirm the de-acceleration to avoid confusion between other situations where the current can increase, for example, when battery voltage increases after an engine start.

It is also verified if cntStart (132, 134, 136) indicates that these first readings, after turning motor on, are to be registered as the intervals of time to, t, and t2 that will be used on the compensation of departure. If it is zero (132), assigns dif to to (133), if 1 (134), to t (135), and if 2 (136), to t2 (137).

The flag 7aglOms is set every 10ms (139), by some timer, to acts as a time reference to anti-crushing algorithm. If it is found set, it is cleared and anti- crushing functions takes place, as described below.

First, the current measured is inserted at fifo (140) - the position fifo [0] has now the current reading at this moment, fifo [l] the reading l0ms before, fifo [2] 20ms before, fifo [3] 30ms before and fifo [4] 40ms before. An auxiliary variable b then assumes the difference between the current reading fifo [O] and the reading 40ms before fifo [4], minus K2 constant: b=fifo [0]-fifo [4] -K2. Then, b will be positive if the current reading is higher than the 40ms older current plus K2. So, K2 establishes a minimum slope of current increasing, in units of AD converter, for 40ms, to be considered as a possible crushing, signaled by b>0.

Another auxiliary variable c quantifies the occurrences of b>O in a weighed way: if b>l (143) 2 is added to c (142), else if b=l (143) only 1 is added to c (144), else if b=0, c is reduced by 1 (147) if it is higher than 0 (146), and if b<O c is cleared (148). Then c is compared to another constant Kl (140), which is related to the response time of anti-crushing, another sensitivity adjust. When c>Kl (156) a crushing will be assumed, however another test is done to make sure that it is a real crushing: the current fifo [O] must also be higher than 10ms before-fifo [l] (149). If no, the current increasing was only a short rise, caused by some external vibration on the vehicle. If fifo [0<fifo [l] (149) c is zeroed (152) avoiding it to reach Kl. Other conditions clear c, inhibiting the anti-crushing: if the windows is opening (150) or if the system is not calibrated (151) (the end of course reference was not taken yet) -flowchart 2.

Also the signal of the variable a is considered. If it is positive (> or = the zero) means an increasing of times between undulations (de-acceleration), which confirms the

deceleration of the window (157). If a<0 (153), c is subtracted by 1 (155) if it is not already zero (154).

Finally, if c>Kl and if the crushing happens inside the protective area, Position>WINMIN and Position<WINMAX (156), the motor is switched off (157), the function PrepareBraking () (130) is invoked, which prepares variable and timers to braking current sampling, and sets flagReturn which will inform to move the window backward (175), after the calculations of braking trajectory and compensation of departure.

PrepareBraking (J (figure 12) This routine is immediately called after turning off the motor (157), to prepare the temporization of sampling of motor current generation during braking. SumSamples is zeroed (160) and later will have the arithmetical addition of all readings. NumSamples receives 50, previewing a maximum of 50 readings, or until the measured current falls to a negligible level. The first 23 samples will be registered in Vector, assuming it is enough to store the significant portion of the braking current to perform the calculus and interpolation showed at algorithm 5-figure 14. For every sampling, NumSamples is subtracted by 1 (164).

It will be used as a sample counter and as an index to Vector (171), where the sample will be stored. NextRead will indicate the instant where the next sampling must happens.

The first reading will take place difm/2 from now, where the motor is being switched off, so NextRead=oldtimer + difm/2 (pi at figure 6). The successive samplings will be separated by the time difm. So the reading always occurs in the center of the sampling rectangle.

Algorithm 4-Departure () (figure 13)

Departure () just switch on the motor (176), at desired direction (closing or opening the windows), and sets cntStart to 0. This will count each unitary counting (138, Fig. 11), identifying the three first intervals of time, for posterior calculation of departure compensation.

Algorithm 5-Reading of Braking current (figure 14) The braking reading must occurs at the points pl, p2..., pn illustrated at figure 6. The reading is synchronized with the coincidence of NextRead (163) with the value timer. NextRead can be an"output compare"register of a hardware timer provided with it (available on several microcontrollers), where a hardware interrupt is generated when timer reaches the value stored on the output compare register. However, the moment of reading sample can also be identified by software verification of when the timer reaches the value of NextRead, as it is displayed at algorithm 5. The algorithm is inserted at main loop (actually <200us each loop). First it verifies the counter NumSamples (161). If NumSamples>O (161) the braking is still in course. After it verifies if is already the moment to take one sample, verifying if the timer already reached the NextRead value (163). If so, NumAmostras is subtracted by 1, NextRead is prepared to occurs difm units of timer ahead, and prepares an auxiliary variable a as an index to Vector (164). The braking signal appears with positive value on opposing FET transistor to the one used for normal movement before switching off, as the braking current is the opposite to the traction current. Therefore, UpFlag is verified (165) to select which AD input is to be read (167 and 166). If a<23 (168) the sample is stored in vector [a], else it is added to the SampleSum (172). A sample of current less or equal 3 is considered negligible, finishing the sampling

before NumSamples reaches zero (170). Then it is finally called BrakingCalculus () (174) routine, described next.

Algorithm 6-BrakingCalculus ()-linear and interpolation of braking curve, calculation of the braking trajectory, and compensation of departure (figure 15).

This algorithm initially transforms the curve e into the curve c (figure 5-C) through linear interpolation of the read points, as figure 6. According to flowchart of figure 15, the first loop (175) eliminates or reduces the undulation of the signal, if present. From the position P14 (vector [14]) to pi (vector [1]) it is verified if the value of the position pi is lower than the average of its two neighbors, pi_ and Pi+1 (178). If so, pi assumes the average (179), aligning the three points. After finishing this loop, the curve will have lower undulations, easing trajectory calculus. It was chosen to verify only the first 14 positions just because of practical verification, but can be different on other systems. At the next loop (180), from the position pa to po, pi is compared with the linear projection of two next points pi+i and Pi+2 (181 and 182). If it is lower than it, it assumes the projection value (183) linearizing the curve, obtaining a virtual value for po, which could not be read due to the motor inductance. The curve now represents a relative behavior of the motor speed, eliminating the undulations and inductive effect. The sampling rate was at the same rate of previous unitary counting before turning off the motor. The points pi represents the relative speed of the motor during its braking at each expected unitary counting if the motor where not turned off. Assuming po is proportional to the speed before switching off, each pi/po is numerically equal to a partial motor displacement, in units of undulation. The sum

of all pi/po will be the total motor displacement during braking =E (pi/po) =S (pi)/po. So, all pi must be added (184), and then divided by po (191) to obtain the total motor displacement during braking. This, will have an integer part, typically between 2 and 15, and a fractionary part. If more than 14 points belong to the braking, their value will be present at the accumulator SumSamples (185), resulted from the sum of samples not registered on vector. This should be added to S (pi) before dividing it to po to get BrakingCorrection (191). StartingCorrection is also calculated (186), based on time intervals to, t1 and t2.

BrakingCorrection and StartingCorrection are positive values and must be added to position, if the window is opening (189), or subtracted, if closing (187), depending on UpFlag (187). After updating position we expected that the fractional part be the minimum, meaning the reading and calculus are precise. Anyway it must be rounded to the closest integer.