‘v . I .' . - u .. ‘. :.;.'r, 3"- 3 31.... 3..-..333 .Ifl." _' ”1'23 .‘ 3.3.!” 1g“ .3_333 II.-‘"I-3'I.;. ,3: 3‘ Orv—'3‘. .3 "‘ """I.||I’III._ I'"‘ ui'Ir-‘II' I'II'.",.1.I IIIJ,’ 1..., I _. 3g; . '-.".J ‘ v. . 13.“. :.;f -.1 -.: IIIj'I VIII-1mm "'."= ;~'I: 223‘. II 33.3 4:; IEIIHIII' I?“ I I I, -. III”, duh-3 '_.‘-’IIMI'u' «II:;.:III ."' 'IluIJIII .3. '.I.3I:g I...;:|’fI3I,,3.,34;'1';II‘.I r .- 333 I3 _3- '31 ..'. .. " IIII ‘ 37.3 3.3‘ .'II' I" I. f '.‘ I ' I: I' I'3’I3 ."' ‘ ' ' . (.‘IMI’ u" ‘.’h .ji': 3. 'I' ..I III ”I ”I I I..-I"..I' "I"1"I.=II“..iIII... qu' :II. l"L‘"" ..!I g .“ ‘E- F .- ~.'-.3I 1... 333333333 . 33.333“ 333 .. IH'IIII. IIIIi .‘ "' "‘ . _‘;‘_3I33 -' “III-PHLIv'I'I'II" 93133 I333: “3'3 3.7-I'I 3' II 1' .I .c - IOI A- IN. 'I‘ ‘ “’_EI‘) 'I-~+ Vfi {13“13‘3‘3‘Ifh é... fitnr. 133?;sz I‘. 35.»... 2...}. r... " '_.'.3 ii. .33- 33!: ','I ... 3 v ‘E' l" " -.' am... .3- I133 “TI“ Etv_3r .' 4 |Q1ir I; ::.'.3' 3'3, ..3 92“qu II" III; '-:3- - II AMI?” I333; MI...“ II J 3.»: K33 “‘I‘III3u3OI3: III|II3 3 .I!’I'._; ‘I. 121: [II ' v 11'.- -:',l'_-III "rII'ILH‘I F.13’3"I'I'I33:3§F3I 333333 333: I I333 .333 III 3,333.11. 4&4}? 333333.313: ._.<, 7333? :{3 "- 7' I .' I Lind]??? s; 3‘? o :9': "- I!" 4‘3 ' ' '33I.:I: H'I. r 333(1303 ‘4' 31.3.. I" I, . “$4.251...” .I'fl ‘53,. «was.» . 154' " ("f . 'G‘ll 'i W04. ;' ‘h‘ Ev. 1‘ 3 4 :vamm 3 .- «1.3.1333. . : Ila «.3._ I311! I; ';3‘£3(; . . . #3 3 . II ., “‘nagt'lgII.’ . I ".'!‘- 51.13”. ‘ ' '1_I'EI';..; {M' I . ' 3;} . ' ' ”I .I" - 'nfiIIII." ' 3 IIIIIII 13313.- - :‘I'i-Ti E... J M‘ 'I‘I LIN“. 1°“- MI! :95 -,-.'} . '. , ”If - I '..‘é.-.I:O‘~ds,' fjé 3 5.31 “1-“ ' ' '3‘ ‘ '- ' H '3". 1-H: “I." I"? 1 I . 3». ' " ' ‘ $135, I [:_D_ 'nI 5' ‘ . - c: '. ' I 97-" I” II " -.-. ' v: .5 ' 'I' . z 3;... . I. -..=.I ‘ .‘ I.“ I :3: In 5 g 'i' 3 3 33 3 . 3.1“” " ”I 3" «*7 ~— ..~ %-':- =. .. 3'. . . __ : - - ;_".*~'~'I 'e.‘ ‘9. I 333. n .2 -' 7 Hf: ' .I!. 3.13 I... -‘ 'I " ".1 "' .- . ounl‘. i'. ...I . Ii'~ II I? ~' "F": ‘I'. .. .. .'= ui' II.”- '.' ;. . I~-"-' "‘ I I I H. ‘ . I“, - .5 . ‘ ’u I -.-:‘:'. ’- 33‘" .~.-:.!;;. '- '~...‘.'oh-.r _II~.' . IL'. -': '. 'v' 4' w". " "‘.. I ."I ~. .‘- i ' " "’ " i"? I I433. 1‘ _‘ 3 3 . .. . l 'quto W In"), I. ' ‘W'L: I'sz'I "'I‘L. u I: I3... . ,,_ .333I3 Om} II I ' “In.“ I I. IF... 3 - I .II3II'I . II | 33: 5:" 3 I .33’l||33 :l3'f";-3 '7" V V 1 1 CN ‘_DC + DC '5’?) ”i3 +EVCE 2 Typically VD and Vcs are between one half and one volt. So as VCN goes slightly positive, the free wheeling diode Dc+ will start to conduct. Similarly to zero crossing detection as described in section 2.2.1 conduction occurs for the first time approximately thirty electrical degrees before the next commutation. It is important to note that the zero 1 9 crossing of the back emf causes the free wheeling diode to conduct but that the zero crossing itself is not detected. Notice that if the analysis above is performed for the case when transistors A+ and C- are conducting, then the transistor A+ will need to be chopped. This means that after 360 electrical degrees each transistor will go through a state where it is conducting for sixty degrees and chopped for sixty degrees. Figure 2.4 shows the induced line-to-neutral voltages and correspbnding switching states. The shaded area of the switching states indicate that the transistor is being chopped. Figure 2.4 - Line-to-Neutral Back EMF and Switching Events Including Chopping 20 To detect the conducting state of the fieewheeling diodes another diode and resistor can be placed in anti-parallel with each free-wheeling diode. The voltage drop across the extra diode can be measured by a comparator as described in [4]. Figure 2.5 shows the structure of the detection circuit pr0posed by [4]. Note that one of these circuits must be connected to each phase of the inverter. Bias Voltage “1 Detection Free- 3 Diode Wheelin Diode E To Motor Phase Free- #5 % ngcllmg SEDetection l e I Diode I ' 1 Bias Voltage Figure 2.5 - Detection Circuit Using Floating DC Supplies In the work of [4] the control of the motor is done very simply using a multiplexer to select which comparator output to use and a digital phase shifter to implement the thirty electrical degrees of delay that is needed for the next commutation signal. The method proposed by Ogasawara and Akagi works at very low speeds (45 rpm in [4]) since the diode conduction occurs whenever the induced voltage is greater than the 21 average of the forward voltage drop across the fi'eewheeling diode and the conducting voltage drop across the power transistor (typically one half to one volt). Since the minimum detection speed is so small, a very simple starting procedure can be employed. As with any sensorless motor operating scheme the first time any two phases are energized the rotor will move either forward or backward. If the phases are energized long enough, the rotor will come to rest at a position where there is zero total torque on the rotor. It should be noted that for a two pole machine there are two equilibrium points for the rotor but only one stable equilibrium point. Therefore the rotor will come to rest in only one position (assuming that fiiction is insignificant). Figure 2.6 shows a cross-section of the motor when two predetermined phases are energized and the rotor has reached the stable equilibrium point. The circles in the stator indicate the direction of current flow. The arrows in the air gap indicate the direction of the torque caused by the Lorentz force (Bxi). 22 Figure 2.6 - Motor Cross Section During Initialization of Starting Procedure If the next commutation then advances the switching sequence by 120 electrical degrees (two steps) the rotor will accelerate at a constant rate for sixty degrees (assuming constant load). The acceleration is constant because the current is constant and the flux fi'om the magnet pole will be constant (therefore the torque will be constant) for the next sixty degrees: The rate of acceleration is proportional to the current through the conducting phases. Figure 2.7 shows the motor cross-section after this commutation. Since the minimum detection speed is so low, the next commutation can be performed automatically by the diode conduction detection circuit and the control hardware. So the starting scheme consists of an initialization and only one additional open loop commutation. 23 Figure 2.7 - Motor Cross Section During Second Phase of Starting Procedure This discrete rotor position detection method allows very low operating speeds and a simple, short starting procedure. However, there are several disadvantages to this method which make it less attractive than zero crossing detection. If these disadvantages can be overcome, the simple starting procedure and low operating speeds will make this method superior to zero crossing detection. 2.3 DISADVANT AGES OF OGASAWARA AND AKAGI’S METHOD The disadvantages of the discrete rotor position detection method of section 2.2.2 can be grouped into three categories. The first category is disadvantages associated with 24 the implementation of the detection circuit. The detection circuit described in section 2.2.2 requires six isolated voltage supplies, which are difficult to implement in a manor which is both inexpensive and durable. The second category is disadvantages associated with the operating range of the motor. Proper explanation of this problem is the subject of section 2.3.1 . The third category is disadvantages associated with dynamic performance, and is discussed in section 2.3.2. 2.3.1 DIFFICULTY IN MAXIMIZING MOTOR OPERATING SPEED RANGE The sensorless operating scheme described in section 2.2.2 detects the rotor position only the instant that the inverter chaps. Therefore the time at which conduction of the free-wheeling diode is detected may be as much as one chopping period after the zero crossing of the back emf occurred. This means that when the rotor speed becomes comparable to the chopping fiequency the time when the freewheeling diode conducts may be become significantly different fiorn the time when the induced voltage crosses zero as shown in Figure 2.8. 25 VAN O V \ \ \ . \ . .\' ..... ' \ h _ — — _. — — — . Error Pomt of zero Detection of crossing \ /Diode Conduction A+ FU‘UTLI—LI'LI L__ Figure 2.8 - Detection Error at High Speeds If high rotor speeds are desired, the chopping fiequency must be comparably high. In [4] the chopping is performed at a fixed frequency regardless of rotor speed. Chopping at high fiequencies causes an increase in switching losses at all rotor speeds. A simple way to lessen the degree of this problem is described in chapter 3. In addition to the error that occurs at high speeds, an additional error occurs at low speeds as well. This error becomes significant when the induced voltage becomes comparable with the minimum voltage needed to cause the free wheeling diode to conduct. For example, Figure 2.9 shows a motor that has a peak-to-peak induced voltage 26 of Kv [Volts/rpm]. If the average voltage drop of the inverter free wheeling diodes and conducting transistors is Kc [Volts], the induced voltage must become greater than or equal to Kc for the free wheeling diode to conduct. Figure 2.9 shows the case when the rotor speed is low enough that the induced voltage is comparable to the voltage that is needed for the free wheeling diode to conduct. 60° (Electrical) VAN 1 : ACK” x rpm) 3 Error 3 O V Kc --------- -------------------- d-----—------------- Figure 2.9 - Detection Error at Low Speeds For the machine to operate at its minimum possible speed, the digital phase shifter described in [4] should account for this error. The phase shifter in [4] does attempt to account for this error, but it does so by simply commanding the commutation to occur as soon as the conduction is sensed whenever the rotor speed is below some predetermined value. This is clearly not an optimal solution if the motor is intended to operate at low speeds for any significant amount of time. 27 2.3.2 PROBLEMS WITH DYNAMIC PERFORMANCE The DC rail voltage must be chopped so that the diode will conduct. Aside from increased switching losses, this results in other dynamic performance losses. Since there is always chopping, the maximum DC voltage can never be applied to the motor. This results in a lower maximum speed and a lower maximum acceleration for any load. Similarly to zero crossing detection, the rotor position is detected thirty electrical degrees before the next commutation. The delay is large enough that a very dynamic load could change the rotor speed enough to cause a misprediction of the commutation time. The digital phase shifter with programmable delay used in [4] was made to account for linear accelerations, but it will always mispredict the commutation instant when the acceleration begins and when the acceleration ends. If the magnitude of this misprediction is large enough, the motor will not run smoothly and the phase current may become exceptionally large. If the load disturbance causes the rotor to slow down, the next commutation may occur so early that the motor will not be able to deliver enough torque to complete the rotation and the motor will stall. With the exception of the problems discussed in the previous paragraph, all of the disadvantages to this method of sensorless operation can be overcome or lessened by the modifications proposed in chapter 3. These modifications may also lead to the eventual elimination of all of the disadvantages to this method (including those mentioned in the previous paragraph) as discussed in chapter 6. Chapter 3 MODIFICATIONS TO OGASAWARA AND AKAGI’S METHOD In Ogasawara and Akagi’s method, the conducting state of the a flee-wheeling diode in the inverter is used to determine the rotor position. As mentioned before this scheme allows the motor to operate at very low speeds. In fact the operating speed is so low that the motor can be started by moving the rotor to some initial position and then providing only one additional open loop commutation. However this method has several disadvantages as described in section 2.3. Section 3.1 is dedicated to proposed solutions to many of the problems presented previously. In this section a new detection circuit is proposed that eliminates the need for six isolated voltage supplies (see Figme 2.5). In addition to this the digital phase shifter is replaced by a microcontroller which can be used eliminate the errors that occur at high and low rotor speeds as described in section 2.3. The microcontroller can also chop in a more selective manor so that some of the dynamic problems mentioned before can also be lessened. The addition of the microcontroller and its increased abilities make it possible to go even further to enhance the dynamic performance of the motor. This will be discussed in chapter 6, and has yet to be implemented. 28 29 3.1 PROPOSED IMPROVEMENTS Since the conduction of current in the free-wheeling diode corresponds to current in the “open” phase of the inverter, the phase current can be sensed instead of the voltage drop across the diode. Phase current detection can be done by adding a very small resistor in each of the motor phases. This is already done many applications to implement overcurrent detection. Or current can be sensed using current transducers. Inverters for automotive and other applications may already contain three current transducers so there should be little or no cost for this implementation. The use of current transducers provides isolation between the phases and the rest of the detection logic and makes it possible to implement current detection without the use of isolated voltage supplies. Figure 3.1 shows the proposed current detection circuit. Notice that the bias voltages for the comparators can be implemented with batteries or more conveniently with Operational amplifiers since they reference a common ground. One of these circuits should be used for each motor phase. Ideally the bias voltage supplies for all six comparators could be implemented with only two operational amplifiers. The value of the bias voltage depends on the current transducer and comparator. 3O Phase Wire Current From Transducer Phase Wire Inverter To Motor Positive Current Measurement >£sent gmt Current | '- .. Detected Measurement g . Resistor >— f— Negative __ T Cm'rent g: Present Figure 3.1 - Detection Circuit Implemented with Current Transducers When the motor is running with the proper chopping scheme the input and output of the detection circuit will look like the waveforms in Figure 3.2. 31 Current Due To Free-Wheeling Diode Phase W v Current Positive Cm'rent Present H '1 Negative Current Present H Phase Current Detected Figure 3.2 - Waveforms of the Cm'rent Detection Circuit Of course the output of the detection circuit should only be monitored at the proper time. Therefore there must be additional logic to gate the proper circuit output to the controller. To eliminate the errors that occur at high rotor speeds (see section 2.3.1), the microcontroller can adjust the chopping frequency as the rotor speed changes. This means that the chopping frequency does not need to be tmnecessarily high at low rotor speeds. This will result in lower switching losses and still allow high rotor speeds. The chopping frequency can be adjusted continuously as rotor speed changes, or one of only two or three predetermined chopping frequencies can be selected as the rotor speed 32 reaches calibrated thresholds. Unfortunately the maximum rotor speed will still be limited by the maximum chopping fiequency of the inverter. The error in detecting the zero crossing at low rotor speeds (see section 2.3.1 and Figure 2.9) can also be corrected by the microcontroller. The value of the error shown in Figure 2.9 can be calculated using the following formula: _ 59(3) _1_ Error — IO Kv P rpmz [seconds] (1) where P is the number of poles the machine contains, and Kc and K, are the minimum induced voltage for detection and the motor voltage constant respectively (see Figure 2.9). Of course an alternate expression for this equation can be derived for more convenient calculations inside the microcontroller. Since chopping is required to detect the rotor position, the motor cannot achieve maximum speed or maximum acceleration. This effect can be lessened if the chopping is stopped just after current is detected in the open phase until the next commutation begins. This will result in approximately 50% less chopping when the motor is commanded to operate at its maximum voltage. Although this does not eliminate the problem it is certainly a step in the right direction. This irregular chopping scheme may result in torque oscillations. The experimental results (see chapter 5) discuss this potential problem. 33 3.2 PROPOSED SEN SORLESS OPERATING SCHEME The system proposed for operating the motor without rotor position sensors is represented in Figure 3.3. Chopping Selector Inverter Circuit Micro- controller Detection Circuit Figure 3.3 - Proposed System for Sensorless Operation The detection circuit is similar to that of Figure 3.1 except that three of the circuits will be required (one for each phase) and extra logic is needed so that the microcontroller can select which circuit output to read at the proper time. The chopping selector circuit determines which transistor to chop. This function could be performed by the microcontroller, but since the circuit is almost entirely combinational logic, it can be easily implemented externally. The microcontroller performs all of the calculations needed to determine the commutation time. It must first perform the simple starting procedure, then determine 34 which phase current to monitor. Afier the current is detected in the open phase, the microcontroller can use any of a variety of methods to predict the time for the next commutation. The simplest prediction scheme is one in which the microcontroller determines the time at which the current detection occurs (“B” in Figure 3.4) and compares that time to the time of the last commutation (“A” in Figure 3.4). The change in time (“AT” in Figure 3.4) will then be added to the detection time to determine the time for the next commutation as shown in Figure 3.4. Current Due To Free-Wheeling Diode Phase V V Current . u A Phase 0., Current Detected 'A|'1|\ \ \ A AT B B + AT Figure 3.4 - Simple Method of Commutation Time Prediction 35 Alternately, the microcontroller can compare the time at which current is detected in the open phase (“B” in Figure 3.5) with the last time current was detected in the last open phase (“A” in Figure 3.5) and add one half of the difference (“AT” in Figure 3.5) to the most recent time that current was detected as shown in Figure 3.5. Phase A V Current Mill" A . —/¥ A g ‘ *—B+AT Phase C V Current ' X '1 AT = '/z(B-A) Current Detected in '— Phase A Figure 3.5 - Preferred Method of Determining Commutation Time In addition to either of these prediction schemes, the microcontroller must also compensate for the low speed errors associated with (1). At high speeds, the microcontroller must also increase the chopping frequency. When the inverter is chopping at maximum duty cycle, the microcontroller should also signal the chopping 36 selector circuit to stop chopping after current is detected in the open phase as described before. The implementation is this system is described in Chapter 4. Chapter 4 EXPERIMENTAL SETUP An experiment was performed to test Ogasawara and Akagi’s method with the proposed improvements. This chapter describes the hardware and software used in the experiment. This chapter is organized into sections that correspond to the components of the proposed system as shown in F igm'e 3.3. 4.1 CHOPPING SELECTOR CIRCUIT The chopping selector circuit of Figure 3.3 was implemented by the circuit shown in Figure 4.1. The circuit represented in Figure 4.1 is slightly redundant, and contains some extra logic to protect the inverter. 37 38 FROM TO MICRO- INVERTER CONTROLLER A+: TPU CH 1 A-: TPU CH 12 8+: TPU CH 1 B-: TPU CH 1 C+: TPU CH9 C-: TPU CH 8 PWM: TPU CH 0 CHOP: TPU CH 6 Figure 4.1 - Chopping Selector Circuit The microcontroller simply indicates which phases should be energized, provides the chopping waveform, and indicates whether or not chopping is to be allowed. The selector circuit applies the chopping waveform to the appropriate phase. The D-type flip- flopsareusedtoensurethatanychangeininverterstatewillbesynchronizedwitha change in the PWM signal. This is done to ensure that a phase cannot be turned “on” and “ofl” again in an extremely short amount of time for the protection of the inverter. 39 The exclusive-OR gates are used for protection against shoot-through. Shoot- through is caused when any two transistors in a given phase (i.e. A+ and A-) are conducting at the same time. This causes a large current flow through the transistors and can destroy the inverter. As indicated by the use of both AND and NAND gates in the final stage of the circuit, the inverter allows the transistors that are connected to the positive rail (A+, B+, and C+) to conduct with high inputs. However the transistors connected to the negative rail (A-, B-, C-) are active low. To disable chopping the microcontroller. simply sets the value of em high. This is only done when the PWM is at its maximum duty cycle and after the current has been detected in the open phase. 4.2 DETECTION CIRCUIT The detection circuit fiom Figure 3.3 was implemented using a circuit similar to that of Figure 3. 1 but with some slight modifications. The experimental circuit for all of the phases rs shown m Figure 4. 2. The signal labels include the names of the microcontroller pins that either provide or receive the signal. 40 IN PHASE A: Port E Pin 3 CURRENT IN PHASE B: Port E Pin 2 CURRENT IN PHASE C: Port E Pin 1 Figure 4.2 - Detection Circuit 41 The operational amplifies used for both comparators and bias voltage were number LF347 which contains four amplifiers per integrated circuit. Since these Operational amplifiers were used with :5 V rails, the diodes and resistors were needed so that a -5 V output would not be applied to the two-input OR gates. Although six Operational amplifiers were used to generate the bias voltages for the comparators, fewer amplifiers (as few as two) may be used to generate the bias voltages for the three phases. Notice that the bias voltages are all positive. One would expect the bias voltages for the comparators that detect negative phase current (represented by a negative voltage across the measm'ing resistor) to be negative. However the internal bias of the Op-amps and current transducers allow a small positive voltage to be used. The value of the bias voltages are less than 30 mV. The structure of this circuit provides some insight into the control algorithm executed by the microcontroller. For example, if the microcontroller initiates a commutation in which phases C and B are conducting and phase A is Open, then the signal labeled “CURRENT IN PHASE A” is monitored to ensure that the commutation is complete. After the current in phase A has decayed, the microcontroller sets the signal labeled “CHECK PHASE A”. This allows the detection of any current in phase A to cause an interrupt to indicate that the induced voltage has just crossed zero. 42 4.3 INVERTER The inverter used for the experiment was built in the Electric Machines Lab at Michigan State University. It consists Of a power transistor module and a driver board. The transistor module (also known as a power module) used is an Intellimod PM3 ORFSO60 manufactured by Powerex. This module contains the usual six IGBTs and free-wheeling diodes along with a seventh power transistor which can be used to short the DC rail. The forward voltage drop across a conducting flee-wheeling diode (V n) was measured to be 0.53 V. The saturation voltage drop across the power transistors (V CE) was measured to be 0.99 V. The average of these two voltages is 0.76 V. This is the induced voltage need to cause a flee-wheeling diode to conduct (K). The power module also contains protection circuitry which may be activated when the transistors are too hot, conduct too much current, or are driven with improper voltages. The driver board provides isolation between the high voltage of the inverter and the TTL signals produced by the chopping selector circuit. It converts the six TTL signals into the six driving signals for the power module. It should be mentioned that shoot-through protection is provided by two separate sources. First the power module has internal protection fiom shoot-through, however this protection is not intended to be used on a normal basis. In fact repeated activation of the shoot-through protection devices on the power module is considered to be misuse and can lead to damage. The second layer of shoot-through protection comes from the chopping 43 selector circuit of Figure 4.1. As mentioned before, the exclusive-OR gates prevent two transistors in the same phase from being accidentally turned on at the same time. 4.4 BRUSHLESS DC MOTOR The motor used for the experiment was a four pole Bodine 3/ 8 HP trapezoidal brushless DC motor (type 34B6BEBL, model #3309). The motor is rated at 2.7 A and 2500 rpm. The rotor contains rare earth permanent magnets which produce an induced voltage of 42 mV/rpm peak-tO-peak (K,) in the stator. Since the flee-wheeling diode will conduct when the magnitude of the induced voltage exceeds 0.76 V the theoretical minimum speed of the motor is 36.19 rpm. The motor was originally intended to be Operated using the three Hall-effect sensors attached to the back Of the machine. These sensors were disconnected for the experiments. 4.5 MICROCONTROLLER The microcontroller used for the experiment was a Motorola 68332. This is a 32- bit processor capable Of operating at 16.67 MHz The 68332 also contains a Time Processor Unit (TPU) which was used to facilitate the PWM and timing functions required to operate the motor. The processor contains two 8-bit parallel I/O ports (ports E and F) and the TPU has 16 channels which may be used as I/O or to implement any of the 44 pre-programmed timing ftmctions. All of the microcontroller inputs except the signal “CURRENT IN OPEN PHASE” (Figure 4.2) use the parallel I/O port B. All of the microcontroller outputs are implemented using TPU channels as output pins since port E has only eight pins (port F was intentionally not used to leave room for future expansion). The TPU’s PWM function was used to facilitate chopping. This pre-programmed firnction generates a PWM signal of period and duty cycle specified by two registers. This makes it possible to control the motor voltage by simply increasing or decreasing the value in the duty cycle register. The period register can be adjusted to increase or decrease the chopping frequency which will enable the motor to Operate properly at high and low speeds as described earlier. The TPU’s Input Transition Counter (ITC) fimction was used to capture a timer value when the signal labeled “CURRENT IN OPEN PHASE” (Figure 4.2) transitions fiorn low to high. This will also cause an interrupt. The interrupt service routine (ISR) for the ITC then calculates the time at which the next commutation should occm' (actually just the difference between the current time and the next commutation time is calculated). The first closed loop commutation time is calculated using the simple method shown in Figure 3.4. After the first closed loop commutation, the algorithm shown in . Figure 3.5 is used. The slightly more complicated algorithm Of Figure 3.5 is preferred since it is based on actual current detection and not a previous calculation. The more simplistic method of Figure 3.4 is used for the first closed loop commutation because it is easy to initialize since the time of the last Open 100p commutation can be used for initialization. Unfortunately an interrupt must be generated to capture the time of the last 45 open loop commutation. Therefore the first time the ITC ISR is executed the time of the last Open loop commutation is captured. The second time the ITC ISR is executed the first closed loop commutation time is calculated using the method of Figure 3.4. During the third invocation (and during all subsequent invocations) of the ISR the commutation time is calculated using the method shown in Figure 3.5. At low speeds, the commutation time (calculated by the method described above) must be corrected since the induced voltage is comparable to the voltage needed for the flee-wheeling diode to conduct. Since all of the timing is done using a TPU timer, equation (1) must be modified to give the error in timer counts. Since the motor has four poles and the TPU timer is configured to run at 65.10 kHz, equation (1) can easily be modified as shown. 4 K Erro = EEC—(1536 - 10 - 6)AC2 [counts] (2) V where AC is the value of AT (fi'om Figures 3.4 and 3.5) expressed in 15.36 us increments. Multiplying by the constant, 15.36x10'6 be can accomplished by shifting the binary value 16 places to the right, or taking only the high word of AC2 if it is stored as a long word. This is not exact but produces less than 1% error. The values for Kc and K, can be determined easily from the characteristics of the inverter and motor respectively. However the value Of Kc determined from the inverter characteristics is only valid if the 46 detection circuit is able to detect infinitesimally small amounts of current. The actual back emf that must be Obtained for the detection circuit to detect the rotor position on time must be determined through experiment (see section 5.1). After the error is subtracted fiom the commutation time, the ITC ISR initializes another TPU firnction called an Output Compare (OC). The OC causes an interrupt at the calculated commutation time (from the ITC ISR). The OC interrupt service routine then initiates the commutation. The commutation is complete when a low voltage is present on the “CURRENT IN PHASE x” signal (x is the Open phase) for a predetermined number of loops. The OC interrupt service routine then sets the proper “CHECK PHASE x” signal (x is the open phase) so that current in the open phase can cause another ITC interrupt. The OC ISR also adjusts the chopping frequency to allow high rotor speeds. Finally, the ITC interrupt is enabled, which causes the process to repeat indefinitely. Figure 4.3 shows a flow chart for the control algorithm executed by the main program and ITC ISR. Figure 4.4 shows a flow chart for the OC ISR. Appendix A contains the actual assembly code which implements these functions. It should be noted that in the experiment, the motor spins in the Opposite direction than that implied by Figures 2.1, 2.4, 2.6, 2.7, 2.8 and 3.5. 47 [initialize Microcontroller ] I Disable Interrupts I [ Turn Off Inverter l Lgear all “CHECK PHASE” signals] Initialize Rotor Position to: A- & C+ on, Phase B Open [Enable ITC Interrupts] Advance Commutation by 120°: A+ & B- on, Phase C Open Set “CHECK PHASE A" (to Cause Interrupt to get Initial Time) M Second Time 1 Through? Afier ISR has Executed Once Set “CHECK PHASE C” (Initiate Closed L°°P “mm” Shift Value Right 1 L Endless Calculate Error Loop M Subtract Error I Store Result in 10C Register 1 Enable 0C & Interrupts @wm@ Figure 4.3 - Flow Chart Of Main Program and ITC ISR 48 L Disable Interrupts j rInitiate CommutaticFl “CURRENT IN PHASE A” = 0 Set “CHECK PHASE A” & Clear “CHOP” L__ YES PHASE B” = O f, for N loops . Set “CHECK PHASE B” & Clear “CHOP PHASE C” = 0 Set “CHECK PHASE C” & Clear “CHOP” RPM > R YES Chop at High 9 Frequency Chop at Low Frequency L 5 Enable ITC & Interrupts L @m@ Figure 4.4 - Flow Chart of Output Compare ISR Chapter 5 DESCRIPTION OF EXPERIMENTS AND RESULTS Several experiments were run to determine the performance of the proposed system. This chapter is organized by experiment. Section 5.1.1 describes the tuning and validation of the detection circuit. Once the detection circuit was properly tuned, an experiment was performed to determine the actual value of Kc used in equation (2), as described in section 5.1.2. This value corresponds to the minimum speed at which the motor can spin with optimal commutation. Section 5.2 describes experiments that were performed to investigate the effects of changing the chopping scheme to lessen the amount of chopping required and to allow for higher rotor speeds as proposed earlier. 5.1 DETERMINATION OF CONSTANT S The constant K, which represents the minimum induced voltage at which current can be detected in the Open phase, has a theoretical value of 0.79 V. The limited sensitivity of the detection circuit results in a higher actual value for Kc. The actual value of Kc was determined through a series of experiments. The first set of experiments was designed to get the motor to operate optimally when the detection circuit is tuned to its 49 50 maximum operable sensitivity. After this was accomplished, a second set of experiments was done, in which the value of Kc was determined by trial and error using the shape of the phase currents to determine when the appropriate value was selected. Section 5.1.1 describes the first set of experiments and section 5.1.2 describes the second set. 5.1.1 TUNING AND VALIDATION OF THE DETECTION CIRCUIT The value of Kc depends on how soon the detection circuit can detect current in the open phase. If the detection circuit is tuned to its maximum sensitivity, the value of Kc can be minimized, thus enabling the motor to operate at lower rotor speeds. The sensitivity of the detection circuit depends heavily on characteristics of the current transducers, the comparators, and the bias voltages. For a given cmrent transducer and comparator, adjusting the bias voltages is the only way to adjust the sensitivity. Unfortunately variations in the comparators and current transducers make it necessary to individually tune the bias voltages to ensure that the detection circuit responds the same for positive and negative current in each phase. The motor will not run optimally if the current detector in one phase is more sensitive than the detector in the others, or if a detector is more sensitive to positive current than negative current. The first step in the timing process is to determine which comparator output provides the least sensitivity. This comparator will be the limiting factor for the detection circuit, and all of the other comparators must be tuned to match it. To determine the least 5 1 sensitive comparator we can examine the inverter input signals that are generated by the chopping selector circuit while the motor is Operating with the proposed sensorless drive. Consider the inverter input signal that controls the transistor A+ as shown in Figure 5.1. When the motor is operating properly under steady state conditions the transistor should be chopped for 60 electrical degrees and conduct for sixty electrical degrees as shown in Figme 5.1 (see also Figure 2.4). The small spikes that occur when A+ is not being chOpped are the product of noise from the microcontroller and can be ignored. Figure 5.1 - A+ When the Motor is Operating Properly When the transistor A+ is chopped, the transistor B- is conducting and phase C is open The microcontroller should be examining phase C for positive current (this will indicate that the free wheeling diode is conducting). When the transistor A+ is not being chopped, and transistor 0 is conducting (as in the right hand side of Figure 5.1), the microcontroller should be examining phase B for negative current. If for some reason the 52 . comparator which detects positive current in phase C is less sensitive than the comparator that detects negative current in phase B, then the amount of time A+ is chopped will be longer than the amount of time that A+ is conducting as shown in Figure 5.2. W Figure 5 .2 - A+ When Detection Circuit is Unbalanced If the bias voltage of each comparator is adjusted to provide the minimum offset (the minimum offset is the offset below which the motor stalls), then the maximum amount of time that the inverter stays in any one state will correspond to the least sensitive component of the detection circuit. The rest of the comparator offset voltages can then be adjusted until the corresponding inverter state remains active for the same amount of time as the state that corresponds to the least sensitive comparator. This will ensure that the detection circuit is “balanced”. The minimum offset voltages (for balanced operation) for the comparators that detect positive current in phases A, B and C were determined to be 20.0, 15.3 and 23.8 mV respectively. The comparators that detect negative current in the motor phases were unusual because they also required positive ofi'set voltages (negative voltages should be expected for these comparators). The maximum values for the bias voltages (for balanced operation) for the comparators that detect negative current in phases A, B, and C 53 were determined to be 5.9, 13.7 and 6.1 mV respectively. Figure 5.3 shows the current in phase A along with the signal generated by the portion of the detection circuit that indicates positive current in phase A. Notice that the detection circuit detects current that is almost indistinguishable fiom noise when viewed on an oscilloscope. Phase Current Positive Current Detected ”LIL. Current Detected 3min: 200 ms {r 1.5A Figure 5.3 - Phase Current and Its Detection 54 5.1.2 DETERMINATION OF Kc After the detection circuit is set to its maximum balanced sensitivity, the minimum value of Kc (and hence the minimum rotor speed for optimal operation) can be determined by examining the phase currents when different values of Kc are used by the microcontroller to determine the error correction term represented in equation (1). If the experimental value of Kc is too large, then the low speed error will be too large as well. This will cause the commutation to occur too soon. As a result of the early commutation, the maximum induced voltage will not yet be present in the conducting phases. Since the maximum induced voltage cannot “push back” against the applied voltage, the motor will draw a larger current. As the rotor position increases and the poles are covered by the conducting phases, the current will decrease back to its normal value. Figure 5.4 shows the phase current of the motor when the value of Kc is chosen to be too large. Figure 5.4 - Phase Current When Kc is too Large 55 If too small of a value is chosen for K, then the calculated commutation time will be longer than the Optimal commutation time. This means that the rotor poles will pass the energized phases and the phase current will increase as shown in Figure 5.5. Figure 5.5 - Phase Current When Kc is too Small When the proper value of Kc is chosen, the phase current should be flat (when the phase is energized) as shown in Figure 5.6. Figure 5.6 - Phase Current for Proper Kc 56 The actual value for Kc was determined by experiment to be 1.155 V. This corresponds to a minimum rotor speed of 55 rpm. After selecting the proper value for K, the low speed error correction term represented by equation (2) was used to adjust the commutation time predicted by the method of Figure 3.5. Figure 5.7 shows how the low speed correction term adjusts the predicted commutation time. Note that the values are expressed in timer counts (1 count = 15.36 microseconds). 6000 . . . + + Predicted Commutation 5000- + —Adjusted Commutation AC (Counts) 4000f + + 3000- ++ +++ 2000 ’ ++++++ l 1000 - M. 0 f . . .0 50 100 150 200 Rotor Speed (RPM) Figure 5.7 - Low Speed Error Correction In addition to the correction factor produced by equation (2), an additional 20 counts are subtracted fiom the predicted commutation time to account for the delay 57 between the time the OC interrupt occurs and the time when the commutation actually occurs. This delay is associated with the microcontroller interrupt service time and the length Of the code that is executed before the commutation in the OC ISR. 5.2 VALIDATION OF CHOPPING REDUCTION AND CHOPPING FREQUENCY ADJUSTMENT SCHEMES As mentioned earlier, the proposed BLDC drive should stop chopping the inverter rail voltage after current is detected in the open phase, if the chopper is running at its maximum duty cycle. Attempts to validate this procedure and to quantify the actual increase in obtainable voltage as well as torque ripple were not successful for the following reasons: It was observed that at high duty cycles, the detection circuit becomes less sensitive which results in late commutations. It was Observed that at high duty cycles (97%) and low rotor speeds (less than 600 rpm) the detection of current in the Open phase occurs so late that it is impossible to initiate the next commutation on time. This is true even when the commutation is commanded at the instant current is sensed in the open phase. However this is not the case if the commutation is commanded the instant that current is sensed in the Open phase at high rotor speeds (greater than 600 rpm). This is fortunate since high duty cycles and low rotor speed are generally not allowed due to restrictions on phase current, however high duty cycles and high rotor speeds may be very common. Unfortunately, commanding commutation to occur as soon as current is detected in the Open phase does not allow the microcontroller to stop chopping. 58 It may be somewhat misleading to refer to high duty cycles, since it is the amount of time which the transistor is chopped and not the percentage of conducting time which causes the detection circuit to become less sensitive. Since the TPU timer was configured so that a chopping fi'equency of 3 kHz was achieved by making the chopping period 34 counts long, the maximum duty cycle was 97% (33/34). If the chopping period were longer, the maximum duty cycle would increase without further loss Of sensitivity by the . detection circuit. Several experiments were run to determine the maximum rotor speed when chopping at 3 kHz (a typical chopping frequency). The experiments indicated that rotor speeds above approximately 2300 rpm were difficult to achieve due to the high speed errors indicated in Figure 2.8. This is the same as the maximum speed in [4]. To allow higher speeds the microcontroller was programmed to change the chopping frequency to I 6 kHz when the rotor speed exceeds approximately 700 rpm. This allowed rotor speeds well above the motor rated speed of 2500 rpm. However, decreasing the chopping period also lowers the maximum duty cycle. In this case the maximum duty cycle drops from 97% to 94%. This decrease in voltage will caused a loss in maximum rotor speed Of approximately 28 rpm (from 1299 to 1271 rpm) for a 50V DC rail. Chapter 6 FUTURE IMPROVEMENTS The proposed system has several flaws which may limit the number of applications for which it may be used. There are two basic limitations to the proposed system. The first limitation is the system’s inability to compensate for acceleration. A correction factor could have been added to account for linear accelerations as was done in the original system, however there are many applications where linear acceleration are not common. A simple method for providing compensation for all types of acceleration is proposed in section 6.1. The second limitation is that chopping is required to detect the rotor position. The possibility of not chopping is discussed in section 6.2. Both of the proposed future improvements use the computational abilities of the microcontroller in an attempt to create a hybrid drive that uses both estimation and detection techniques to Operate the motor. 59 60 6.1 DYNAMIC LOAD COMPENSATION To account for accelerations, the microcontroller can be used to integrate the velocity of the rotor to determine position, and hence the proper commutation instant. The linear speed-torque and torque-current relationships of the trapezoidal brushless DC motor make it easy to calculate the motor velocity if the applied voltage and current are known. The integrator must be initialized to some known position. Since the detection of current in the open phase corresponds to a known rotor position (after taking into account the low speed errors), the detection can be used to initialize the integrator. The integrator can then indicate when the commutation should occur, thus compensating for any type Of acceleration or deceleration. Figure 6.1 indicates how the microcontroller activities could correspond to the detection of current in the open phase. Notice that the integration occurs only fiom the time current is detected in the open phase until the next commutation. NO calculations are needed after the commutation occurs until current is detected in the next open phase. As mentioned earlier, the detection circuit becomes less sensitive at high duty cycles, and requires the commutation to be initiated as soon as current is detected in the Open phase. Therefore no integration will be needed when Operating at high duty cycles. 61 Trigging Event Current Detected in Open Phase :Time Micro- controller Tasks Calculate Rotor Speed Through Phase Current Initiate Commutation When Indicated by Calculated Position Calculate Rotor Position From Speed, Kc and Kv Begin Integration Of Speed Using Calculated Initial Position Wait Until Next Time Current is Detected in the Open Phase Figure 6.1 - Algorithm for Dynamic Load Compensation 62 6.2 ELIMINATION OF CHOPPING There are many applications where the ability to apply the full rail voltage is desired. This is impossible for the proposed system since the full rail voltage can only be applied when there is no chopping (this is equivalent to chopping with a 100% duty cycle). Fortunately the full rail voltage is usually only commanded at high speeds due to current limitations. At high rotor speeds the induced voltage has a profound effect on the phase current. This makes it easier to calculate the rotor position via integration of the velocity for long periods of time. It is proposed that if the duty cycle is commanded to 100%, the last occurrence of current in the Open phase (from before the duty cycle was 100%) should initiate and initialize integration of the velocity (as described above), and that the integration continue until a lower duty cycle is commanded. For example, assume that the motor is operating at a low duty cycle, and integrating the phase current as described earlier. The integration was initialized the last time current was detected in the open phase. If the duty cycle is then commanded to 100%, instead of ceasing the integration alter the commutation, simply continue until the duty cycle is lowered and current can be detected in the open phase again. Since the induced voltage is large, the integration should provide a sufficiently accurate estimate of the rotor speed. This is a calculation intensive procedure that represents the transition fiom a sensorless detection drive to a sensorless estimation based drive. Chapter 7 CONCLUSIONS AND COMMENTS The experiments of Chapter 5 prove that the proposed sensorless driveallows the motor to operate at a wider speed range than the original system proposed by Ogasawara and Akagi. Experiments show that the motor can operate at speeds from 55 to over 2500 rpm efficiently. The proposed drive should be more efficient than the drive in [4] since it provides much more accurate error correction at low rotor speeds. The proposed system corrects for low speed error down to 55 rpm, whereas the original system initiated commutation as soon as current is detected in the open phase at all speeds below 500 rpm. The proposed system can achieve a maximum rotor speed that is more than 200 rpm faster than the original system due to the implementation Of a variable chopping fiequency. However the increase in chopping fi'equency is generally accompanied by a decrease in the maximum applicable voltage since the DC rail voltage must be chopped for some fixed minimum amount of time. The minimum speed of the motor with the proposed system is approximately 10 rpm higher than that Of the original system. However this should be expected since the motor used in [4] had a higher voltage constant (Ky) and a lower conducting voltage drop 63 64 across the flee-wheeling diodes and power transistors of the inverter (Kc). The theoretical minimum operating speed of the motor used with the proposed drive is approximately 36 rpm whereas the theoretical minimum Operating speed Of the motor used with the original system was 22 rpm. The proposed system is able to come much closer to its theoretically minimum speed than the original system. This indicates that the use of current transducers and the proposed detection circuit is equally if not more sensitive than the detection circuit of the original system (when the duty cycle is not tOO high). Attempts to reduce the amount of time that the rail voltage was chopped were not successful due to an unexpected decrease in the sensitivity Of the detection circuit at high duty cycles. This loss Of sensitivity, however, does not interfere with the motor’s ability to achieve high speeds, but makes the drive less efficient when operating at low speeds. It should be noted that speed and torque control were not mentioned in this thesis. The goal of the proposed drive was to allow the motor to Operate properly, no matter what the commanded speed or torque. This means that any speed or torque control may be implemented independently of the commutation scheme. In summary, the two main weaknesses of the proposed drive are the need for chopping, and the inability to compensate for a dynamic load. These weakness may be overcome using the modifications suggested in the previous chapter. In nearly all other respects the proposed drive obtains superior performance when compared to the original system. APPENDIX A 65 *************eeea*********************************************** * This Program is intended to drive a brusless D.C. * motor without rotor position sensors. * The software requires very specific hardware to * interface with the drive ***************************************************************** org $4000 SYNCR EQU $FFFA04 CPU CLOCK SYN. CONTROL REG TPUMCR EQU $FFFE00 TPU Module Control Register TICR EQU $FFFEO8 TPU Interrupt Enable Register CIER EQU SFFFEOA TPU Channel Interrupt Enable Reg CISR EQU $FFFE20 TPU Channel Intrpt. Status Reg CFSR3 EQU $FFFE12 TPU Channel Function Select Reg HSQRI EQU $FFFE16 TPU Host Sequence Register 1 CHOPARO EQU SFFFFOO TPU Channel 0 Parameter O Reg CHOPAR2 EQU $FFFFO4 TPU Channel 0 Parameter 2 Reg CHOPAR3 EQU $FFFFO6 " " 3 CHIPARO EQU $FFFF10 TPU Channel 1 Parameter 0 Reg CHlPARl EQU $FFFF12 CH1PAR2 EQU $FFFF14 TPU Channel 1 Parameter 2 Reg FINTRAN EQU $FFFF18 CH2PARO EQU $FFFF20 TPU Channel 2 Parameter 0 Reg CH2PAR1 EQU $FFFF22 CH2PAR2 EQU $FFFF24 TPU Channel 2 Parameter 2 Reg CH2PAR3 EQU $FF FF 26 HSRRO EQU $FFFE18 HSRRI EQU $FFFE1A TPU Host Service Request Reg 1 CPRO EQU $FFFE1 C CPRl EQU $FFFE1E TPU Channel Priority Reg 1 PEPAR EQU $FFFA17 PORT E PIN ASSIGNMENT REG. DDRE EQU $FFFA15 PORT E DATA DIRECTION REG. FORTE EQU $FFFA13 PORT E DATA REGISTER ******Logic Signals For Inverter, Flags & Variables***** * STATO A+A-B+B-C+C- dc.w %0000011010011010 First Inverter state A+ and B- on Coff 66 STAT] dc.w %0000011010101001 A+.C- Boff STAT2 dc.w %0000101001101001 B+,C- Aoff STAT3 dc.w %0000100101101010 B+,A- Coff STAT4 dc.w %0000100110100110 C+,A- Boff STATS dc.w %0000101010010110 C+,B- Aoff STATZ dc.w %0000101010101010 All OFF STATE dc.b $0 STATE OF INVERTER F irsTlM dc.b 0 Flag to get initial time LsTran dc.w 0 Last time spikes occured SndTIM dc.b 0 Second time through ISRl (first comm) ChOpMOde dc.b 0 Chopping Freq (0 = Low, 1 = HI) ******************************** *************Inten-upt VCCIOIS********************** org $104 CHIVEC DC.L $10004 TPU Ch 1 Interrupt Service Routine location CH2VEC DC.L $10204 TPU Ch 2 " ***************************************************** **************** Initialization ************************ org $3000 move.w #$FFFF,D2 move.w #$CF80,SYNCR SET SYSTEM CLOCK TO l6MHz *******SETUP PORT E AS INPUT PORT********** move.b move.b #$00,PEPAR Set Port E to I/O function #$00,DDRE Set Port E to INPUT ********SET UP TPU MAIN REGISTERS************ move.w #$608E,TPUMCR PRESCALE TCRl BY 8 SET IARB TO $E move.w #$O640,TICR TPU INTRP LEV. 6 VECTOR AT 4*40 move.w #$8EA9,CF SR3 Ch 1 = ITC ChO=PWM ch2 =OC ch3=DIO move.w #$0888,CFSR3-2 Ch 4,5 = DIO, CH6 = NO_ChOp move.w #$8888,CFSR3-4 Ch 8,9,10,11 = DIO move.w #$0088,CFSR3-6 ch 12,13 = DIO ******SET UP DIO CHANNELS (ENABLES and Inverter)***** move.w #%0010101010000000,HSRR1 Set ENABLE A,B,C Low (disable) Allow Chopping 67 move.w #%0011111111000000,CPR1 Set CH 3-6 & 8-13 move.w #%0000111111111111,CPRO to High Priority * **********SET UP CHANNEL 1 (INPUT)********** ori.w #$0004,HSQR1 Chl One Continuous mode (no links) move.w #$0007,CH1PARO Chl Detect Either edge move.w #$000E,CH1PAR1 No Start Link or Link chan cnt or BA move.w #$0001,CH1PAR2 Max Count = 1 (count 1 transition) move.w #$0004,HSRR1 Initialize ch] (ITC) ori.w #$000C,CPR1 Set CH1 high priority clr.w D0 WAIT] move.w HSRR1,DO WAIT TO MAKE SURE ITC INTTIALIZTION andi.w #$OF,DO IS COMPLETE bne WAITl * **************end OfChl semp***************** * ***********SET UP CHANNEL 0 (CHOPPER)******** move.w #$0091,CHOPARO SET CHANNEL ZERO move.w #$1C,CHOPAR2 HIGH TIME (COUNTS) move.w #$22,CHOPAR3 PERIOD (COUNTS) move.w #$0002,HSRR1 Initialize ch0 (PWM) ori.w #$OOO3,CPR1 Set ChO high priority clr.w D0 WAITO move.w HSRR1,D0 WAIT TO MAKE SURE PWM INTTIALIZTION andi.w #$OF,D0 IS COMPLETE ~ bne WAITO III *****************end OfChO setup*********** *II!********************************************************* * Turn Off all phases and wait about 6 sec. ************$********************************************** lea STATZ,A0 move.w (A0),D0 move.w D0,HSRRO clr.l D0 delay addi.l #1,D0 cmpi.l #$1FFFFF,D0 beq start bra delay 68 ************************II!******************************************** a******************************************************************** ******* Set duty cycle to max safe voltage start move.w #$15,CHOPAR2 High time (counts) ******* Initialize rotor position clr.w DO lea STAT3,A0 move.w (A0)+,DO move.w D0,HSRRO * *** * * * Wait for rotor to move to initial position c1r.l D0 INIPOS addi.l #1 ,DO cmpi.l #$FFFF,D0 delay time can be adjusted bmi INIPOS ******* Start first commutation (state 5) lea STAT5,A0 move.w (A0)+,D0 move.w D0,HSRRO ******* Get Initial Time (using Channel 1) move.w #$0002,CIER ENABLE CHANNEL 1 INTERRUPTS andi.w #$FOFF,sr ENABLE INTERRUPS ori.w #$0500,sr " move.w #$540,HSRR1 set all enables to trigger intrpt * that gets initial time getTIM move.b ’ FirsTIM,D0 Wait until Initail Time is stored beq getTIM 69 ******* Check for no current in Open phase (A) and set enable NOtOFF btst.b #3,PORTE if commutation is done (no current in bne NotOF F open phase) then move.w #$40,HSRR1 set ENABLEA ************************************************************* ******* Initiate Closed Loop Control *********** ************************************************************* move.w #$0002,CIER ENABLE CHANNEL 1 IN TERRUPTS andi.w #$FOFF,sr ENABLE INTERRUPS ori.w #$0500,sr " III************************************************************ ********e**************************************************** ******** MAINPROGRAM ************* ****************************#******************************** outloop bra outloop III**********III***********#************************************** ****************************************************#********* *************Interrupt Service Routine For Channel 1********* org $10004 andi.w #$FFFD,CIER DISABLE CHANNEL 1 INTERRUPTS move.w CISR,D6 .. Clear Channel 1 IRQ andi.w #$FFFD,CISR move.w #%0000101010000000,HSRR1 TURN OFF ENABLEA,B,C * Stop Chopping if at max duty cycle move.w CHOPAR3,D5 sub.w CHOPAR2,D5 cmpi.w #7,D5 bhi CHOP move.w #%0001000000000000,HSRR1 Stop Chopping CHOP NotFrst ROLLOVER CHKsnd NotScnd move.b bne move.w move.b bra move.w move.w move.w cmp.w bhi sub.w bra clr.l move.w sub.w add.w move.b bne move.b bra move.w lsr.w 7O FirsTIM,D0 NotFrst F INTRAN,LsTran #$FF,FirsTIM END2 FINTRAN,D3 LsTran,D4 D3,D7 SAVE COUNTER VALUES D3 ,D4 ROLLOVER D4,D3 CHKsnd Calculate Offset time D0 #$FFFF,DO D4,DO D0,D3 SndTIM,D0 NotScnd #$FF,SndTIM SETINT D3,D2 #1 ,D3 STOR FOR USE IN OC ISR ******* Adjust for errors ***** clr.l clr.l move.w mulu.w mulu.l lsr.l lsr.l sub.w sub.w clr.w bpl clr.w D0 D1 D3,D1 D3,D1 #22,D1 (15 is theoretical min) #8,Dl shift to divide #8,D1 by 2"-16 D1 ,D3 #20,D3 D3 Use this line at max duty cycle only! SETINT D3 71 SETINT move.w F INTRAN,LsTran * ***********SET UP CHANNEL2OUTPUT DELAY******** move.w #$OO83,CH2PARO SET CHANNEL TWO move.w D3,CH2PAR1 OFFSET (WRITTEN BY CH1 ISR) move.w #$0018,CH2PAR2 REFERENCE ADDRESS FROM CH1 INPUT TIME ori.w #$OOOO,HSQR1 Schedule Interrupt move.w #$0010,HSRR1 Init ori.w #$OO30,CPR1 Set Ch2 high priority clr.w D0 WAIT2 move.w HSRRI ,DO WAIT TO MAKE SURE OC INITIALIZTION andi.w #$0030,D0 IS COMPLETE bne WAIT2 * *****************End 0fCh2 Setup!!!******************** ori.w #$0004,CIER Enable Channel 2 Interrupts rte ******************End ofChmnel1ISR********************* *****************CHANNEL 2 ISR****************************** org $10204 andi.w #$FFFB,CIER DISABLE CHANNEL 2 INTERRUPTS move.w CISR,D6 Clear Channel 2 IRQ andi.w #$FFFB,CISR cmpa.l #STAT5,A0 bhi NXTREV bra COMM NXTREV lea STATO,A0 move.b #00,STATE COMM move.w (A0)+,D0 move.w D0,HSRRO * *****Wait For Commutation to complete******** ** clr.l D0 AOFF AOFF 1 BOFF BOFF] COFF COFF] END2 move.b beq cmpi.b beq bls cmpi.b beq bls bhi move.b btst.b bne subi.b bne move.w bra move.b bne subi.b brie move.w bra move.b bne subi.b bne move.w bra 72 Determine which phase should be Open STATE,DO COFF #2,D0 AOFF BOFF #4,D0 BOFF COFF AOFF #60,D5 #3,PORTE AOFF #1 ,DS AOFF] #$2040,HSRR1 END2 if commutation is done (no current in Open phase) then set ENABLEA Start Chopping #60,D5 btst.b #2,PORTE BOFF #1 ,DS BOFF] #$2100,HSRR1 END2 set ENABLEB Start Chopping #60,D5 btst.b #1,PORTE COFF #1 ,D5 COFF] #$2400,HSRR1 END2 set ENABLEC Start Chopping ******** Adjust Chopping Frequency to account for speed **.*** clr.l move.b bne cmpi.w bhi move.w 151.1 131.1 D0 ChOpMode,D0 HiMOde #446,D2 Cont CHOPAR2,DO #8,D0 #7,DO Check to see if rpm > 700 move.w #$1 1 ,DO movel D0,CHOPAR2 move.b #1 ,ChOpMOde HiMOde cmpi.w #446,D2 bls Cont move.w CHOPAR2,D0 151.1 #8,D0 lsl.1 #8,D0 131.1 #1 ,D0 move.w #$22,D0 move] D0,CHOPAR2 move.b #0,ChopMode Cont addi.b #1,STATE ori.w #$0002,CIER rte if rrnp > 700 go to hi mode Check to see if rpm > 700 if rpm < 700 go to low mode Enable Channel 1 Interrupts ****************end OfChZ ISR***************************** BIBLIOGRAPHY [1] [2] [3] [4] 74 G. C. Yomg and R Kiefer, “Electronically Commutated Motor for Driving a Compressor,” United States Patent, Patent Number 5,491,978, February 20, 1996 Nobuyuki Matsui, “Sensorless PM Brushless DC Motor Drives,” IEEE Transactions on Industrial Electronics, vol. 43, pp. 300-308, April 1996 K Iizuka, H. Uzuhashi, M. Kano, T. Endo and K. Mohri, “Microcomputer Control for Sensorless Brushless Motor,” IEEE Transactions on Industry Applications, vol. IA-21, pp. 595-601, June 1985. Satoshi Ogasawara and Hirofurni Akagi, “An Approach to Position Sensorless Drive for Brushless dc Motors,” IEEE Transactions on Industry Applications, vol. 27, pp. 928-933, September 1991 "Illllilllllllllilli