Dear all,
I used to run these controls using FAST, but due to a configuration error about the version of MATLAB they are outputing an error.
Can you help me to create a block diagram on Simulink that I can run these controls again?
[code]if px==1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Optimal control
Num = 2*r{i}*(u - 2.14*omega_g^2)*(-2*2.14*omega_g) ...
+2*q{i}*(Pref - u*omega_g)*(-u);
DerivCp=geraDerivadaCp(Cp,wind,Pitch,omega_g);
Parte1=r{i}*(u - 2.14*omega_g^2)^2;
Parte2=q{i}*(Pref - u*omega_g)^2;
Au2=b2*q{i}*omega_g/DerivCp;
Bu2= -2*b2*r{i}*2.14*omega_g/DerivCp - b2*q{i}*Pref/DerivCp + r{i} + q{i}*omega_g^2;
Cu2= -( -2*b2*r{i}*2.14^2*omega_g^3/DerivCp + r{i}*2.14*omega_g^2 + q{i}*Pref*omega_g );
raizes = roots([Au2 Bu2 Cu2]);
raizMin = min(raizes);
raizMax = max(raizes);
if raizMin>0
ut3=raizMin;
else
ut3=raizMax;
end
u=ut3;
flag=['markov'];
if u<0
disp('socorro. u negativo')
end
flag = ['markov'];
end
if px==2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Jockerman interpretado Yolanda
if (leer<1129)
u = 2.14*omega_g^2;
elseif (leer>1165)
u = Pref/omega_g;
else
alpha = -leer/36 + 1165/36;
u = alpha*2.14*omega_g^2 + (1-alpha)*Pref/omega_g;
end
flag=['jocker'];
end
if px==3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Regra chaveado Chino
if (wind<11.4)
u = 2.14*omega_g^2;
else
u = Pref/omega_g;
end
flag=['chino'];
end[/code]
This is the block diagram it was running until the MATLAB version changes.
https://drive.google.com/file/d/1PBhWsKo4T62aR8A4Bj_pLO70dG70ihiq/view
The script now is presenting the following errors:
I’ve searched about these errors I found the following topic:
https://www.mathworks.com/matlabcentral/answers/259203-s-function-does-not-exist
Then I considered that the problem can be the MATLAB version, but still couldn’t install any of them that could run the script.
Can you recommend a block diagram that I can run these already implemented controls?
I’m really grateful for your help.