Help me understand this PQ Controller Model (ABC to dq-reference using Park Transform) in Simulink
You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.

Accepted Answer
Hi @Timothy Joel,
Thank you for your detailed question regarding the PQ controller implementation for BESS applications. I appreciate you sharing the block diagram and your specific concerns about the Park Transform and control loop implementation.
Advance Notice Regarding Technical Support: I want to inform you upfront that I do not have access to MATLAB Simulink software for hands-on demonstration or model creation. However, I'm committed to providing comprehensive guidance based on established control theory principles and MathWorks documentation. For detailed implementation assistance, I encourage you to continue posting your questions on the MathWorks community platform, which adheres to their support policies and connects you with verified experts who have direct access to the software.
Comprehensive Analysis of Your Block Diagram and Implementation Questions:
1. Park Transform Block Implementation (ABC to dq Reference Frame): For the Park Transform implementation in Simulink, you should use the abc to dq0 transformation block. The Power (dq0, Instantaneous) block computes the three-phase instantaneous active and reactive powers from a periodic set of three-phase voltages and currents expressed in the dq0 reference frame
( https://www.mathworks.com/help/sps/powersys/ref/powerdq0instantaneous.html ).
The key implementation considerations are: * The angular position input (ωt) requires a phase-locked loop (PLL) output to provide proper synchronization with the grid frequency * Ensure your three-phase voltage and current measurements are properly conditioned before entering the Park Transform * The transformation converts your abc measurements into d-axis (active power component) and q-axis (reactive power component) in the synchronous reference frame
2. Detailed Signal Flow and Timing Implementation: Based on your block diagram, the implementation sequence should be:
Stage 1 - Measurement and Transformation: * ABC voltage and current measurements from the grid/BESS interface * Park Transform (ABC → dq) using synchronized PLL reference * This provides instantaneous dq voltage and current components
Stage 2 - Power Calculation and Filtering: * The Power block computes the active power (P), in watts, and the reactive power (Q), in vars, of a voltage-current pair at fundamental frequency (https://www.mathworks.com/help/sps/powersys/ref/power.html) * The transfer functions 1/(1+Trs) act as low-pass filters to attenuate measurement noise and switching harmonics * These filters should be applied AFTER power calculation but BEFORE the PI controllers
Stage 3 - Control Loop Implementation: * Compare filtered P and Q measurements with reference values (P_ref, Q_ref) * Apply PI controllers Kp + Ki/sTip to generate current references (id_ref, iq_ref)
3. Critical Control Elements from Your Block Diagram: AC Deadband Offset Limit (Kq Block): This element implements voltage-dependent reactive power control. In BESS applications, this typically follows IEEE 1547 standards where reactive power injection varies based on voltage deviations from nominal. The deadband prevents unnecessary switching during normal voltage conditions.
Current Limiting (id_max, id_min, iq_max, iq_min): These limits are crucial for BESS protection: * id_max/id_min: Limits active power (charging/discharging current) * iq_max/iq_min: Limits reactive power injection capability * Must consider inverter thermal limits and battery State of Charge (SOC)
4. Decoupling Control Implementation: Your block diagram shows a basic PQ controller, but advanced implementations require decoupling terms to eliminate cross-coupling between d and q axes. Decoupled active and reactive power control for a three-phase inverter connected to the utility grid based on the PI controller
The decoupling terms typically include: * ωLiq (feed-forward term for d-axis) * -ωLid (feed-forward term for q-axis) * Grid voltage feed-forward terms
5. BESS-Specific Implementation Considerations: For BESS applications, your controller must integrate with: * Battery Management System (BMS) constraints * State of Charge (SOC) limitations affecting active power references * Temperature and thermal management affecting current limits * Grid code compliance (IEEE 1547, IEEE 2030.2.1)
6. Simulink Implementation Recommendations: a) Start with basic blocks: * Use "abc to dq0 Transformation" block from Simscape Power Systems * Implement PI controllers using "PID Controller" blocks configured for PI operation * Use "Saturation" blocks for current limiting b) Power measurement: * The Active & Reactive Power block measures the active power P and reactive power Q associated with a periodic voltage-current pair that can contain harmonics ( https://www.mathworks.com/help/sps/powersys/ref/activereactivepower.html ) c) Signal conditioning: * Implement the 1/(1+Trs) filters using "Transfer Function" blocks * Typical time constants: T = 0.001 to 0.01 seconds depending on switching frequency
7. Validation and Testing Approach: 1. Test Park Transform with known three-phase signals 2. Validate power calculation with steady-state conditions 3. Tune PI controllers starting with active power loop, then reactive power 4. Verify current limiting under various operating conditions 5. Test decoupling performance during transient conditions
Regarding Ongoing Collaboration: While I would be happy to continue providing technical guidance, I must adhere to MathWorks community guidelines. I encourage you to post your subsequent questions on the MATLAB Central platform where they can be properly archived, searchable by other users facing similar challenges, and addressed by experts with direct software access.
Recommended Next Steps: 1. Download and examine the Grid connected three phase inverter control using DQ frame (https://www.mathworks.com/matlabcentral/fileexchange/72702-grid-connected-three-phase-inverter-control-using-dq-frame) example 2. Start with simplified model without current limiting 3. Gradually add BESS-specific constraints and protections 4. Validate against known BESS control benchmarks
This comprehensive analysis should address your immediate implementation concerns while providing the theoretical foundation for advanced BESS control development.
Hope this helps.
References:
- MathWorks Documentation: Power (dq0, Instantaneous) - https://www.mathworks.com/help/sps/powersys/ref/powerdq0instantaneous.html
- MathWorks Documentation: Active & Reactive Power - https://www.mathworks.com/help/sps/powersys/ref/activereactivepower.html
- MathWorks Documentation: Power Measurement - https://www.mathworks.com/help/sps/powersys/ref/power.html
- MathWorks File Exchange: Active and Reactive Power Control - https://www.mathworks.com/matlabcentral/fileexchange/85705-active-and-reactive-power-control-for-a-three-phase-inverter
- MathWorks File Exchange: Grid Connected Inverter Control - https://www.mathworks.com/matlabcentral/fileexchange/72702-grid-connected-three-phase-inverter-control-using-dq-frame
2 Comments
Hi @Timothy Joel,
I've gone through your follow-up questions and the entire thread, and I can see you need more specific implementation guidance. Let me address everything systematically, including the details we haven't fully covered yet.
1) Voltage control vs Q and Q_ref - Complete Implementation: Your block diagram shows a dual-mode reactive power controller. Here's exactly how it works:
The bottom path (reactive power control) has two inputs that get summed: * External Q_ref: This comes from higher-level control (like your BESS energy management system) * Voltage-based Q_ref: Generated internally from voltage deviations
For measurement: * V_nom: This is simply your nominal grid voltage (typically 1.0 pu or your actual grid voltage like 480V, 13.8kV, etc.) * V(t): Measured RMS voltage at your point of connection, typically using a voltage sensor or the same measurements feeding your Park transform * Q measurement: Calculated from your dq voltages and currents: Q = (3/2)(Vdiq - Vqid)
In Simulink, you'll use: * RMS block or Three-Phase V-I Measurement block for V(t) * Constant block set to your nominal voltage for V_nom * The voltage error (ΔV) feeds through the low-pass filter, then the deadband/gain block
2) Power-to-Current Conversion - The Missing Physics: Here's the crucial part you're missing. The PI controllers aren't magic - they're based on the fundamental dq-frame power equations:
P = (3/2) * (Vd*id + Vq*iq) Q = (3/2) * (Vd*iq - Vq*id)
In a stiff grid where Vq ≈ 0 and Vd ≈ constant: * P ≈ (3/2) * Vd * id → So id ≈ P/(1.5*Vd) * Q ≈ (3/2) * Vd * iq → So iq ≈ Q/(1.5*Vd)
Your PI controller gains should account for this relationship. If you're working in per-unit with Vd ≈ 1.0 pu, then:
- A 1 pu power error should produce roughly 0.67 pu current reference
- Your PI controller proportional gain should be around Kp = 2/3 as a starting point
The PI controllers are essentially power-to-current converters with the physics built into the gain values.
3) Per-unit vs SI Units - Practical Implementation:
For your BESS controller, use per-unit throughout with these base values: S_base = Your inverter MVA rating (e.g., 1 MVA) V_base = Grid line-to-line voltage (e.g., 480V) I_base = S_base / (sqrt(3) * V_base) P_base = S_base = Q_base
All internal signals should be per-unit: * VI measurements → convert to pu before Park transform * PQ calculations → already in pu if VI are in pu * id_ref, iq_ref → in pu (makes limiting intuitive: 1.0 = rated current) * Only convert back to SI units at the very end for your inverter PWM references
4) Complete Signal Flow Sequence (This was missing from before):
Here's the exact implementation order in Simulink: Stage 1 - Measurement:
Three-phase V,I → RMS/filtering → Convert to pu → Park Transform (abc to dq) Grid frequency → PLL → Phase angle (θ) → Park Transform
Stage 2 - Power Calculation: Vd, Vq, id, iq → Power calculation block → P, Q (instantaneous) P, Q → Low-pass filters (1/(1+Trs)) → P_filtered, Q_filtered
Stage 3 - Reference Generation: P_ref (external) - P_filtered = ΔP → PI controller → id_ref V_nom - V_rms = ΔV → Filter → Deadband → Kq gain → Q_voltage_ref Q_ref (external) + Q_voltage_ref - Q_filtered = ΔQ → PI controller → iq_ref
Stage 4 - Current Limiting: id_ref → Saturation (id_min, id_max) → id_ref_limited iq_ref → Saturation (iq_min, iq_max) → iq_ref_limited Optional: Circular limiting → sqrt(id² + iq²) ≤ I_max
5) Specific Simulink Blocks You Need:
- Park Transform: "abc to dq0 Transformation" block (set transformation type to "abc to dq")
- Power Calculation: "Power (dq0, Instantaneous)" block
- Filters: "Transfer Function" blocks with numerator [1] and denominator [Tr 1]
- PI Controllers: "PID Controller" blocks (set D=0, leave just P and I)
- Current Limiting: "Saturation" blocks
- Deadband: "Dead Zone" block or "Relay" block
- RMS Voltage: "RMS" block or "Three-Phase V-I Measurement" block
6) BESS-Specific Implementation Details:
For your bus network voltage support application: * Voltage deadband: Typically ±2-5% of nominal (0.02-0.05 pu) * Filter time constants: Tr ≈ 0.01-0.05 seconds (balance noise rejection vs. response speed) * Current priorities: Usually id gets priority over iq (active power more critical than reactive) * SOC integration: Your P_ref should come from a higher-level controller that considers battery state of charge
7) PI Controller Tuning Starting Points:
For Power Loops (per-unit system): Kp_P ≈ 0.5-2.0 (start with 1.0) Ki_P ≈ 10-50 (start with 20) Kp_Q ≈ 0.5-2.0 (start with 1.0) Ki_Q ≈ 10-50 (start with 20)
8) About MATLAB Central posting:
You're posting in exactly the right place. For your future BESS questions about voltage and frequency support, you can either: * Continue this thread if directly related to PQ control implementation * Start new questions for broader BESS topics (like frequency response, SOC management, etc.)
Implementation Checklist:
1. Set up base values and convert all measurements to per-unit 2. Implement Park transform with proper PLL synchronization 3. Add power calculation and filtering 4. Implement the dual reactive power control (voltage + external reference) 5. Add PI controllers with the physics-based gains mentioned above 6. Implement coordinated current limiting 7. Test with simple step references before adding complexity
Next Steps: Start with a simplified version - just the active power loop first. Get that working, then add the reactive power control. The voltage-based reactive power control is actually the trickier part because of the deadband and dual-reference summing.
This should give you everything you need for a complete implementation.
Hope this should help you move forward now.
More Answers (0)
Categories
Find more on Sources in Help Center and File Exchange
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)