Hi @Carlos,
I took a look at your setup and I can see what's going wrong here. First thing that jumps out is that your gate_L signal is completely flat in those scope traces - that's your main problem right there. One of your transistors isn't switching at all, which explains why you're getting 0V output.
Now looking at your actual control subsystem diagram (the one with V_ref1 at 350V), I can see the issue. That control implementation is way too complicated and has some fundamental problems. You've got division operations, what looks like modulo or normalization with f_sw, multiple comparators, AND gates - it's all creating a logic mess that's causing gate_L to stay stuck at zero. The way this should work is much simpler - your PI controller gives you a duty cycle, you multiply it by 0.5 to keep each transistor under 50%, then you compare that with a sawtooth carrier. One transistor gets the direct comparison result, the other gets the complement. But your current implementation with all those division blocks and AND gate logic isn't doing that correctly.
Here's what I'd suggest. Honestly, I think you need to scrap that entire control subsystem and rebuild it from scratch with a much simpler approach. The current implementation is trying to do something with f_sw normalization and complex logic that's just not working. What you actually need is maybe 5-6 blocks total. Start with a subtract block for your error (V_ref - V_out), feed that into your PI controller, multiply the output by 0.5 to limit duty cycle, then compare with a simple sawtooth generator running at 50kHz. Use one relational operator set to ">=" for gate_R, and either use "<" for gate_L or just invert gate_R with a NOT gate. That's it. No division by f_sw, no AND gates, no complex normalization. The simpler you make this, the easier it'll be to debug.
Now about that transformer block - those saturation parameters you've got there look really off. The format should be two rows: first row is magnetization current values, second row is flux values. Your entry "[0;8;34221 1.33331e-08]" doesn't make sense to me. For debugging purposes, I'd honestly just set it to something like [0 0.1; 0 0.1] which basically gives you a linear transformer with no saturation. You can always add proper saturation later once you get the basic control working. Also set your magnetization resistance Rm to something high like 500 pu and Lm to maybe 500 pu as well.
The turns ratio looks about right for what you're trying to do. With 137.14V input and wanting 350V output, you need roughly 2.55:1 on the secondary which matches your voltage array [137.14 137.14 350 350]. Just make sure those windings are actually connected the way you think they are in your circuit.
Before you do anything else with that closed loop, I'd actually suggest building a completely new simplified control subsystem alongside your current one. Keep the old one for reference but don't try to patch it - those division blocks and AND gate logic have too many places where things can go wrong. Build the new simple version I described, then disconnect your PI controller temporarily and just feed a constant 0.3 (30% duty cycle) into your PWM generator. You should see both gate signals switching nicely and complementary to each other. If you don't see that with the simplified control, then we know there's something else wrong. But I'm betting once you simplify that control subsystem, both gates will start switching properly.
Quick reality check on your design - push-pull converters absolutely cannot go beyond 50% duty cycle per transistor or you'll saturate the core. That's why the 0.5 gain is there. The complementary operation means when Q1 is on, Q2 is off and vice versa. You also need some dead time between them to prevent shoot-through, usually around 100-200ns. Make sure your control implementation actually has that dead time built in.
One more thing - your solver settings matter here. Use ode23tb or ode15s since power electronics are stiff systems, and set your maximum step size to something like 2e-6 seconds (that's 1/10th of your switching period). If your step size is too large, you'll miss switching events entirely.
That File Exchange model giving you zero gate signals while the output was stable is a classic sign of a broken control loop that's not actually doing anything. The official MathWorks example is definitely more solid, but you've got to adapt it properly to your specs. The fact that even open loop isn't working tells me the issue is in the PWM signal generation itself, not the feedback loop.
Try building that simplified control subsystem first - literally just the blocks I mentioned: subtract, PI, gain of 0.5, sawtooth generator (Repeating Sequence block works great for this, set it to output 0 to 1 at 50kHz), one >= comparator for gate_R, and either a < comparator or NOT gate for gate_L. Get that working in open loop with a constant 0.3 duty cycle, add scopes everywhere - on the PI output, the duty cycle after the 0.5 gain, the sawtooth, both gate signals, the transformer primary currents, everything. Once you see proper complementary switching on both gates and a reasonable output voltage, then close the loop and tune your PI gains. I think you'll find this simplified approach works way better than trying to debug that complex control logic you've got now.
Let me know what you find when you check those PWM signals in open loop. I'm betting that's where your problem is.
Good luck!













































































