function [state_eq, obser_eq, Nx, Ny, Nu, NparSys, Nparam, NparID, dt, Ndata, ... t, Z, Uinp, param, parFlag, x0, iSD, SDyError, output_file] = mDefCase04cm(test_case, target_log) % Definition of model, flight data, initial values etc. % test_case = 4 -- Longitudinal motion: HFB-320 Aircraft % Nonlinear model in terms of non-dimensional derivatives as function of % variables in the stability axes (V, alfa): % states - V, alpha, theta, q % outputs - V, alpha, theta, q, qdot, ax, az % inputs - de, thrust % % Inputs % test_case test case number % % Outputs % state_eq function to code right hand sides of state equations % obser_eq function to code right hand sides of observation equations % Nx number of states % Ny number of observation variables % Nu number of input (control) variables % NparSys number of system parameters % Nparam total number of system and bias parameters % NparID total number of parameters to be estimated (free parameters) % dt sampling time % Ndata total number of data points for Nzi time segments % t time vector % Z observation variables: Data array of measured outputs (Ndata,Ny) % Uinp input variables: Data array of measured input (Ndata,Nu) % param initial starting values for unknown parameters (aerodynamic derivatives) % parFlag flags for free and fixed parameters % x0 initial conditions on state variables % iSD Flag to specify optionally initial R (default; 0) % SDyError standard-deviations of output errors to compute initial covariance % matrix R (required only for iSD ~= 0) if (nargin < 1), target_log = 0; end % Constants d2r = pi/180; r2d = 180/pi; %---------------------------------------------------------------------------------------- % Model definition state_eq = 'xdot_TC04b_hfb_lon'; % Function for state equations obser_eq = 'obs_TC04c_hfb_lon'; % Function for observation equations Nx = 4; % Number of states Ny = 6; % Number of observation variables Nu = 1; % Number of input (control) variables NparSys = 10; % Number of system parameters Nparam = NparSys + Nx; % Total number of parameters to be estimated dt = 0.02; % Sampling time iSD = 0; % Initial R option (default; 0) disp(['Test Case = ', num2str(test_case)]); disp('Longitudinal motion, nonlinear model -- Business Jet R/C without dt: Nx=4, Ny=6, Nu=1') %---------------------------------------------------------------------------------------- % Load flight data for Nzi time segments to be analyzed and concatenate log_file = sprintf('../CVS_IGNORE/flight_log_true.csv'); output_file = sprintf('../CVS_IGNORE/FEM_out_true_%d.csv', test_case); if target_log > 0, log_file = sprintf('../CVS_IGNORE/flight_log_%03d.csv', target_log - 1); output_file = sprintf('../CVS_IGNORE/FEM_out_%03d_%d.csv', target_log - 1, test_case); end disp(['Target file = ', log_file]); data = load(log_file); % Number of data points Ndata = size(data,1); izhf = Ndata; % Generate new time axis t = [0:dt:Ndata*dt-dt]'; % Observation variables V, alpha, theta, q, axcg, azcg Z = [data(:,3),data(:,4),data(:,5),data(:,6),data(:,8),data(:,9)]; % Input variables de Uinp = [data(:,2)]; % Initial starting values for unknown parameters (aerodynamic derivatives) % Xu, Xa, Zu, Za, Zq, Zde, Mu, Ma, Mq, Mde, f11, f22, f33, f44 param = [-3.00000D-01; 2.00000D+00; ... -1.00000D-00; -1.00000D+02; -3.00000D-00; -9.00000D-00; ... 0.00000D-00; -4.00000D+01; -8.00000D-00; -1.00000D+02; ... 1.00000D-04; 1.00000D-08; 1.00000D-08; 1.00000D-06]; % 真値の場合 if target_log > 0, param = [-1.00000D+00; 1.00000D+01; ... -1.00000D+01; -1.00000D+02; -1.00000D+01; -1.00000D+01; ... 1.00000D-02; -1.00000D+02; -1.00000D+01; -1.00000D+02; ... 1.00000D+00; 1.00000D-02; 1.00000D-02; 1.00000D+00]; end % Flags for free and fixed parameters parFlag = [1; 1; ... 1; 1; 1; 1; ... 1; 1; 1; 1; ... 0; 0; 0; 0]; % 真値の場合 if target_log > 0, parFlag = [1; 1; ... 1; 1; 1; 1; ... 1; 1; 1; 1; ... 1; 1; 1; 1]; end % Total number of free parameters NparID = size(find(parFlag~=0),1); % Initial conditions on state variables u, alpha, theta, q x0 = [3; 1*d2r; 1*d2r; 1*d2r]; % Initial R: Default (iSD=0) or specified as standard-deviations of output errors SDyError = []; % SDyError = zeros(Ny,1); % iSD = 1; % SDyError = [.....]'; % if iSD=1, specify SD for Ny outputs % トリム状態における対気速度[m/s], 下方向速度[m/s], ピッチ角(安定軸), ピトー管オフセット global stables; stables = [17.0; 0; 0 * d2r; 0];