function [state_eq, obser_eq, Nx, Ny, Nu, NparSys, Nparam, NparID, dt, Ndata, ... t, Z, Uinp, param, parFlag, x0, iSD, SDyError] = mDefCase04bm(test_case) % 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) % Constants d2r = pi/180; r2d = 180/pi; %---------------------------------------------------------------------------------------- % Model definition state_eq = 'xdot_TC04b_hfb_lon'; % Function for state equations obser_eq = 'obs_TC04b_hfb_lon'; % Function for observation equations Nx = 4; % Number of states Ny = 4; % 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=4, Nu=1') %---------------------------------------------------------------------------------------- % Load flight data for Nzi time segments to be analyzed and concatenate global loop_count target_file = sprintf('../CVS_IGNORE/flight_log_true.csv', loop_count); if loop_count > 0 target_file = sprintf('../CVS_IGNORE/flight_log_%03d.csv', loop_count - 1); end disp(['Target file = ', target_file]); data = load(target_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 Z = [data(:,3),data(:,4),data(:,5),data(:,6)]; % 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 = [-1.00000D+00; 1.00000D+00; ... -1.00000D+00; -1.00000D+02; -1.00000D+00; -1.00000D+01; ... 0.00000D-00; -1.00000D+01; -1.00000D+01; -1.00000D+02; ... 1.00000D+00; 1.00000D-01; 1.00000D-01; 1.00000D-00]; % Flags for free and fixed parameters parFlag = [1; 1; ... 1; 1; 1; 1; ... 1; 1; 1; 1; ... 1; 1; 1; 1]; % Total number of free parameters NparID = size(find(parFlag~=0),1); % Initial conditions on state variables V, alpha, theta, q x0 = [mean(Z(1:50,1)); mean(Z(1:50,2)); mean(Z(1:50,3)); mean(Z(1:50,4))]; %x0 = [17.0; 0*d2r; 0*d2r; 0.0]; % Initial R: Default (iSD=0) or specified as standard-deviations of output errors SDyError = []; % SDyError = zeros(Ny,1); %iSD = 1; %SDyError = [1D+00; 1D-04; 1D-02; 1D-02]; % if iSD=1, specify SD for Ny outputs