?? ssts__tether_mmet_iii_discrete_force_sfunction.m
字號:
function [sys,x0,str,ts] = SSTS__tether_MMET_III_discrete_force_sfunction(t,x,u,flag,NN)
% /*M-FILE Function SSTS__tether_MMET_III_discrete_force_sfunction MMM SSTSLAB */
% /*==================================================================================================
% Simple Space Tether Simulation Laboratory Toolbox for Matlab 7.x
%
% Copyright 2007 The SxLAB Family - Yi Chen - leo.chen.yi@gmail.com
% ====================================================================================================
%File description:
% this sfunction is to calculate the discrete force for each point masses
% from 1~N ( MMET-III axial model with discrete point masses )
%
%Input:
%
% t -- time [Not modify]
% x -- state of s funciton [Not modify]
% u -- inputs vector , where [by user]
% u(1) -- N, number of point masses ( 20 in default)
% u(2) -- ro, tether density - kg/(m^3)
% u(3) -- sectional_area,tether cross-section - m^2
% u(4) -- length, tether length - m
% u(5) -- mass of payload - kg
% u(6) -- velocity_psi, angular velocity - rad/s
% flag -- flat status [No modify]
% option -- 1 ,'+'
% 2 ,'-'
%Output:
% sys -- outputs vector [by user]
% x0 -- sfunction std output [Not modify]
% str -- sfunction std output [Not modify]
% ts -- sfunction std output [Not modify]
%
% Appendix comments:
% follow the example of timestwo.m, provide by matlab
%
% Usage:
%
%
%===================================================================================================
% See Also: SSTS__tether_MMET_III_discrete_force_sfunction
% SSTS__tether_MMET_II_discrete_number_sfunction_II
% SSTS__tether_MMET_II_discrete_number_sfunction_III
%
%===================================================================================================
%
%===================================================================================================
%Revision -
%Date Name Description of Change email Location
%26-Jan-2007 Chen Yi Initial chenyi2005@gmail.com Glasgow
%HISTORY$
%==================================================================================================*/
% SSTS__tether_MMET_III_discrete_force_sfunction Begin
% The following outlines the general structure of an S-function.
switch flag,
case 0,
[sys,x0,str,ts] = mdlInitializeSizes( NN );
case 3
sys = mdlOutputs(t,x,u);
%%%%%%%%%%%%%%%%%%%
% Unhandled flags %
%%%%%%%%%%%%%%%%%%%
% There are no termination tasks (flag=9) to be handled.
% Also, there are no continuous or discrete states,
% so flags 1,2, and 4 are not used, so return an emptyu
% matrix
case { 1, 2, 4, 9 }
sys=[];
otherwise
error(['Unhandled flag = ',num2str(flag)]);
end
% SSTS__tether_MMET_III_discrete_force_sfunction End
%=============================================================================
% mdlInitializeSizes
% Return the sizes, initial conditions, and sample times for the S-function.
%=============================================================================
%
function [sys,x0,str,ts]=mdlInitializeSizes( NN )
% %load data from mat file
% load('SSTS__tether_MMET_III_Point_Mass_Number.mat');
% %set variables according to the order in SSTS__tether_MMET_III.mdl
% % mat file always have simulation time as the first line
% % save('SSTS__tether_MMET_III_Point_Mass_Number.mat', 'N_number');
% NN = N_number(2,1);
% %with 2 end point
%Point Masses Number
% NN = 20;
sizes = simsizes;
sizes.NumContStates = 0;
sizes.NumDiscStates = 0; % x
sizes.NumOutputs = NN/2; % sys
sizes.NumInputs = 6; % u
sizes.DirFeedthrough = 1; % if 0, not direct feedthrough, we need have flag = 2
% if 1, has direct feedthrough, we dont need
% flag = 2 ,
sizes.NumSampleTimes = 1; % at least one sample time is needed
sys = simsizes(sizes);
str = []; % str is always an empty matrix
x0 = []; % initialize the initial conditions
ts = [-1 0]; % inherited sample time ,initialize the array of sample times
% end mdlInitializeSizes
%=============================================================================
% mdlOutputs
% Return the output vector for the S-function
%=============================================================================
%
function sys = mdlOutputs(t,x,u)
% [sys] =sum_point_mass(u,option);
[ sys ]= SSTS__tether_MMET_III_discrete_number_force(u(1),u(2),u(3),u(4),u(5),u(6));
% u(1) -- N, number of point masses ( 20 in default)
% u(2) -- ro, tether density - kg/(m^3)
% u(3) -- sectional_area,tether cross-section - m^2
% u(4) -- length, tether length - m
% u(5) -- mass of payload - kg
% u(6) -- velocity_psi, angular velocity - rad/s
% end mdlOutputs
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -