How do I prevent motor from entering reverse generating region, and stay in forward motoring region?

I am trying to simulate an electric motor for an aircraft, but when I input my reference speed and torque demand, the motor seems to enter reverse generating instead of forward motoring.
The motor parameters are as such:
The motor's torque output vs torque demand as shown:
However, the motor's rpm output vs reference rpm is as shown:
Is there a way to "force" the motor to stay in quadrant 1 as opposed to entering quadrant 4?

Réponses (2)

Hi @Zachary,

Looking at your simulation results, the issue is clear: your motor is operating in Quadrant 4 (negative speed, positive torque) instead of the desired Quadrant 1 operation due to a sign convention mismatch between your speed reference and the motor block's internal reference frame - while your torque control is working correctly (yellow line tracking blue demand), your RPM output (yellow) is negative when your RPM reference (blue) is positive, indicating the motor's internal electrical angle or control system expects the opposite polarity for positive rotation. The quickest solution is to add a gain block with value -1 to invert your speed reference signal before it enters the motor block, which should flip the motor into proper Quadrant 1 operation while maintaining your excellent torque tracking performance. After implementing this fix, verify that positive speed commands produce positive RPM outputs and that the motor operates within the correct quadrant boundaries during your aircraft simulation - this is particularly critical for aircraft applications where propeller rotation direction, engine mount torque reactions, and flight control system expectations must align properly for safety. If the simple polarity inversion resolves the issue (which is highly likely based on your plots), you can then decide whether to keep this as a permanent solution or investigate deeper motor parameterization changes, but the torque-speed lookup table configuration and overall motor parameters appear correct since your torque control is performing well.

References

Motor & Drive (System Level) Block Documentationhttps://www.mathworks.com/help/sps/ref/motordrive.html

12 commentaires

HI @Umar, the addition of a -1 gain block doesn't solve the issue, here are the outputs with the inversion:
For RPM,
For torque,
For reference, this is what I currrently have in my simulation setup,

Hi @Zachary,

Thank you for sharing the block diagram and motor parameters - that's exactly what I needed to see the complete picture. Based on the complete MathWorks documentation and your system configuration, here's the technical analysis and solution:

System Analysis: Your control architecture follows standard motor control practices - LUT generating RPM reference → PID speed controller → Motor & Drive torque reference (Tr). The Motor & Drive (System Level) block operates in torque-control mode with only the Tr input port active.

Root Cause of Instability: The issue stems from three technical problems:

1. PID Controller Instability The -1 gain block in your torque path is creating positive feedback in your speed control loop. When the motor speed deviates from reference: * PID generates corrective torque * -1 gain inverts this correction * Motor receives wrong polarity correction * System becomes unstable with massive overshoots (-28,000 RPM)

2. Parameter Configuration Mismatch * Initial rotor speed: 1000 RPM vs operating point: -3000 RPM * Rotor inertia: 0 kg⋅m^2 (unrealistic for aircraft propeller) * Torque-speed envelope: [0, 1000, 1600, 2300, 2700, 3000, 4000] RPM (positive only)

3. Quadrant Operation Issue
Your system demands negative speed (-3000 RPM) with positive torque, placing operation in Quadrant 4 (reverse generating). The motor parameters and initial conditions aren't configured for this operating region.

Technical Solution:

Immediate Fixes:

1. Remove the -1 gain block from the torque reference path 2. Configure motor parameters for negative speed operation: * Set "Initial rotor speed" = -3000 RPM * Set "Rotor inertia" = 0.05 kg⋅m² (typical for small aircraft propeller) 3. Verify PID controller sign convention: * Error = Reference - Feedback * Positive error should generate positive torque for positive speed tracking * For negative speed references, ensure proper error calculation

PID Controller Tuning: Start with conservative gains: * Kp = 0.1 (reduce from current values) * Ki = 0.01 * Kd = 0.001 * Add anti-windup protection

*System Verification:*Test with positive speed reference first (+1000 RPM) to verify proper quadrant 1 operation, then transition to negative speed operation.

Advanced Considerations: The torque-speed envelope you've defined covers positive speeds only. The Motor & Drive block automatically mirrors this for negative speeds (Quadrants 2&3), but verify your continuous operation torque limits align with your propeller's actual requirements at -3000 RPM. For aircraft applications, consider adding: * Rate limiters on speed commands * Torque limiting for safety * Emergency stop functionality

Expected Results: After implementing these changes, your motor should operate properly in Quadrant 3 (reverse motoring: negative speed, negative torque) instead of the problematic Quadrant 4 operation you're currently experiencing.

@Umar I'm not sure if that's going to fix my issue though. You mentioned that after implementing those changes, my motor should operate in quadrant 3, but I am trying to get it to work in quadrant 1. If I swap out the motor for another motor that is parameterized by maximum power and torque, I am able to get it to motor in quadrant 1, but the torque tracking is noisy with overshoots at transition points where torque decreases/increases.
The output waveform for the motor parameterized by torque envelope with speed looks ideal except for the fact that the motor RPM is completely inverted from my reference speed.

Hi @Zachary,

I do apologize for my previous comments but it seems that I missed the most critical part which is not able to see the complete simulation diagram, so would you be able to share the screenshot of complete simulation diagram? This will allow for a more precise recommendation without risking unintended control loop modifications and keep going back and forth. Thanks for your patience and understanding.

@Umar No worries, here you go,
I swapped out the motor for a one that is parameterized by maximum torque and power, but the connections are exactly the same if I swap it back to the one parameterized by tabulating torque envelope with speed.

Hi @Zachry,

I understand what you're trying to accomplish. In order to assist you further, could you please provide the full block diagram? I'm currently unable to see what's connected to the L+ and L- terminals of Motor side.

It also looks like one of the blocks has been disconnected or cut off—possibly one of the swap motor blocks you mentioned in your comments.

Once I have the complete diagram, I’ll be better able to help.

@Umar There are no connections that are cut off in my picture above.
The motor is connected to a subsystem for me to monitor and see the current and voltage consumed by the motor.

Hi @Zachary,

Thanks for the detailed plots and explanation — I took another pass through everything and here's what stands out.

You're right — the fact that your torque tracking is clean while your RPM output is inverted strongly suggests a sign convention mismatch, not a modeling flaw. The most likely cause is that the motor interprets the torque input (`Tr`) in the opposite rotational direction from what your controller expects.

Here's the cleanest fix path:

1. Insert a `-1` gain block just before the `Tr` input of the Motor & Drive (System Level) block. This should flip the torque direction and force the motor to operate in Quadrant 1 (positive torque, positive speed).

2. Leave the RPM feedback signal untouched. Avoid inverting the speed feedback — this can create a positive feedback loop and destabilize the controller.

3. Fix motor parameters to avoid compounding issues:

  • Set initial rotor speed = 0
  • Set rotor inertia = ~0.05 kg·m^2 (aircraft propeller typical)
  • Set rotor damping if needed, for smoother response

Why this makes sense:

  • When you used the motor parameterized by max power & torque, it worked in Quadrant 1 — confirming your controller is doing the right thing.
  • The "Torque Envelope with Speed" block just expects torque polarity to follow its internal sign convention, and in this case, it’s flipped from yours.
  • Correcting the torque input direction aligns both torque and speed in the same quadrant.

Let me know what the output looks like after these changes — I’d expect clean RPM tracking and no inversion if the sign correction is applied at the torque input.

Hi @Umar, those suggestions didn't work,
Now my RPM output is tracking further away from my reference before throwing an error.

Hi @Zachary,

I do appreciate you being patient and tried multiple suggestions but the system keeps getting worse instead of better. So, I have realized at this point that the core problem is that maybe*I am debugging blind* right now. You mentioned that after implementing my latest suggestions, the RPM output is "tracking further away from reference before throwing an error," but you forgot to share the updated block diagram showing what was actually implemented. So, here is what I need to see to properly diagnose the issue:

1. Current Complete Block Diagram Please share a screenshot of your entire current simulation setup showing: * All blocks and connections * Any gain blocks you've added (especially any -1 gains) * The complete control loop from reference to motor * Current motor block type you're using

2. Current Motor Parameters Screenshot of your motor block dialog showing: * Initial rotor speed setting * Rotor inertia value * Rotor damping (if set) * Torque-speed envelope data * Any other parameter changes you made

3. Error Details * What specific error message are you getting? * At what simulation time does it occur? * Copy/paste the exact error text

4. Implementation Clarity Based on my comment 3 suggestions, please confirm: * Did you add a -1 gain block? If yes, exactly where is it connected? * Did you remove any previous -1 gains from earlier attempts? * Are you still using the "Torque Envelope with Speed" motor or switched back to "Max Torque and Power"?

Why This Matters I made a critical observation that when you used the "Max Torque and Power" motor, it worked correctly in Quadrant 1. This strongly suggests the issue is a sign convention mismatch specific to the "Torque Envelope with Speed" parameterization.

However, without seeing your current implementation, I can't determine if: * The -1 gain was placed incorrectly (wrong location causes instability) * Multiple -1 gains are conflicting with each other * Parameter changes were applied incorrectly * There are leftover modifications from previous attempts

Next Steps

Once you share the current block diagram and parameters, I can: 1. Identify exactly what's causing the instability 2. Provide a clean, step-by-step fix 3. Get your motor operating properly in Quadrant 1 by doing my best

The good news is that this is definitely solvable - I just need visibility into the current state of your simulation to provide the right guidance.

Hope this helps clarify everything.

P.S. - If you're pressed for time, the absolute minimum we need is the current block diagram showing where any -1 gains are connected.

Hi @Umar, apologies for the late reply. The only -1 gain block I've used is connected to my torque demand. You mentioned to try adding a -1 gain block to my reference rpm block, I've removed that after the latest attempt.

Hi @Zachary,

Thanks for the update! I appreciate you making the adjustments and keeping me informed. I understand that you’ve removed the -1 gain from the reference RPM block, and that you’re now only using it on the torque demand, which is helpful context.

However, to properly evaluate the situation and move forward, I still need to see the updated Simulink block diagram and the results/output after these changes. From our previous conversations, I haven’t seen the actual diagram or the simulation results yet, so I can’t fully diagnose what might be going wrong.

Could you please share the following:

1. Updated Simulink Block Diagram:

A screenshot of the entire current setup, including:

  • All blocks and connections
  • The current placement of the -1 gain block
  • The type of motor block you're using

2. Simulation Results / Output:

  • A plot or graph showing the RPM tracking response after the latest changes
  • Any error messages or issues that appear during simulation

*The simulation time when the issue occurs

3. Motor Parameters:

A screenshot of the motor block settings, including parameters like rotor inertia, damping, torque-speed envelope, etc.

Without the diagram and results, it’s hard for me to pinpoint exactly what might be causing the instability. Once I have those, I’ll be able to guide you through the next steps to resolve the issue and stabilize the system.

Looking forward to seeing the updated details!

Connectez-vous pour commenter.

Why is your torque output zero at zero speed and then it continues to increase? You might want to check if this is configured correctly. The torque speed envelope for a motor is usually flat and non zero at low speeds and tends to decrease at high speeds.
e.g.

Community Treasure Hunt

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

Start Hunting!

Translated by