You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
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?
7 views (last 30 days)
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
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
Dear Mr. Pandit,
Thank you for your recommendations, you have given me a starting point. Since I am very new to this, I have a follow up question for you. I usually tune the PID in my speed controller using a block called the 'Check Step Response Characteristics" in the 'Simulink Design Optimization' toolbox. Do you recommend I use the same method for the two PID inside the torque controller? If not can you point me in the right direction on how to tune this?
Also, I get a perfect waveform while using "Averaged Switch" but when I select 'MOSFET' in the converter block, I encounter this error.
Thank you again for your valuable inputs on this!
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.
Aditya
on 31 May 2023
Edited: Aditya
on 31 May 2023
Thank you for your response! You have given me a lot to work with, I very much appreciate your help on this. Just leaving some information here for you to see:
- Switching frequency - 1e4, Outer loop sample time - 1e-4, PWM generator sample time - 1e-6, and Inner loop sample time - 1e-5.
- Solver setting: Variable step, ode23t, relative and absolute tolerance set to 1e-4. Unchecked auto scale of absolute tolerance.
- Double checked to make sure the 'ElecSensor' subsystem are modelled correctly.
One observation: 'reference Id' from my 'MTPA Reference' block does not match actual 'Id' got from motor Iabc after 'Park Transform', the same is for Iq. Is this indicative of poorly tuned PID?
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
Thank you for your quick response, I have run both the models. I am attaching both the screenshots here.
For averaged switch model: reference current and feedback current is -122 and 511 (Id & Iq). both match!!
For MOSFET model: reference current is -122 and 511 while feedback current is -131 and 510 (Id & Iq)
I have used the same blocks for both the model, the only change is selecting between MOSFET and Averaged Switch in the "Converter (Three Phase)" block. (Also attached with this message)
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
Good morning!
Thank you for your recommendations! What blocks come under control loop sample time? and where can I add 'Ts' i.e. sample time for control system in my model? In a similar sense, where can I add sample time for 'Ts_motor' ? I apologise if these questions are too basic.
I would like to provide more clarity on my earlier statement regarding sample time for various components in my model:
1.Speed controller_PI and feedback speed (wm) is set to = 1e-4
2. PWM generator is set to = 1e-6
3. MTPA reference block by default outputs at 1e-4, I have added 2 unit delay for it's output with sample time set to '-1'.
4. A unit delay for Iabc in current sensor is set to 1e-5, the same for Vabc, and theta from mechanical sensor.
5. Id and Iq PI controllers are set to a sample time of 1e-5
I have used the SimScape local solver and I did specify PWM generator sample time, I am getting more or less similar results befor and after.
I am also attaching my model here in case you need to take a look.
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
Dear Mr. Pandit,
I have raised a service request, I do not know where excatly I am going wrong, On the service request, I have mentioned them to get in touch with you and set up a meeting depending on your availability.
In the meantime I will keep trying to solve this and try to understand the example that you had shared.
Thank you again for your inputs on this. Looking forward to talking to you soon!
Aditya
on 13 Sep 2023
Dear Mr. Pandit,
I have a very quick question for you if that's alright.
I have a torque control model with a delta wound motor. I am using the 'MTPA Reference' block and 'IPMSM Control Reference' block for reference Id and Iq generation. The Id and Iq reference values generated by the blocks are not on the MTPA curve except the first operating point!. The Ld, Lq and flux that I use in the blocks are from electromagnetics software designed for Delta motor. These blocks work perfectly for me when I use them for other star connected motor in torque control.
Can you give me a bit of clarity as to why this does not work for Delta wound motor?
Thank you so much for all the support!!
Communities
More Answers in the Power Electronics Control
See Also
Categories
Find more on Motor Parameter Estimation and Plant Modeling 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!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)