Luận án Nghiên cứu nâng cao hiệu quả làm việc bộ biến đổi tăng áp DC-DC trong hệ thống nguồn pin mặt trời

Pin Mặt trời (PV) bao gồm nhiều tế bào quang điện (solar cells) - là phần tử án
dẫn có chứa trên bề mặt một số lượng lớn các cảm iến ánh sáng là điốt quang, thực
hiện biến năng lượng của ánh sáng trực tiếp thành điện năng ằng hiệu ứng quang điện,
là một hiện tượng vật lý và hóa học. Nó là một dạng tế bào quang điện, các tế bào
quang điện này có thể hoạt động được dưới cả ánh sáng nhân tạo và ánh sáng tự nhiên
được định nghĩa là một thiết bị có các đặc tính điện, như dòng điện, điện áp hoặc điện
trở, thay đổi khi tiếp xúc với ánh sáng. Modul các thiết bị pin mặt trời riêng lẻ được kết
nối với nhau thường là các khối tạo thành các modul quang điện, thông thường được
gọi là các tấm pin mặt trời. Cường độ dòng điện, hiệu điện thế hoặc điện trở của pin
mặt trời thay đổi phụ thuộc bởi lượng ánh sáng chiếu lên chúng. Cấu tạo một tấm pin
mặt trời cơ bản gồm các thành phần như hình 1.1 [10], [17], [18]–[21].
Khi bề mặt tấm pin mặt trời được chiếu sáng, sẽ xuất hiện hiện tượng bức xạ
mặt trời thẩm thấu vào tế bào quang điện, mang theo nguồn năng lượng proton.
Nguồn năng lượng này được tích trữ ngày một nhiều, đến khi đạt giới hạn chúng sẽ
gây nên hiện tượng các electron bị ức ra khỏi cấu tạo nguyên tử, hình thành
các electron tự do mang điện âm, các lỗ hổng mang điện dương. Chúng kết hợp với
từ trường của 2 hai lớp silic P và N di chuyển thành một dòng, mà chúng ta hay vẫn
gọi là dòng điện một chiều (hình 1.2). Mối quan hệ giữa dòng điện của Pin mặt trời
(IPV) và điện áp (VPV) phát ra từ các tấm Pin là một mối quan hệ phi tuyến phức tạp,
trong đó công suất phát ra tại mỗi thời điểm phụ thuộc vào nhiệt độ T của lớp tiếp
giáp P-N, công suất của bức xạ mặt trời (G) và công suất của phụ tải. Đồng thời,
quá trình chuyển từ trạng thái vận hành này sang trạng thái vận hành khác là tức
thời và không bị ảnh hưởng ởi các yếu tố liên quan đến quán tính. Một điểm quan
trọng khác là: các tấm Pin mặt trời luôn tồn tại một trạng thái vận hành mà công
suất phát ra là lớn nhất tương ứng với mỗi cặp giá trị về nhiệt độ bề mặt tấm Pin
mặt trời và cường độ ức xạ mặt trời. Khai thác được trạng thái vận hành này sẽ
giúp khắc phục được nhược điểm hiệu suất thấp, giá thành cao của dạng nguồn này.
Điều này có thể đạt được nhờ điều chỉnh tải tiêu thụ tương ứng với công suất tại
điểm công suất cực đại [22]. 
pdf 157 trang phubao 26/12/2022 5120
Bạn đang xem 20 trang mẫu của tài liệu "Luận án Nghiên cứu nâng cao hiệu quả làm việc bộ biến đổi tăng áp DC-DC trong hệ thống nguồn pin mặt trời", để tải tài liệu gốc về máy hãy click vào nút Download ở trên.

File đính kèm:

  • pdfluan_an_nghien_cuu_nang_cao_hieu_qua_lam_viec_bo_bien_doi_ta.pdf
  • pdfQD Hoi dong cap truong- Nguyen Duc Minh.pdf
  • pdfThong tin ve KL moi cua LATS.pdf
  • pdfTom tat luan an - Tieng Anh.pdf
  • pdfTom tat luan an -Tieng Viet.pdf

Nội dung text: Luận án Nghiên cứu nâng cao hiệu quả làm việc bộ biến đổi tăng áp DC-DC trong hệ thống nguồn pin mặt trời

  1. 101 TÀI LIỆU THAM KHẢO Tiếng Việt [1]. Lê Thị Minh Châu, Trần Anh Tuấn, Trịnh Tuấn Anh, Lê Đức Tùng, Dƣơng Minh Quân, Nghiên cứu thiết kế bộ tăng áp DC-DC ứng dụng cho hệ thống pin năng lƣợng mặt trời, JST: Engineering and Technology for Sustainable Development Volume 31, Issue 3, July 2021, 083-08 [2]. Trịnh Trung Hiếu, Đoàn Anh Tuấn, Lê Thị Tịnh Minh, Thiết kế bộ biến đổi DC-DC mới cho hệ thống điện sử dụng năng lƣợng mặt trời, Tạp chí Khoa học và Công nghệ - Đại học Đà Nẵng, vol. 17, no. 3, 2019 [3]. Bùi Văn Hiền, Trƣơng Việt Anh, Quách Thanh Hải, Tối ƣu điểm phát công suất cực đại của pin mặt trời làm việc trong điều kiện bóng che, Tạp chí Phát triển Khoa học và Công nghệ –Kĩ thuật và Công nghệ, 3(1) (2020) :326-338. [4]. Trƣơng Việt Anh, Bùi Văn Hiền, Dƣơng Thanh Long, Lƣơng Xuân Trƣờng, Đánh giá tác động của hiện tƣợng óng che lên đặc tính làm việc của các cấu hình kết nối pin mặt trời, Tạp chí Khoa học và Công nghệ, Số 45A, 2020, Trƣờng Đại học Công nghiệp thành phố Hồ Chí Minh. [5]. Nguyễn Viết Ngƣ, Lê Thị Minh Tâm (2020); Nghiên cứu giải pháp nâng cao hiệu quả ám điểm công suất cực đại dàn pin điện mặt trời dƣới điều kiện có bóng che. Tạp chí khoa học và công nghệ, số 26, 2020, Trƣờng Đại học Sƣ phạm Kỹ thuật Hƣng Yên. [6]. Nguyễn Viết Ngƣ, Lê Thị Minh Tâm, Trần Thị Thƣờng, Nguyễn Xuân Trƣờng (2015); So sánh hai thuật toán INC và P&O trong điều khiển bám công suất cực đại của hệ thống Pin mặt trời cấp điện độc lập; Tạp chí Khoa học và Phát triển 2015, tập 13, số 8: 1452-1463. [7]. Nguyễn Thị Việt Hồng, Trịnh Trọng Chƣởng, (2022), Đánh giá hiệu quả của phƣơng pháp P&O trong việc xác định điểm công suất cực đại của Pin mặt trời khi điều kiện môi trƣờng thay đổi, báo cao Hội nghị sinh viên NCKH các trƣờng Đại học kỹ thuật, Hà Nội. [8]. Bùi Văn Huy, Trần Trọng Minh, Nguyễn văn Liễn (2014), Điều khiển dòng công suất hai chiều qua ộ iến đổi AC-DC-AC-AC đa ậc nối tầng với khâu trung gian tần số cao, Chuyên san kỹ thuật điều khiển và tự động hóa tháng 12-2014
  2. 103 [20] R. R. Tobias et al., “Design and Construction of a Solar Energy Module for Optimizing Solar Energy Efficiency,” 2020 IEEE 12th Int. Conf. Humanoid, Nanotechnology, Inf. Technol. Commun. Control. Environ. Manag. HNICEM 2020, Dec. 2020. [21] S. Choi, V. G. Agelidis, J. Yang, D. Coutellier, and P. Mara eas, “Analysis, design and experimental results of a floating-output interleaved-input boost- derived DC-DC high-gain transformer-less converter,” IET Power Electron., vol. 4, no. 1, pp. 168–180, Jan. 2011. [22] L. F. L. Villa, D. Picault, B. Raison, S. Bacha, and A. La onne, “Maximizing the power output of partially shaded photovoltaic plants through optimization of the interconnections among its modules,” IEEE J. Photovoltaics, vol. 2, no. 2, pp. 154–163, 2012. [23] B. Lekouaghet, C. Bou akir, and A. Bouka ou, “A New method to represent the I-V and P-V characteristics of different photovoltaic modules,” SIENR 2021 - 6th Int. Symp. New Renew. Energies, 2021. [24] C. R. Jeevandoss, M. Kumaravel, and V. J. Kumar, “Sunlight ased I-V characterization of solar PV cells,” Conf. Rec. - IEEE Instrum. Meas. Technol. Conf., pp. 1593–1596, 2011. [25] P. S. M. Saad, M. Y. Bin Kas udi, and H. Hashim, “I-V and P-V Solar Cell Characteristics Simulation for a Single Diode Photovoltaic,” 2022 IEEE Int. Conf. Power Eng. Appl. ICPEA 2022 - Proc., 2022. [26] L. S. Yang, T. J. Liang, and J. F. Chen, “Transformerless DC-DC converters with high step-up voltage gain,” IEEE Trans. Ind. Electron., vol. 56, no. 8, pp. 3144–3152, 2009. [27] R. Darussalam, R. I. Pramana, and A. Rajani, “Experimental investigation of serial parallel and total-cross-tied configuration photovoltaic under partial shading conditions,” in Proceeding - ICSEEA 2017 International Conference on Sustainable Energy Engineering and Application: "Continuous Improvement of Sustainable Energy for Eco-Mobility", 2017, vol. 2018-
  3. 105 software,” Proc. 2015 IEEE Int. Renew. Sustain. Energy Conf. IRSEC 2015, Apr. 2016. [39] D. P. Hohm and M. E. Ropp, “Comparative study of maximum power point tracking algorithms using an experimental, programmable, maximum power point tracking test ed,” Conf. Rec. IEEE Photovolt. Spec. Conf., vol. 2000- January, pp. 1699–1702, 2000. [40] X. T. Luong, V. H. Bui, D. T. Do, T. H. Quach, and V. A. Truong, “An Improvement of Maximum Power Point Tracking Algorithm Based on Particle Swarm Optimization Method for Photovoltaic System,” in Proceedings of 2020 5th International Conference on Green Technology and Sustainable Development, GTSD 2020, 2020, pp. 53–58. [41] P. T. Sawant and C. L. Bhattar, “Optimization of PV System Using Particle Swarm Algorithm under Dynamic Weather Conditions,” in Proceedings - 6th International Advanced Computing Conference, IACC 2016, 2016, pp. 208– 213. [42] A. Bidram, A. Davoudi, and R. S. Balog, “Control and circuit techniques to mitigate partial shading effects in photovoltaic arrays,” IEEE J. Photovoltaics, vol. 2, no. 4, pp. 532–546, 2012. [43] M. Jazayeri, S. Uysal, and K. Jazayeri, “A comparative study on different photovoltaic array topologies under partial shading conditions,” Proc. IEEE Power Eng. Soc. Transm. Distrib. Conf., Jul. 2014. [44] “IEEE Xplore: IEEE Transactions on Sustaina le Energy.” [Online]. Available: [Accessed: 29-May-2022]. [45] M. Z. S. El-Dein, M. Kazerani, and M. M. A. Salama, “Novel configurations for photovoltaic farms to reduce partial shading losses,” IEEE Power Energy Soc. Gen. Meet., 2011. [46] Y. J. Wang and P. C. Hsu, “An investigation on partial shading of PV
  4. 107 J. Photoenergy, vol. 2012, 2012. [57] F. Belhachat and C. Lar es, “Modeling, analysis and comparison of solar photovoltaic array configurations under partial shading conditions,” Sol. Energy, vol. 120, pp. 399–418, Oct. 2015. [58] F. Belhachat and C. Lar es, “A review of glo al maximum power point tracking techniques of photovoltaic system under partial shading conditions,” Renewable and Sustainable Energy Reviews, vol. 92. Pergamon, pp. 513–553, 01-Sep-2018. [59] G. Spagnuolo, G. Petrone, B. Lehman, C. A. Ramos Paja, Y. Zhao, and M. L. Orozco Gutierrez, “Control of photovoltaic arrays: Dynamical reconfiguration for fighting mismatched conditions and meeting load requests,” IEEE Ind. Electron. Mag., vol. 9, no. 1, pp. 62–76, Mar. 2015. [60] V. R. Kota and M. N. Bhukya, “A novel linear tangents ased P&O scheme for MPPT of a PV system,” Renew. Sustain. Energy Rev., vol. 71, pp. 257– 267, May 2017. [61] N. Karami, N. Moubayed, and R. Outbib, “General review and classification of different MPPT Techniques,” Renew. Sustain. Energy Rev., vol. 68, pp. 1– 18, Feb. 2017. [62] A. Soetedjo, A. Lomi, Y. I. Nakhoda, and A. U. Krismanto, “Modeling of Maximum Power Point Tracking Controller for Solar Power System,” TELKOMNIKA (Telecommunication Comput. Electron. Control., vol. 10, no. 3, p. 419, Sep. 2012. [63] V. V. R. Scarpa, S. Buso, and G. Spiazzi, “Low-complexity MPPT technique exploiting the PV module MPP locus characterization,” IEEE Trans. Ind. Electron., vol. 56, no. 5, pp. 1531–1538, 2009. [64] D. Kwon and G. A. Rincon-Mora, “Operation-based signal-flow AC analysis of switching DC-DC converters in CCM and DCM,” Circuits Syst. Midwest Symp., pp. 957–960, Aug. 2009. [65] M. A. Vitorino, L. V. Hartmann, A. M. N. Lima, and M. B. R. Corrêa, “Using
  5. 109 [74] J. S. Kumari and C. S. Ba u, “Mathematical Modeling and Simulation of Photovoltaic Cell using Matlab-Simulink Environment,” Int. J. Electr. Comput. Eng., vol. 2, no. 1, Oct. 2011. [75] X. H. Nguyen and M. P. Nguyen, “Mathematical modeling of photovoltaic cell/module/arrays with tags in Matla /Simulink,” Environ. Syst. Res. 2015 41, vol. 4, no. 1, pp. 1–13, Dec. 2015. [76] M. Forouzesh, Y. P. Siwakoti, S. A. Gorji, F. Blaabjerg, and B. Lehman, “Step-Up DC-DC converters: A comprehensive review of voltage-boosting techniques, topologies, and applications,” IEEE Trans. Power Electron., vol. 32, no. 12, pp. 9143–9178, Dec. 2017. [77] W. Li, L. Fan, Y. Zhao, X. He, D. Xu, and B. Wu, “High-step-up and high- efficiency fuel-cell power-generation system with active-clamp flyback- forward converter,” IEEE Trans. Ind. Electron., vol. 59, no. 1, pp. 599–610, Jan. 2012. [78] J. Leyva-Ramos, M. G. Ortiz-Lopez, L. H. Diaz-Saldierna, and J. A. Morales- Saldaña, “Switching regulator using a quadratic oost converter for wide DC conversion ratios,” IET Power Electron., vol. 2, no. 5, pp. 605–613, Sep. 2009. [79] L. Wang, Q. H. Wu, W. H. Tang, Z. Y. Yu, and W. Ma, “CCM-DCM average current control for both continuous and discontinuous conduction modes oost PFC converters,” 2017 IEEE Electr. Power Energy Conf. EPEC 2017, vol. 2017-October, pp. 1–6, Feb. 2018. [80] X. C. Ngo et al., “Grid-connected photovoltaic systems with single-axis sun tracker: Case study for central Vietnam,” Energies, vol. 13, no. 6. 2020. [81] J. C. Teo, R. H. G. Tan, V. H. Mok, V. K. Ramachandaramurthy, and C. Tan, “Impact of partial shading on the P-V characteristics and the maximum power of a photovoltaic string,” Energies, vol. 11, no. 7, 2018. [82] A. Chaudhary, S. Gupta, D. Pande, F. Mahfooz, and G. Varshney, “Effect of Partial Shading on Characteristics of PV panel using Simscape,” J. Eng. Res.
  6. 111 Power Electron., vol. 23, no. 2, pp. 832–840, Mar. 2008. [92] K. Ş. Parlak, “PV array reconfiguration method under partial shading conditions,” Int. J. Electr. Power Energy Syst., vol. 63, pp. 713–721, Dec. 2014. [93] C. Barreiro, P. M. Jansson, A. Thompson, and J. L. Schmalzel, “PV y-pass diode performance in landscape and portrait modalities,” Conf. Rec. IEEE Photovolt. Spec. Conf., no. June, pp. 003097–003102, 2011. [94] K. Ishaque and Z. Salam, “A review of maximum power point tracking techniques of PV system for uniform insolation and partial shading condition,” Renewable and Sustainable Energy Reviews, vol. 19. Pergamon, pp. 475–488, 01-Mar-2013. [95] N. Čo anov, Ž. Jakopović, and V. Šunde, “High Power Soft-Switching IGBT DC-DC Converter,” Autom. ‒ J. Control. Meas. Electron. Comput. Commun., vol. 54, no. 2, Apr. 2013. [96] G. Ortiz, H. Uemura, D. Bortis, J. W. Kolar, and O. Apeldoorn, “Modeling of soft-switching losses of IGBTs in high-power high-efficiency dual-active- bridge DC-DC converters,” IEEE Trans. Electron Devices, vol. 60, no. 2, pp. 587–597, 2013. [97] Toshi a Electronic Devices & Storage Corporation, “Comparison of SiC MOSFET and Si IGBT,” no. July 2021, pp. 1–10, 2020. [98] Y. Zhao et al., “Silver sintering die attach process for IGBT power module production,” Conf. Proc. - IEEE Appl. Power Electron. Conf. Expo. - APEC, pp. 3091–3094, May 2017. [99] N. Phung Quang and E. Gmbh, “Inverter control with space vector modulation,” Power Syst., vol. 20, pp. 17–59, 2008. [100] N. T. Linh, “Voltage sta ility analysis of grids connected wind generators,” 2009 4th IEEE Conf. Ind. Electron. Appl. ICIEA 2009, pp. 2657–2660, 2009. [101] W. Li, J. Liu, J. Wu, and X. He, “Design and analysis of isolated ZVT oost converters for high-efficiency and high-step-up applications,” IEEE Trans.
  7. 113 PHỤ LỤC
  8. thông nối tiếp UART, có thể mở rộng để kết nối đƣợc với máy tính; - Khối nguồn: Mạch hoạt động ằng nguồn 12VDC. Trên mách có ộ iến đổi điện áp 12-3.3 VDC để cung cấp cho vi xử lý và một số thiết ị ngoại vị khác nhƣ LCD Ngoài ra, sử dụng 2 IC cách ly điện áp 12-12V để cấp cho IC TLP250, mục địch để cách ly giữa khối công suất và khối điều khiển. h u màn hình CD có chức năng hiển thị các thông số của hệ thống nhƣ dòng điện, điện áp, tần số. Sơ đồ nguyên lý khâu màn hình LCD Để thực hiện việc module hóa linh hoạt các khâu thiết kế. Màn hình module LCD đƣợc thiết kế riêng với ộ vi xử lý STMSS100. Giao tiếp giữa khối điều khiển trung tâm với khối màn hình thực hiện qua chuẩn giao tiếp nối tiếp UART, tốc độ cài đặt là 19200 aud. Điện áp cấp khối màn hình là 3.3V. Màn hình có khả năng điều chỉnh độ tƣơng phản thông qua iến trở VR1. Vi xử lý trung tâm sử dụng lõi chíp ARM Cortex STM32F103. Mạch driver Mạch drive cho các van IGBT sử dụng cách ly quang TLP250. Nguồn cách ly đƣợc lấy từ module chuyển đổi DC-DC A0515. Đây là khối nhận tín hiệu điện áp vào 5
  9. PHỤ LỤC 2 Kết quả mô phỏng điện áp, công suất mạch DC-DC khi D thay đổi D = 20% - - D = 25% - - D = 30% - - D = 35% - -
  10. D = 60% - - D = 62% - - D = 63% - - D = 64% - -
  11. D = 69% - - D = 70% - - D = 71% - - D = 72% - -
  12. PHỤ LỤC 3 Code thuật toán PSO function D = PSO(Vpv, Ipv) persistent u; persistent dcurrent; persistent pbest; persistent p; persistent dc; persistent v; persistent counter; persistent gbest; if(isempty(counter)) counter = 0; end if(isempty(dcurrent)) dcurrent = 0.5; end if(isempty(gbest)) gbest = 0.5; end if(isempty(p)) p = zeros (4,1); end if(isempty(v)) v=zeros(4,1); end if(isempty(pbest)) pbest=zeros(4,1); end
  13. counter = 1; return; elseif(u==2) D=dc(u); dcurrent=D; counter=1; return; elseif(u==3) D=dc(u); dcurrent=D; counter=1; return; elseif(u==4) D=dc(u); dcurrent=D; counter=1; return; elseif(u==5) [m,i]=max(p); gbest=pbest(i); D=gbest; dcurrent=D; counter=1; v(1)=updatevelocity(v(1), pbest(1), dc(1), gbest) v(2)=updatevelocity(v(2), pbest(2), dc(2), gbest) v(3)=updatevelocity(v(3), pbest(3), dc(3), gbest) v(4)=updatevelocity(v(4), pbest(4), dc(4), gbest) dc(1)=updateduty (dc(1),v(1)) dc(2)=updateduty (dc(2),v(2))
  14. PHỤ LỤC 4 Giải thuật phần mềm cài đặt hệ thống trên MCU STM32F103C8T6 a) Cấu hình Vi xử lý /* USER CODE BEGIN Header */ /* Includes */ #include "main.h" /* Private variables */ ADC_HandleTypeDef hadc1; DMA_HandleTypeDef hdma_adc1; TIM_HandleTypeDef htim1; TIM_HandleTypeDef htim2; TIM_HandleTypeDef htim4; UART_HandleTypeDef huart3; /* USER CODE BEGIN PV */ __IO uint16_t ADC_value[3]; // 3 kenh 0, 1 va 2 unsigned char Rx3Data[64]; unsigned int Rx3Length; int angle,x1,x2,x3,setpoint, v_ref; int flag, flag_boost; int a0,a1,a2,e0,e1,e2,u0,u1,i; /* USER CODE END PV */ /* Private function prototypes */ void SystemClock_Config(void); static void MX_GPIO_Init(void); static void MX_DMA_Init(void); static void MX_ADC1_Init(void); static void MX_TIM1_Init(void); static void MX_USART3_UART_Init(void);
  15. flag_boost=0; v_ref=50; i=0; /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ x1=ADC_value[0]; x2=ADC_value[1]; x3=ADC_value[2]; HAL_UART_Transmit(&huart3, Rx3Data, Rx3Length, 0x00fff); TIM1->RCR=1; //lua chon thoi diem cap nhat du lieu HAL_TIM_Base_Start_IT(&htim1); HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1); HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_1); HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_2); // HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_2); HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_3); /* if(x2>600) { flag_boost = 1;
  16. } / * @brief System Clock Configuration * @retval None */ void SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct = {0}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; / Initializes the CPU, AHB and APB busses clocks */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1; RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { Error_Handler(); } / Initializes the CPU, AHB and APB busses clocks */ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
  17. hadc1.Init.ContinuousConvMode = ENABLE; hadc1.Init.DiscontinuousConvMode = DISABLE; hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START; hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT; hadc1.Init.NbrOfConversion = 3; if (HAL_ADC_Init(&hadc1) != HAL_OK) { Error_Handler(); } / Configure Regular Channel */ sConfig.Channel = ADC_CHANNEL_0; sConfig.Rank = ADC_REGULAR_RANK_1; sConfig.SamplingTime = ADC_SAMPLETIME_13CYCLES_5; if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK) { Error_Handler(); } / Configure Regular Channel */ sConfig.Channel = ADC_CHANNEL_1; sConfig.Rank = ADC_REGULAR_RANK_2; if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK) { Error_Handler(); } / Configure Regular Channel */ sConfig.Channel = ADC_CHANNEL_2;
  18. } if (HAL_TIM_PWM_Init(&htim1) != HAL_OK) { Error_Handler(); } sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET; sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; if (HAL_TIMEx_MasterConfigSynchronization(&htim1, &sMasterConfig) != HAL_OK) { Error_Handler(); } sConfigOC.OCMode = TIM_OCMODE_PWM1; sConfigOC.Pulse = 0; sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH; sConfigOC.OCNPolarity = TIM_OCNPOLARITY_HIGH; sConfigOC.OCFastMode = TIM_OCFAST_DISABLE; sConfigOC.OCIdleState = TIM_OCIDLESTATE_RESET; sConfigOC.OCNIdleState = TIM_OCNIDLESTATE_RESET; if (HAL_TIM_PWM_ConfigChannel(&htim1, &sConfigOC, TIM_CHANNEL_1) != HAL_OK) { Error_Handler(); } if (HAL_TIM_PWM_ConfigChannel(&htim1, &sConfigOC, TIM_CHANNEL_2) != HAL_OK) { Error_Handler();
  19. htim2.Init.CounterMode = TIM_COUNTERMODE_UP; htim2.Init.Period = 1000; htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; if (HAL_TIM_Base_Init(&htim2) != HAL_OK) { Error_Handler(); } sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL; if (HAL_TIM_ConfigClockSource(&htim2, &sClockSourceConfig) != HAL_OK) { Error_Handler(); } sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET; sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; if (HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig) != HAL_OK) { Error_Handler(); } } static void MX_TIM4_Init(void) { TIM_Encoder_InitTypeDef sConfig = {0}; TIM_MasterConfigTypeDef sMasterConfig = {0}; htim4.Instance = TIM4;
  20. { huart3.Instance = USART3; huart3.Init.BaudRate = 19200; huart3.Init.WordLength = UART_WORDLENGTH_8B; huart3.Init.StopBits = UART_STOPBITS_1; huart3.Init.Parity = UART_PARITY_NONE; huart3.Init.Mode = UART_MODE_TX_RX; huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE; huart3.Init.OverSampling = UART_OVERSAMPLING_16; if (HAL_UART_Init(&huart3) != HAL_OK) { Error_Handler(); } } static void MX_DMA_Init(void) { __HAL_RCC_DMA1_CLK_ENABLE(); HAL_NVIC_SetPriority(DMA1_Channel1_IRQn, 0, 0); HAL_NVIC_EnableIRQ(DMA1_Channel1_IRQn); } static void MX_GPIO_Init(void) { GPIO_InitTypeDef GPIO_InitStruct = {0}; __HAL_RCC_GPIOC_CLK_ENABLE(); __HAL_RCC_GPIOD_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE(); HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13|GPIO_PIN_14,
  21. * @param line: assert_param error line source number * @retval None */ void assert_failed(uint8_t *file, uint32_t line) { /* USER CODE BEGIN 6 */ /* User can add his own implementation to report the file name and line number, tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* USER CODE END 6 */ } #endif /* USE_FULL_ASSERT */ / (C) COPYRIGHT STMicroelectronics END OF FILE / b) Giải thuật điều chế sóng sin 1 pha /* Includes */ #include "main.h" #include "stm32f1xx_it.h" const int sinetable[61] ={26, 52, 104,156,207,258,309,358,406,453,499, 544,587,629,669,707,743,777,809,838,866, 891,913,933,951,965,978,987,994,998,1000, 998,994,987,978,965,951,933,913,891,866, 838,809,777,743,707,669,629,587,544,499, 453,406,358,309,258,207,156,104,52,26}; extern int angle; extern __IO uint16_t ADC_value[3]; // 3 kenh 0, 1 va 2
  22. { angle=0; } } HAL_TIM_IRQHandler(&htim1); } c) Điều khiển PID cho bộ Boost void TIM2_IRQHandler(void) { /* USER CODE BEGIN TIM2_IRQn 0 */ // HAL_GPIO_TogglePin(GPIOC,GPIO_PIN_14); /* USER CODE END TIM2_IRQn 0 */ HAL_TIM_IRQHandler(&htim2); /* USER CODE BEGIN TIM2_IRQn 1 */ /* USER CODE END TIM2_IRQn 1 */ }