The following working MATLAB code can be used to tune a PID controller and for future application development. Each function must be in a separate file with the name described here. The main file, Main.m, executes and controls the entire code and calls the other functions, as long as they are all in the same folder with the names listed below. There are 5 files in total and these may be recovered from the following MFO_Chaos_Control.zip file.
1. Main.m // the main file to start the execution
2. MFO_Chaos.m // The optimizer
3. Cost_funct.m // The function to be minimized
4. Plant.slx //The plant for which PID gains are required to be optimized
In this version, the plant was developed in MATLAB/Simulink 2023a. Accordingly, for newer versions changes may be made.
% Cite this article
% Khatri, A., Gaba, A., Rana, K.P.S. et al. A novel life choice-based optimizer. Soft Comput 24, 9121–9141 (2020).
% https://doi.org/10.1007/s00500-019-04443-z
After running the current settings, you will get the following response.
The best solution obtained by LCBO is : 9.9528 3.7492 9.7437
The best optimal value of the objective function found by LCBO is : 0.98519