PFC:800WPSUC7-4pin
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
control_interrupts.h File Reference

Interrupts code. More...

#include <DAVE.h>

Go to the source code of this file.

Data Structures

struct  PFC_coefs
 

Macros

#define VOLT_LOOP_SHIFT_Q12   4
 
#define VOLT_LOOP_SHIFT_Q13   3
 
#define BOP_DCBUS_RATIO   13
 
#define SOFT_START_MAX   2317
 
#define MAX_DUTY   953
 
#define PFC_RUNNING   (0x04|0x08)
 
Shifting for ADC related variables
#define ADC_FIR_TO_Q15   1
 
#define ADC_TO_Q15   3
 
#define IIR_QFORMAT   14
 
#define ADC_TO_IIR   (IIR_QFORMAT+ADC_TO_Q15)
 
#define LPF_TO_2ADC   (ADC_TO_IIR-1)
 
#define LPF_TO_Q15   15
 
#define NOTCH_TO_Q15   14
 
DCM DCM variables
#define K_DCM_SHIFT   10
 
#define K_DCM_FACTOR   22749
 
#define AVG_DCM_SHIFT   15
 
#define T_DCM_MAX   1400
 
#define T_DCM_MIN   147
 
DC_filter DC voltage filter definitions
#define MULT_FACTOR_DC_FILTER   9
 
#define DC_FILTER_SHIFT   3
 
iLoop Current loop coefficients calculation, CCM
#define COEFF_OFFSET1_9k_Q14   14640
 
#define COEFF_SLOPE1_9k_Q14   32282
 
#define ZERO_LOC_9k_Q14   11468
 
#define COEFF_OFFSET1_4k_Q14   11074
 
#define COEFF_SLOPE1_4k_Q14   24420
 
#define COEFF_OFFSET2_4k_Q14   3871
 
#define COEFF_SLOPE2_4k_Q14   4607
 
#define ZERO_LOC_4k_Q14   11468
 
#define COEFF_ILIMIT_Q14   11915
 
#define Q28_TO_Q14   14
 
#define Q29_TO_Q14   15
 
#define Q28_TO_Q13   15
 
#define CURRENT_REF_TO_Q15   19
 
#define DUTY_FF_MULT_Q15   16853
 
#define NOMINAL_FREQ   1475
 
#define MAX_DUTY_NOMINAL_FREQ   1430
 
#define NOMINAL_FREQ_x2   737
 
#define MAX_DUTY_FREQx2   715
 
Output voltage related macros
#define VOUT_OFFSET   57
 
#define VOUT_OVP_STOP   24398+VOUT_OFFSET
 
#define VOUT_OVP_LATCH   25850+VOUT_OFFSET
 
#define VOUT_STEADY_MIN   22945+VOUT_OFFSET
 
#define VOUT_STEADY_MAX   23526+VOUT_OFFSET
 
#define VOUT_ORIGIN1   20044+VOUT_OFFSET
 
#define VOUT_SLOPE1   20950
 
#define TO_Q15   14
 
#define VOUT_UVP_MIN   19285
 
#define VOUT_START_MIN   6660
 
#define VOUT_START_MAX   22528
 
#define VOLTAGE_OFFSET_NL_ON   21717
 
#define VOLTAGE_OFFSET_NL_OFF   22297
 
#define VOLTAGE_OFFSET_NL_GAIN   3
 
#define VOLTAGE_OFFSET_NL_MAX   (32000/2)
 
Soft start related macros
#define SOFT_START_STEP_VOLTAGE   1022
 
#define ST_STB_BOP_CHECK_BULK   80
 
#define ST_STB_BOP_SFTSTRT_WAIT   (10+ST_STB_BOP_CHECK_BULK)
 

Typedefs

typedef enum state state_t
 
typedef enum fault fault_t
 
typedef struct PFC_coefs PFC_coefs_t
 

Enumerations

enum  state {
  ST_INIT = 0x00, ST_STB = 0x01, ST_STB_BOP = 0x02, ST_SOFT_START = 0x04,
  ST_RUNNING = 0x08, ST_LATCH = 0x10
}
 
enum  fault {
  F_INIT = 0x0, F_OVP = 0x1, F_BOP = 0x2, F_UVP = 0x4,
  F_PEAK = 0x8, F_OTP = 0x10
}
 
enum  comp_BW_t { BW4 = 0, BW9 = 1 }
 

Functions

__STATIC_INLINE void PWM_OFF ()
 
__STATIC_INLINE void PWM_ON ()
 
__STATIC_INLINE void relay_ON ()
 
__STATIC_INLINE void relay_OFF ()
 
__STATIC_INLINE void set_duty (uint16_t duty)
 
__STATIC_INLINE void set_nominal_frequency (uint16_t duty)
 
__STATIC_INLINE void set_twice_frequency (uint16_t duty)
 
__STATIC_INLINE void Iref (uint16_t level)
 
__STATIC_INLINE void ENABLE_PRIM_ON ()
 
__STATIC_INLINE void ENABLE_PRIM_OFF ()
 

Variables

__IO uint32_t * ADCResult_iL
 
__IO uint32_t * ADCResult_DCBus
 
__IO uint32_t * ADCResult_VAC
 
__IO uint32_t * ADCResult_Temp
 
__IO uint32_t * ADCResult_BOP
 
volatile PFC_coefs_t PFC
 
__I uint32_t * DCM_capture
 
volatile state_t status_reg
 
volatile fault_t fault_reg
 
volatile uint16_t freq_in_count
 

Detailed Description

Interrupts code.

Author
Meneses Herrera, David
Date
20.06.2017

Macro Definition Documentation

#define ADC_FIR_TO_Q15   1

ADC with FIR [2 2 0] normalization shift (Q15)

#define ADC_TO_IIR   (IIR_QFORMAT+ADC_TO_Q15)

Shift for RMS filter input

#define ADC_TO_Q15   3

ADC normalization shift (Q15)

#define AVG_DCM_SHIFT   15

Shift fort DCM current correction factor multiplication

#define BOP_DCBUS_RATIO   13

Ratio between DC and average input voltage before start-up sequence.

#define COEFF_ILIMIT_Q14   11915

Current limit between regions, considering linear variation of the inductance

#define COEFF_OFFSET1_4k_Q14   11074

Current coefficient offset of first region (coefficient for 0A operation)

#define COEFF_OFFSET1_9k_Q14   14640

Current coefficient offset of first region (coefficient for 0A operation)

#define COEFF_OFFSET2_4k_Q14   3871

Current coefficient offset of second region (coefficient for I_Limit operation)

#define COEFF_SLOPE1_4k_Q14   24420

Current coefficient slope of first region, considering linear variation of the inductance

#define COEFF_SLOPE1_9k_Q14   32282

Current coefficient slope of first region, considering linear variation of the inductance

#define COEFF_SLOPE2_4k_Q14   4607

Current coefficient slope of second region, considering linear variation of the inductance

#define CURRENT_REF_TO_Q15   19

Current reference adaptation to Q15 representation

#define DUTY_FF_MULT_Q15   16853

Multiplier for duty feedforward calculation (Q15)

#define IIR_QFORMAT   14

RMS filter coefficient format

#define K_DCM_FACTOR   22749

Factor applied for DCM current correction, in case more accurate detection is necessary

#define K_DCM_SHIFT   10

Shift for DCM current correction factor calculation

#define LPF_TO_2ADC   (ADC_TO_IIR-1)

Shift of RMS filter for proper Iref calculation

#define LPF_TO_Q15   15

Shift of DC filter for proper voltage loop

#define MAX_DUTY   953

Maximum allowed duty cycle

#define MAX_DUTY_FREQx2   715

Maximum allowed duty cycle during normal operation

#define MAX_DUTY_NOMINAL_FREQ   1430

Maximum allowed duty cycle during normal operation

#define NOMINAL_FREQ   1475

Switching frequency for normal operation

#define NOMINAL_FREQ_x2   737

Switching frequency for reduced ripple operation

#define NOTCH_TO_Q15   14

Shift of DC filter for proper voltage loop

#define PFC_RUNNING   (0x04|0x08)

PWM is on during PFC operation, e.g. soft-start and running operation

#define Q28_TO_Q13   15

Shifting for duty feedforward: Q28 to Q13

#define Q28_TO_Q14   14

Shifting for coefficient calculation: Q28 to Q14

#define Q29_TO_Q14   15

Shifting for coefficient calculation: Q29 to Q14

#define SOFT_START_MAX   2317

Maximum value of the multiplier for current-loop operation

#define SOFT_START_STEP_VOLTAGE   1022

Reference step for the soft-start phase.

#define ST_STB_BOP_CHECK_BULK   80

Number of cycles before checking the bulk voltage after input voltage is in range and the decision of closing the relay is taken.

#define ST_STB_BOP_SFTSTRT_WAIT   (10+ST_STB_BOP_CHECK_BULK)

Number of cycles before starting the converter after closing the relay.

#define T_DCM_MAX   1400

Maximum captured time to be considered DCM operation

#define T_DCM_MIN   147

Minimum captured time to be considered DCM operation

#define TO_Q15   14

Shifting for bulk voltage target calculation: Q30 to Q15

#define VOLT_LOOP_SHIFT_Q12   4

Voltage loop shifting after addition with Q12 coefficients

#define VOLT_LOOP_SHIFT_Q13   3

Voltage loop shifting after addition with Q13 coefficients

#define VOLTAGE_OFFSET_NL_GAIN   3

Output voltage offset non-linear gain.

#define VOLTAGE_OFFSET_NL_MAX   (32000/2)

Maximum output voltage offset to apply non-linear loop error.

#define VOLTAGE_OFFSET_NL_OFF   22297

Output voltage offset limit to stop applying non-linear loop error.

#define VOLTAGE_OFFSET_NL_ON   21717

Output voltage offset limit to apply non-linear loop error.

#define VOUT_OFFSET   57

Offset to adjust bulk voltage level, Q15 representation

#define VOUT_ORIGIN1   20044+VOUT_OFFSET

Linear variation of bulk voltage with output current/power

#define VOUT_OVP_LATCH   25850+VOUT_OFFSET

440V, Q15 representation; Used only for debugging purposes

#define VOUT_OVP_STOP   24398+VOUT_OFFSET

420V, Q15 representation

#define VOUT_SLOPE1   20950

Linear variation of bulk voltage with output current/power

#define VOUT_START_MAX   22528

Output voltage before start-up must be lower than 275*sqrt(2) (Q15).

#define VOUT_START_MIN   6660

Output voltage before start-up must be higher than 84*sqrt(2) (Q15).

#define VOUT_STEADY_MAX   23526+VOUT_OFFSET

398V, Q15 representation. Used for the control loop reference and resume value after OVP

#define VOUT_STEADY_MIN   22945+VOUT_OFFSET

390V, Q15 representation. Used for the control loop reference and resume value after OVP

#define VOUT_UVP_MIN   19285

UV to stop PFC operation: 333V, Q15 representation

#define ZERO_LOC_4k_Q14   11468

Zero location of the current compensator (Q14 format)

#define ZERO_LOC_9k_Q14   11468

Zero location of the current compensator (Q14 format)

Typedef Documentation

typedef enum fault fault_t

Defined fault states used to manage the converter protections

typedef struct PFC_coefs PFC_coefs_t

Structure for the PFC related variables

typedef enum state state_t

Defined states to be used in the starting sequence and state machine

Enumeration Type Documentation

enum comp_BW_t

Defined fault states used to manage the converter protections

enum fault

Defined fault states used to manage the converter protections

enum state

Defined states to be used in the starting sequence and state machine

Function Documentation

__STATIC_INLINE void Iref ( uint16_t  level)

Iref is derived from CCU40.CC43 and a low-pass filter so level is set via duty cycle

__STATIC_INLINE void set_duty ( uint16_t  duty)
Parameters
dutyModify duty cycle of the PFC-PWM and the trigger of the ADC
__STATIC_INLINE void set_nominal_frequency ( uint16_t  duty)
Parameters
dutyNominal frequency operation at low current levels
__STATIC_INLINE void set_twice_frequency ( uint16_t  duty)
Parameters
dutyDouble nominal frequency operation at high current levels