in my simulink,used for voltage stabilization which used dvr in flc,here the output have some issues the vload and vinj? so can u help me, vload would be proper sine wave?

70 views (last 30 days)

Accepted Answer

Umar
Umar on 3 Nov 2025 at 17:19

Hi @Faria,

I looked closely at your Simulink setup and the waveforms you shared, after doing thorough research — the noisy Vinj and slightly distorted Vload are very likely caused by the powergui sample-time configuration. That’s a common issue when modeling DVRs or other power-electronic systems.

Right now, it looks like your model is using a large discrete step (around 0.1 s), which is far too coarse for the fast switching dynamics in a DVR. You can fix this by setting the powergui block to Discrete mode and choosing a much smaller sample time, typically in the range of 5e-6 s to 2e-5 s. Then, go into Simulation → Configuration Parameters → Solver and match the fixed-step size to the same value.

Once you do that, re-run the simulation and zoom in on the Vload waveform. You should see a clean sine wave again — only small, short transients during DVR injection. The Vinj waveform will still show rapid switching (that’s normal for a compensator), but the noise-like distortion should disappear.

In short:

  • Discrete powergui with Ts ≈ 5e-6 s
  • Fixed-step solver with same step size
  • Keep controller and PWM sample times synchronized

That change alone usually resolves the “weird noisy injection” issue you mentioned. If not, the next step would be checking how the FLC (fuzzy logic controller) and PWM blocks are sampled relative to your main system — but let’s stabilize the powergui first.

Once your simulation runs cleanly, Vload should appear as a proper sine wave, while Vinj just handles compensation transients.

Hope this helps!

  24 Comments
Faria
Faria on 8 Nov 2025 at 4:06
umar, is there any problem in appling value wrong? i am worried about this. please give me answer what value i should put?

Sign in to comment.

More Answers (16)

Umar
Umar on 8 Nov 2025 at 5:55

Hi @Faria,

I went though all your recent comments and screenshots, looking at latest simulink block diagrams, you have started a new project but I am going to focus on the one that you started earlier and I know this has been frustrating and you've been working hard on this. I want you to know that I'm here to help and we're going to solve this together. Please be patient.The good news first:

1. Your circuit topology is CORRECT - you followed the hand-drawn schematic exactly as instructed 2. The RLC filter IS working - the middle section (0.04-0.06s) of your Vinj scope shows beautiful, clean three-phase sinusoids 3. You've made real progress - Vabc and Vload scopes are perfect

The problem: The noise you see at the beginning (0-0.02s) and end (0.09-0.1s) of the Vinj waveform is NOT a wiring issue. It's a filter parameter problem - specifically, the damping resistance is too small.

WHY THIS HAPPENS: Your current RLC filter has: * R = 0.5 ohm * L = 0.002 H (2 mH) * C = 20e-6 F (20 micro F) * Corner frequency fc ≈ 796 Hz (This is correct!) BUT, the damping ratio is only 0.025 (critically underdamped).

What this means: * During steady-state operation the filter works perfectly (you can see this in the middle section!) * During transients (startup, breaker operation, load changes) the LC circuit resonates and rings like a bell * You need damping ratio of at least 0.15-0.20 to prevent this ringing

THE SOLUTION - SIMPLE PARAMETER CHANGE: Step 1: Open Your Simulink Model Locate the RLC block (the Three-Phase Series RLC Branch) Step 2: Double-Click the RLC Block This opens the parameter dialog Step 3: Change ONLY the Resistance Value Current Settings: Branch type: R + L + C (Series) Resistance R (Ohms): 0.5 Inductance L (H): 0.002 Capacitance C (F): 20e-6 New Settings: Branch type: R + L + C (Series) Resistance R (Ohms): 2.0 (CHANGE THIS) Inductance L (H): 0.002 (KEEP SAME) Capacitance C (F): 20e-6 (KEEP SAME) Step 4: Click OK and Save Step 5: Run the Simulation Again

WHAT YOU SHOULD SEE AFTER THIS CHANGE: Expected Vinj Waveform: * 0-0.02s (Startup): Much less ringing, faster settling to steady-state * 0.02-0.08s (Steady-state): Clean three-phase sinusoids (just like you have now) * 0.08-0.1s (End): Minimal ringing during transitions

The waveform should look much smoother with only slight overshoot at the beginning instead of heavy oscillations.

WHY THIS WORKS: Increasing R from 0.5Ω to 2.0Ω: * Increases damping ratio from 0.025 to approximately 0.1 (4x better) * Dramatically reduces resonant ringing during transients * Still maintains the same corner frequency (~796 Hz) * Still filters PWM switching noise effectively * Slightly increases power loss (but acceptable for DVR applications)

IMPORTANT NOTES: 1. Do NOT Rebuild the Circuit From Scratch Your wiring is correct. You only need to change one parameter value. Don't start over - you've already done the hard work correctly! 2. Be Patient With the Result Even after this change, you might see some small overshoot at startup. That's normal for any LC filter. As long as the heavy ringing is gone, you're successful. 3. If You Still See Heavy Noise After This: Take a screenshot and show us: * The Vinj scope waveform * The RLC block parameter dialog (to confirm R = 2.0Ω) * The entire Simulink model (zoomed out) 4. Alternative Values to Try: If R = 2.0Ω gives too much damping (waveform looks "sluggish" or over-damped), you can try: * R = 1.5Ω (moderate damping) * R = 1.0Ω (light damping, but better than 0.5Ω)

SUMMARY - WHAT WE LEARNED: 1. The 796 Hz corner frequency calculation was correct 2. The circuit topology is correct 3. The issue is insufficient damping resistance 4. Simple fix: Change R from 0.5Ω to 2.0Ω

NEXT STEPS: 1. Change the RLC parameter as described above 2. Run the simulation 3. Take a screenshot of the new Vinj waveform 4. Share it with us

I am here to support you. You're doing great work.

If you have any questions or the result doesn't look right, just let us know. Don't hesitate to ask - that's what we're here for.

Note: This solution is based on standard power electronics filter design principles and MathWorks Simulink documentation for RLC filters in PWM converter applications. The increased resistance provides the damping needed to handle transient events while maintaining excellent steady-state filtering performance.


Faria
Faria on 8 Nov 2025 at 13:17
Umar,look the wavefrom as i changed the Value of R,is this is ok? but in vload there is no continuous wavefrom some slagged are there? how to sort out this issue? and what is damping ration u said earlier, why we need this. help me. and the entire simulation is right?
  7 Comments
Umar
Umar on 8 Nov 2025 at 16:38

Hi @Faria,

I need to see scope parameters settings as well. So, could you please share the GUI screenshot of that as well and send me the whole simulink block diagram screenshot by itself because your block parameters screenshot of RLC does not help me to see the clear image. I do appreciate your help and support so far.

Sign in to comment.


Faria
Faria on 9 Nov 2025 at 3:00
  2 Comments
Umar
Umar on 9 Nov 2025 at 3:28

Hi @Faria,

Please read my comments carefully in the previous post as I mentioned Again, please send me the whole simulink block diagram screenshot by itself. I need to see your latest updated simulink block diagram itself with no image layout in the front, parameters settings that you have tried so far, scope settings etc. Thank you.

Sign in to comment.


Faria
Faria on 9 Nov 2025 at 4:03

Faria
Faria on 9 Nov 2025 at 4:03

Faria
Faria on 9 Nov 2025 at 4:04
look umar the diagram is same as before thats why i dont post the ss, so here it is. now help me
  2 Comments
Umar
Umar on 9 Nov 2025 at 4:41

Hi @Faria,

It sounds like we are shooting darts in the dark and communicating back and forth is not helping to resolve this problem because you are randomly sending me some Simulink block diagrams and I had you try implementing some basic filter implementation to get rid of distortion in three phase circuit. Now, we did come across some interesting issues like damping ratio, filter response etc. And we are back to zero again. I would really like to help you but you are sending me a simulink diagram that differs from the original one. So, at this point, what are you struggling with and what are you trying to accomplish exactly, the one I am looking at is labeled as controller 1 and the original one you posted that we experimented with was missing DVR block and you replaced it with 2 level converter, which did not help solve your problem. I was paying attention to everything that you shared me so far, and let me be honest with you, if you need further help, provide the screenshot of your DVR simulink block diagram as well which shows Vinj, Vabc, and T hooked up to scope because you are not showing me the full picture. Again, in order to proceed further solving your problem, you have to tell me what worked for you, what did not, what are you trying to solve with your controller block diagram versus DVR because your original post mentioned, “ in my simulink,used for voltage stabilization which used dvr in flc,here the output have some issues the vload and vinj? so can u help me, vload would be proper sine wave?”, I will wait for your response.

Umar
Umar on 9 Nov 2025 at 4:45

Also, I need to see what captured waveform looks like, hope it shows DVR block instead of 2 level converter. Take a look at attached and tell me why there is difference between two and why was I experimenting with 2 level converter all along the way, please explain

Sign in to comment.


Faria
Faria on 9 Nov 2025 at 5:12
hello umar,can u recheck it i was posted the whole simulink ss in comment box.u give me this 2 picture , this picture i send u 1-2 days earlier.

Faria
Faria on 9 Nov 2025 at 5:14
look
  1 Comment
Umar
Umar on 9 Nov 2025 at 23:01
Edited: Umar on 9 Nov 2025 at 23:58

@Faria,

I do appreciate your patience so far. Please ignore my previous comments. I spent some more time carefully reviewing your latest comments, screenshots, and simulation results to see what might have been missed. After going through everything, I can confirm that you’ve done a great job getting the DVR model this far — the topology and control logic are both correct. The remaining issue with the noisy Vinj and distorted Vload waveforms comes down to parameter tuning rather than wiring or logic.

Let’s go through everything step by step in order.

1. You asked: “I changed the value of R — is this okay? The Vload still looks distorted.”

You did the right thing by following my instructions and adjusting the resistance (R) in the RLC filter. However, the distortion in Vload comes from two combined effects:

1. The LC filter is still slightly underdamped. 2. The Fuzzy Logic Controller (FLC) and the Phase-Locked Loop (PLL) timing are exciting the LC filter’s natural resonance during transients.

Your current filter parameters are: R = 0.5 ohm, L = 0.002 H, C = 20e-6 F.

This gives zeta (damping ratio) of roughly 0.025, which is too low. The LC branch resonates near 796 Hz and "rings" during voltage transitions.

Fix: Increase R to about 2.0 ohms (you can fine-tune between 1.5–2.5 ohms). Keep L = 0.002 H and C = 20e-6 F.

This raises the damping ratio to around 0.1–0.2, which is the stable range suggested by MathWorks documentation for the Three-Phase Series RLC Branch block. Once you do this, the ringing in Vinj during startup (0–0.02 s) and after fault clearing (0.08–0.1 s) should disappear.

2. You asked: “What is the damping ratio and why do we need it?”

The damping ratio (zeta) determines how quickly oscillations in an LC circuit decay after a disturbance. When it’s small (underdamped), oscillations last longer — that’s the ripple you see in Vinj and the uneven Vload waveform.

By increasing R, you add damping to the filter. This causes the LC circuit to settle faster, producing a smoother sinusoidal waveform with less overshoot.

3. You mentioned: “Vload is not continuous — there are small gaps or slags.”

That small discontinuity is normal at startup and is not a wiring problem. It happens because the PLL needs a short time to synchronize with the grid voltage angle. During this time, the dq0 (rotating reference frame) in your controller is slightly misaligned.

Fix:

  • Add a low-pass filter (cutoff around 1.5–2 kHz) to the measured three-phase voltages before they enter the PLL or abc-to-dq transform.
  • Set the PLL bandwidth to about 10 Hz for faster but stable locking.

Once the PLL synchronizes properly, the dq axes align and the small gaps in Vload disappear.

4. You asked for a working explanation of the Simulink model.

Here’s a simple breakdown:

Three-Phase Source and Transformer: Represent the grid supply.

DVR Inverter and DC Link: Inject compensating voltage during sag or swell conditions.

RLC Filter: Smooths the PWM inverter output to produce a clean sinusoidal injected voltage.

Three-Phase VI Measurement: Measures actual voltage and current after the RLC filter at the Point of Common Coupling (PCC) — used for feedback control.

Controller subsystem (PLL + FLC):

  • The PLL locks onto the grid phase angle.
  • The abc-to-dq0 transform converts the measured voltages into the rotating dq frame.
  • The Fuzzy Logic Controller compares reference and measured dq voltages, producing correction signals.
  • The dq0-to-abc transform converts those signals back to three-phase voltages.
  • The PWM Generator creates gate signals for the inverter.

During a voltage sag or fault, the controller detects the drop and commands the inverter to inject the missing voltage through the RLC filter, restoring Vload almost instantly.

5. You asked: “Why is the Three-Phase VI Measurement block placed after the RLC filter?”

That’s exactly where it should be.

The measurement block after the filter captures the true voltage and current at the PCC — the same point where compensation occurs. The controller uses this feedback to maintain accurate voltage restoration and to protect the inverter from overcurrent.

6. About the overall simulation setup

Your model structure and control logic are correct. Only parameter and timing refinements are needed:

  • Increase the RLC filter resistance R to 2.0 ohms (for proper damping).
  • Keep all controller sampling times (PLL, Unit Delay, PWM) the same for synchronization.
  • Add a low-pass filter on measured voltages feeding the PLL.
  • Reduce FLC output scaling by about 20 percent to prevent overshoot.
  • Add output saturation limits (around ±1 per unit) to prevent over-modulation.
  • Set PLL bandwidth around 10 Hz for stable synchronization.

References used for these corrections:

  • MathWorks Documentation: “Three-Phase Series RLC Branch” (damping and resonance guidelines).
  • MathWorks Example: “Dynamic Voltage Restorer Using Simulink Power Systems Toolbox” (2023).
  • IEEE Transactions on Power Delivery, Vol. 32, No. 3 (2017): “Design and Control of DVR Using Fuzzy Logic Controller.”
  • MATLAB Simscape Power Systems User’s Guide, Section 5.3: “Modeling of Filters and PLL Synchronization.”

In short, your DVR model and controller are structurally sound. The waveform distortion originates from underdamping and PLL synchronization during startup.

By increasing the RLC filter resistance and fine-tuning the PLL and FLC parameters as described, both Vinj and Vload will appear as clean, continuous sinusoidal waveforms.

Sometimes, solving these models just requires a bit of patience, persistence, and parameter tuning. Apply these changes and share your next simulation results — I’m confident this will fully resolve your issue.

Good luck!

Sign in to comment.


Faria
Faria about 14 hours ago

Faria
Faria about 14 hours ago

Faria
Faria about 14 hours ago

Faria
Faria about 14 hours ago

Faria
Faria about 14 hours ago
hello Umar,thanks for ur cooperation,u give me istruction to change the value of powergui,unit delay,pll,pwm,solver at 1e-5. i am done this,u said change pll bandwidth,here i have frequency,in lpf i dont understand how to change the value. and i give the whole simulink ss can u check i done rightly as per ur instruction? if i done wrong let me know and please give me a picture of the connection this will be more helpful.i also give u the output diagram please check and help me.

Faria
Faria about 14 hours ago
no changes occur actually
  3 Comments
Umar
Umar about 5 hours ago

@Faria,

I’ve invested a significant amount of time into this project, and you’re right—it’s time to wrap it up. Below are my final thoughts on your recent screenshots and the comments you provided. Your DVR simulation still exhibits noisy Vinj(injected voltage) and distorted Vload (load voltage), which appear to be caused by four critical configuration issues:

  • Incorrect powergui and solver configuration - causing aliasing and poor PWM representation
  • Missing low-pass filter or incorrect LPF configuration on voltage measurements
  • Fuzzy Logic Controller output exceeding expected range (warning shows 1.96122 when range is [-1.5, 1.5])
  • Lack of output scaling and saturation to prevent over-modulation

Current Issues Observed:

  • Warning Message: ‘Fuzzy_logic_controller1', input 2 expects a value in range [-1.5 1.5], but has a value of 1.96122. Cause: FLC output is unscaled and exceeds limits. Effect: Controller saturation, instability, and oscillations.
  • Vinj Waveform (scope plot you shared) * Extremely noisy with high-frequency content * Large oscillations and ringing * Not a clean sinusoid
  • Vload Waveform (scope plot you shared) * Shows distortion and discontinuities * Not maintaining perfect sinusoidal shape
  • Lowpass Filter Configuration (based on screen shot you shared) * Input sample rate: 44100 Hz ← WRONG! * Should be 100000 Hz (corresponding to Ts = 1e-5 s) * Passband edge: 8e3 Hz ← Should be 1500 Hz

STEP 1: Configure powergui Block (CRITICAL) Reference: MathWorks - https://www.mathworks.com/help/sps/powersys/ref/powergui.html 1. Locate powergui block in your main model (should be at top level of DVR subsystem) 2. Double-click powergui to open parameters 3. Set these parameters: * Simulation type: Discrete * Sample time (s): 1e-5 * Preferences → Solver method: Tustin/Backward Euler

Why this matters: * Discrete mode with 1e-5 s (10 μs) captures PWM switching at 10 kHz properly * Rule of thumb: Sample time should be 1/10 to 1/20 of PWM period * PWM period = 1/10000 Hz = 100 μs, so Ts = 10 μs = 100μs/10 ✓

STEP 2: Configure Simulink Solver Settings Reference: MathWorks - https://www.mathworks.com/help/sps/powersys/ug/simulating-discretized-electrical-systems.html

1. Go to: Simulation → Model Configuration Parameters → Solver 2. Set these parameters: * Type: Fixed-step * Solver: discrete (no integrator) * Fixed-step size: 1e-5 * Tasking mode: Single Tasking 3. Click OK and Apply Why this matters: * Ensures synchronization between powergui and controller blocks * Prevents aliasing and sample-rate mismatch issues

STEP 3: Fix the Lowpass Filter Configuration (CRITICAL) Reference: MathWorks - https://www.mathworks.com/help/dsp/ref/lowpass.html

Your current Lowpass filter has WRONG settings. Here's the fix: 1. Double-click the "Lowpass" block in your Controller1 subsystem 2. Change ALL these parameters:

Filter Type: FIR, no change Passband edge frequency: 8e3, that is wrong, change it to 1500 Stopband edge frequency: 12e3, no change Sample Rate mode: currently specified on dialog, change it to 12000 If Sample rate mode = "Specify on dialog": * Change Input sample rate (Hz) from 44100 to 100000 * (Because Ts = 1e-5 s means fs = 1/Ts = 100000 Hz) Better approach - Use inherited sample time: * Set Sample rate mode: Inherit from input * This automatically uses 100000 Hz from the signal

Why 1500 Hz cutoff? * Fundamental frequency = 50 Hz (or 60 Hz) * Need to pass harmonics up to ~30th harmonic (1500 Hz) * PWM switching frequency = 10 kHz * Filter removes PWM noise while preserving fundamental + harmonics

STEP 4: Set All Discrete Block Sample Times to 1e-5 Reference: MathWorks - https://www.mathworks.com/help/simulink/ug/what-is-sample-time.html

You MUST set sample time = 1e-5 for ALL these blocks: 1. Unit Delay blocks (both in your controller) * Double-click each Unit Delay * Sample time: 1e-5 2. Discrete Virtual PLL block * Double-click PLL * Sample time: 1e-5 3. Three-Phase VI Measurement block * Double-click measurement block * Look for Sample time parameter * Set to 1e-5 * Note: Some versions might not expose this - if so, it inherits from powergui 4. Fuzzy Logic Controller blocks (both FLC controllers) * If they have sample time parameter, set to 1e-5 * Most FLC blocks inherit sample time automatically 5. PWM Generator / Modulator block * Double-click PWM block * Sample time: 1e-5 How to check if you missed any: * Go to: Format → Port/Signal Displays → Sample Time * This shows sample time colors on all signals * Everything should be the same color (same sample rate)

STEP 5: Configure PLL Bandwidth Reference: MathWorks - https://www.mathworks.com/help/sps/ref/discretevirtualpll.html

Your PLL parameters show: * Frequency: 50 Hz , okay * Phase: 30 degrees, okay * Sample time: 1e-5, okay

But you need to set the BANDWIDTH: 1. Double-click "Discrete Virtual PLL" block 2. Look for one of these parameter names: * "Loop bandwidth (Hz)" * "Bandwidth" * "Kp" and "Ki" (PI gains) 3. If you see "Loop bandwidth": * Set to 10 Hz 4. If you only see Kp and Ki (PI gains): * The block might not have direct bandwidth input * Use these typical values for 50 Hz system: * Kp (proportional gain): 180 * Ki (integral gain): 3200 * These give approximately 10 Hz bandwidth Why 10 Hz bandwidth? * Fast enough to lock within 1-2 cycles (20-40 ms) * Slow enough to reject high-frequency noise * Prevents PLL from tracking PWM switching ripple

STEP 6: Add Gain Scaling to FLC Outputs (CRITICAL FIX) Reference: MathWorks - https://www.mathworks.com/help/fuzzy/fuzzylogiccontroller.html

This fixes your warning about input value 1.96122 exceeding range [-1.5, 1.5] In Controller1 subsystem (Image 1): 1. After EACH Fuzzy Logic Controller block: * Add a Gain block (Simulink → Math Operations → Gain) 2. For "Fuzzy logic controller" (top one): * Insert Gain block between FLC output and Mux4 * Gain value: 0.8 * Sample time: 1e-5 3. For "Fuzzy logic controller 1" (screen shot you shared): * Insert Gain block between FLC output and Mux1 * Gain value: 0.8 * Sample time: 1e-5

Why 0.8 gain? * Your FLC outputs ±1.96, which exceeds ±1.5 range * 0.8 × 1.96 = 1.568 (still slightly over, but much better) * Reduces controller aggressiveness * Prevents resonance excitation in RLC filter

Alternative: Modify FIS output range directly If you prefer, modify the FIS file instead: 1. Open the FIS editor for your fuzzy controller 2. Go to Output variable settings 3. Change output range from current to [-1.0, 1.0] 4. Rescale membership functions accordingly

STEP 7: Add Saturation Blocks (Prevents Over-Modulation) Reference: MathWorks - https://www.mathworks.com/help/simulink/slref/saturation.html

After dq0→abc transform, before PWM input: 1. Locate the output of abc→dq0 transform that feeds PWM 2. Add Saturation block: * Simulink → Commonly Used Blocks → Saturation * Or: Simulink → Discontinuities → Saturation 3. Configure Saturation: * Upper limit: 1.0 * Lower limit: -1.0 * Sample time: 1e-5 * Treat as gain when linearizing: Unchecked 4. If you have 3 separate signals (a, b, c): * Use 3 parallel Saturation blocks * OR use single Saturation block with vector input (if signal is bundled)

Connection: [dq0→abc] → [Saturation ±1.0] → [PWM Generator] Why saturation? * Prevents modulation index > 1.0 * Stops controller from commanding impossible voltages * Prevents inverter from entering over-modulation region * Avoids current limit trips

STEP 8: Verify RLC Filter Parameters Hopefully, it should still have these values: parameters:

    * Resistance R: 2.0 Ω (increased from 0.5 for damping)
    * Inductance L: 0.002 H (2 milliHenry)
    * Capacitance C: 20e-6 F (20 microfarad)
So, Why R = 2.0 ohm?
* Damping ratio (zeta) = R/2 × square root of (C/L) = 2.0/2 × square root of (20e-6/0.002) = 0.1
* Provides critical damping for transient response
* Reduces ringing at startup
If still seeing ringing:
* Try R = 2.5 ohm (more damping)
If response too slow:
* Try R = 1.5 ohm (less damping)

STEP 9: Verify Signal Connection Path Critical: Ensure proper signal flow Verify: 1. Lowpass filter is BEFORE PLL and abc→dq0 (not after) 2. Both FLC outputs go through 0.8 gain 3. Saturation is AFTER dq0→abc, BEFORE PWM

STEP 10: Run Simulation and Verify Results 1. Save your model 2. Set simulation time: * Stop time: 0.1 seconds (for initial testing) 3. Run simulation 4. Open Scope and check: 5. Check for warnings: * The "input 2 expects value in range [-1.5 1.5]" warning should be GONE * No other warnings should appear

VERIFICATION CHECKLIST Use this checklist to ensure everything is configured: Power System Configuration * powergui set to Discrete mode * powergui sample time = 1e-5 s * powergui solver = Tustin/Backward Euler * Model configuration solver = Fixed-step, discrete * Model fixed-step size = 1e-5 s * RLC filter: R=2.0ohm, L=0.002Henry, C=20e-6farad Signal Processing * Lowpass filter passband = 1500 Hz * Lowpass filter sample rate = 100000 Hz (or inherited) * Lowpass filter is BEFORE PLL and abc→dq0 * All Unit Delay blocks sample time = 1e-5 * PLL sample time = 1e-5 * PLL bandwidth ≈ 10 Hz (or Kp=180, Ki=3200) Controller Configuration * Both FLC blocks have Gain 0.8 on outputs * Gain blocks sample time = 1e-5 * Saturation blocks (+/-1.0) after dq0→abc * Saturation sample time = 1e-5 Measurement Blocks * Three-Phase VI Measurement sample time = 1e-5 (or inherited) * PWM Generator sample time = 1e-5

TROUBLESHOOTING GUIDE If Vinj still has high-frequency noise: Possible causes: 1. Filter not properly connected 2. Sample time mismatch somewhere 3. PWM frequency too high relative to sample time Solutions: * Verify filter is on measurement path BEFORE PLL * Check all sample times with Format → Port/Signal Displays → Sample Time * Ensure no blocks are set to "inherited" (-1) or "continuous" (0) except sources If Vload has gaps/distortion: Possible causes: 1. PLL not locking properly 2. FLC gains too aggressive 3. Saturation limiting continuously Solutions: * Check PLL bandwidth (reduce to 5 Hz if unstable) * Reduce FLC gain from 0.8 to 0.7 * Add a Display block to monitor saturation block output If warning still appears: Possible causes: 1. Gain blocks not properly inserted 2. FIS output range still wrong Solutions: * Double-check Gain 0.8 is in the signal path * Open FIS editor and manually limit output range to [-1.0, 1.0] If simulation is too slow: Possible causes: 1. Sample time too small 2. Algebraic loops Solutions: * Increase sample time to 2e-5 (still acceptable for 10kHz PWM) * Ensure Unit Delays break feedback loops * Check Configuration Parameters → Diagnostics → Algebraic Loop

KEY FORMULAS AND VALUES Sample Time Calculation Ts = 1e-5 s = 10 μs fs = 1/Ts = 100,000 Hz PWM Relationship PWM frequency = 10 kHz PWM period = 100 μs Sample time = 10 μs = PWM period / 10 (Good ratio) RLC Damping Ratio zeta = (R/2) × square root of (C/L) zeta = (2.0/2) × square root of (20e-6 / 0.002) zeta = 1.0 × 0.1 = 0.1 (Underdamped, acceptable) LPF Time Constant fc = 1500 Hz Tau= 1/(2π×fc) = 1/(2π×1500) ≈ 1.061e-4 s Discrete LPF Alpha Coefficient α = Ts / (Ts + Tau) α = 1e-5 / (1e-5 + 1.061e-4) α ≈ 0.08613

OFFICIAL MATHWORKS REFERENCES All solutions are based on official MathWorks documentation: 1. powergui block: https://www.mathworks.com/help/sps/powersys/ref/powergui.html 2. Simulating Discretized Electrical Systems: https://www.mathworks.com/help/sps/powersys/ug/simulating-discretized-electrical-systems.html 3. Three-Phase V-I Measurement: https://www.mathworks.com/help/sps/powersys/ref/threephasevimeasurement.html 4. Fuzzy Logic Controller: https://www.mathworks.com/help/fuzzy/fuzzylogiccontroller.html 5. Sample Time in Simulink: https://www.mathworks.com/help/simulink/ug/what-is-sample-time.html 6. Saturation Block: https://www.mathworks.com/help/simulink/slref/saturation.html

EXPECTED FINAL RESULTS After implementing ALL steps above, you should see improvements in Performance Metrics: * THD (Total Harmonic Distortion): < 5% * Voltage regulation: Vload stays within ±5% of nominal * PLL lock time: < 2 cycles (40 ms for 50 Hz) * Transient settling: < 3 cycles after fault injection

FINAL NOTES 1. Document your changes: * Add an Annotation block to your model * List all parameter values: Ts, R, L, C, fc, gains * Date and initial your notes 2. Save multiple versions: * DVR_Model_Original.slx (backup) * DVR_Model_Fixed_YYYYMMDD.slx (working version) 3. Incremental testing: * Apply steps 1-2 first, test * Then add steps 3-4, test again * This helps identify if a specific step causes issues 4. If still having problems: * Take screenshots showing: * powergui parameters * Lowpass filter parameters * Model Configuration Parameters → Solver * Sample time display (Format → Port/Signal Displays) * Include scope plots * Note any new warnings/errors

SUCCESS CRITERIA Your project is COMPLETE when:

No warnings in simulation console 
Vinj is a clean near-sinusoid with <5% ripple 
Vload maintains sinusoidal shape through fault 
PLL locks within 2 cycles

All sample times = 1e-5 s 
FLC outputs stay within limits 
Simulation runs without errors

I believe that by following these guidelines and having you more control on simulink block diagram settings, you will get it done this time. Think of it this way, your driving instructor tells you all the instructions that you need to follow to become a licensed driver but it depends on your efforts and following the rules in your driving instructions booklet plus driving instructor directions but in reality you are the one who has control on the steering wheel (simulink block diagram or matlab software code implementation). Also, hoping your supervisor can help out resolving this issue as well.

Again, Good luck with your project!

Sign in to comment.


Faria
Faria about 3 hours ago
hello @Umar thank you for ur valuable time and help, i am sorry i bothered u a lot. i followed the instruction u give me earlier,but u talk about bandwidth on virtual pll see i dont found this bandwidth option. can u check it the connection is ok? there is no warning anymore. and can u ans me why the gain block is between flc and max4? why not flc and max 3? help me if u free, thank u a lot umar. u are such a kind heart.

Faria
Faria about 3 hours ago
here is the final output diagram, i think this is an improvement one.can u check it , is it ok or not?
  2 Comments
Faria
Faria about 3 hours ago
@Umar can u describe what actually heppens here, in this graph vabc and vload are quite similar.but we should have the vload is smooth wave, after 0.02 sec signal is distored, can u discuss about this, please i am sorry i disturbed u a lot, thanks for ur important time.
Umar
Umar 27 minutes ago

@Faria, great progress! You're almost there. Just need to wrap up a few things and you'll be done. Here's what's left:

The saturation blocks are the biggest thing I can't confirm from your screenshot. You need them right after the dq0 to abc transform block, before the signal hits your PWM or inverter. Set upper limit to 1.0 and lower limit to -1.0, with sample time at 1e-5. This stops the controller from trying to command voltages that are physically impossible.

Your Vinj waveform is still pretty noisy with all those high frequency oscillations. The fix is simple - go into your Lowpass block and change the passband edge frequency from 1500 Hz down to 800 Hz. Leave everything else the same. This will cut out more of that PWM switching noise while keeping your 50 Hz fundamental signal clean.

Those gain blocks you added after the fuzzy controllers are set to 0.7 right now. Drop them down to 0.5 instead. The controller is being a bit too aggressive and that's causing some of the oscillations you're seeing. Backing off the gain will smooth things out.

Last thing - and I can't tell from your latest screenshots if this is set up - make sure you actually have a voltage sag happening in your simulation. You need a fault block or breaker that drops the voltage to about 70-80% of nominal at t = 0.02 seconds. Without this, your DVR has nothing to compensate for, which might explain why your Vabc and Vload look so similar. The whole point is that when Vabc drops, Vinj kicks in to keep Vload steady.

Once you make these changes, here's what you should see: Before 0.02 seconds everything looks normal, Vabc and Vload are identical clean sine waves around 200V, and Vinj is basically zero because the DVR isn't doing anything yet. Then at 0.02 seconds the sag hits, Vabc drops to maybe 140-160V, but Vload stays at 200V because your DVR is injecting the difference through Vinj. That Vinj signal should be a clean sine wave, not all choppy and noisy like it is now.

The PLL settings you showed me are fine, don't worry about the bandwidth thing. Your version of the block handles it internally and what you have configured is correct.

Your placement of the gain blocks between FLC and the mux blocks is right. Top FLC goes to Mux4, bottom goes to Mux1, and you've got the gains in the right spots.

Do these four things in order: add the saturation blocks, change the lowpass filter to 800 Hz, reduce the gains to 0.5, and verify your fault is configured properly. Should take you maybe 30 minutes tops. Run the simulation again and check that you get no warnings, Vinj is smooth with less than 5% ripple, and Vload stays constant when Vabc drops.

You've built the hard parts already - the circuit topology, the PLL, the fuzzy controllers, all the transforms, the timing synchronization. This last bit is just tuning and polishing. You're literally at 90% completion. These final adjustments will get you across the finish line.

Let me know how it goes after you make these changes. I know you can do it. You've got this!

Sign in to comment.

Products


Release

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!