In my Speed Control model using FOC to run a IPMSM motor, my output torque fluctuates by 1N-m. How do I solve this error?
Show older comments
Dear Mathworks community,
I am working on a speed control model, using FOC, I plan to run the IPMSM motor at to meet a certain RPM and torque target. While my speed meets it's target, Torque target is also met but it keeps fluctuating up and down.
Target speed - 500 rpm and target torque - 60 Nm.
I am using the default 3-phase converter with 'Switching Device' set to MOSFET, PWM generator is set to 'Space Vector Modulation'. Output from 'ModWave Scope' does not show 'SVM' waveform. Where am I going wrong? Any help on this is very much appreciated!!
Thanks in advance!
Answers (1)
Darshan Pandit
on 31 May 2023
0 votes
Hi aditya,
It appears that either Iq current loop controller, and perhaps Id current loop controller too, aren't tuned properly.
These are inside the torque controller subsystem.
10 Comments
Aditya
on 31 May 2023
Darshan Pandit
on 31 May 2023
Edited: Darshan Pandit
on 31 May 2023
Hi aditya,
there are more than one ways to tune the PID controllers. You're using one of them, and it should be good as long as you're getting step responses right. Also, you mentioned that the responses are smooth when you use "Averaged Switch" but do not function when you perform PWM switching, tells us something:
- Check sample time for plant model (should be ~1/100 of PWM switching frequency) for correct simulation.
- Check solver settings.
- Check ElecSensor subsystem and ensure that current sensors are modelled currecty.
On a separate note, and this is optional, you may try out this example with your system parameters for averaged value switching and confirm the gains are correct.
Darshan Pandit
on 31 May 2023
Hi aditya,
Can you repeat the observation with averaged switching mode ? If the reference and feedback currents aren't matching, then you are correct. Let me know.
Aditya
on 31 May 2023
Darshan Pandit
on 31 May 2023
Edited: Darshan Pandit
on 31 May 2023
Seems like an issue with plant model sample timings.
I guess the control loops are operating at a different sample time than your expectaction.
Would it be possible for you to confirm control loop sample time ?
You can do this by going to debug menu --> Information Overlays --> Sample Time --> Colors
Going from your response earlier, let me summarize the sample timings:
- Switching frequency: 1e4 = 10e3,
- Outer loop sample time: 1e-4 = 100e-6,
- PWM generator sample time: 1e-6,
- Inner loop sample time: 1e-5 = 10e-6.
You're trying to execute inner loop 10 times before the PWM update time, which is 100e-6 for 10kHz frequency. This way, the dutycycle would change during PWM generation, which is not desired. Ideally, dutycycle changes only once per PWM switching cycle.
Anyway, here is an example of different sample timings for the system:
%% Set PWM Switching frequency
PWM_frequency = 10e3; %Hz // converter s/w freq
T_pwm = 1/PWM_frequency; %s // PWM switching time period
%% Set Sample Times
Ts = T_pwm; %sec // Sample time for control system
Ts_motor = T_pwm/2; %sec // Simulation time step for average value inverter
Ts_inverter = T_pwm/2; %sec // Simulation time step for average value inverter
Ts_speed = 10*Ts; %sec // Sample time for speed controller
Ts_motor_simscape = T_pwm/100; %sec // Simulation time step for simscape based PWM inverter
Also, try using local solver in SimScape solver configuration block and specify PWM generator sample time there. The rate transition between various sample times should be handled via subsystems modelling various sensors. You may use this example to understand this better.
Aditya
on 1 Jun 2023
Darshan Pandit
on 1 Jun 2023
hi aditya,
It's fine. We all are learning all the time. Anyway, all of the answers that you're looking for are in the example model mentioned earlier. To be specific, here are the responses:
- What blocks come under control loop sample time?
A: Algorithms (e.g. Field Oriented Control in this case) designed in the model would typically come under control loop sample time. There is no hard rule, and you can have multiple sample time within the algorithm. (e.g. Ts_speed = 100e-6; Ts_mtpa = 100e-6; What I find incorrect is, Ts_innerLoop = 10e-6 for T_pwm = 100e-6. My assuption is based on a guess that you're using PI controllers for Id and Iq loop. I may be wrong as I haven't had a detailed look at your model.
- where can I add 'Ts' i.e. sample time for control system in my model?
In all of the blocks that define control algorithm.
- In a similar sense, where can I add sample time for 'Ts_motor' ?
In the plant models, if you're using average inverater. If you're using PWM switching, use the 1e-6 sample time. This can be defined directly in solver configuration block while using simscape.
If you wish us to have a details look at the model, please contact us and we have a team who would be glad to help you out. Ask them to connect with me & we can set up a meeting and speed up the whole debugging process.
Hope this helps.
Have a good day.
Aditya
on 1 Jun 2023
Aditya
on 13 Sep 2023
Communities
More Answers in the Power Electronics Control
Categories
Find more on Permanent Magnet in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!