Patent Publication Number: US-10763740-B2

Title: Switch off time control systems and methods

Description:
CROSS-REFERENCE TO RELATED APPLICATIONS 
     This application claims the benefit of U.S. Provisional Application No. 62/323,538, filed on Apr. 15, 2016. The entire disclosure of the application referenced above is incorporated herein by reference. 
    
    
     FIELD 
     The present disclosure relates to a voltage converters and, more particularly, to circuits for filtering systems and methods controlling switching of voltage converters. 
     BACKGROUND 
     The background description provided here is for the purpose of generally presenting the context of the disclosure. Work of the presently named inventors, to the extent it is described in this background section, as well as aspects of the description that may not otherwise qualify as prior art at the time of filing, are neither expressly nor impliedly admitted as prior art against the present disclosure. 
     Electric motors are used in a wide variety of industrial and residential applications including, but not limited to, heating, ventilating, and air conditioning (HVAC) systems. For example only, an electric motor may drive a compressor in an HVAC system. One or more additional electric motors may also be implemented in the HVAC system. For example only, the HVAC system may include another electric motor that drives a fan associated with a condenser. Another electric motor may be included in the HVAC system to drive a fan associated with an evaporator. 
     SUMMARY 
     In a feature, a power factor correction (PFC) system is described. A desired OFF period module determines a desired OFF period for a switch of a PFC circuit based on an input voltage to the PFC circuit and an output voltage of the PFC circuit. A switching control module transitions the switch from an ON state to an OFF state when a measured current through an inductor of the PFC circuit is greater than a demanded current through the inductor and maintains the switch in the OFF state for the desired OFF period after the transition from the ON state to the OFF state. 
     In further features, the desired OFF period module sets the desired OFF period using one of: (i) an equation that relates input voltages and output voltages to desired OFF periods; and (ii) a look-up table that relates input voltages and output voltages to desired OFF periods. 
     In further features, the desired OFF period module sets the desired OFF period using the equation: 
               DOP   =       t   p     *       V   I       V   O           ,         
where DOP is the desired OFF period, t p  is a predetermined switching period, v i  is the input voltage, and v o  is the output voltage.
 
     In further features, the switching control module: in response to a determination that a period between (i) a time of the transition from the ON state to the OFF state and (ii) a present time is greater than the desired OFF period, transitions the switch from the OFF state to the ON state; and maintains the switch in the ON state until the measured current through the inductor of the PFC circuit is greater than the demanded current through the inductor. 
     In further features, a current demand module determines the demanded current through the inductor based on a difference between the output voltage and a desired value of the output voltage. 
     In further features, the desired OFF period module determines the desired OFF period further based on a switching period of the switch. 
     In further features, a desired ON period module that determines a desired ON period for the switch, the desired ON period is variable, and the desired OFF period module sets the desired OFF period based on the switching period minus the desired ON period. 
     In further features, a desired ON period module sets a desired ON period for the switch based on a maximum current through the inductor, the demanded current through the inductor, and the input voltage, and the desired OFF period module sets the desired OFF period based on the switching period minus the desired ON period. 
     In further features, a desired ON period module sets a desired ON period for the switch based on a maximum current through the inductor, the demanded current through the inductor, the input voltage, and the output voltage. The desired OFF period module sets the desired OFF period based on the switching period minus the desired ON period. 
     In further features: a discontinuous mode ON period module determines a first expected ON period for discontinuous mode operation based on a maximum current through the inductor, the demanded current through the inductor, and the input voltage; a continuous mode ON period module determines a second expected ON period for continuous mode operation based on the maximum current through the inductor, the demanded current through the inductor, the input voltage, and the output voltage; and an expected ON period module sets a third expected ON period for the switch to one of the first expected ON period and the second expected ON period. The desired OFF period module sets the desired OFF period based on the switching period minus the third expected ON period. 
     In a feature, a power factor correction (PFC) method includes: determining a desired OFF period for a switch of a PFC circuit based on an input voltage to the PFC circuit and an output voltage of the PFC circuit; transitioning the switch from an ON state to an OFF state when a measured current through an inductor of the PFC circuit is greater than a demanded current through the inductor; and maintaining the switch in the OFF state for the desired OFF period after the transition from the ON state to the OFF state. 
     In further features, determining the desired OFF period includes setting the desired OFF period using one of: (i) an equation that relates input voltages and output voltages to desired OFF periods; and (ii) a look-up table that relates input voltages and output voltages to desired OFF periods. 
     In further features, determining the desired OFF period includes setting the desired OFF period using the equation: 
               DOP   =       t   p     *       V   I       V   O           ,         
where DOP is the desired OFF period, t p  is a predetermined switching period, v i  is the input voltage, and v o  is the output voltage.
 
     In further features, the PFC method further includes: in response to a determination that a period between (i) a time of the transition from the ON state to the OFF state and (ii) a present time is greater than the desired OFF period, transitioning the switch from the OFF state to the ON state; and maintaining the switch in the ON state until the measured current through the inductor of the PFC circuit is greater than the demanded current through the inductor. 
     In further features, the PFC method further includes determining the demanded current through the inductor based on a difference between the output voltage and a desired value of the output voltage. 
     In further features, determining the desired OFF period includes determining the desired OFF period further based on a switching period of the switch. 
     In further features, the PFC method further includes determining a desired ON period for the switch, wherein the desired ON period is variable. Determining the desired OFF period includes setting the desired OFF period based on the switching period minus the desired ON period. 
     In further features, determining the desired ON period includes setting a desired ON period for the switch based on a maximum current through the inductor, the demanded current through the inductor, and the input voltage. The desired OFF period module sets the desired OFF period based on the switching period minus the desired ON period. 
     In further features, the PFC method further includes setting a desired ON period for the switch based on a maximum current through the inductor, the demanded current through the inductor, the input voltage, and the output voltage. Determining the desired OFF period includes setting the desired OFF period based on the switching period minus the desired ON period. 
     In further features, the PFC method further includes: determining a first expected ON period for discontinuous mode operation based on a maximum current through the inductor, the demanded current through the inductor, and the input voltage; determining a second expected ON period for continuous mode operation based on the maximum current through the inductor, the demanded current through the inductor, the input voltage, and the output voltage; and setting a third expected ON period for the switch to one of the first expected ON period and the second expected ON period. Determining the desired OFF period includes setting the desired OFF period based on the switching period minus the third expected ON period. 
     Further areas of applicability of the present disclosure will become apparent from the detailed description, the claims and the drawings. The detailed description and specific examples are intended for purposes of illustration only and are not intended to limit the scope of the disclosure. 
    
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
       The present disclosure will become more fully understood from the detailed description and the accompanying drawings, wherein: 
         FIG. 1  is a functional block diagram of an example refrigeration system; 
         FIG. 2  is a block diagram of an example implementation of the compressor motor drive of  FIG. 1 ; 
         FIG. 3A  is a block diagram of an example implementation of the power factor correction (PFC) circuit of  FIG. 2 ; 
         FIG. 3B  is a block diagram of another example implementation of the PFC circuit of  FIG. 2 ; 
         FIG. 4A  is a functional block diagram of an example implementation of the PFC circuit of  FIG. 3A ; 
         FIG. 4B  is a functional block diagram of an example implementation of the PFC circuit of  FIG. 3B ; 
         FIG. 5  is a functional block diagram of an example implementation of the control module; 
         FIG. 6  is a functional block diagram of an example implementation of a voltage control module; 
         FIGS. 7-8  are example graphs of current versus time; 
         FIG. 9  is a functional block diagram of an example implementation of a current demand module; 
         FIG. 10  is an example graph of the current versus time; 
         FIG. 11  is an example graph of measured DC bus voltage versus time; 
         FIGS. 12 and 13  are example graphs for light load conditions and heavy load conditions, respectively, of currents versus time; 
         FIGS. 14 and 15  are example graphs for light load conditions and heavy load conditions, respectively, of currents versus time; 
         FIG. 16  is an example graph of measured DC bus voltage versus time in response to step changes between heavy load and light load conditions; 
         FIG. 17  is a flowchart depicting an example method of determining a final current demand; 
         FIGS. 18-19  are functional block diagrams of example implementations of a current control module; 
         FIGS. 20-21  are example graphs of current versus time for non-periodic current ripples; 
         FIGS. 22-25  include example graphs of current versus time under varying input voltage, output voltage, and load conditions produced using a variable desired OFF period; 
         FIG. 26  is a flowchart including an example method of determining the desired OFF period of a switch and controlling the switch based on the desired OFF period; 
         FIGS. 27A and 27B  include a functional block diagram of an example implementation of a reference signal generation module; 
         FIGS. 27C and 27D  include a functional block diagram of an example implementation of a reference signal generation module; 
         FIGS. 27E and 27F  include a functional block diagram of an example implementation of a reference signal generation module; 
         FIG. 28  includes an example graph of filtered AC input voltage versus time; 
         FIG. 29  includes an example graph of filter correction versus supply frequency; 
         FIG. 30  includes an example graph of voltage of a reference signal versus time; 
         FIG. 31  is a flowchart depicting an example method of determining an AC line zero crossing; 
         FIG. 32  is a flowchart depicting an example method of determining a reference signal zero crossing; and 
         FIG. 33  is a flowchart depicting an example method of generating the reference signal. 
     
    
    
     In the drawings, reference numbers may be reused to identify similar and/or identical elements. 
     DETAILED DESCRIPTION 
     Refrigeration System 
       FIG. 1  is a functional block diagram of an example refrigeration system  100  including a compressor  102 , a condenser  104 , an expansion valve  106 , and an evaporator  108 . According to the principles of the present disclosure, the refrigeration system  100  may include additional and/or alternative components, such as a reversing valve or a filter-drier. In addition, the present disclosure is applicable to other types of refrigeration systems including, but not limited to, heating, ventilating, and air conditioning (HVAC), heat pump, refrigeration, and chiller systems. 
     The compressor  102  receives refrigerant in vapor form and compresses the refrigerant. The compressor  102  provides pressurized refrigerant in vapor form to the condenser  104 . The compressor  102  includes an electric motor that drives a pump. For example only, the pump of the compressor  102  may include a scroll compressor and/or a reciprocating compressor. 
     All or a portion of the pressurized refrigerant is converted into liquid form within the condenser  104 . The condenser  104  transfers heat away from the refrigerant, thereby cooling the refrigerant. When the refrigerant vapor is cooled to a temperature that is less than a saturation temperature, the refrigerant transforms into a liquid (or liquefied) refrigerant. The condenser  104  may include an electric fan that increases the rate of heat transfer away from the refrigerant. 
     The condenser  104  provides the refrigerant to the evaporator  108  via the expansion valve  106 . The expansion valve  106  controls the flow rate at which the refrigerant is supplied to the evaporator  108 . The expansion valve  106  may include a thermostatic expansion valve or may be controlled electronically by, for example, a system controller  130 . A pressure drop caused by the expansion valve  106  may cause a portion of the liquefied refrigerant to transform back into the vapor form. In this manner, the evaporator  108  may receive a mixture of refrigerant vapor and liquefied refrigerant. 
     The refrigerant absorbs heat in the evaporator  108 . Liquid refrigerant transitions into vapor form when warmed to a temperature that is greater than the saturation temperature of the refrigerant. The evaporator  108  may include an electric fan that increases the rate of heat transfer to the refrigerant. 
     A utility  120  provides power to the refrigeration system  100 . For example only, the utility  120  may provide single-phase alternating current (AC) power at approximately 230 Volts root mean squared (V RMS ). In other implementations, the utility  120  may provide three-phase AC power at approximately 400 V RMS , 480 V RMS , or 600 V RMS  at a line frequency of, for example, 50 or 60 Hz. When the three-phase AC power is nominally 600 V RMS , the actual available voltage of the power may be 575 V RMS . 
     The utility  120  may provide the AC power to the system controller  130  via an AC line, which includes two or more conductors. The AC power may also be provided to a drive  132  via the AC line. The system controller  130  controls the refrigeration system  100 . For example only, the system controller  130  may control the refrigeration system  100  based on user inputs and/or parameters measured by various sensors (not shown). The sensors may include pressure sensors, temperature sensors, current sensors, voltage sensors, etc. The sensors may also include feedback information from the drive control, such as motor currents or torque, over a serial data bus or other suitable data buses. 
     A user interface  134  provides user inputs to the system controller  130 . The user interface  134  may additionally or alternatively provide the user inputs directly to the drive  132 . The user inputs may include, for example, a desired temperature, requests regarding operation of a fan (e.g., a request for continuous operation of the evaporator fan), and/or other suitable inputs. The user interface  134  may take the form of a thermostat, and some or all functions of the system controller (including, for example, actuating a heat source) may be incorporated into the thermostat. 
     The system controller  130  may control operation of the fan of the condenser  104 , the fan of the evaporator  108 , and the expansion valve  106 . The drive  132  may control the compressor  102  based on commands from the system controller  130 . For example only, the system controller  130  may instruct the drive  132  to operate the motor of the compressor  102  at a certain speed or to operate the compressor  102  at a certain capacity. In various implementations, the drive  132  may also control the condenser fan. 
     A thermistor  140  is thermally coupled to the refrigerant line exiting the compressor  102  that conveys refrigerant vapor to the condenser  104 . The variable resistance of the thermistor  140  therefore varies with the discharge line temperature (DLT) of the compressor  102 . As described in more detail, the drive  132  monitors the resistance of the thermistor  140  to determine the temperature of the refrigerant exiting the compressor  102 . 
     The DLT may be used to control the compressor  102 , such as by varying capacity of the compressor  102 , and may also be used to detect a fault. For example, if the DLT exceeds the threshold, the drive  132  may power down the compressor  102  to prevent damage to the compressor  102 . 
     Drive 
     In  FIG. 2 , an example implementation of the drive  132  includes an electromagnetic interference (EMI) filter and protection circuit  204 , which receives power from an AC line. The EMI filter and protection circuit  204  reduces EMI that might otherwise be injected back onto the AC line from the drive  132 . The EMI filter and protection circuit  204  may also remove or reduce EMI arriving from the AC line. Further, the EMI filter and protection circuit  204  protects against power surges, such as may be caused by lightening, and/or other types of power surges and sags. 
     A charging circuit  208  controls power supplied from the EMI filter and protection circuit  204  to a power factor correction (PFC) circuit  212 . For example, when the drive  132  initially powers up, the charging circuit  208  may place a resistance in series between the EMI filter and protection circuit  204  and the PFC circuit  212  to reduce the amount of current inrush. These current or power spikes may cause various components to prematurely fail. 
     After initial charging is completed, the charging circuit  208  may close a relay that bypasses the current-limiting resistor. For example, a control module  220  may provide a relay control signal to the relay within the charging circuit  208 . In various implementations, the control module  220  may assert the relay control signal to bypass the current-limiting resistor after a predetermined period of time following start up, or based on closed loop feedback indicating that charging is near completion. 
     The PFC circuit  212  converts incoming AC power to DC power. The PFC circuit  212  may not be limited to PFC functionality—for example, the PFC circuit  212  may also perform voltage conversion functions, such as acting as a boost circuit and/or a buck circuit. In some implementations, the PFC circuit  212  may be replaced by a non-PFC voltage converter. The DC power may have voltage ripples, which are reduced by filter capacitance  224 . Filter capacitance  224  may include one or more capacitors arranged in parallel and connected to the DC bus. The PFC circuit  212  may attempt to draw current from the AC line in a sinusoidal pattern that matches the sinusoidal pattern of the incoming voltage. As the sinusoids align, the power factor approaches one, which represents the greatest efficiency and the least demanding load on the AC line. 
     The PFC circuit  212  includes one or more switches that are controlled by the control module  220  using one or more signals labeled as power switch control. The control module  220  determines the power switch control signals based on a measured voltage of the DC bus, measured current in the PFC circuit  212 , AC line voltages, temperature or temperatures of the PFC circuit  212 , and the measured state of a power switch in the PFC circuit  212 . While the example of use of measured values is provided, the control module  220  may determine the power switch control signals based on an estimated voltage of the DC bus, estimated current in the PFC circuit  212 , estimated AC line voltages, estimated temperature or temperatures of the PFC circuit  212 , and/or the estimated or expected state of a power switch in the PFC circuit  212 . In various implementations, the AC line voltages are measured or estimated subsequent to the EMI filter and protection circuit  204  but prior to the charging circuit  208 . 
     The control module  220  is powered by a DC-DC power supply  228 , which provides a voltage suitable for logic of the control module  220 , such as 3.3 Volts, 2.5 Volts, etc. The DC-DC power supply  228  may also provide DC power for operating switches of the PFC circuit  212  and an inverter power circuit  232 . For example only, this voltage may be a higher voltage than for digital logic, with 15 Volts being one example. 
     The inverter power circuit  232  also receives power switch control signals from the control module  220 . In response to the power switch control signals, switches within the inverter power circuit  232  cause current to flow in respective windings of a motor  236  of the compressor  102 . The control module  220  may receive a measurement or estimate of motor current for each winding of the motor  236  or each leg of the inverter power circuit  232 . The control module  220  may also receive a temperature indication from the inverter power circuit  232 . 
     For example only, the temperature received from the inverter power circuit  232  and the temperature received from the PFC circuit  212  are used only for fault purposes. In other words, once the temperature exceeds a predetermined threshold, a fault is declared and the drive  132  is either powered down or operated at a reduced capacity. For example, the drive  132  may be operated at a reduced capacity and if the temperature does not decrease at a predetermined rate, the drive  132  transitions to a shutdown state. 
     The control module  220  may also receive an indication of the discharge line temperature from the compressor  102  using the thermistor  140 . An isolation circuit  260  may provide a pulse-width-modulated representation of the resistance of the thermistor  140  to the control module  220 . The isolation circuit  260  may include galvanic isolation so that there is no electrical connection between the thermistor  140  and the control module  220 . 
     The isolation circuit  260  may further receive protection inputs indicating faults, such as a high-pressure cutoff or a low-pressure cutoff, where pressure refers to refrigerant pressure. If any of the protection inputs indicate a fault and, in some implementations, if any of the protection inputs become disconnected from the isolation circuit  260 , the isolation circuit  260  ceases sending the PWM temperature signal to the control module  220 . Therefore, the control module  220  may infer that a protection input has been received from an absence of the PWM signal. The control module  220  may, in response, shut down the drive  132 . 
     The control module  220  controls an integrated display  264 , which may include a grid of LEDs and/or a single LED package, which may be a tri-color LED. The control module  220  can provide status information, such as firmware versions, as well as error information using the integrated display  264 . The control module  220  communicates with external devices, such as the system controller  130  in  FIG. 1 , using a communications transceiver  268 . For example only, the communications transceiver  268  may conform to the RS-485 or RS-232 serial bus standards or to the Controller Area Network (CAN) bus standard. 
     PFC Circuits 
     In  FIG. 3A , a PFC circuit  300  is one implementation of the PFC circuit  212  of  FIG. 2 . The PFC circuit  300  includes a rectifier  304  that converts incoming AC into pulsating DC. In various implementations, the rectifier  304  includes a full-wave diode bridge. The DC output of the rectifier  304  is across first and second terminals. The first terminal is connected to an inductor  308 , while the second terminal is connected to a current sensor  312 . An opposite end of the inductor  308  is connected to a node that is common to the inductor  308 , an anode of a diode  316 , and a first terminal of a switch  320 . 
     The PFC circuit  300  generates a DC bus, where a first terminal of the DC bus is connected to a cathode of the diode  316  while a second terminal of the DC bus is connected to the second output terminal of the rectifier  304  via the current sensor  312 . The current sensor  312  can, therefore, sense the current within the switch  320  as well as the current in the DC bus and current in the inductor  308 . The second terminal of the DC bus is also connected to a second terminal of the switch  320 . 
     A driver  324  receives the power switch control signal from the control module  220  of  FIG. 2  and rapidly charges or discharges a control terminal of the switch  320 . For example, the switch  320  may be a field effect transistor with a gate terminal as the control terminal. More specifically, the switch  320  may be a power metal-oxide-semiconductor field-effect transistor (MOSFET), such as the STW38N65M5 power MOSFET from STMicroelectronics. The driver  324 , in response to the power switch control signal, charges or discharges the capacitance at the gate of the field effect transistor. 
     A switch monitor circuit  328  measures whether the switch is on or off. This closed loop control enables the control module  220  to determine whether the switch  320  has reacted to a command provided by the power switch control signal and may also be used to determine how long it takes the switch  320  to respond to that control signal. The measured switch state is output from the switch monitor circuit  328  back to the control module  220 . The control module  220  may update its control of the power switch control signal to compensate for delays in turning on and/or turning off the switch  320 . 
     In  FIG. 3A , the inductor, the switch  320 , and the diode  316  are arranged in a boost configuration. In brief, the switch  320  closes, causing current through the inductor  308  to increase. Then the switch  320  is opened, but the current through the inductor  308  cannot change instantaneously because the voltage across an inductor is proportional to the derivative of the current. The voltage across the inductor  308  becomes negative, meaning that the end of the inductor  308  connected to the anode of the diode  316  experiences a voltage increase above the voltage output from the rectifier  304 . 
     Once the voltage at the anode of the diode  316  increases above the turn-on voltage of the diode  316 , the current through the inductor  308  can be fed through the diode  316  to the DC bus. The current through the inductor  308  decreases and then the switch  320  is closed once more, causing the current and the inductor  308  to increase. 
     In various implementations, the switch  320  may be turned on until the current sensor  312  determines that a predetermined threshold of current has been exceeded. At that time, the switch  320  is turned off for a specified period of time. This specified period may be adaptive, changing along with the voltage of the DC bus as well as the voltage of the AC input change. However, the off time (when the switch  320  is open) is a specified value. Once a time equal to the specified value has elapsed, the switch  320  is turned back on again and the process repeats. The off time can be fixed or variable. In the case of the off time being variable, the off time can be limited to at least a predetermined minimum off time. 
     To reduce the physical size and parts cost of the PFC circuit  300 , the inductance of the inductor  308  (which may be the largest contributor to the physical size of the PFC circuit  300 ) may be lowered. However, with a lower inductance, the inductor  308  will saturate more quickly. Therefore, the switch  320  will have to operate more quickly. While more quickly and smaller are relative terms, present power switching control operates in the range of 10 kilohertz to 20 kilohertz switching frequencies. In the present application, the switching frequency of the switch  320  may be increased to more than 50 kilohertz, more than 100 kilohertz, or more than 200 kilohertz. For example, the switching frequency of the switch may be controlled to be approximately 200 kilohertz. 
     The switch  320  is therefore chosen to allow for faster switching as well as to have low switching losses. With faster switching, the inductance of the inductor  308  can be smaller. In addition, the diode  316  may need to be faster. Silicon carbide diodes may have fast response times. For example, the diode  316  may be an STPSC2006CW Silicon Carbide dual diode package from STMicroelectronics. 
     In order to accurately drive the switch  320  when operating at higher speeds, the control strategy must similarly be accelerated. For example only, the control module  220  may include multiple devices, such as a microcontroller configured to perform more involved calculations and an FPGA (field programmable gate array) or PLD (programmable logic device) configured to monitor and respond to inputs in near real time. In this context, near real time means that the time resolution of measurement and time delay in responding to inputs of the FPGA or PLD is negligible compared to the physical time scale of interest. For faster switching speeds, the near real time response of the FPGA/PLD may introduce non-negligible delays. In such cases, the delay of the FPGA/PLD and driving circuitry may be measured and compensated for. For example, if the turn-off of a switch occurs later than needed because of a delay, the turn-off can be instructed earlier to compensate for the delay. 
     A bypass rectifier  340  is connected in parallel with the rectifier  304  at the AC line input. A second output terminal of the bypass rectifier  340  is connected to the second terminal rectifier  304 . However, a first output terminal of the bypass rectifier  340  is connected to the cathode of the diode  316 . 
     As a result, when the PFC circuit  300  is not operating to boost the DC bus voltage, the bypass rectifier  340  will be active when the line-to-line voltage of the AC input exceeds the voltage across the DC bus. The bypass rectifier  340 , in these situations, diverts current from passing through the diode  316 . Because the inductor  308  is small, and the switch  320  switches rapidly, the diode  316  is also selected to exhibit fast switching times. The diode  316  may, therefore, be less tolerant to high currents, and so current is selectively shunted around the diode  316  by the bypass rectifier  340 . 
     In addition, the current path through the rectifier  304  and the diode  316  experiences three diode voltage drops or two diode voltage drops and the switch voltage drop, while the path through the bypass rectifier  340  experiences only two diode voltage drops. While the single phase AC input in  FIG. 3A  is associated with a boost converter topology, the present disclosure also encompasses a buck converter topology or a buck-boost converter topology. 
     In  FIG. 3B , a buck converter topology is shown with a three-phase AC input signal. Note that the principles of the present disclosure also apply to a boost converter or buck-boost converter topology used with a three-phase AC input. A PFC circuit  350  represents another implementation of the PFC circuit  212  of  FIG. 2 . 
     A three-phase rectifier  354  receives three-phase AC and generates pulsating DC across first and second terminals. A switch  358  is connected between the first terminal of the three-phase rectifier  354  and a common node. The common node is connected to an inductor  366  and a cathode of a power diode  370 . 
     An anode of the power diode  370  is connected to a second terminal of the three-phase rectifier  354 . An opposite terminal of the inductor  366  establishes one terminal of the DC bus, while the second output of the three-phase rectifier  354  establishes the other terminal of the DC bus. In the configuration shown in  FIG. 3B , the switch  358 , the inductor  366 , and the diode  370  are configured in a buck topology. 
     A current sensor  362  is connected in series between the anode of the diode  370  and the DC bus. In other implementations, the current sensor  362  may be located in series with the inductor  366 . In other implementations, the current sensor  362  may be located in series with the switch  358 . In other implementations, the current sensor  362  may be located in series between the anode of the diode  370  and the second output of the three-phase rectifier  354 . The current sensor  362  measures current through the inductor  366  as well as current through the DC bus and provides a current signal indicative of the amount of the current. 
     A driver  374  drives a control terminal of the switch  358  based on a power switch control signal from the control module  220  in  FIG. 2 . A switch monitor circuit  378  detects whether the switch  358  has opened or closed and reports the switch state to the control module  220 . With the location of the current sensor  362 , the current sensor  362  will measure approximately zero current when the switch  358  is open. 
       FIG. 4A  is a simplified functional block diagram of the PFC circuit  300  of  FIG. 3A  and the control module  220 . The rectifier  304  rectifies the AC input voltage to produce a DC voltage. This DC voltage is illustrated by DC voltage  404  in  FIG. 4 . The control module  220  controls switching of the switch  320  to convert the DC voltage  404  into a DC bus voltage that is greater than the DC voltage  404 . The PFC circuit  300  therefore includes a boost converter in the examples of  FIGS. 3A and 4 . Boost converters convert an input voltage (e.g., DC voltage  404 ) into a higher output voltage (e.g., DC bus voltage). The present application is applicable to single phase boost converters and three-phase boost converters. 
       FIG. 4B  is a simplified functional block diagram of one phase of the PFC circuit  350  of  FIG. 3B  and the control module  220 . The three-phase rectifier  354  rectifies the three-phase AC input voltage to produce three-phase DC voltage. The DC voltage of the one of the three phases is illustrated by DC voltage  504  in  FIG. 4B . The control module  220  controls switching of the switches of the phases to convert the DC voltages input to the three phases into a DC bus voltage that is less than the input voltage. The PFC circuit  350  therefore includes a buck converter in the examples of  FIGS. 3B and 4B . Buck converters convert an input voltage into a lower output voltage. The present application is applicable to single phase buck converters and three-phase buck converters. Some converters may operate as combination boost/buck converters. 
       FIG. 5  is a functional block diagram of an example implementation of the control module  220 . The concepts described below are applicable to boost converters, such as the examples of  FIGS. 3A and 4A . The concepts described below are also applicable to buck converters, such as the examples of  FIGS. 3B and 4B . 
     A desired voltage module  604  determines a desired DC bus voltage. The desired DC bus voltage may be a fixed predetermined value or may be variable. The desired voltage module  604  may determine the desired DC bus voltage, for example, based on a peak voltage of the AC line (V PEAK ) and/or at least one of a plurality of system parameters. 
     For example only, the plurality of system parameters may include, but are not limited to, actual and commanded compressor speed, actual and estimated inverter output power, actual and estimated drive output power, input and output current, drive input voltage, inverter output voltage, estimated motor torque, various temperatures, and a demand from the condenser  104 . The various temperatures may include, for example, temperatures of the PFC circuit  212 , the inverter power circuit  232 , circuit boards, the compressor scroll, and the motor  236 . By way of example, a look-up table may include a desired DC bus voltage V DES  corresponding to possible AC peak voltages V PEAK  and each of the different combinations of the plurality of system parameters. The desired voltage module  604  may determine the desired DC bus voltage using the look-up table. For values between entries of the look-up table, the desired voltage module  604  may determine the desired DC bus voltage using interpolation. Further example discussion regarding setting the desired DC bus voltage is provided in the U.S. Prov. App. titled “Power Factor Correction Circuits and Methods Including Partial Power Factor Correction Operation for Boost and Buck Power Converters,” U.S. Prov. App. No. 62,323,498 filed on Apr. 15, 2016, which is incorporated herein in its entirety. 
     A voltage control module  608  (see also  FIG. 6 ) determines a difference between the desired DC bus voltage and the measured DC bus voltage and determines a first current demand based on the difference. The voltage control module  608  applies a filter to the first current demand and determines an initial current demand based on the first and filtered current demands. 
     The voltage control module  608  weights the contributions of the first and filtered current demands to the initial current demand based on the magnitude of the difference between the measured and desired DC bus voltages. More specifically, the voltage control module  608  applies a greater weight to the filtered current demand when the magnitude of the difference is low. The voltage control module  608  increases the weighting of the first current demand and decreases the weighting of the filtered current demand as the difference increases. 
     A current demand module  612  (see e.g.,  FIG. 9 ) may apply a filter to the initial current demand, such as a notch filter. The current demand module  612  may also perform one or more signal processing functions to reduce noise in the initial current demand. The current demand module  612  multiplies the (filtered) initial current demand with a reference signal to produce a final current demand. While the example of the current demand module  612  filtering the initial current demand is provided, the current demand module  612  may not filter the initial current demand in other examples. In such a case, the initial current demand may be multiplied with the reference signal to produce the final current demand. 
     A reference generation module  616  (see e.g.,  FIGS. 27A and 27B ) determines zero crossings of the AC line and the reference signal. Based on the zero crossings, the reference generation module  616  generates the reference signal to track the AC input voltage in phase and frequency. In this way, the final current demand follows the AC input voltage, for example, to maximize power factor. 
     A current control module  620  (see e.g.,  FIGS. 18 and 19 ) controls switching of the switch  320 . More specifically, the current control module  620  transitions the switch  320  OFF when the measured current is greater than the current demand. The current control module  620  then maintains the switch  320  OFF for a desired OFF period. The desired OFF period is variable, and the current control module  620  determines the desired OFF period, for example, based on the AC input voltage and/or the measured DC bus voltage. 
       FIG. 6  is a functional block diagram of an example implementation of the voltage control module  608 . As stated above, the voltage control module  608  generates an initial current demand based on the desired DC bus voltage and the measured DC bus voltage. The initial current demand corresponds to a target value for the measured current. The measured DC bus voltage is measured using a voltage sensor. The desired DC bus voltage is determined by the desired voltage module  604 . 
     The voltage control module  608  includes an error control module  704  that receives the desired DC bus voltage and the measured DC bus voltage. The error control module  704  generates a first current demand to minimize the difference between the desired DC bus voltage and the measured DC bus voltage. 
     For example, a subtraction module  708  subtracts the measured DC bus voltage from the desired DC bus voltage to determine a DC voltage error. A proportional module  712  multiplies the DC voltage error by a proportional constant. An integrator module  716  combines the DC voltage error with a previous output of the integrator module  716 . The integrator module  716  may first multiply the DC voltage error by an integral constant. The integrator module  716  may also apply upper and/or lower limits to its output. In various implementations, the integrator module  716  may bias its output to adjust toward a tracking input (e.g., the second current demand). 
     A summation module  720  adds the output of the proportional module  712  with the output of the integrator module  716 . The sum from the summation module  720  is output from the error control module  704  as the first current demand. Although the error control module  704  is shown for purposes of illustration as a Proportional-Integral (PI) controller, another suitable type of closed-loop controller may be used. Additionally, a feed-forward component may also be implemented which may be summed with a feedback component (e.g., the sum) to generate the first current demand. 
     A filter module  724  applies a filter to the first current demand to produce a second current demand. The filter may be, for example, a low-pass filter (LPF) or another suitable type of filter. A cutoff frequency of the filter may be calibrated, for example, to smooth cycle-to-cycle ripple that may be attributable to the error control module  704 . The filter module  724  may lower bandwidth and may smooth/attenuate the cycle-to-cycle ripple created by the error control module  704  attempting to adjust the measured DC bus voltage toward the desired DC bus voltage. For example only,  FIG. 7  includes an example graph of current produced using a PI controller based on a sinusoidal input voltage.  FIG. 8  includes an example graph of current produced using low pass filtering of the output of a PI controller. 
     Referring back to  FIG. 6 , the voltage control module  608  also includes a weighting module that weights the contributions of the first and second current demands to the initial current demand. The weighting module reduces of use of the second current demand and increases the use of the first current demand as the DC voltage error increases. This may minimize harmonics and minimize response time to load changes. 
     An absolute value module  728  determines and outputs an absolute value (i.e., magnitude) of the DC voltage error. A biasing module  732  applies a bias to the absolute value of the DC voltage error to require that the DC voltage error be larger than a predetermined biasing value before decreasing the contribution of the second current demand and including a contribution of the first current demand. For example, the biasing module  732  may set its output based on or equal to the predetermined biasing value (e.g., 10 V) subtracted from the absolute value of the DC voltage error. When the absolute value of the DC voltage error is less than the predetermined biasing value, the initial current demand may be set equal to the second current demand due to the biasing. The biasing is associated with the saturation module ( 740 ) discussed further below. 
     A gain module  736  applies a predetermined gain value to the output of the biasing module  732 . For example, the gain module  736  set its output based on or equal to the output of the biasing module  732  multiplied by the predetermined gain value. The predetermined gain value may be, for example, approximately 0.2 or another suitable value. 
     A saturation module  740  may apply limits to the output of the gain module  736 . As used herein, saturation modules may enforce a lower limit, an upper limit, both upper and lower limits, or neither limit. The upper and lower limits may be predetermined and/or may be updated based upon various parameters. In the case of the saturation module  740 , the lower limit may be, for example, zero to re-enforce the biasing applied by the biasing module  732 . The upper limit of the saturation module  740  may be 1 to limit weighting values to between 0 and 1, inclusive. The output of the saturation module  740  is a first weighting value for weighting the contribution of the first current demand. 
     A subtraction module  744  subtracts the output of the saturation module  740  from a predetermined value, such as 1. The output of the subtraction module  744  is a second weighting value for weighting the contribution of the second current demand. A multiplication module  748  multiplies the second current demand output by the filter module  724  with the second weighting value output by the subtraction module  744  to produce a third demanded current. A multiplication module  752  multiplies the first current demand output by the error control module  704  with the first weighting value output by the saturation module  740  to produce a fourth current demand. The modules  728 ,  732 ,  736 ,  740 ,  744 ,  748 , and  752  can collectively be referred to as the weighting module. A summation module  756  adds the third current demand with the fourth current demand to produce the initial current demand. 
     As discussed further below, the initial current demand is multiplied with a sinusoidal reference signal that is generated to be synchronized with the AC input voltage. This may provide a better power factor and minimize harmonics of the AC input current as the load may draw more sinusoidal current and power. Generation of the reference signal is also discussed below. 
       FIG. 9  includes a functional block diagram of an example implementation of the current demand module  612 . A saturation module  804  may apply one or more limits to the initial current demand before the initial current demand is input to a notch filter module  808 . The notch filter module  808  applies a notch filter to the initial current demand, and a saturation module  812  may apply one or more limits to the initial current demand output by the notch filter module  808 . While the example of the use of the saturation modules  804  and  812  is shown and discussed, one or both of the saturation modules  804  and  812  may be omitted and/or replaced with other suitable types of signal processing. The application of the notch filter reduces harmonics while allowing for a fast response to load changes. 
     The notch filter may be, for example, a first or second order polynomial notch filter. For example only, the notch filter may be represented by the following second order transfer function. 
                   b   ⁢           ⁢   0     +     b   ⁢           ⁢   1   *     z     -   1         +     b   ⁢           ⁢   2   *     z     -   2               a   ⁢           ⁢   0     +     a   ⁢           ⁢   1   *     z     -   1         +     a   ⁢           ⁢   2   *     z     -   2             ,         
where the b0, b1, b2, a0, a1, and a2 are filter coefficients, and z is the initial current demand input to the notch filter module  808 . One or more of the filter coefficients may be fixed, predetermined values. For example, the filter coefficients b0, b2, a0, and a2 may be fixed predetermined values. The filter coefficient a0 may be 1 (one) in various implementations. In various implementations, the filter coefficients b0, b2, a0, and/or a2 may be variable values.
 
     A filter coefficients module  816  determines one or more filter coefficients (e.g., a1 and b1) for the notch filter based on a frequency of the AC input voltage. Since the reference signal is generated to be synchronous with the AC input voltage, the frequency of the AC input voltage may be represented by the frequency of the reference signal. The frequency of the reference signal may be used as a supply frequency. Alternatively, a frequency of the AC input voltage may be measured and used as the supply frequency. The notch may be, for example, approximately twice the supply frequency. 
     The filter coefficients module  816  may determine the filter coefficient(s) using one or more look-up tables and/or functions that relate the supply frequency to the filter coefficient(s). For values between entries of the look-up table, the filter coefficients module  816  may determine the filter coefficient(s) using interpolation. In various implementations, the filter coefficients a1 and b1 may be the same value or may be determined using the same look-up table or function. Examples of such a function include a second order polynomial equation using predetermined coefficients for determining the filter coefficients (e.g., a1 and b1) as a function of the supply frequency. 
     As stated above, the saturation module  812  may apply one or more limits to the initial current demand output by the notch filter module  808 . A multiplier module  820  multiplies the output of the saturation module  812  with the reference signal. An absolute value module  824  determines and outputs an absolute value (i.e., magnitude) of the output of the multiplier module  820  to produce a final current demand. Alternatively, the absolute value module  824  may be omitted, and an absolute value of the reference signal may be input to the multiplier module  820 . The absolute value usage places the final current demand into correspondence with the post-rectification current. As discussed further below, the final current demand is used to control switching of the switch  320  based on a comparison with the measured current. 
       FIG. 10  is an example graph of the current produced by controlling switching based on the final current demand generated based on  FIGS. 6 and 9 . The current has a relatively sinusoidal shape, as illustrated in  FIG. 10 .  FIG. 11  is an example graph of the measured DC bus voltage produced by controlling switching based on the final current demand generated based on  FIGS. 6 and 9  in response to step changes between heavy load and light load conditions. 
     In contrast with  FIG. 10 ,  FIGS. 12 and 13  are example graphs for light load conditions and heavy load conditions, respectively, of the currents produced by controlling switching based on the second current demand output by the error control module  704 . As illustrated in  FIGS. 12 and 13 , the currents have a less sinusoidal (and possibly more square) shape than the current of  FIG. 10 . 
     Multiplying the second current demand output by the error control module  704  with the reference signal may produce more sinusoidal currents. For example,  FIGS. 14 and 15  are example graphs for light load conditions and heavy load conditions, respectively, of the currents produced by controlling switching based on the reference signal multiplied with the second current demand output by the filter module  724 . As illustrated in  FIGS. 14 and 15 , the currents have a less sinusoidal (and possibly more triangular) shape than the current of  FIG. 10 . 
       FIG. 16  is an example graph of the measured DC bus voltage produced by controlling switching based on the reference signal multiplied with the second current demand output by the error control module  704  in response to step changes between heavy load and light load conditions. Such control may tend to produce a slower response time, more overshoot, and/or more undershoot than that of the example of  FIG. 11 . 
       FIG. 17  is a flowchart depicting an example method of determining the final current demand. Control begins with  904  where the error control module  704  determines the DC voltage error based on the difference between the desired DC bus voltage and the measured DC bus voltage. At  908 , the error control module  704  determines the first current demand based on the voltage bus error, for example, using PI control, as discussed above. 
     At  912 , the absolute value module  728  determines an absolute value of the DC voltage error, and the biasing module  732  applies the bias to the absolute value of the DC voltage error. For example, the biasing module  732  may set its output based on or equal to the predetermined biasing value (e.g., 10 V) subtracted from the absolute value of the DC voltage error. The gain module  736  applies the predetermined gain value to the output of the biasing module  732 , and the saturation module  740  may apply limits to the output of the gain module  736 . The output of the saturation module  740  corresponds to the first weighting value for weighting the contribution of the first current demand. 
     Also at  912 , the subtraction module  744  determines the second weighting value for weighting the contribution of the second current demand. For example, the subtraction module  744  may set the second weighting value based on or equal to 1 minus the first weighting value. Generally, due to the biasing, the first weighting value may be zero or approximately zero (such that the second weighting value may be one or approximately one) when the DC voltage error is less than the predetermined biasing value. The second weighting value may decrease toward zero and the first weighting value may increase toward one as the DC voltage error increases above the predetermined biasing value. While the example of use of the first and second weighting values and the first and second current demands, one or more additional filters could be applied to determine the second current demand from the first current demand. In such examples, more weighting values could be used, or the first and second weighting values could be applied to a different combination of current demands. 
     At  916 , the filter module  724  applies the filter to the first current demand to produce the second current demand. At  920 , the multiplier module  752  multiplies the first current demand by the first weighting value to produce the third current demand, and the multiplication module  748  multiplies the second current demand by the second weighting value to produce the fourth current demand. Also at  920 , the summation module  756  sets the initial current demand equal to or based on the sum of the third current demand and the fourth current demand. 
     At  924 , the saturation module  804  may apply upper and/or lower limits to the initial current demand. In various implementations, the application of upper and/or lower limits may be omitted or replaced with one or more other types of signal processing. At  928 , the filter coefficients module  816  determines the filter coefficients for the notch filter. The filter coefficients module  816  determines the filter coefficients based on the supply frequency. 
     At  932 , the notch filter module  808  applies the notch filter, using the filter coefficients, to the initial current demand. At  936 , the saturation module  812  may apply upper and/or lower limits to the initial current demand output by the notch filter module  808 . In various implementations, the application of upper and/or lower limits may be omitted or replaced with one or more other types of signal processing. 
     At  940 , the multiplier module  820  sets the final current demand based on or equal to the initial current demand (e.g., output by the saturation module  812 ) multiplied by the reference signal. The absolute value module  824  may determine an absolute value of the final current demand at  944 . At  948 , the current control module  620  controls switching of the switch  320  based on the final current demand and the measured current. As discussed further below, the current control module  620  transitions the switch  320  from ON to OFF when the measured current becomes greater than the final current demand. The current control module  620  maintains the switch  320  OFF for a (variable) desired OFF period, and transitions the switch  320  from OFF to ON when the desired OFF period has passed. While this example is discussed further below, the current control module  620  may alternatively transition the switch  320  from OFF to ON when the measured current becomes less than the final current demand, maintain the switch  320  ON for a (variable) desired ON period, and transition the switch  320  from ON to OFF once the desired ON period has passed. The desired ON period may be determined similarly to the desired OFF period discussed below. 
       FIG. 18  is a functional block diagram of an example implementation of the current control module  620 . The current control module  620  controls switching of the switch  320  based on a comparison of the final current demand with the measured current. The measured current may be measured using the current sensor  312 . 
     A comparison module  1004  sets a comparison signal to a first state when the measured current is less than the final current demand. The comparison module  1004  sets the comparison signal to a second state when the measured current is greater than the final current demand. 
     A switching control module  1008  controls switching of the switch  320  based on the comparison of the measured current with the final current demand. For example, the switching control module  1008  transitions the switch  320  to OFF (not conducting) when the comparison signal transitions from the first state to the second state. The switching control module  1008  then maintains the switch  320  OFF for a desired OFF period. More specifically, the switching control module  1008  maintains the switch  320  OFF until an OFF period is greater than the desired OFF period. The OFF period corresponds to the period since the measured current last became greater than the final current demand. 
     A timer module  1012  increments the OFF period when the comparison signal is in the second state. More specifically, the timer module  1012  increments the OFF period when the switch  320  is OFF. In this manner, the OFF period tracks the period elapsed since the switching control module  1008  last transitioned the switch  320  from ON to OFF (i.e., the measured current became greater than the final current demand). The timer module  1012  resets the OFF period when the switching control module  1008  transitions the switch  320  from OFF to ON. 
     When the OFF period is greater than (or equal to) the desired OFF period, the switching control module  1008  may transition the switch  320  ON (conducting) and maintain the switch  320  ON until the comparison signal next is in the second state. In various implementations, the switching control module  1008  may wait for, or ensure that, the measured current is less than the final current demand before generating the output signal to turn the switch  320  ON. Under relatively steady state load conditions, the turning ON of the switch  320  may occur at approximately a beginning of a next predetermined switching period. 
     The predetermined switching periods (t p ) correspond to a predetermined switching frequency. The predetermined switching frequency may be, for example, approximately 200 kilohertz (kHz) or another suitable switching frequency. The predetermined switching periods correspond to 1 divided by the predetermined switching frequency. The switching control module  1008  may control the switch  320  to be ON (conducting) and OFF (not conducting) for different portions of each predetermined switching period. In various implementations, a frequency module (not shown) may randomly vary the predetermined switching frequency or the predetermined switching period, for example, according to an output of a random number generator. 
     A desired OFF period module  1016  determines the desired OFF period. Written generally, for a boost converter, the desired OFF period module  1016  may determine the desired OFF period based on input voltage, output voltage, and the predetermined switching period. The input voltage may correspond to the voltage input to the PFC circuit  300 . For example, an absolute value module  1020  determines and outputs an absolute value (i.e., magnitude) of the AC input voltage measured by an AC input voltage sensor. The output of the absolute value module  1020  may be used as the input voltage. The output voltage may be the measured DC bus voltage. While the example of a sinusoidal AC input has been described, the present application is also applicable to other types of inputs including rectified inputs resulting from rectification of AC inputs. 
     The desired OFF period module  1016  may determine the desired OFF period using one of a function and a look-up table that relates input voltages and output voltages to desired OFF times given the predetermined switching period. For values between entries of the look-up table, the desired OFF period module  1016  may determine the desired OFF period using interpolation. As an example, for a boost converter (e.g., the boost converter of  FIG. 4A ) the desired OFF period module  1016  may set the desired OFF period based on or equal to 
                 t   p     *       V   I       V   O         ,         
where t p  is the predetermined switching period, V I  is the input voltage, and V O  is the output voltage.
 
     The switching control module  1008  also compensates for a turn ON delay period of the switch  320  and a turn OFF delay period of the switch  320 . When the turn ON and turn OFF delay periods are negligible, this compensation may be omitted. The turn ON delay period corresponds to the period between a first time when the switching control module  1008  generates an output signal to turn the switch  320  ON and a second time when the switch  320  actually reaches ON (conductance) in response. The turn OFF delay period corresponds to the period between a first time when the switching control module  1008  generates the output signal to turn the switch  320  OFF and a second time when the switch  320  actually reaches OFF (non-conductance) in response. 
     To account for the turn ON delay period, the switching control module  1008  should hypothetically generate the output signal to turn the switch  320  ON before the OFF period reaches the desired OFF period. The switching control module  1008  should hypothetically also generate the output signal to turn the switch  320  ON before the current becomes greater than the final current demand due to the turn OFF delay period. 
     The switching control module  1008  could adjust the desired OFF period based on the turn ON delay period and the turn OFF delay period. For example, the switching control module  1008  could add the turn OFF delay period and subtract the turn ON delay period from the desired OFF period. This (adjusted) desired OFF period will be compared with the OFF period from the timer module  1012  to determine when to turn the switch  320  ON. 
     Other alternatives for this compensation are also possible. For example, the switching control module  1008  could generate the output signal to turn the switch  320  OFF when the measured current is greater than a current threshold that is less than the final current demand. The switching control module  1008  could generate the output signal to turn the switch  320  ON the turn ON delay period before the OFF period reaches the desired OFF period. 
     A delay determination module  1024  determines the turn ON delay period and the turn OFF delay period. A monitoring module  1028  monitors the switch state signal from the switch monitor circuit  328  and generates an ON/OFF signal based on the voltage. For example, the monitoring module  1028  may set the ON/OFF signal to indicate that the switch  320  is ON or OFF based on the switch state signal. Alternatively, the switch state signal may be used directly. In various implementations, the turn ON delay period and the turn OFF delay period may be set, for example, based on datasheet information regarding the turn ON and turn Off delay periods of the switch  320 . Further example discussion regarding the voltage across the switch  320  is provided in the U.S. Prov. App. titled “Switch Actuation Measurement Circuit for Voltage Converter,” U.S. Prov. App. No. 62/323,563, filed on Apr. 15, 2016, which is incorporated herein in its entirety. While the monitoring module  1028  is shown as being implemented within the current control module  620 , the monitoring module  1028  may be implemented externally to the current control module  620  and may be implemented externally to the control module  220 . 
     The delay determination module  1024  may set the turn ON delay period based on or equal to the period between a first time when the switching control module  1008  generates the output signal to turn the switch  320  ON and a second time when the ON/OFF signal transitions to ON in response to the output signal. The delay determination module  1024  may set the turn OFF delay period based on or equal to the period between a first time when the switching control module  1008  generates the output signal to turn the switch  320  OFF and a second time when the ON/OFF signal transitions to OFF in response to the output signal. 
     While the example of turning the switch  320  OFF when the measured current becomes greater than the final current demand and maintaining the switch  320  OFF for the desired OFF period thereafter, the switching control module  1008  may alternatively turn the switch  320  ON for a desired ON period. More specifically, the switching control module  1008  may turn the switch  320  ON when the measured current falls below the final current demand, maintain the switch  320  ON for a desired ON period, and turn the switch  320  OFF when the desired ON period has passed after the turning of the switch  320  ON. A desired ON period module (not shown) determines the desired ON period. Written generally, for a boost converter, the desired ON period module may determine the desired ON period based on the input voltage, the output voltage, and the predetermined switching period. The desired ON period module may determine the desired ON period using one of a function and a look-up table that relates input voltages and output voltages to desired ON times given the predetermined switching period. For values between entries of the look-up table, the desired ON period module may determine the desired ON period using interpolation. 
       FIG. 19  includes a functional block diagram of another example implementation of the current control module  620 .  FIG. 19  may be used to accommodate possible operation in discontinuous mode. Possible operation in discontinuous mode may be considered because discontinuous mode operation may cause an increase in switching frequency since the ON period of the switch may be shorter than expected. Discontinuous mode operation may refer to the measured current reaching zero during predetermined switching periods. During continuous mode operation, the measured current does not reach zero. Operation may change between continuous and discontinuous mode operation, for example, as the input and/or output voltage changes. For example only, discontinuous mode operation may occur near zero crossings. 
     Instead of determining the desired OFF period based on the input voltage, the output voltage, and the predetermined switching period (as in the example of  FIG. 18 ), the desired OFF period module  1016  may determine the desired OFF period based on the predetermined switching period and an expected ON period. The desired OFF period module  1016  may determine the desired OFF period using a function or a look-up table that relates predetermined switching periods and expected ON periods to desired OFF periods. For values between entries of the look-up table, the desired OFF period module  1016  may determine the desired OFF period using interpolation. For example, the desired OFF period module  1016  may set the desired OFF period based on or equal to:
 
t p −t ON_EXP ,
 
where t p  is the predetermined switching period and t ON_EXP  is the expected ON period.
 
     An expected ON period module  1104  may set the expected ON period based on or equal to a lesser one of: an expected discontinuous mode ON period; and an expected continuous mode ON period. Stated another way, the expected ON period module  1104  may set the expected ON period based on or equal to the expected discontinuous mode ON period when the expected discontinuous mode ON period is less than the expected continuous mode ON period. The expected ON period module  1104  may set the expected ON period based on or equal to the expected continuous mode ON period when the expected continuous mode ON period is less than or equal to the expected discontinuous mode ON period. 
     A discontinuous mode ON period module  1108  determines the expected discontinuous mode ON period based on the final current demand, the inductance (L) of the inductor  308 , and the input voltage. The discontinuous mode ON period module  1108  determines the expected discontinuous mode ON period using a function or a look-up table that relates final current demands, inductances, and input voltages to expected discontinuous mode ON periods. For values between entries of the look-up table, discontinuous mode ON period module  1108  may determine the expected discontinuous mode ON period using interpolation. For example, the discontinuous mode ON period module  1108  may set the expected discontinuous mode ON period based on or equal to: 
                 IDem   *   L       V   I       ,         
where v I  is the input voltage, IDem is the final current demand, and L is the inductance of the inductor  308 .
 
     A continuous mode ON period module  1102  determines the expected continuous mode ON period based on the predetermined switching period, the output voltage, and the input voltage. The continuous mode ON period module  1102  determines the expected continuous mode ON period using a function or a look-up table that relates predetermined switching periods, output voltages, and input voltages to expected continuous mode ON periods. For values between entries of the look-up table, the continuous mode ON period module  1102  may determine the expected continuous mode ON period using interpolation. For example, the continuous mode ON period module  1112  may set the expected continuous mode ON period based on or equal to: 
                 t   p     *         V   O     -     V   I         V   O         ,         
where t p  is the predetermined switching period, v O  is the output voltage, and v I  is the input voltage.
 
     Another alternative for determining the expected ON period will now be described. A maximum module  1116  determines a maximum current (I Max). The maximum current corresponds to a maximum measured current that is expected given the final current demand using the expected continuous mode ON period and starting from zero current. The maximum module  1116  determines the maximum current based on the expected continuous mode ON period, the input voltage, and the inductance of the inductor  308 . The maximum module  1116  determines the maximum current using a function or a look-up table that relates expected continuous mode ON periods, input voltages, and inductances to maximum currents. For values between entries of the look-up table, the maximum module  1116  may determine the maximum current using interpolation. For example, the maximum module  1116  may set the maximum current period based on or equal to: 
                   t   ON_Cont     *     V   I       L     ,         
where t ON_Cont  is the expected continuous mode ON period, v I  is the input voltage, and L is the inductance of the inductor  308 .
 
     When the final current demand is less than the maximum current, discontinuous mode operation is occurring, and the expected ON period module  1104  may set the expected ON period based on or equal to: 
                 t   ON_Cont     *     IDem   IMax       ,         
where t ON_Cont  is the expected continuous mode ON period, IDem is the final current demand, and IMax is the maximum current. Alternatively, when discontinuous mode operation is occurring (i.e., when the final current demand is less than the maximum current), the expected ON period module  1104  may set the expected ON period based on or equal to:
 
                 IDem   *   L       V   I       ,         
where IDem is the final current demand, L is the inductance of the inductor  308 , v O  is the output voltage, and v I  is the input voltage. When the final current demand is greater than or equal to the maximum current, the expected ON period module  1104  may set the expected ON period based on or equal to the expected continuous mode ON period (t ON_Cont ).
 
     While  FIGS. 18 and 19  have been described for the example of a boost converter, the variable OFF period concepts are also applicable to buck converters. For example, for a buck converter (e.g., the buck converter of  FIGS. 3B and 4B ) the desired OFF period module  1016  may set the desired OFF period based on or equal to: 
                 t   p     *         V   I     -     V   O         V   O         ,         
where t p  is the predetermined switching period, v i  is the input voltage, and v o  is the output voltage. For discontinuous currents, similar corrections to those described with respect to  FIG. 19  can be applied for the example of a buck converter.
 
     Turning the switch  320  ON for a predetermined fixed ON period during each predetermined switching period or turning the switch  320  OFF for a predetermined fixed OFF period during each predetermined switching period may cause less than desirable current ripple, such as when a ratio of the input voltage to the output voltage is low. For example, the magnitude of the current ripple may increase and/or a cause a frequency of the current ripple to be different than the predetermined switching frequency. Also, switching based on the comparison of the measured current with the final current demand and using a fixed predetermined switching period may produce non-periodic current ripple.  FIGS. 20 and 21  include example graphs of current versus time and illustrate example non-periodic current ripples. 
     Determining the desired OFF period and maintaining the switch  320  OFF for the desired OFF period provides more periodic current ripple having approximately the predetermined switching frequency.  FIGS. 22, 23, and 24  include example graphs of current versus time under varying input voltage, output voltage, and load conditions produced by determining the desired OFF period based on the example of  FIG. 18 .  FIG. 25  includes an example graph of current versus time produced by determining the desired OFF period based on the example of  FIG. 19 . This may provide for more stable operation than the use of a predetermined fixed ON or OFF period and more stable operation than the use of a predetermined switching period. 
       FIG. 26  includes a flowchart depicting an example method of determining the desired OFF period of the switch  320  and controlling the switch  320  based on the desired OFF period. Control begins with  1204  where the switching control module  1008  determines whether the switch  320  is OFF (non-conducting). If  1204  is true, control transfers to  1228 , which is discussed further below. If  1204  is false, control continues with  1208 . 
     At  1208 , the desired OFF period module  1016  determines the desired OFF period. The desired OFF period module  1016  may determine the desired OFF period as described above with respect to the examples of  FIGS. 20 and 21 . At  1212 , the switching control module  1008  may adjust the desired OFF period based on the turn ON delay period and the turn OFF delay period. For example, the switching control module  1008  may sum the desired OFF period with the turn ON delay period and subtract the turn OFF delay period. 
     The comparison module  1004  may determine whether the measured current is greater than the final current demand at  1216 . The determination of the final current demand is discussed above. If  1216  is false, the timer module  1012  resets the OFF period and the switching control module  1008  maintains the switch  320  OFF at  1220 , and control ends. If  1216  is true, control continues with  1224 . 
     The switching control module  1008  generates the output signal to turn the switch  320  OFF at  1224  when the measured current is greater than the final current demand. At  1228 , the switching control module  1008  may determine whether the OFF period of the switch  320  is greater than the desired OFF period. If  1228  is false, the switching control module  1008  maintains the switch  320  OFF at  1232 , and control ends. If  1228  is true, the switching control module  1008  may generate the output signal to turn the switch  320  ON at  1236 , and control ends. In various implementations, the switching control module  1008  may wait for, or ensure that, the measured current is less than the final current demand before generating the output signal to turn the switch  320  ON at  1236 . While control is shown as ending, the example of  FIG. 26  is illustrative of one control loop and control may return to  1204  for a next control loop. 
       FIGS. 27A and 27B  together include a functional block diagram of an example reference signal generation module  616 . Referring now to  FIG. 27A , a filter module  1304  applies a filter to the AC input voltage measured using the AC line voltage sensor to produce a filtered AC input voltage. For example only, the filter module  1304  may apply a first or second order low pass filter or another suitable type of filter. 
     A comparison module  1308  compares the filtered AC input voltage with a first predetermined voltage that is less than 0 (zero) V. The comparison module  1308  transitions a store signal from a second state to a first state when the filtered AC input voltage transitions from less than the first predetermined voltage to greater than the first predetermined voltage. For example only, the first predetermined voltage may be approximately −50 V or another suitable voltage that is less than 0 V. 
     When the store signal transitions from the second state to the first state, a storing module  1312  stores the filtered AC input voltage and a present time. The stored filtered AC input voltage and the stored time are used to determine a zero crossing of the AC input voltage. Present time may be tracked, for example, by a clock. 
     The comparison module  1308  also compares the filtered AC input voltage with a second predetermined voltage that is greater than 0 V. The comparison module  1308  transitions an interpolate signal from a second state to a first state when the filtered AC input voltage transitions from less than the second predetermined voltage to greater than the second predetermined voltage. For example only, the second predetermined voltage may be approximately +50 V or another suitable voltage that is greater than 0 V. While the example of first and second predetermined voltages that are symmetric about 0 V (e.g., +/−50 V), non-symmetric first and second predetermined voltages may be used or the first and second predetermined voltages may be symmetric about a voltage other than 0 V. 
     When the interpolate signal transitions from the second state to the first state, a zero crossing module  1316  determines an AC line zero crossing (e.g., time) based on the filtered AC input voltage at that (present) time, the present time, the stored time, and the stored filtered AC input voltage. The stored time and the stored filtered AC input voltage are provided by the storing module  1312 . The zero crossing module  1316  may determine the AC line zero crossing, for example, using linear interpolation based on the filtered AC input voltage, the present time, the stored time, and the stored filtered AC input voltage. The AC line zero crossing corresponds to the time when the filtered AC input voltage crossed zero as it increased from the first predetermined voltage to the second predetermined voltage. An AC line zero crossing may be determined for each rising of the AC voltage across zero. 
       FIG. 28  includes an example graph of the filtered AC input voltage versus time. In this example, the input AC voltage (and therefore the filtered AC input voltage) are not purely sinusoidal for illustration purposes. The first voltage, the time of the first voltage (first time), the second voltage, and the time of the second voltage (second time) can be used to determine the zero crossing via linear interpolation. 
     Referring back to  FIG. 27A , a frequency module  1320  determines the supply frequency. As discussed above, the supply frequency is used by the filter coefficients module  816  to determine the filter confidents of the notch filter. The supply frequency corresponds to the frequency of the AC input voltage. The frequency module  1320  may determine the supply frequency, for example, based on two or more values of the filtered AC input voltage. For example, the frequency module  1320  may determine the supply frequency based on the period between the filtered AC input voltages of two consecutive peaks or two consecutive zero crossings. Alternatively, the frequency module  1320  may determine the supply frequency based on the reference signal. 
     The filtering performed by the filter module  1304  causes the filtered AC input voltage to be delayed relative to the AC input voltage. A filter correction module  1324  determines a filter correction for this delay based on the supply frequency. For example, the filter correction module  1324  may determine the filter correction using a function or a look-up table that relates supply frequencies to filter corrections. For values between entries of the look-up table, the filter correction module  1324  may determine the filter corrections using interpolation.  FIG. 29  includes an example graph of filter correction versus supply frequency. 
     An error module  1328  determines an error based on a difference between the AC line zero crossing and a reference signal zero crossing. The error module  1328  may also adjust the error for the filter correction. For example, the error module  1328  may set the error based on or equal to the AC line zero crossing plus the filter correction minus the reference signal zero crossing. In various implementations, the AC line zero crossing may be adjusted based on the filter correction (e.g., summed with the filter correction), and the error module  1328  may set the error equal to or based on the (adjusted) AC line zero crossing minus the reference signal zero crossing. 
     A phase adjustment module  1332  determines a phase adjustment for a sine wave used to generate the reference signal based on the error. For example, the phase adjustment module  1332  may determine the phase adjustment using one of a function and a look-up table that relates errors to phase adjustments. For values between entries of the look-up table, the phase adjustment module  1332  may determine the phase adjustment using interpolation. When the error is greater than a predetermined period, such as approximately 1 period of the supply frequency, the phase adjustment module  1332  may treat the error as zero and leave the phase adjustment unchanged. 
     An RMS module  1336  determines an RMS (root mean squared) voltage of the AC input voltage based on the supply frequency and the AC input voltage. For example, the RMS module  1336  may determine the RMS voltage using one of a function that relates AC input voltages and supply frequencies to RMS voltages. As an example, the RMS module  1336  may determine the RMS voltage by determining an average of squares the AC input voltages obtained over one period (as indicated by the supply frequency) and set the RMS voltage based on a square root of the average. The RMS module  1336  may also multiply the RMS voltage by the square root of 2 to obtain a peak voltage. While the example of determining the RMS voltage based on the AC input voltage is provided, the filtered AC voltage may be used in place of the AC input voltage. As discussed further below, the RMS voltage (or the peak voltage) may be used to scale the reference signal such that the voltage of the reference signal corresponds to the AC input voltage. 
     Referring now to  FIG. 27B , a sine generator module  1350  generates a sine reference signal. The sine generator module  1350  may generate the sine reference signal to form a sine wave that varies over time between +1 and −1 and that has a frequency equal to the frequency of the AC input voltage. The sine generator module  1350 , however, adjusts the sine reference signal based on the phase adjustment such that zero crossings of the reference signal align with zero crossings of the AC input voltage. The sine generator module  1350  may generate the sine reference signal, for example, as described below in conjunction with  1368 ,  1370 , and  1372  of  FIG. 27D . 
     A reference module  1354  generates the reference signal based on the sine reference signal and the RMS voltage. For example, the reference module  1354  may set the reference signal based on or equal to the (value of the) sine reference signal multiplied by the peak voltage of the RMS voltage. The reference signal therefore varies over time with voltages corresponding to the AC input voltages and has a frequency equal to the AC input voltage. 
     A comparison module  1358  compares the reference signal with a third predetermined voltage that is greater than 0 (zero) V. The comparison module  1358  transitions a store signal from a second state to a first state when the reference signal transitions from greater than the third predetermined voltage to less than the third predetermined voltage. For example only, the third predetermined voltage may be approximately +50 V or another suitable voltage that is greater than 0 V. The third predetermined voltage may be the same as the second predetermined voltage. 
     When the store signal transitions from the second state to the first state, a storing module  1362  stores the (voltage of) the reference signal and a present time. The stored voltage of the reference signal and the stored time are used to determine a zero crossing of the reference signal. 
     The comparison module  1358  also compares the reference signal with a fourth predetermined voltage that is less than 0 V. The comparison module  1358  transitions an interpolate signal from a second state to a first state when the reference signal transitions from greater than the fourth predetermined voltage to less than the fourth predetermined voltage. For example only, the fourth predetermined voltage may be approximately −50 V or another suitable voltage that is less than 0 V. While the example of third and fourth predetermined voltages that are symmetric about 0 V (e.g., +/−50 V), non-symmetric third and fourth predetermined voltages may be used. The fourth predetermined voltage may be the same as the first predetermined voltage. 
     When the interpolate signal transitions from the second state to the first state, a zero crossing module  1366  determines a reference signal zero crossing (e.g., time) based on the (voltage of) the reference signal at that (present) time, the present time, the stored time, and the stored voltage of the reference signal. The stored time and the stored voltage of the reference signal are provided by the storing module  1362 . The zero crossing module  1366  may determine the reference signal zero crossing, for example, using linear interpolation based on the voltage of the reference signal, the present time, the stored time, and the stored voltage of the reference signal. The reference signal zero crossing corresponds to the time when the reference signal crossed zero V as it decreases from the third predetermined voltage to the fourth predetermined voltage. A reference signal zero crossing may be determined for each falling of the reference signal across zero. 
       FIG. 30  includes an example graph of the voltage of the reference signal versus time. The first voltage of the reference signal, the time of the first voltage (first time), the second voltage of the reference signal, and the time of the second voltage (second time) can be used to determine the zero crossing of the reference signal via linear interpolation. While the example of determining the reference signal zero crossing using the reference signal is discussed, the sine reference signal could equally be used. 
     As discussed above, the reference signal zero crossing is used with the AC line zero crossing to determine the phase correction. Due to AC line zero crossings being determined based on the rising portion of the AC input voltage and reference signal zero crossings being determined based on the falling portions of the reference signal, each reference signal zero crossing should be approximately 180 degrees (½ of a period) out of phase from the AC line zero crossings that occur before and after that reference signal zero crossing. 
     The phase adjustment module  1332  may account for this phase difference in generating the phase adjustment. For example only, each AC line zero crossing may be adjusted based on the period corresponding to ½ of a period of the supply frequency before being used by the error module  1328 . For example, the period corresponding to ½ of the period of the supply frequency may be summed with each AC line zero crossing before use by the error module  1328 . 
     Another way to generate the reference signal is described in commonly assigned, U.S. Pat. No. 8,264,860, issued on Sep. 11, 2012, which is incorporated herein in its entirety. Generating the reference signal as described herein, however, can be performed more slowly and consume less computational resources. Generating the reference signal as described herein may also render a better reference signal when the AC input voltage is distorted. The filtering provided by the filter module  1304  provides additional robustness. The filtering imparts delay, but this delay is compensated for by the filter correction module  1324 , as described above. 
       FIGS. 27C and 27D  together include a functional block diagram of an example reference signal generation module  616 .  FIG. 27C  includes elements that are similar to those of  FIG. 27A . The reference signal zero crossing input to the error module  1328 , however, is determined differently. 
     Referring now to  FIG. 27D , a base module  1368  determines a base reference (signal) angle based on the supply frequency. The base reference angle corresponds to an angle of the reference signal (e.g., between 0 and 360 degrees, which corresponds to 1 period of the reference signal). The base module  1368  may, for example, mathematically integrate the supply frequency each control loop. The mathematical integration produces a change in the base reference angle. The base module  1368  may update the base reference angle each control loop by summing the change determined for that control loop with the base reference angle from the last control loop. In various implementations, the base module  1368  may limit the base reference angle to between 0 and a predetermined maximum value, such as 360 degrees, wrapping back to 0 when the base reference angle becomes greater than the predetermined maximum value. This may be performed, for example, using the modulo function. 
     A reference angle module  1370  determines a reference signal angle based on the phase adjustment and the base reference angle. For example, the reference angle module  1370  may set the reference signal angle based on or equal to the phase adjustment plus the base reference angle. 
     A sine module  1372  determines a sine reference signal angle as the sine (function) of the reference signal angle. As such, the sine reference signal angle varies between +1 and −1 based on the reference signal angle. A reference module  1374  generates the reference signal based on the sine reference signal angle and the RMS voltage. For example, the reference module  1374  may set the reference signal based on or equal to the (value of the) sine reference signal angle multiplied by the peak voltage of the RMS voltage. The reference signal therefore varies over time with voltages corresponding to the AC input voltages and has a frequency equal to the AC input voltage. 
     A comparison module  1376  compares the reference signal angle with a first predetermined angle. The comparison module  1376  transitions a store signal from a second state to a first state when the reference signal angle transitions from less than the first predetermined angle to greater than the first predetermined angle. For example only, the first predetermined angle may be approximately 150 degrees or another suitable angle before an expected zero crossing of the reference signal (e.g., 180 degrees). 
     When the store signal transitions from the second state to the first state, a storing module  1378  stores the reference signal angle and a present time. The stored reference angle and the stored time are used to determine a zero crossing of the reference signal. 
     The comparison module  1376  also compares the reference angle with a second predetermined angle. The comparison module  1376  transitions an interpolate signal from a second state to a first state when the reference angle transitions from less than the second predetermined angle to greater than the second predetermined angle. For example only, the second predetermined angle may be approximately 210 degrees or another suitable angle after an expected zero crossing of the reference signal (e.g., 180 degrees). While the example of first and second predetermined angles that are symmetric about 180 degrees is provided, other non-symmetric predetermined angles and other predetermined angles may be used. 
     When the interpolate signal transitions from the second state to the first state, a zero crossing module  1380  determines a reference signal zero crossing (e.g., time) based on the reference signal angle at the present time, the present time, the stored time, and the stored reference signal angle. The stored time and the stored reference signal angle are provided by the storing module  1378 . The zero crossing module  1380  may determine the reference signal zero crossing, for example, using linear interpolation based on the reference signal angle, the present time, the stored time, and the stored reference signal angle. The reference signal zero crossing corresponds to the time when the reference signal crossed zero V as the reference signal decreased. A reference signal zero crossing may be determined for each falling of the reference signal across zero. 
       FIGS. 27E and 27F  together include a functional block diagram of an example reference signal generation module  616 . In the example of  FIGS. 27E and 27F , the AC line zero crossing is used to determine an expected reference angle. In the example of  FIGS. 27E and 27F , the reference signal zero crossing is not determined. 
     Referring to  FIG. 27F , an expectation module  1386  determines an expected reference signal angle. The expected reference signal angle at a given time corresponds to an expected value of the reference signal angle at that time. The expectation module  1386  determines the expected reference signal angle based on the AC line zero crossing and the supply frequency. For example, the expectation module  1386  may set the expected reference signal angle to zero at each AC line zero crossing. The expectation module  1386  may mathematically integrate the supply frequency each control loop. The mathematical integration produces a change in the expected reference signal angle. The expectation module  1386  may update the expected reference signal angle each control loop by summing the change determined for that control loop with the expected reference signal angle from the last control loop. In various implementations, the expectation module  1386  may limit the expected reference signal angle to between 0 and a predetermined maximum value, such as 360 degrees, wrapping back to 0 when the expected reference signal angle becomes greater than the predetermined maximum value. This may be performed, for example, using the modulo function. The expected reference signal angle is discussed further below. 
     A reference angle module  1388  determines a base reference (signal) angle based on an adjusted supply frequency. Generation of the adjusted supply frequency is discussed further below with respect to  FIG. 27E . The reference angle module  1388  may, for example, determine a change in the reference signal angle based on a period between consecutive determinations of the base reference signal angle and the adjusted supply frequency. The reference angle module  1388  may, for example, mathematically integrate the adjusted supply frequency each control loop. The mathematical integration produces a change in the base reference angle. The reference angle module  1388  may update the base reference angle each control loop by summing the change determined for that control loop with the base reference angle from the last control loop. In various implementations, the reference angle module  1388  may limit the base reference angle to between 0 and a predetermined maximum value, such as 360 degrees, wrapping back to 0 when the base reference angle becomes greater than the predetermined maximum value. This may be performed, for example, using the modulo function. The sine module  1372  and the reference module  1374  are discussed above and are used to generate the reference signal. 
     Referring to  FIG. 27E , an error module  1390  determines an angle error based on the filter correction (from the filter correction module  1324 ), the expected reference signal angle (determined by the expectation module  1386 ), and the reference angle (determined by the reference angle module  1388 ). For example only, the error module  1390  may set the angle error based on or equal to the expected reference angle minus the reference signal angle plus the filter correction. 
     A frequency adjustment module  1392  determines a frequency adjustment based on the error. For example, the frequency adjustment module  1392  may increase the frequency adjustment as the error increases and decrease the frequency adjustment as the error decreases. An adjusting module  1394  adjusts the supply frequency based on the frequency adjustment to determine the adjusted supply frequency. For example, the adjusting module  1394  may set the adjusted supply frequency based on or equal to the supply frequency plus the frequency adjustment. Based on the above, the reference signal will be adjusted to correspond to the AC line voltage in frequency and phase. 
       FIG. 31  is a flowchart depicting an example method of determining an AC line zero crossing, for example based on the example of  FIG. 27A-27B . Control begins with  1404  where the filter module  1304  filters the AC input voltage to produce a filtered AC input voltage. For example only, the filter module  1304  may apply a low pass filter. At  1408 , the comparison module  1308  determines whether the filtered AC input voltage has transitioned from less than the first predetermined voltage (e.g., −50 V) to greater than the first predetermined voltage. If  1408  is true, the storing module  1312  stores the filtered AC input voltage and the present time at  1412 , and control ends. If  1408  is false, control transfers to  1416 . 
     At  1416 , the comparison module  1308  determines whether the filtered AC input voltage has transitioned from less than the second predetermined voltage (e.g., +50 V) to greater than the second predetermined voltage. If  1416  is true, the zero crossing module  1316  determines the AC line zero crossing (as the filtered AC input voltage increased from the first predetermined voltage toward the second predetermined voltage) at  1420  based on the stored filtered AC input voltage, the present filtered AC input voltage, the stored time, and the present time using linear interpolation. Control then ends. If  1416  is false, control ends. While control is shown as ending, the example of  FIG. 31  is illustrative of one control loop and control may return to  1404  for a next control loop. Also, while the example of interpolating once when the filtered AC voltage transitions to greater than the second predetermined voltage has been described, the zero crossing module  1316  may perform the interpolation based on the present filtered AC voltage for each control loop and determine the AC line zero crossing based on the interpolation at the time when the filtered AC input voltage has transitioned to greater than the second predetermined voltage. 
       FIG. 32  is a flowchart depicting an example method of determining a reference signal zero crossing, for example based on the example of  FIG. 27A-27B . Control begins with  1504  where the reference module  1354  generates the reference signal (voltage) based on the RMS voltage multiplied with the sine reference signal (value). At  1508 , the comparison module  1358  determines whether the voltage of the reference signal has transitioned from greater than the third predetermined voltage (e.g., +50 V) to less than the third predetermined voltage. If  1508  is true, the storing module  1362  stores the reference signal voltage and the present time at  1512 , and control ends. If  1508  is false, control transfers to  1516 . 
     At  1516 , the comparison module  1358  determines whether the voltage of the reference signal has transitioned from greater than the fourth predetermined voltage (e.g., −50 V) to less than the fourth predetermined voltage. If  1516  is true, the zero crossing module  1366  determines the reference signal zero crossing (as the reference signal decreased from the third predetermined voltage toward the fourth predetermined voltage) at  1520  based on the stored reference signal voltage, the present voltage of the reference signal, the stored time, and the present time using linear interpolation. Control then ends. If  1516  is false, control ends. While control is shown as ending, the example of  FIG. 32  is illustrative of one control loop and control may return to  1504  for a next control loop. The example of  FIG. 32  may be performed concurrently with the example of  FIG. 31 . Also, while the example of interpolating once when the voltage of the reference signal transitions to less than the fourth predetermined voltage has been described, the zero crossing module  1366  may perform the interpolation based on the present voltage of the reference signal for each control loop and determine the reference signal zero crossing based on the interpolation at the time when the present voltage has transitioned to less than the fourth predetermined voltage. 
       FIG. 33  is a flowchart depicting an example method of generating the reference signal, for example based on the example of  FIG. 27A-27B . Control may begin with  1604  where the sine generator module  1350  may determine whether the zero crossing module  1366  has just determined the reference signal zero crossing. For example, the zero crossing module  1366  may signal such a determination to the sine generator module  1350  or the sine generator module  1350  may determine that the zero crossing module  1366  determined the reference signal zero crossing when the reference signal zero crossing changes. If  1604  is false, control may transfer to  1628 , which is discussed further below. If  1604  is true, control may continue with  1612 . 
     At  1612 , control makes one or more adjustments to account for the approximately ½ of one period (e.g., 1/supply frequency) difference between the AC line zero crossing and the reference signal zero crossing. For example, the zero crossing module  1316  may add ½ of one period of the AC input voltage to the AC line zero crossing, or the zero crossing module  1366  may subtract ½ of one period of the AC input voltage from the reference signal zero crossing. At  1616 , the filter correction module  1324  determines the filter correction based on the supply frequency. The filter correction corresponds to the delay period imposed by the filter module  1304 . 
     At  1620 , the error module  1328  determines an error between the (last determined) AC line zero crossing and the (just determined) reference signal zero crossing. For example, the error module  1328  may set the error based on or equal to the AC line zero crossing plus the filter correction minus the reference signal zero crossing. The phase adjustment module  1332  updates the phase adjustment at  1624  based on the error. For example, the phase adjustment module  1332  may determine the phase adjustment using a function or a look-up table that relates errors to phase adjustments. 
     At  1628 , the sine generator module  1350  generates a next value of the sine reference signal for generating a sine wave over the next period based on the phase adjustment. The reference module  1354  generates the next voltage of the reference signal based on the value of the sine reference signal and the RMS voltage (of the AC line) at  1632 . For example, the reference module  1354  may set the voltage of the reference signal based on or equal to the value of the sine reference signal multiplied with the peak voltage of the RMS voltage. The RMS module  1336  determines the RMS voltage based on the AC input voltage, such as at  1628 . The RMS module  1336  may set the peak voltage based on or equal to the RMS voltage multiplied by the square root of 2. 
     While control is shown as ending, the example of  FIG. 33  is illustrative of one control loop and control may return to  1604  for a next control loop. The example of  FIG. 33  may be performed concurrently with the examples of  FIGS. 31 and 32 . Also, while the example of updating the phase adjustment when the reference signal zero crossing is determined, the phase adjustment could be additionally or alternatively updated when the AC line zero crossing is determined using that AC line zero crossing and the last reference signal zero crossing (from approximately ½ of one period earlier). While  FIGS. 31-33  are discussed in conjunction with the examples of  FIGS. 27A-27B , similar concepts are applicable to the examples of  FIGS. 27C-D  and  FIGS. 27E-F . 
     The foregoing description is merely illustrative in nature and is in no way intended to limit the disclosure, its application, or uses. The broad teachings of the disclosure can be implemented in a variety of forms. Therefore, while this disclosure includes particular examples, the true scope of the disclosure should not be so limited since other modifications will become apparent upon a study of the drawings, the specification, and the following claims. It should be understood that one or more steps within a method may be executed in different order (or concurrently) without altering the principles of the present disclosure. Further, although each of the embodiments is described above as having certain features, any one or more of those features described with respect to any embodiment of the disclosure can be implemented in and/or combined with features of any of the other embodiments, even if that combination is not explicitly described. In other words, the described embodiments are not mutually exclusive, and permutations of one or more embodiments with one another remain within the scope of this disclosure. 
     Spatial and functional relationships between elements (for example, between modules, circuit elements, semiconductor layers, etc.) are described using various terms, including “connected,” “engaged,” “coupled,” “adjacent,” “next to,” “on top of,” “above,” “below,” and “disposed.” Unless explicitly described as being “direct,” when a relationship between first and second elements is described in the above disclosure, that relationship can be a direct relationship where no other intervening elements are present between the first and second elements, but can also be an indirect relationship where one or more intervening elements are present (either spatially or functionally) between the first and second elements. As used herein, the phrase at least one of A, B, and C should be construed to mean a logical (A OR B OR C), using a non-exclusive logical OR, and should not be construed to mean “at least one of A, at least one of B, and at least one of C.” 
     In the figures, the direction of an arrow, as indicated by the arrowhead, generally demonstrates the flow of information (such as data or instructions) that is of interest to the illustration. For example, when element A and element B exchange a variety of information but information transmitted from element A to element B is relevant to the illustration, the arrow may point from element A to element B. This unidirectional arrow does not imply that no other information is transmitted from element B to element A. Further, for information sent from element A to element B, element B may send requests for, or receipt acknowledgements of, the information to element A. 
     In this application, including the definitions below, the term “module” or the term “controller” may be replaced with the term “circuit.” The term “module” may refer to, be part of, or include: an Application Specific Integrated Circuit (ASIC); a digital, analog, or mixed analog/digital discrete circuit; a digital, analog, or mixed analog/digital integrated circuit; a combinational logic circuit; a field programmable gate array (FPGA); a processor circuit (shared, dedicated, or group) that executes code; a memory circuit (shared, dedicated, or group) that stores code executed by the processor circuit; other suitable hardware components that provide the described functionality; or a combination of some or all of the above, such as in a system-on-chip. 
     The module may include one or more interface circuits. In some examples, the interface circuits may include wired or wireless interfaces that are connected to a local area network (LAN), the Internet, a wide area network (WAN), or combinations thereof. The functionality of any given module of the present disclosure may be distributed among multiple modules that are connected via interface circuits. For example, multiple modules may allow load balancing. In a further example, a server (also known as remote, or cloud) module may accomplish some functionality on behalf of a client module. 
     Some or all hardware features of a module may be defined using a language for hardware description, such as IEEE Standard 1364-2005 (commonly called “Verilog”) and IEEE Standard 1076-2008 (commonly called “VHDL”). The hardware description language may be used to manufacture and/or program a hardware circuit. In some implementations, some or all features of a module may be defined by a language, such as IEEE 1666-2005 (commonly called “SystemC”), that encompasses both code, as described below, and hardware description. 
     The term code, as used above, may include software, firmware, and/or microcode, and may refer to programs, routines, functions, classes, data structures, and/or objects. The term shared processor circuit encompasses a single processor circuit that executes some or all code from multiple modules. The term group processor circuit encompasses a processor circuit that, in combination with additional processor circuits, executes some or all code from one or more modules. References to multiple processor circuits encompass multiple processor circuits on discrete dies, multiple processor circuits on a single die, multiple cores of a single processor circuit, multiple threads of a single processor circuit, or a combination of the above. The term shared memory circuit encompasses a single memory circuit that stores some or all code from multiple modules. The term group memory circuit encompasses a memory circuit that, in combination with additional memories, stores some or all code from one or more modules. 
     The term memory circuit is a subset of the term computer-readable medium. The term computer-readable medium, as used herein, does not encompass transitory electrical or electromagnetic signals propagating through a medium (such as on a carrier wave); the term computer-readable medium may therefore be considered tangible and non-transitory. Non-limiting examples of a non-transitory computer-readable medium are nonvolatile memory circuits (such as a flash memory circuit, an erasable programmable read-only memory circuit, or a mask read-only memory circuit), volatile memory circuits (such as a static random access memory circuit or a dynamic random access memory circuit), magnetic storage media (such as an analog or digital magnetic tape or a hard disk drive), and optical storage media (such as a CD, a DVD, or a Blu-ray Disc). 
     The apparatuses and methods described in this application may be partially or fully implemented by a special purpose computer created by configuring a general purpose computer to execute one or more particular functions embodied in computer programs. The functional blocks and flowchart elements described above serve as software specifications, which can be translated into the computer programs by the routine work of a skilled technician or programmer. 
     The computer programs include processor-executable instructions that are stored on at least one non-transitory computer-readable medium. The computer programs may also include or rely on stored data. The computer programs may encompass a basic input/output system (BIOS) that interacts with hardware of the special purpose computer, device drivers that interact with particular devices of the special purpose computer, one or more operating systems, user applications, background services, background applications, etc. 
     The computer programs may include: (i) descriptive text to be parsed, such as HTML (hypertext markup language), XML (extensible markup language), or JSON (JavaScript Object Notation) (ii) assembly code, (iii) object code generated from source code by a compiler, (iv) source code for execution by an interpreter, (v) source code for compilation and execution by a just-in-time compiler, etc. As examples only, source code may be written using syntax from languages including C, C++, C#, Objective-C, Swift, Haskell, Go, SQL, R, Lisp, Java®, Fortran, Perl, Pascal, Curl, OCaml, Javascript®, HTML5 (Hypertext Markup Language 5th revision), Ada, ASP (Active Server Pages), PHP (PHP: Hypertext Preprocessor), Scala, Eiffel, Smalltalk, Erlang, Ruby, Flash®, Visual Basic®, Lua, MATLAB, SIMULINK, and Python®. 
     None of the elements recited in the claims are intended to be a means-plus-function element within the meaning of 35 U.S.C. § 112(f) unless an element is expressly recited using the phrase “means for,” or in the case of a method claim using the phrases “operation for” or “step for.”