I'm using PSO to tune the parameters of the PID controller . my model uses a s-function block to represent the equations of the system in SIMULINK. When I try to tune the system using PSO offline, the system takes very long time (almost half an hour) with no response, and I stopped the run. After all this time the program was still calculating the s-function for flag = 1 at time 9.1 and PSO didn't even run!!
How can I solve this delay problem ?