% ------------------------------------------------------------------------------
% Print FLNTU sensor technical data in output CSV file.
%
% SYNTAX :
%  print_sensor_tech_data_in_csv_file_ir_rudics_sbd2_FLNTU( ...
%    a_cycleNum, a_profNum, a_dataIndexList, ...
%    a_sensorTechFLNTU)
%
% INPUT PARAMETERS :
%   a_cycleNum        : cycle number of the packet
%   a_profNum         : profile number of the packet
%   a_dataIndex       : index of the packet
%   a_sensorTechFLNTU : FLNTU technical data
%
% OUTPUT PARAMETERS :
%
% EXAMPLES :
%
% SEE ALSO :
% AUTHORS  : Jean-Philippe Rannou (Altran)(jean-philippe.rannou@altran.com)
% ------------------------------------------------------------------------------
% RELEASES :
%   02/11/2013 - RNU - creation
% ------------------------------------------------------------------------------
function print_sensor_tech_data_in_csv_file_ir_rudics_sbd2_FLNTU( ...
   a_cycleNum, a_profNum, a_dataIndexList, ...
   a_sensorTechFLNTU)

% current float WMO number
global g_decArgo_floatNum;

% output CSV file Id
global g_decArgo_outputCsvFileId;

% unpack the input data
a_sensorTechFLNTUNbPackDesc = a_sensorTechFLNTU{1};
a_sensorTechFLNTUNbPackDrift = a_sensorTechFLNTU{2};
a_sensorTechFLNTUNbPackAsc = a_sensorTechFLNTU{3};
a_sensorTechFLNTUNbMeasDescZ1 = a_sensorTechFLNTU{4};
a_sensorTechFLNTUNbMeasDescZ2 = a_sensorTechFLNTU{5};
a_sensorTechFLNTUNbMeasDescZ3 = a_sensorTechFLNTU{6};
a_sensorTechFLNTUNbMeasDescZ4 = a_sensorTechFLNTU{7};
a_sensorTechFLNTUNbMeasDescZ5 = a_sensorTechFLNTU{8};
a_sensorTechFLNTUNbMeasDrift = a_sensorTechFLNTU{9};
a_sensorTechFLNTUNbMeasAscZ1 = a_sensorTechFLNTU{10};
a_sensorTechFLNTUNbMeasAscZ2 = a_sensorTechFLNTU{11};
a_sensorTechFLNTUNbMeasAscZ3 = a_sensorTechFLNTU{12};
a_sensorTechFLNTUNbMeasAscZ4 = a_sensorTechFLNTU{13};
a_sensorTechFLNTUNbMeasAscZ5 = a_sensorTechFLNTU{14};
a_sensorTechFLNTUSensorState = a_sensorTechFLNTU{15};
a_sensorTechFLNTUCoefScaleChloro = a_sensorTechFLNTU{16};
a_sensorTechFLNTUDarkCountChloro = a_sensorTechFLNTU{17};
a_sensorTechFLNTUCoefScaleTurbi = a_sensorTechFLNTU{18};
a_sensorTechFLNTUDarkCountTurbi = a_sensorTechFLNTU{19};

% select the data (according to a_cycleNum and a_profNum)
idPack = find((a_sensorTechFLNTUNbPackDesc(a_dataIndexList, 1) == a_cycleNum) & ...
   (a_sensorTechFLNTUNbPackDesc(a_dataIndexList, 2) == a_profNum));

for id = 1:length(idPack)
   idP = a_dataIndexList(idPack(id));

   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; FLNTU tech; Nb packets for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechFLNTUNbPackDesc(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; FLNTU tech; Nb packets for drift; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechFLNTUNbPackDrift(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; FLNTU tech; Nb packets for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechFLNTUNbPackAsc(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; FLNTU tech; Nb bins in zone 1 for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechFLNTUNbMeasDescZ1(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; FLNTU tech; Nb bins in zone 2 for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechFLNTUNbMeasDescZ2(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; FLNTU tech; Nb bins in zone 3 for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechFLNTUNbMeasDescZ3(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; FLNTU tech; Nb bins in zone 4 for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechFLNTUNbMeasDescZ4(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; FLNTU tech; Nb bins in zone 5 for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechFLNTUNbMeasDescZ5(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; FLNTU tech; Nb bins for drift; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechFLNTUNbMeasDrift(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; FLNTU tech; Nb bins in zone 1 for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechFLNTUNbMeasAscZ1(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; FLNTU tech; Nb bins in zone 2 for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechFLNTUNbMeasAscZ2(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; FLNTU tech; Nb bins in zone 3 for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechFLNTUNbMeasAscZ3(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; FLNTU tech; Nb bins in zone 4 for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechFLNTUNbMeasAscZ4(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; FLNTU tech; Nb bins in zone 5 for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechFLNTUNbMeasAscZ5(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; FLNTU tech; Sensor state indicator (1:Ok, 0:Ko); %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechFLNTUSensorState(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; FLNTU tech; Chloro.: scale fact. coef; %s\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      num_2_str(a_sensorTechFLNTUCoefScaleChloro(idP, 3)));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; FLNTU tech; Chloro.: dark count coef; %s\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      num_2_str(a_sensorTechFLNTUDarkCountChloro(idP, 3)));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; FLNTU tech; Turbidity: scale fact. coef; %s\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      num_2_str(a_sensorTechFLNTUCoefScaleTurbi(idP, 3)));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; FLNTU tech; Turbidity: dark count coef; %s\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      num_2_str(a_sensorTechFLNTUDarkCountTurbi(idP, 3)));
end

return
