风力涡轮机故障检测和隔离方法

免费下载用于风力涡轮机故障检测和隔离方法Matlab代码(http://www.apollocode.net/a/1062.html)

function [sys,x0,str,ts] = Detection_pitch(t,x,u,flag,A,B,C,L)

switch flag,

  %%%%%%%%%%%%%%%%%%

  % Initialization %

  %%%%%%%%%%%%%%%%%%

  case 0,

    [sys,x0,str,ts]=mdlInitializeSizes;

  %%%%%%%%%%%%%%%

  % Derivatives %

  %%%%%%%%%%%%%%%

  case 1,

    sys=mdlDerivatives(t,x,u,A,B,C,L);

  %%%%%%%%%%%

  % Outputs %

  %%%%%%%%%%%

  case 3,

    sys=mdlOutputs(t,x,u,C);

  %%%%%%%%%%%%%%%%%%%

  % Unhandled flags %

  %%%%%%%%%%%%%%%%%%%

  case { 2, 4, 9 },

    sys = [];

  %%%%%%%%%%%%%%%%%%%%

  % Unexpected flags %

  %%%%%%%%%%%%%%%%%%%%

  otherwise

    error(['Unhandled flag = ',num2str(flag)]);

end

% end csfunc

%

%=============================================================================

% mdlInitializeSizes

% Return the sizes, initial conditions, and sample times for the S-function.

%=============================================================================

%

function [sys,x0,str,ts]=mdlInitializeSizes

sizes = simsizes;

sizes.NumContStates  = 2;

sizes.NumDiscStates  = 0;

sizes.NumOutputs     = 1;

sizes.NumInputs      = 2;

sizes.DirFeedthrough = 1;

sizes.NumSampleTimes = 1;

sys = simsizes(sizes);

x0  = [0 0 ]' ;

str = [];

ts  = [0 0];

% end mdlInitializeSizes

%

%=============================================================================

% mdlDerivatives

% Return the derivatives for the continuous states.

%=============================================================================

%

function sys=mdlDerivatives(t,x,u,A,B,C,L)

y = u(1); 

control = u(2);

x_est = x(1:2);

y_est = C*x_est;

sys = [ A*x_est + B*control + L*(y-y_est) ];

   

% end mdlDerivatives

%

%=============================================================================

% mdlOutputs

% Return the block outputs.

%=============================================================================

%

function sys=mdlOutputs(t,x,u,C)

x_est = x(1:2);

y_est = C*x_est;

sys = [y_est ]; 

%end mdlOutputs

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值