Home

STEVAL-ISV003V1: firmware user manual

image

Contents

1. The DS TIMx Configuration includes the configuration code for the advanced timer TIM8 The counter value DataSensing Init Counter is defined inside the DCDC_Converter h file ky Doc ID 023556 Rev 1 11 39 STM32F1xx internal peripherals for DC AC section UM1561 12 39 The repetition counter is set to 1 in order to have an update event at the center of the counting as shown in Figure 4 Figure 5 Repetition counter settings for advanced timer Center aligned mode Edge aligned mode Upcounting Downcounting Counter TIM uev 52444444444 4444444444 4444444444 JVNVNNN TIMx RCR 1 UEV A TMKRCR 2 Uk A 4 JVNNNSN 3 AD A A 4 TIMx 3 A NNN and re synchronization vee A A A A by SW by SW by SW P T x m E UEV r Update Event Preload registers transferred to active registers and update interrupt generated AM15194v1 DCAC_Inverter c The c file defines all functions useful in managing the DC AC section in particular DCAC_Init PDCAC_TypeDef_t pDCACInit DCAC SendCommand DCAC Commands t DCAC SetPulse u32 PulseCurrent u32 PulseVoltage DCAC GetStatus DCAC GetConfiguration IPDCAC TypeDef t pDCACInit DCAC RefreshDispl
2. void DMA1 11 configuration Ck ckCckck k k k k k k ck ck k k k k ck ckck k k ck k k k k k k k k k k k k k k k k k k k k ck kk DMA Configuration Analog to digital converter configuration kk ckckckckckck k k k k k k k k k k k k k k k k R k K K KOR KOR R K K KOR KOR ko DS DMA Configuration void DMA DeInit DMA1 Channell DMA InitStructure DMA PeripheralBaseAddr ADC1 DR Address DMA InitStructure DMA MemoryBaseAddr vu32 DataSensing Init DataRegister DMA InitStructure D DMA InitStructure D DMA InitStructure D DMA InitStructure D DMA InitStructure D DMA InitStructure D DMA InitStructure D D DMA InitStructure DMA InitStructure DMA Init DMA1 Channeli1 Enable DMA1 11 DMA Cmd DMA1 11 Clear 11 trans Doc ID 023556 Rev 1 MA BufferSize MA PeripheralInc MA MemoryInc MA PeripheralDataSize MA MemoryDataSize MA Mode MA Priority DMA M2M DMA DIR PeripheralSRC DataSensing Init RegisterSize DMA PeripheralInc Disable DMA MemoryInc Enable DMA PeripheralDataSize Word DMA MemoryDataSize Word DMA Mode Circular DMA Priority High DMA M2M Disable amp DMA InitStructure ENABLE fer complete flag 17 39 Data sensing section for the closed loop control UM1561 18 39 DMA ClearFlag DMA1 FLAG TC1 where vu32 DataSensing Init Da
3. ADC2 configura ADC_InitStructure DC_InitStructure DC_InitStructure DC_InitStructure 3 x E DC InitStructure ENABL tion ADC e E Mode ADC Mode RegSimult ADC ScanConvMode ENABLE ADC ContinuousConvMode DISABLE 1 ExternalTrigConv ADC ExternalTrigConv None DataAlign ADC DataAlign Left Doc ID 023556 Rev 1 UM1561 Data sensing section for the closed loop control p D DC Init DC InitStructure ADC NbrOfChannel ADC2 amp ADC InitStructure EIS ADC2 regular 111 configuration ADC RegularChannel IConfig ADC2 ADC SampleTime 1Cycles5 ADC Channel 11 1 ADC2 regular channel13 configuration ADC RegularChannel ADC SampleTime 1Cycles5 ADC RegularChannel IConfig A IConfig A ADC SampleTime 1Cycles5 DC2 PC3 PANEL DC2 External trigger enabled ADC ITConfig ADC1 ADC ExternalTrigConvCmd ADC2 ENABLI ADC Channel 13 2 VOLTAGE ADC2 regular 115 configuration not used ADC Channel 15 3 Lj ADC IT EOC ENABLE DS EnableAndCalibrate ADC1 DS ADC EnableAndCalibrate ADC2 The ADC1 converts the following information at different channels e ADC_Channel_10 gt AC line current e ADC Channel 12 gt DC panel current e ADC Channel 14 gt DC b
4. UM1561 Sf i User manual STEVAL ISVOO3V1 firmware user manual Introduction This document describes how the firmware to manage the 250 W micro inverter demo STEVAL ISVOO3V1 has been developed Starting from the block diagram it shows in detail the single function and provides a user guide for further code development October 2012 Doc ID 023556 Rev 1 1 39 www st com Contents UM1561 Contents 1 System overview 4 2 Firmware workspace with IAR embedded workbench IDE 5 3 STM32F1xx microcontroller several peripherals used to manage the STEVAL ISV003V1 demonstration board 7 4 STM32F1xx internal peripherals for DC DC section 8 5 STM32F1xx internal peripherals for DC AC section 11 6 Data sensing section for the closed loop control 15 7 STM32F1xx MCU peripherals configuration 21 8 Implementation of digital phase locked loop 23 9 Digital closed loop control and diagnostic functions implemented 27 10 MPPT maximum power point algorithm 33 11 Input output protection 36 12 Revision history 38 2 39 Doc ID 023556 Rev 1 ky UM1561 List of figures List of figures Figure 1 250 W microinverter digital section based on STMS2F1xx microcontrolle
5. DCAC Running ENABLE nRet DCAC ERROR NONE else if cmd DCAC Stop nRet DCAC ERROR ON SEND COMMAND Doc ID 023556 Rev 1 13 39 STM32F1xx internal peripherals for DC AC section UM1561 if DCAC GetStatus LocalDevice State CtrlPWMOutputs DCAC Stopped DCAC Stopped TIM8 DISABLI Lj TIMx disable counter nRet DCAC ERROR NONE return nRet where CtrlPWMOutputs TIM8 ENABLE is Enables TIM8 timer for DCAC section and starts DataSensing acqu isitions CtrlPWMOutputs TIM8 DISABLE is Stops TIM8 timer and stops DataSensing acquisitions DCAC SetPulse This function sets the PWM pulse value produced by the calculations of the closed loop control It is called by the microcontroller each control cycle after board startup DCAC Error t DCAC SetPulse u32 PulseChannell 1132 PulseChannel2 DCAC Error t nRet SetCompare2 TIMS8 PulseChannel1 nRet DCAC ERROR NONE return nRet j where e SetCompare2 TIM8 PulseChannel1 is Set the pulse value of the TIM8 in the capture compare register 14 39 Doc z ID 023556 Rev 1 UM1561 Data sensing section for the closed loop control 6 Data sensing section for the closed loop control The firmware implemented for the
6. Fault BUS OVERVOLTAGE GPIO ResetBits GPIOA GPIO Pin 1 State Control STOP WITH DELAY Diagnostic Control BUS OVERVOLTAGI j if BusFiltered lt 9880 amp amp MPPT_EN TRUE Fault BUS UNDERVOLTAGE GPIO ResetBits GPIOA GPIO Pin 1 State Control STOP WITH DELAY Diagnostic Control BUS UNDERVOLTAGE where Fault BUS OVERVOLTAGE is Bus overvoltage detected Fault BUS UNDERVOLTAGE is Bus undervoltage detected if qralpha Inverter gt 19667 qralpha Inverter lt 19667 amp amp State Control zGRID INSERTION amp amp MPPT EN TRUE 1 6 max output peak current t Fault OUT CURRENT LIMIT GPIO ResetBits GPIOA GPIO Pin 1 State Control STOP WITH DELAY Diagnostic Control OUT CURRENT LIMIT where GPIO ResetBits GPIOA GPIO Pin 1 is AC line overcurrent detected State Control STOP WITH DELAY is PV module Vmin detected if PV_Voltage lt 11000 amp amp State Control GRID INSERTION 22V min GPIO ResetBits GPIOA GPIO Pin 1 State Control STOP WITH DELAY Diagnostic Control PV VOLTAGE MIN Doc ID 023556 Rev 1 UM1561 Input output protection When a bus over undervoltage overcurrent or minimum input voltage appears the closed loop control stops the MPPT function and it moves to the next state machine STOP WITH DELAY At this point the power board
7. u16 CCR Val 1 gt Powprev amp amp Vpanel gt Vpanel prev t if CCR Val Val step 512 t CCR_Val 512 DCDC SetDutyCycle u16 CCR Val Doc ID 023556 Rev 1 33 39 MPPT maximum power point algorithm UM1561 CCR_Val CCR_Val CCR_Val_step DCDC SetDutyCycle u16 CCR Val if Pow Powprev amp amp Vpanel lt Vpanel_prev if CCR Val CCR Val step 512 CCR 1 512 DCDC SetDutyCycle u16 CCR Val else CCR Val CCR Val CCR Val step flag mppt 1 DCDC SetDutyCycle u16 CCR Val j if Pow Powprev amp amp Vpanel Vpanel prev if CCR Val CCR Val step 235 CCR Val 235 DCDC SetDutyCycle u16 CCR Val else CCR Val CCR Val CCR Val step DCDC SetDutyCycle u16 CCR Val Powprev Vpanel prev Vpanel Powz0 q 34 39 Doc ID 023556 Rev 1 UM1561 MPPT maximum power point algorithm Figure 6 250W microinverter firmware flow chart No protections enabled In DC DC section the PWMs are regulated at fixed duty cycle modifiable by LCD In DC AC section the PWMs are controlled by look up table Open loop StartControl in open loop mode ExecControlOpen Loop DC DC amp DC AC converters started Main SetSystem Waiting for Joystick event right left down Up center Openloop or Closed loop select
8. converter is managed by one PWM timer and a GPIO pin synchronized in order to control two legs of the inverter at different switching frequencies The advanced PWM timer TIM8 is used to control the high frequency leg and the GPIO pin for the low frequency leg Only one output of the TIM8 is used and the same is true for the GPIO peripheral The advanced timer is configured in center alignment mode in order to trigger the ADC at the up counting of the counter Figure 4 shows the PWM mode and the trigger events for ADC Figure 4 Center alignment mode for TIM8 timer and trigger event for ADC PWM_TRGOSelection PWM_TRGOMode_Update AZ on overflow REPRATE 1 AZ on overflow REPRATE 1 PWM Center aligned mode ontro I Wait State Loop AD main loop ISR Sampling Period Ts 59us 17kHz AM15192v1 DataSensing c void DS TIMx Configuration void TIM8 Configuration PWM1 Mode TIM TimeBaseStructure TIM Period DataSensing Init Counter 1 TIM TimeBaseStructure TIM Prescaler 0 TIM TimeBaseStructure TIM ClockDivision 0 TimeBaseStructure TIM CounterMode CounterMode CenterAligned1 TIM TimeBaseStructure TIM RepetitionCounter 1 TIM TimeBaseInit TIM8 amp TIM TimeBaseStructure TIM SelectOutputTrigger TIM8 TIM TRGOSource Update where SelectOutputTrigger TIM8 TRGOSource Update is Set the TIM8 output for ADC triggering
9. frequency between 47 Hz and 53 Hz If these conditions are satisfied for a fixed time 10 sec the state machine goes to the next step DC DC DC AC turned on ff k 1 k kk kk kk ke kkk ke ke kkk ANTI ISLANDING DETECTION ckckck ck ck ck ck ckck kck ck k ck k kk if Theta 0x8000 Theta lt 20000 zero_detect DIAGNOSTIC AC VOLTAGE AND FREQ AT STARTUP Freq 47 Hz 53 Hz Vac 185V 265V if State Control DIAGNOSTIC AC LINE State Control DIAGNOSTIC DC LINE if Theta_time gt 331 amp amp Theta time 375 amp amp VqgFiltered mean gt 37150 amp amp VqFiltered lt 39080 if freq monitor time 500 10 GDVoltage GRID VOLTAGE INSIDE RANGE Freq Control FREQ INSIDE RANGE c freq monitor time 0 if Freq Control FREQ OUT OF RANGE amp amp GDVoltage GRID VOLTAGE OUT OF RANGE freq monitor time c else freq monitor time 0 Grid Voltage max 0 Grid Voltage min 0 where e 37150 is AC voltage RMS monitoring e 375 is AC frequency monitoring e 500 is listening time q 26 39 Doc ID 023556 Rev 1 UM1561 Digital closed loop control and diagnostic functions implemented 9 Digital closed loop control and diagnostic functions implemented 250WControl c This open first f is the main f
10. is waiting for a physical opening of the relay During the fixed time 10 msec the PWM continues to modulate at the DC DC stage and the DC AC stage At the end of this period they all switch off This time is in accordance with the relay specifications Doc ID 023556 Rev 1 37 39 Revision history UM1561 12 38 39 Revision history Table 1 Document revision history Date Revision Changes 16 Oct 2012 1 Initial release Doc ID 023556 Rev 1 UM1561 Please Read Carefully Information in this document is provided solely in connection with ST products STMicroelectronics NV and its subsidiaries ST reserve the right to make changes corrections modifications or improvements to this document and the products and services described herein at any time without notice All ST products are sold pursuant to ST s terms and conditions of sale Purchasers are solely responsible for the choice selection and use of the ST products and services described herein and ST assumes no liability whatsoever relating to the choice selection or use of the ST products and services described herein No license express or implied by estoppel or otherwise to any intellectual property rights is granted under this document If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services or any intellectual pro
11. performing an MPPT algorithm on the PV panel side Several hardware peripherals embedded in the microcontroller have been used to control the system and to allow communication with an external unit In particular the power board is made up of two sections a DC DC converter and a DC AC converter Figure 3 shows an overview of the main blocks used to design the system Figure 3 Description of the main hardware parts STEVAL ISV003V1 DC DC converter DC AC converter AC filter AUX PS uC unit and LCD JTAG connector Debug connector RS 232 port AM15189v1 ky Doc ID 023556 Rev 1 7 39 STM32F1xx internal peripherals for DC DC section UM1561 4 8 39 STM32F1xx internal peripherals for DC DC section The DC DC converter is managed by two PWM timers configured in master slave in such a way as to have two phase shifted signals In particular the general timer TIM2 is configured as master with Center Aligned mode counting The overflow of the digital counter at the up counting synchronizes another general timer to work in slave mode Hardware synchronization allows no delay time between the timers and two signals are generated with 180 deg phase shift DCDC Converter c define PERIOD LocalDevice Init Counter define TIM2 PERIOD TIM PERIOD 1 DIVIDED BY 2 CENTER ALIGNED MODE define TIM2 INIT PULSE TIM2 PERIOD gt gt 1 DIVIDED BY 2 50 TIM2 PERIOD define TIM3 PERIOD TIM PERI
12. section for the closed loop control UM1561 16 39 return nRet where DS GPIO Configuration is Configures the GPIO pins 05 TIMx Configuration is Configures the TIM8 timer DS DMA Configuration is Configures the DMA DS DMA Configuration is Configures the ADC DS GPIO Configuration The following GPIO pins are configured as Analog Input in order to connect the external sensing section with the internal ADC f k k k k k k k k k k k k k k k k k k k k k k K k K k KOK K k K K K KOR K K k K K K KO KOK K K K K R KO KR KOK K K K KOK K K k K K k k k k k RO R k k Function Name GPIO_Configuration Description Configures the different GPIO ports for data sensing Input None Output None Return None k k K k k K k K k K OK K KOK K K K K R K K KO KOR K R KOR K K R K R KOK R K K KOR K KOR K K KOR OR R KOR R void DS GPIO Configuration void t Configure 0 PC 1 ADC Channell0 11 as analog input EJ GPIO_InitStructure GPIO_Pin GPIO_Pin_0 GPIO_Pin_1 GPIO_Pin_2 GPIO_Pin_3 GPIO_Pin_4 GPIO_Pin_5 GPIO InitStructure GPIO Mode GPIO Mode AIN GPIO Init GPIOC amp GPIO InitStructure For Debug pourpouse Configure Test Pin PC9 GPIO InitStructure GPIO Pin GPIO Pin 9 GPIO InitStructure GPIO Mode GPIO Mode Out PP GPIO InitStructure GPIO Speed GPIO Sp
13. 0 2 11 0 2 87 0 30 0x326E 0x33DE 0x354D 0 36 0x3824 0 398 0x3DB8 0 3 17 0x4073 0 41 0x4325 0x447A 0 45 0x471C 0x4869 0x49B4 Ox4AFB 0 4 0 4081 Ox4EBF 0x5269 0x539B 0 54 0 55 5 0 5710 0 5842 0x5964 0x5A82 Ox5B9D 0x5CB4 0 50 7 O0Ox5ED7 Ox5FE3 0 60 0x63EF 0 64 8 Ox65DD 0 66 0x67BD 0 68 6 0 698 0x6A6D 0 6 4 0 6 24 Ox6CF9 Ox6DCA 0 6 96 0 719 0 7255 0x7307 0x73B5 Ox745F 0 7504 0 75 5 0x7641 0x76D9 0 776 Ox77FA 0x7884 0x7909 0 798 Ox7AEF 0 7 5 0 7 5 0x7C29 0x7C89 Ox7CE3 0 7039 0x7D8A 0 7006 Ox7E1D Ox7E5F Ox7E9D Ox7ED5 0 7 09 Ox7F87 Ox7FA7 Ox7FC2 Ox7FD8 Ox7FE9 Ox7FF6 Ox7FFD Ox7FFF Ox7FFD Ox7FF6 Ox7FE9 Ox7FD8 0 7 2 Ox7FA7 0x7F38 0 7 09 Ox7ED5 Ox7E9D Ox7E5F Ox7E1D Ox7DD6 0x7D8A 0x7D39 Ox7CE3 0x7C89 0x7C29 0 7 5 Ox7B5D 0x7A05 0x798A 0x7909 0x7884 Ox77FA 0x776C 0 76 9 0x7641 0x75A5 0x7504 0 745 0 73 5 0x7307 0x7255 0x7023 Ox6F5F 0 6 96 Ox6DCA 0 6 9 0 6 24 Ox6B4A 0x6A6D 0x698C 0 68 6 0x67BD 0 66 Ox65DD 0 64 8 Ox61F1 0 60 Ox5FE3 Ox5ED7 0 5 7 Ox5CBA4 Ox5B9D 0x5A82 0x5964 0x5842 0x571D 55 54 0x539B OxAFFB Ox4EBF 0 4081 Ox4C3F Ox4AFB 0x49B4 0 4869 0 471 0 45 0x447A 0 4325 0 41 0x4073 Ox3F17 Ox3AF2 0x398C 0x3824 0 36 0x
14. 354D 0x33DE 0x326E Ox30FB 0 2 87 0 2 11 0x2C98 0 2 1 0x29A3 0x2826 0x23A6 0x2223 0 209 0 1 19 0 1093 Ox1COB 0x1A82 0 18 8 0x176D 0 15 2 0 1455 0x12C8 0 1139 OxOFAB OxOAFB 0x096A 0x07D9 0x0647 0x04B6 0x0324 0x0192 Calc Theta Grid 0 9 11 OxAD97 0xC248 0 0958 OxF1E5 OxOAFB 0x23A6 Ox3AF2 Ox4FFB 0 61 0 7023 0 7 05 Ox7F38 Ox7F87 Ox7AEF 0 719 Ox63EF 0x5269 0x3DB8 0x26A8 0 0 Ox9DOE OxAECD OxC3AA OxDADS 0 75 0x0C8B 0x2528 0x3C56 0x5133 0x62F2 0x70E2 Ox7A7D 0 7 62 0 7 62 Ox7A7D 0 70 2 0 62 2 0 5133 0x3C56 0x2528 0x0C8B The main function Calc Theta Grid includes the code for the grid angle estimation and anti islanding protection void Calc Theta Grid s16 Input Integration static 532 Delta Theta tmp 0 Doc ID 023556 Rev 1 X UM1561 Implementation of digital phase locked loop q static s16 Delta Theta 0 static 1116 freq monitor time 0 mul qi15 415 q31 Input Integration SAMPLING TIME amp Delta Theta tmp Delta Theta 516 Delta Theta gt gt 16 Theta Theta Delta_Theta Theta_time if zero_detect 50 VqFiltered_min 65500 VqFiltered_max 0 Theta_time 0 zero_detect 0 VqFiltered prec 116 Gri
15. 6 amp DataSensingOffSet 1 DataSensing sum AC LineVoltage DataInitCount 1 vul6 amp DataSensingOffSet 2 DataSensing sum DC PanelCurrent DataInitCount 1 vul6 amp DataSensingOffSet 3 DataSensing sum DC PanelVoltage DataInitCount 1 DataInitCount where e if DataInitCount lt MAX DATA INIT COUNT 1 is Time for offset estimation 5 seconds The firmware is based on state machines architecture able to indicate the real operation of the power board for each instant switch State Control case STOPPING sprintf strLineMessage STOPPING break case STOP sprintf strLineMessage STOP break case START sprintf strLineMessage START break case BUS FAULT Doc ID 023556 Rev 1 29 39 Digital closed loop control and diagnostic functions implemented UM1561 30 39 sprintf strLineMessage break case DIAGNOSTIC DC LINE Lj sprintf strLineMessage break case OUT CURRENT LIMIT sprintf strLineMessage break case BUSPRECHARGE sprintf strLineMessage break case DIAGNOSTIC AC LINE p sprintf strLineMessage break I case PV VOLTAGE DVDT sprintf strLineMessage break case PV VOLTAGI ES _ MIN sprintf strLineMessage break case FREQ OUT_OF_RANGE sprintf strLineMessage break case STOP WITH DELAY sprintf strLineMe
16. 6 0x8894 0x8927 0 89 Ox8A5B Ox8AFC 0 8 1 0 8 0 8 9 Ox8DAB 0x8E62 Ox8F1I Ox8FDD 0x90A1 0 916 0 9236 0x9307 0x93DC 0 94 6 Lj a Is pH Doc ID 023556 Rev 1 23 39 Implementation of digital phase locked loop UM1561 24 39 0x9593 0x9674 0x975A 0x9843 0x9931 0 9 23 0 9 18 Ox9EOF Ox9F14 OxAO1D 0 129 0xA239 OxA34C 0xA463 OxA57E OxA69C OxA7BE OxA8E3 OxAB36 65 0 005 0 141 OxB27F 0 1 0 505 OxB64C 0 797 OxB8E4 0xBA33 0 86 OxBCDB 0xBE32 OxBF8D 0 0 9 OxC50E 0xC674 OxC7DC 0 946 OxCAB3 OxCC22 OxCD92 OxCF05 0 0079 0xD1EF 0 0368 OxD4E1 OxD65D OxD7DA OxDC5A OxDDDD OxDF61 0 0 7 OxE26D OxE3F5 0 57 0 708 0 893 OxEA1E OxEBAB OxED38 OxEEC7 0 055 OxF505 OxF696 OxF827 OxF9B9 OxFB4A OxFCDC OxFEGE 0x0000 0x0192 0x0324 0 04 6 0x0647 0 0709 0 096 OxOE1B OxOFAB 0x1139 0 12 8 0 1455 0 15 2 0 176 0 18 8 0x1A82 Ox1COB 0 1093 0 1 19 0x209F 0x2223 0x26A8 0x2826 0x29A3 0 2 1 0x2C98
17. Init CalibrationControl Configure RELE t pAdeseesc oceeeewasecoeseewencedceseeee AY Doc ID 023556 Rev 1 27 39 Digital closed loop control and diagnostic functions implemented UM1561 28 39 GPIO InitStructure GPIO Pin GPIO Pin 1 GPIO InitStructure GPIO Mode GPIO Mode Out PP GPIO InitStructure GPIO Speed GPIO Speed 50MHz GPIO Init GPIOA amp GPIO InitStructure PID Init Integral Part PID Init amp Direct Current PID amp Quadrature Current PID amp Reactive Power PID amp Active Power PID amp BUS Voltage PID amp DQ PLL PID amp MPPT PID Get Control Parameters address GetControlParametersAddress PControlParam t amp CtrlParam Get Data Parameters address GetDataParametersAddress PPhotov t amp Data where InitStructure DutyCycle DCDC DUTYCYCLE is DC DC data structure DCAC InitStructure Counter DCAC COUNTER is DC AC data structure DS InitStructure Counter DCAC COUNTER is Sensing data structure The StartControl function defines the init configuration for all PID regulators It contains also the start commands for the power section void StartControl PID Init Integral Part PID Init amp Direct Current PID amp Quadrature Current PID amp Reactive Power PID amp Active Power PID amp BUS Voltage PID amp DQ PLL PID amp MPPT PID BusOverVoltage FALSE GridOutage FALSE Fault FAULT NONE StoppingCou
18. OD 1 DIVIDED BY 2 CENTER ALIGNED MODE define TIM3 INIT PULSE TIM3 PERIOD 1 DIVIDED BY 2 50 TIM2 PERIOD Set the counting period of the PWM timers TIM2 PERIOD and PERIOD and set the duty cycle value at 50 TIM2 INIT PULSE TIMS INIT PULSE In DCDC_Converter h the DCDC_COUNTER is the PERIOD reference value The c file defines all functions useful in managing the DC DC section in particular e DCDC Init PDCDC TypeDef t pDCDCInit e DCDC SendCommand DCDC Commands t cmd e DCDC GetStatus e DCDC GetConfiguration IPDCDC TypeDef t pDCDCInit e DCDC GetDutyCycle e DCDC GetFrequency e DCDC RefreshDisplay DCDC Error t err u32 steps u32 changes DCDC Init DCAC Error t DCAC Init PDCAC TypeDef t pDCACInit DCAC Error t nRet nRet DCAC ERROR INVALID PARAMETER if pDCACInit t nRet DCAC ERROR ON INIT if LocalDevice State DCAC Running t LocalDevice Init Counter pDCACInit gt Counter LocalDevice Init DeadTime pDCACInit gt DeadTime LocalDevice State DCAC_Stopped Doc ID 023556 Rev 1 0 1561 STM32F1 xx internal peripherals for DC DC section Init peripherals DCAC GPIO Configuration DCAC TIMx Configuration DCAC SetDeadTime LocalDevice Init DeadTime Lj nRet DCAC ERROR NONI ret
19. a USB and a Figure 1 250 W microinverter digital section based on STM32F1xx microcontroller STM32 ARM Cortex M3 32 bit RISC core AM15187v1 Doc ID 023556 Rev 1 UM1561 Firmware workspace with IAR embedded workbench IDE 2 Firmware workspace with IAR embedded workbench IDE Opening IAR workbench editor the workspace 250 W microinverter grid connected appears as shown in Figure 2 Figure 2 IAR embedded workbench IDE workspace TE PSS Ready AM15188v1 It is internally structured in several folders in particular Doc includes fw version file EWARMv5 includes cortexm3 macro s instruction wrappers for special Cortex M3 instructions and stm32f10x_vector c STM32F 10x vector table for EWARMB FWLib includes the firmware library with the c file for each STM32F1xx internal peripheral for example the stm32f10x adc c file provides all the ADC firmware functions stm32f10x tim c provides the TIM functions and the same for other peripherals User includes all user files developed Output contains the and out file Doc ID 023556 Rev 1 5 39 Firmware workspace with IAR embedded workbench IDE UM1561 6 39 The user folder contains all c files that contribute to the power and communication management e 250WControl c the core of the firmware it contains a lot of functions for the closed and open loop cont
20. ay DCAC Error t err u32 steps u32 PulseCurrent u32 changes DCAC_Init DCAC Error t DCAC Init PDCAC TypeDef t pDCACInit DCAC Error t nRet nRet DCAC ERROR INVALID PARAMETER if pDCACInit t nRet DCAC ERROR ON INIT if LocalDevice State DCAC Running t LocalDevice Init Counter pDCACInit gt Counter LocalDevice Init DeadTime pDCACInit gt DeadTime LocalDevice State DCAC_Stopped Doc ID 023556 Rev 1 UM1561 STM32F1 xx internal peripherals for DC AC section Init peripherals DCAC GPIO Configuration DCAC TIMx Configuration DCAC SetDeadTime LocalDevice Init DeadTime Lj nRet DCAC ERROR NONI return nRet J where e DCAC GPIO Configuration is Configuration of the GPIO pin for TIM8 timer and for GPIO function e DCAC TIMx Configuration is Configuration of PWM timer This function includes the init code for the advanced timer TIM8 and GPIO DCAC_SendCommand This function includes the start stop command for the output of the advanced timer TIM8 inverter modulation DCAC DCAC_Error_t nRet Error t DCAC SendCommand DCAC Commands t cmd nRet DCAC ERROR INVALID COMMAND if cmd DCAC Start nRet DCAC ERROR ON SEND COMMAND if DCAC GetStatus LocalDevice State TIMx enable counter TIM CtrlPWMOutputs TIMS8 DCAC Running
21. closed loop control needs a good sensing procedure in order to regulate the bus voltage to inject sinusoidal current to the grid and also for the input control of the DC DC converter that performs an MPPT control The accuracy of the control block is also very important in order to achieve system efficiency DataSensing c The c file defines all functions useful in managing the data sensing section in particular DS Init PDS TypeDef t pDSInit DS SendCommand DS Commands t cmd DS GetStatus DS GetData DS GetConfiguration PDS TypeDef t pDSInit DS RefreshDisplay DS Error t err DS SetAcquistionEvent PFN ACQUISTION pfFn DS Init This function includes the init code for the ADC1 e ADC2 configuration DS DS Error t nRet Error t DS Init PDS TypeDef t pDSInit nRet DS ERROR INVALID PARAMETER if pDSInit nRet DS ERROR ON INIT if DataSensing State DS Running DataSensing Init Counter DataSensing Init DataRegister DataSensing Init RegisterSize DataSensing Init OnAcquisition DataSensing State DSInit Counter tO gg DSInit DataRegister DSInit gt RegisterSize DSInit gt OnAcquisition DS_Stopped Init peripherals DS GPIO Configuration DS TIMx Configuration DS DMA Configuration DS ADCx Configuration nRet DS ERROR NONE P Doc ID 023556 Rev 1 15 39 Data sensing
22. d Volt d qV Quadrature 0x8000 VqFiltered 016 s32 s32 VqFiltered lt lt 8 s32 VqFiltered 532 VqFiltered_prec gt gt 8 if VqFiltered gt VqFiltered_max VqFiltered_max VqFiltered else if VqFiltered lt VqFiltered_min VqFiltered_min VqFiltered VqFiltered_mean ul16 VqFiltered_max VqFiltered_min gt gt 1 where Theta Theta Delta_Theta is Grid angle estimation Theta changes value linearly each switching period between 32768 to 32768 The anti islanding protection is based on grid voltage and frequency monitoring The Vq DC component used for the first is made up of an offset value 32768 plus a DC value function of the AC Vrms value for example 265 Vrms gt Vq 39080 or Vac 186 V gt Vq 37150 265V max amp 186V min if VqFiltered_mean gt 39080 VqFiltered_mean lt 37150 amp amp State_Control GRID_INSERTION amp amp MPPT_EN TRUE amp amp zero_detect gt 5 amp amp Vacprot TRUE GPIO_ResetBits GPIOA GPIO_Pin_1 State_Control STOP_WITH_DELAY Diagnostic Control GRID VOLTAGE OUT OF RANGE Doc ID 023556 Rev 1 25 39 Implementation of digital phase locked loop UM1561 where 37150 is AC voltage protection based Vq value The figure code shows the procedure to control the AC line before the microinverter start up in this example the AC line voltage must be comprised between 185 V and 265 V and the
23. ed Closed loop hw config c Config Configuration GPIO Configuration SysTick Config InitControl ClosedLoop STM3210E LCD Init StartControl Start command sent ExecControl Data Sensing enabled Main function 1 1 1 1 Sema Dmm Diagnostic mode H i l of range Diagnostic AC line H 1 1 Vacmin lt VACrms lt Vacmax i Freq_min lt Freg_grid lt Freq_max 1 gt 1 I Out of range Diagnostic i DC line 1 i 1 PVvolt min PV voltage Pvvoll max STOP f aca DE ayak 1 YES BUSPRECHARGE Inrush control started i 1 1 Protections 1 requested START Pre Grid Insertion control GRID INSERTION _ 250WConverter c AM15210v1 Doc ID 023556 Rev 1 35 39 Input output protection UM1561 11 36 39 Input output protection The power board is also controlled by the microcontroller for the input output protection During normal operation it is possible that the cables input or output side are accidentally disconnected from the panel or from the grid In this case overcurrent or overvoltage may appear at the power stage To avoid damaging the electronic parts a procedure is implemented in the 250WControl c file as follows if BusFiltered 13000
24. eed 50MHz GPIO Init GPIOC amp GPIO InitStructure DS TIMx Configuration The DS TIMx Configuration includes the configuration code for the advanced timer TIM8 useful also for ADC triggering void DS TIMx Configuration void TIM8 Configuration PWM1 Mode TIM TimeBaseStructure TIM Period DataSensing Init Counter 1 TIM TimeBaseStructure TIM Prescaler 0 Doc ID 023556 Rev 1 ky UM1561 Data sensing section for the closed loop control 4 TIM TimeBaseStructure TIM TimeBaseInit TIM8 where SelectOutputTrigger T SelectOutputTrigger TIM8 TIM TimeBaseStructure TIM ClockDivision 0 CounterMode CounterMode CenterAlignedl TIM TimeBaseStructure TIM RepetitionCounter 1 amp TIM TimeBaseStructure TRGOSource Update M8 TIM TRGOSource Update is Configures the TIM8 as trigger for ADC1 and ADC2 DS DMA ContigurationY The direct memory access DMA1 peripheral is configured to store the information acquired by the ADC in a buffer called the data register It is a vector that includes all the information for example AC line voltage AC line current DC bus voltage DC panel current and DC panel voltage EERE kk ck kc ko k k k k k k k k k k k k k k k Function Name DS_ Description Input NONE Return None
25. guration 7 STM32F1xx MCU peripherals configuration hw config c The c file defines all functions useful to init the internal and external peripherals in particular Config configures main system clocks amp power NVIC_Configuration configures NVIC and vector table base location GPIO Configuration configures the different GPIO ports SysTick Config configure a SysTick Base time to 1 ms InitControl initializes the parameters for the control algorithm open closed loop DAC Init configures DAC peripheral used only for debug STMS3210E LCD Init initializes the LCD void SetSystem void RCC configuration RCC Config Interrupt vector NVIC Configuration GPIO Conf GPIO Configuration SysTick for delay function SysTick Config Init 250W Control algorithm InitControl ClosedLoop Init DAC Control DAC Init DAC COUNTER DAC ADDRESS LCD int STM3210E LCD Init Clear the LCD LCD Clear White Photovoltaic data transfer Init PHOTOVSDK Init Doc ID 023556 Rev 1 21 39 STM32F1xx MCU peripherals configuration UM1561 22 39 where e RCC_Config is Configures main system clocks and power e NVIC Configuration is Configures NVIC and Vector Table base location e GPIO Configuration is Configures the different GPIO ports e SysTick Config is Configures the different GPIO
26. ile of the microinverter It includes the firmware code for the closed and loop control the input and output protection and the LCD display management The unction called InitControl contains the init data for the DC DC and DC AC section In particular the DC DC information is contained in the InitStructure the DC AC are contained in the DCAC_InitStructure and the data sensing part in the DS InitStructure void DCAC InitControl ControlMode t mode GPIO InitTypeDef GPIO InitStructure DCDC TypeDef t InitStructure DCAC TypeDef t DCAC InitStructure DS TypeDef t DS InitStructure DCDC Converter configuration InitStructure Counter DCDC COUNTER InitStructure DutyCycle DCDC DUTYCYCLE InitStructure frequency DCDC FREQUENCY DCDC Init amp InitStructure DCAC Inverter init configuration DCAC InitStructure Counter DCAC COUNTER DCAC InitStructure DeadTime DCAC_DEADTIME DCAC Init amp DCAC InitStructure ControlMode mode DataSensing Init configuration DS InitStructure Counter DCAC COUNTER the same counter of the DS InitStructure DataRegister vu32 amp DataSensingIO DS InitStructure RegisterSize DATA SENSING SIZE if mode ClosedLoop DS InitStructure OnAcquisition ExecControl else DS InitStructure OnAcquisition ExecControlOpenLoop DS Init amp DS InitStructure Calibration of data sensing AFTER DS
27. k k k ck ck k ko k k k k k k ko ko ko ko const sl6 Sin Cos Table STEPS tabella USATA x IL VECTOR 0x0000 OxFE6E OxFCDC OxFB4A 0 9 9 0 827 OxF696 OxF505 OxF375 0 1 5 OxF055 OxEEC7 OxED38 OxEBAB OxEAIE 0 893 0 708 OxE57E OxE3F5 OxE26D OxEOE7 OxDF61 OxDDDD OxDC5A OxDADS 0xD958 OxD7DA 0 065 0 4 1 0xD368 1 0 0079 0 05 OxCD92 0xCC22 0xC946 OxC7DC 0xC674 OxC50l 0xC248 0 0 9 OxBF8D 0xBE32 OxBCDB 0 86 0xBA33 OxB8E4 0xB797 0xB64C 0 505 0xB3C1 0 27 0 141 0 005 OxAl 0 97 OxAC65 OxAB36 OxA8E3 OxA7BE 69 OxA57E 0 463 0xA239 0 129 OxAO1D Ox9F14 Ox9EOF 0 9 0 0 9 11 0 9 18 0x9A23 0x9931 0x9843 0x975A 0x9674 0x9593 0 94 6 0x93DC 0x9307 0x9236 0x916A 0x90A1 Ox8FDD 8 0 8 62 Ox8DAB 0 8 9 0x8C4B 0 8 1 Ox8AFC 0x8A5B 0 89 0x8927 0x8894 0x8806 0x877C 0x86F7 0x8676 0 85 0 8583 0x8511 0x84A3 0x843B 0x83D7 0x8377 0x831D 0 82 7 0x8276 0x822A 0x81E3 0 81 1 0x8163 0 812 0 80 7 0 80 8 0 8091 0x8079 0x8059 0 803 0x8028 0x8017 0x800A 0 8003 0x8000 0x8003 0x800A 0x8017 0x8028 0x803E 0x8059 0x8079 0x8091 0x80C8 0x80F7 0 812 0x8163 0 81 1 Ox81E3 0x822A 0x8276 0x82C7 0x831D 0x8377 0x83D7 0x843B 0x84A3 0 8511 0x8583 Ox85FB 0x8676 0x86F7 0 877 0x880
28. nt TIME OUT STOPPING State Control DIAGNOSTIC LINE E Ej DCAC Start DS SendCommand DS Start if ControlMode OpenLoop DCDC SendCommand DCDC ConverterStart DAC Start j where PID Init amp Direct Current PID is Init the PID regulator DS SendCommand DS Start is All power sections started q Doc ID 023556 Rev 1 UM1561 Digital closed loop control and diagnostic functions implemented X The ExecControllnitParamOffset calculates the offset value of the I O variables in particular the DC components DC PanelVoltage the DC PanelCurrent and the AC components LineVoltage LineCurrent The offset values are calculated reading the information for a fixed time 5 seconds It is done to achieve the accuracy of the AC values No manual calibration is needed void ExecControlInitParamOffSet DataSensing sum DC PanelVoltage u16 DataSensingIO DC PanelVoltage DataSensing sum DC PanelCurrent 016 DataSensingIO DC PanelCurrent DataSensing sum AC LineVoltage 016 DataSensingIO AC LineVoltage DataSensing sum AC LineCurrent 016 DataSensingIO AC LineCurrent if DataInitCount MAX DATA INIT COUNT 1 DataInitCount else if DataInitCount MAX DATA INIT COUNT 1 vul6 amp DataSensingOffSet 0 DataSensing sum AC LineCurrent DataInitCount 1 vul
29. ower point algorithm 10 MPPT maximum power point algorithm The overall control architecture for the input side of the power converter requires three feedback signals for correct operation input panel current and input panel voltage are used for maximum power point tracking the output bus voltage is used for monitoring the OV condition and to control the starting stopping procedure These signals are sent to the ADC inputs of the microcontroller according to the pin assignment and in function of these values two timers generate PWM output to drive the DC DC Power MOSFETs or disable the driving signals to turn off the module isolating the solar panel from the output bus The duty cycle value is regulated by a maximum power point tracking algorithm embedded in the STM32F1xx microcontroller This algorithm is developed inside the MPPT func Starting from I O information PV voltage and PV current the DC power is calculated and in function of the voltage it regulates the duty cycle value of the two PWM timers void MPPT func CCR Val u16 DCDC GetDutyCycle Vpanel PV Voltage Ipanel PV Current if Ipanel 0 Ipanel 1 Pow u32 u32 Vpanel u32 Ipanel if flag mppt 1 Step modify if Pow gt Powprev amp amp Vpanel lt Vpanel prev if CCR Val Val step lt 235 CCR Val 235 DCDC SetDutyCycle u16 CCR Val else Val CCR Val CCR Val step DCDC SetDutyCycle
30. perty contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein UNLESS OTHERWISE SET FORTH IN ST S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY FITNESS FOR A PARTICULAR PURPOSE AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION OR INFRINGEMENT OF ANY PATENT COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT UNLESS EXPRESSLY APPROVED IN WRITING BY TWO AUTHORIZED ST REPRESENTATIVES ST PRODUCTS ARE NOT RECOMMENDED AUTHORIZED OR WARRANTED FOR USE IN MILITARY AIR CRAFT SPACE LIFE SAVING OR LIFE SUSTAINING APPLICATIONS NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY DEATH OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE ST PRODUCTS WHICH ARE NOT SPECIFIED AS AUTOMOTIVE GRADE MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER S OWN RISK Resale of ST products with provisions different from the statements and or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever any liability of ST ST and the ST logo are trademarks or registered trademarks of ST in various countries Information in this document supe
31. ports e InitControl ClosedLoop is Initializes the parameters for the control algorithm open closed loop e Init DAC COUNTER DAC ADDRESS is Initializes the parameters for the control algorithm open closed loop e STM3210E LCD Init is Initializes the LCD e LCD Clear White is Initializes the LCD Doc ID 023556 Rev 1 UM1561 Implementation of digital phase locked loop 8 q Implementation of digital phase locked loop DQ_PhaseLockedLoop c The c file defines the DQ PLL implementation for a single phase inverter It is used for the closed loop control in order to estimate the grid angle and to detect the grid voltage before injecting current include stm32fl0x_lib h include Solar_Mul_Div h include 250WControl h define STEPS 512 number of entries of the sine look up table define OFFSET 64 Offset for cos Theta sin cos Table index sin offset define INDUCTANCE VALUE 65 1117 34mH in 41 15 34 10 3 2 15 define SAMPLES 256 define SAMPLING 516 4096 1 SystStatus t Freq Control FREQ OUT RANGE SystStatus t GDVoltage GRID VOLTAGE OUT OF RANGE where e 512 Number of entries of the sine look up table The following code shows the look up table with 512 elements in hexadecimal format ff kk kk kk kkk kkk ke k e k k k k k k 512 elements k k k k k k k k k
32. r 4 Figure 2 embedded workbench IDE workspace 5 Figure 3 Description of the main hardware parts in STEVAL ISVOO3V1 7 Figure 4 Center alignment mode for TIM8 timer and trigger event forADC 11 Figure 5 Repetition counter settings for advanced timer 12 Figure 6 250W microinverter firmware flow 35 Doc ID 023556 Rev 1 3 39 System overview UM1561 4 39 System overview This demonstration board consists of an isolated interleaved boost DC DC converter and a mixed frequency full bridge inverter used to deliver sinusoidal current at 50 Hz or 60 Hz to the grid The board is provided with a digital control section capable of controlling the grid connected operation as well as an MPPT maximum power point tracking algorithm The firmware has been implemented a 32 bit STM32F1xx microcontroller high performance ARM Cortex M3 32 bit RISC core operating at a 72 MHz frequency high speed embedded memories 512 Kbytes for Flash memory and 64 Kbytes of SRAM and an extensive range of enhanced I Os and peripherals connected to two APB buses The device offers three 12 bit ADCs four general purpose 16 bit timers plus two advanced PWM timers well as standard and advanced communication interfaces two I2Cs three SPIs two 1255 one SDIO five USARTs
33. rol e DAC Debug c configures the external DAC used for debug only e DataSensing c configures the data sensing section for closed loop control e DCAC Inverter c contains all functions in regard to the DCAC section e DCDC_Inverter c contains all functions in regard to the DCDC section e PhaseLockedLoop c contains the DQ PLL implementation for a single phase and the anti islanding protection routine e hw config c configures the RCC NVIC GPIOs Systick DAC and display peripherals e the library for the color display e main c includes the main loop function and the system parameters management with joystick e Regulator c includes several PI regulators for the closed loop control e Regulator c includes two PI regulators for the closed loop control the PID Bus Voltage and PLL PID regulator e Solar MPPT includes the maximum power point tracking algorithm for the DC DC control e Solar Mul Div c includes the calculations used for the closed loop control e stm32f10x it c includes main interrupt service routines Doc ID 023556 Rev 1 UM1561 STM32F1xx microcontroller several peripherals used to manage the 5 15 003 1 3 STM32F1xx microcontroller several peripherals used to manage the STEVAL ISVOOS3V1 demonstration board The STEVAL ISVOOSV1 is 250 W dual stage converter digitally controlled by 32 bit STM32F1xx microcontroller to allow operation in grid connection while
34. rsedes and replaces all information previously supplied The ST logo is a registered trademark of STMicroelectronics All other names are the property of their respective owners 2012 STMicroelectronics All rights reserved STMicroelectronics group of companies Australia Belgium Brazil Canada China Czech Republic Finland France Germany Hong Kong India Israel Italy Japan Malaysia Malta Morocco Philippines Singapore Spain Sweden Switzerland United Kingdom United States of America www st com ky Doc ID 023556 Rev 1 39 39
35. ssage BUS FAULT DIAGNOSTIC DC LINE OUT CURRENT LIMIT BUSPRECHARGE DIAGNOSTIC AC LINE PV VOLTAGE DVDT PV VOLTAGE MIN FREQ OUT OF RANGE STOP WITH DI Doc ID 023556 Rev 1 ELAY q UM1561 Digital closed loop control and diagnostic functions implemented break e In particular the following states indicate the status of the power converter STOPPING the power board is going to stop the DC DC and DC AC section power board is off and is ready to restart J START BUSPRECHARGE the DC DC and DC AC section are on The burst mode charges the bus capacitor before the grid insertion GRID INSERTION the microinverter is grid connected and the MPPT algorithm is enabled to transfer maximum power from the PV module e Diagnostic states DIAGNOSTIC AC LINE it verifies the AC line voltage inside the range Vac rms Freq vac DIAGNOSTIC DC LINE it verifies the PV module voltage inside the range e Protection states OUT CURRENT LIMIT the output AC current reaches the maximum value PV VOLTAGE DVDT the MCU detects low irradiance condition of the PV module PV VOLTAGE MIN the PV module goes below the minimum voltage value FREQ OUT OF RANGE the AC line frequency is out of range STOP WITH DELAY the power board is waiting to stop the modulation after the open relay BUS FAULT bus overvoltage or under
36. taRegister is Data Register stores the information DS ADCx Configuration The ADC is triggered by an external trigger The update event of TIM8 generates the trigger signal to acquire the information void DS ADCx Configuration void ADC1 configuration ADC InitStructure ADC InitStructure ADC InitStructure ADC InitStructure ADC Mode ADC Mode RegSimult ADC ScanConvMode ENABLE ADC ContinuousConvMode DISABL ADC ADC ExternalTrigConv Ext p DC InitStructure p p ExternalTrigConv 11 TIM8 TRGO DC InitStructure ADC NbrOfChannel 3 DataAlign DataAlign Left DC Init ADC1 amp ADC InitStructure ADC1 regular 110 configuration ADC RegularChanne ADC SampleTime 1 lConf les5 ig ADC1 ADC Channel 10 1 AC Line current ADC1 regular 112 configuration ADC RegularChanne ADC SampleTime 1 ADC RegularChanne ADC SampleTime 1 lConf les5 lConf les5 ig ADC1 ADC_Channel_12 2 DC Panel current ADC1 regular 112 configuration ig ADC1 ADC Channel 14 3 BUS Voltage External trigger enabled ADC ExternalTrigConvCmd ADC1 ENABLI AFIO REMAP for Trigger on Tim8 TRGO GPIO PinRemapConfig GPIO Remap ADC1 ETRGREG ENABLE Enable ADC1 DMA ADC_DMACmd ADC1
37. ure RevPark Circle Limitation Control Volt AlphaBeta Rev Park Output Inverter Output Inverter if State Control DIAGNOSTIC DC LINE amp amp State Control zDIAGNOSTIC AC LINE amp amp State Control BUSPRECHARG if Control Volt AlphaBeta qValpha lt 0 GPIOB gt BRR GPIO Pin 8 Pulsel 016 new mul 15 q15 q31 Control Volt AlphaBeta qValpha MODINDEX gt gt 16 DCAC SetPulse Pulse1 Pulse1 else if Control Volt AlphaBeta qValpha 0 GPIOB gt BSRR GPIO Pin 8 Pulse2 016 new mul q15 15 q31 s16 0x8000 Control Volt AlphaBeta qValpha MODINDEX gt gt 16 DCAC SetPulse Pulse2 Pulse2 where if Control Volt AlphaBeta qValpha lt 0 t GPIOB gt BRR GPIO Pin 8 Pulsel 016 new mul q15 q15 q31 Control Volt AlphaBeta qValpha MODINDEX gt gt 16 DCAC_SetPulse Pulsel Pulsel j is 10 msec window GPIOB gt BRR GPIO Pin 8 is GPIO pin for low frequency modulation gt GPIO Pin 8 is GPIO pin for low frequency modulation e Pulsel 016 new mul 15 q15 q31 Control Volt AlphaBeta qValpha MODINDEX 16 is PWM calculation for high frequency modulation Pulse2 016 new mul 415 415 q31 s16 0x8000 Control Volt AlphaBeta qValpha MODINDEX gt gt 16 is PWM calculation for high frequency modulation 4 32 39 Doc ID 023556 Rev 1 UM1561 MPPT maximum p
38. urn nRet where DCAC GPIO Configuration is Configuration of the GPIO pin for PWM timers DCAC TIMx Configuration is Configuration of PWM timers TIM2 and for master slave mode DCDC_SendCommand DCDC Error t DCDC SendCommand DCDC Commands t cmd DCDC Error t nRet nRet DCDC ERROR INVALID COMMAND if cmd DCDC ConverterStart nRet DCDC ERROR ON SEND COMMAND if DCDC GetStatus DCDC Running LocalDevice State DCDC Running TIMx enable counter TIM Cmd TIM2 ENABLE nRet DCDC ERROR NONI Lj j else if cmd DCDC ConverterStop nRet DCDC ERROR ON SEND COMMAND if DCDC GetStatus DCDC Stopped LocalDevice State DCDC Stopped 4 Doc ID 023556 Rev 1 9 39 STM32F1xx internal peripherals for DC DC section UM1561 TIMx disable counter TIM Cmd TIM2 DISABLE TIM Cmd TIM3 DISABLE DCDC TIMx Configuration nRet DCDC_ERROR_NONE return nRet where Cmd TIM2 ENABLE is Enables PWM timer 2 and the synchronization with TIM3 TIM Cmd TIM2 DISABLE is Stops the PWM timers TIM2 and TIM3 10 39 Doc ID 023556 Rev 1 0 1561 STM32F1 xx internal peripherals for DC AC section 5 STM32F1xx internal peripherals for DC AC section The DC AC
39. us voltage ADC2 configuration ADC Mode ADC_ScanConvMode DC_InitStructure DC_InitStructure DC_InitStructure DC_InitStructure A A A ADC InitStructure A ADC InitStructure Al DC Init ADC2 ADC Mode RegSimult ADC ContinuousConvMode DISABLE ENABLE Ij ADC ExternalTrigConv ADC ExternalTrigConv None ADC DataAlign ADC DataAlign Left ADC NbrOfChannel amp ADC InitStructure ES ADC2 regular 111 configuration ADC RegularChannel ADC SampleTime 1 1 IConfig ADC2 les5 ADC Channel 11 1 ADC2 regular channel13 configuration ADC Regul Sample ADC RegularChannel ADC SampleTime 1 1 larChanne 1Cycl IConfig A les5 DC2 IConfig A les5 External trigger enabled ADC ExternalTrigConvCmd ADC2 ENABLI 4 ADC Channel 13 2 ADC2 regular 115 configuration not used DC2 ADC Channel 15 3 Doc ID 023556 Rev 1 19 39 Data sensing section for the closed loop control UM1561 ENABLE ADC_ITConfig ADC1 ADC IT EOC DS ADC EnableAndCalibrate ADC1 DS EnableAndCalibrate ADC2 The ADC2 converts the following information at different channels e ADC Channel 11 AC line voltage e ADC Channel 13 DC panel voltage 20 39 Doc ID 023556 Rev 1 UM1561 STM32F1xx MCU peripherals confi
40. voltage protection state the status changes to STOPPING after modulation switch off Closed loop control calculation This is the main function for the closed loop control It comprises the code to regulate the bus voltage and to manage the output current in grid insertion mode In particular for the greater part of the control it is based on PID regulators such as the following e PID Bus Voltage amp BUS Voltage PID Bus Voltage e PID Reactive Power amp Reactive Power PID Actual QD Power Q Reactive e DirectCurrent amp Direct Current PID Inverter q d gl Direct e QuadratureCurrent amp Quadrature Current PID Inverter q d gl Quadrature This part of the calculation together with the reverse park transformation with the circle limitation generates as the output the PWM duty cycle value for the DC AC section This function is called at switching frequency void CalcAndSetACComponents SystStatus t state Quadrature Current PID Reference PID Bus Voltage amp BUS Voltage PID Bus Voltage Direct Current PID Reference PID Reactive Power amp Reactive Power PID Actual QD Power Q Reactive Output Inverter s16 PID DirectCurrent amp Direct Current PID Inverter d qI Direct Doc ID 023556 Rev 1 31 39 Digital closed loop control and diagnostic functions implemented UM1561 Output gIq Inverter s16 PID QuadratureCurrent amp Quadrature Current PID Inverter d qI Quadrat

Download Pdf Manuals

image

Related Search

Related Contents

User Manual  Introduction to Eviews 5 - Feweb        Sony DVP-NC625 User's Manual  Mouse Feeder Cell Quantification Kit  マンダウン機能付外部警報器 RWL-I 取扱説明書  Piano della Sicurezza e Coordinamento OUS    

Copyright © All rights reserved.
Failed to retrieve file