Skip to content

angrram/Three_Phase_PFC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hardware-in-the-Loop (DiY) with STM32F7 & Spartan-7 (Cmod S7)

⚡ Three-Phase Boost PFC (DQ control & DSOGI PLL)

Blue: VDC Green: IAC1 IMG_3001 Pasted image 20250511104047 Pasted image 20250511104250 Pasted image 20250511104432

📦 Project Structure

HIL-3Phase-PFC
├── stf7
│   ├── stf7
│      ├── main.c (All code and binaries)
│      └── 3ph.elf
│   ├── matlab
│        ├──*.slx (All Simulink & Matlab files for the STM32F7)
│       
├── matlab
│    ├── sim
│        ├── *.slx (All Simulink files for the Spartan7)
├── vivado_lite
│    ├── All vivado files for the project
├── ips
│    ├── All vivado IPs for the project
└── README.md

⚙️ System Overview

  • Application: Digital control of a 3-phase PFC converter in real time using PLL Dsogi.
  • Controller: STM32F767ZI (ARM Cortex-M7 @ 216MHz)
  • FPGA: Xilinx Spartan-7
  • Mode: Hardware-in-the-Loop with real-time plant emulation in FPGA

🔌 Key Features

  • Real-time HIL simulation of a 3-phase AC/DC PFC stage DACs MCP4922.
  • FPGA-based fast plant model (fixed-step solver at 110MHz rate), FETs were linearize.
  • Digital control loop implementation on STM32F7 @8Khz (which is ok for a S7) (PID, PLL Dsogi).
  • MATLAB/Simulink/Simscape model for validation using PiL, MiL.
  • Scalable for DSP or other FPGA platforms.

🧠 Technical Highlights

Component Function
Spartan-7 FPGA Emulates PFC power stage dynamics in real time
STM32F7 MCU Executes control algorithms (current, voltage regulation)
MATLAB/Simulink Design, test, and compare control loops and plant models


🚀 Getting Started

✅ Prerequisites

  • STM32CubeIDE 1.15+
  • Vivado 2022.1 or later
  • MATLAB R2022b
  • STM32F767ZI Nucleo or custom board
  • Spartan-7 FPGA board (e.g., Digilent Cmod S7 or custom design)

🧪 Quick Test

  1. Flash the STM32 with pfc3van.elf/
  2. Load bitstream to FPGA from design_1_wrapper.bin/
  3. Run host-side script or GUI to initiate control loop test
  4. Observe performance via scope

🧰 Tools Used

  • STM32CubeMX / STM32CubeIDE – Microcontroller development
  • Xilinx Vivado – FPGA synthesis and implementation
  • MATLAB/Simulink/Simscape – Plant and control modeling

📈 Future Work

  • CAN/EtherCAT interface for industrial integration
  • Adaptive control algorithms
  • Integration with real-time OS (FreeRTOS)
  • PWM jitter analysis and suppression
  • Fully parameterized VHDL generator from Simulink

🤝 Contributions

Contributions, bug reports, and feature requests are welcome.
Please open an Issue or submit a Pull Request.


📄 License

This project is licensed under the MIT License. See the LICENSE file for details.


📫 Contact

  • Lead Developer: Angel Rodriguez
  • Email: ang.rodr97@gmail.com Subject: HIL PFC 3PH

⚠️ This project is for research and development purposes. Not certified for use in safety-critical or production energy systems.