- Increase the Step Size: A step size of 0.001 might be too small and causing the solver to take very fine steps through the simulation. Try increasing the step size to see if the simulation speed improves without sacrificing accuracy.
- Optimize the FIS: Simplify the FIS if possible. Reducing the number of membership functions or rules can decrease the computational load.
- Solver Configuration: Check the solver settings in Simulink. For stiff systems or systems with discontinuities, solvers like 'ode15s' or 'ode23t' might be more appropriate.
- Use Fixed-Step Solver: Switching to a fixed-step solver can sometimes improve simulation speed, but be aware that it may affect simulation accuracy.
- Profile the Simulation: Use MATLAB's built-in profiler to identify which parts of the simulation are consuming the most time. This can help you pinpoint where optimizations are needed.
- Implement FLC in MATLAB Script: If the slowness is due to the Fuzzy Logic Toolbox's simulation blocks, consider implementing the FLC logic in a MATLAB script using functions like "evalfis".
Fuzzy Logic Controller Simulation
11 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I designed a fuzzy logic controller for my system, it has 2 inputs which is error and derivative of error.
3 inputs, Kp, Ki, Kd. And all have 7 membership functions so I need to have 49 rules which is not a problem.
But, when it comes to simulate in simulink with 0.001 stepsize, somehow it can not simulate properly.
I mean, it is so slow that I can not see the result of the simulation. It moves forward like in 10e-13 ranks. And sometimes its stuck in a specific time, no matter how much I wait, simulation needs to be stopped by me.
I am using Fuzzy Logic Toolbox and my Matlab version is 2020a. I writed a script to create my FIS. And I dont think the problem is causing from my script or from my system. Because I designed a simple fuzzy and it works properly for a any DC motor model. I want to simulate fastly in my intended system in the first place. Solver and stepsize choice is up to simulink.
So what do you think, What should I change or should I write my own script to simulate FLC, if this slowness causing from the Toolbox?
0 件のコメント
回答 (1 件)
Hari
2024 年 1 月 10 日
Hi Eymen Kosar,
I understand that you have a fuzzy logic controller (FLC) with two inputs (error and derivative of error) and three parameters (Kp, Ki, Kd), each with seven membership functions and have 49 rules for the FLC. When simulating in Simulink with a step size of 0.001, you are experiencing an issue of simuliation being slow.
Assuming the FLC design is correct and the problem lies with the simulation setup, one possible reason for the slow simulation could be the complexity of the fuzzy inference system (FIS) combined with a small step size, which can significantly increase computation time. Here are some steps you can try to improve simulation speed:
% Assuming 'fis' is your fuzzy inference system and 'input' is a two-element vector [error, dError]
output = evalfis(fis, input);
Refer to the documentation of the Fuzzy Logic Toolbox for more information on creating and simulating fuzzy inference systems:
Fuzzy Logic Toolbox Documentation - https://www.mathworks.com/help/fuzzy/index.html
For choosing and configuring solvers in Simulink, refer the documentation:
Solvers in Simulink - https://www.mathworks.com/help/simulink/ug/types-of-solvers.html
To learn more about MATLAB's profiler and how it can be used to analyze performance issues, refer to the documention:
MATLAB Profiler Documentation - https://www.mathworks.com/help/matlab/matlab_prog/profiling-for-improving-performance.html
Hope this helps!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Fuzzy Logic in Simulink についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!