I simulated the following function on matlab. now trying to simulate it on simulink. in the uploaded image the simulink block structure can be seen where i assumed a constant for (Tb),but i should implement it as a function shown in the matlab text.
조회 수: 2 (최근 30일)
이전 댓글 표시
function dudt = first_order2(u,kd,cd,ct,Tt,Jt,Jb,WOB,Ls,Lk,Ld,Lstr)
% u(1) = ot; u(2) = wt; u(3) = ob; u(4) = wb
%R = 0.0492;
%dc = 3.7186;
Tst = cd * (u(2) - u(4)) + kd *(u(1) - u(3));
Tcf = (2/3) * Ls * WOB;
%if u(4) * Ld <= 0.3
% fun = @(r) 2 * WOB / R^2 * (r.^2. * ((Lk/R) + ((Ls/R) - (Lk/R))*exp(-dc*u(4)*r)));
% Tdr = integral(fun,0,R);
%else
Tdr = ((2/3) * Lk * WOB) + (2 * WOB * (Ls - Lk) / (Ld^3 * u(4)^3)) * (2 - exp(-Ld*u(4)) * (Ld^2 * u(4)^2 + 2 * Ld * u(4) + 2)) + (0.5 * WOB * Lstr * u(4));
%end
if abs(u(4)) <= 0.001 && Tst < Tcf
Tb = sign(u(4))*Tst;
elseif abs(u(4)) <= 0.001 && Tst >= Tcf
Tb = sign(u(4))*Tcf;
elseif abs(u(4)) > 0.001
Tb = sign(u(4))*Tdr;
end
dudt = zeros(4,1);
dudt(1) = u(2);
dudt(2) =(-(cd + ct) * u(2) + cd * u(4) - kd * u(1) + kd * u(3) + Tt) / Jt;
dudt(3) = u(4);
dudt(4) = (cd * u(2) - cd * u(4) + kd * u(1) - kd * u(3) - Tb) / Jb;
end
댓글 수: 0
채택된 답변
Aquatris
2018년 7월 17일
You have a couple options for implementing the Tb variable. One possibility is to use Switch Block to mimic the if conditions. Another one is to use Matlab Function Block and type your if statements inside to change Tb values.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Pole and Zero Locations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!