% sg_calib_constants.m
% establishes glider calibration constants

% This fils is an example and MUST be changed apprpriately for your
% own glider.

% Edited by ESDU, SAMS, 1st May 2017

id_str = '532';

mission_title ='Ellett Array 1';

%From NOCS trimsheet
mass	=	52.0883	;	% from sum on trim sheet
rho0	=	1.027500	;	% from ballast worksheet for "new" environment

% Coeffs
therm_expan	=	7.05000000E-05	;	
temp_ref	=	1.50000000E+01	;	
abs_compress	=	4.18000000E-06	;	
pitchbias	=	0.00000000E+00	;
% % initial hydrodynamic model params		
% % volmax	=	51459	;	% from ballast worksheet final table
% % hd_a	=	3.83600000E-03	;	
% % hd_b	=	1.00780000E-02	;	
% % hd_c	=	9.85000000E-06	;	
% % New params after running regress_vbd during mission
% % ESDU, 04/04/2019
% % 04-Apr-2019 17:57:57 RMS=1.8166 cm/s Ellett Array 1 Dives: 354 355 407 432 457 458 466 474 480 585 620:638 644 649 677 728 737
% volmax = 51396.2;
% hd_a = 3.42645e-03;
% hd_b = 9.04330e-03;
% hd_c = 2.09646e-14;
% Post-mission processing, final coeffs
% 10-Jul-2019 12:52:31 RMS=1.3736 cm/s Ellett Array 1 Dives: 12 66 354 355 407 432 466 474 480 585 649 651 677 728 748 772 992 1002 1010 1013 1057 1078 1081 1087 1088 1264 1625:1633 1635 1636 1641:1648 1650:1658 1665 1666 1674
volmax = 51397.5;
hd_a = 3.42696e-03;
hd_b = 9.31876e-03;
hd_c = 2.00756e-14;
	

% software limits from cal sheet:			
pitch_min_cnts	=	158	;
pitch_max_cnts	=	3890	;
roll_min_cnts	=	284	;
roll_max_cnts	=	3847	;
vbd_min_cnts	=	500	;
vbd_max_cnts	=	3960	;
vbd_cnts_per_cc	=	-4.076707	;
			
% pump parameters			
pump_rate_intercept	=	1.275	;
pump_rate_slope	=	-0.00015	;
pump_power_intercept	=	17.4033	;
pump_power_slope	=	0.017824	;


% CT coefficients - S/N 0224
calibcomm = 'SBE s/n 0228, calibration 03 March 2018';
t_g =  4.40823210e-03 ;
t_h =  6.44404008e-04 ;
t_i =  2.64503275e-05 ; 
t_j =  3.30338531e-06 ;
% Minimum and maximum frequencies (kHz) for reasonable
%  oceanographic values of temperature from SBE calibration
sbe_temp_freq_min = 3.4; % kHz, from cal for 1 deg T
sbe_temp_freq_max = 6.6; % kHz, from cal for 32.5 deg T

c_g = -9.68367062e+00 ;
c_h =  1.14685595e+00 ;
c_i = -2.08214733e-03 ;
c_j =  2.39213522e-04 ;
% Minimum and maximum frequencies (kHz) for reasonable
%  oceanographic values of conductivity SBE calibration
sbe_cond_freq_min = 2.9; % kHz, from cal for 0 salinity
sbe_cond_freq_max = 7.9; % kHz, est for T greater than 32.5 
cpcor = -9.5700e-08 ;
ctcor = 3.2500e-06 ;

% Oxugen optode
comm_oxy_type	='	AA4831	';	% spec  Aa_optode
calibcomm_oxygen	='	SN: 252  CAL: 17-Sep-16	';	% SN and cal date
optode_TempCoef0    =  2.64259E+01;
optode_TempCoef1    =  -3.14944E-02;
optode_TempCoef2    =  3.00714E-06;
optode_TempCoef3    =  -4.37861E-09;
optode_TempCoef4    =  0;
optode_TempCoef5    =  0;
optode_PhaseCoef0=0.0;
optode_PhaseCoef1=1.0;
optode_PhaseCoef2=0.0;
optode_PhaseCoef3=0.0;
optode_FoilCoefA0	=	-2.988314E-06	;
optode_FoilCoefA1	=	-6.137785E-06	;	
optode_FoilCoefA2	=	 1.684659E-03	;	
optode_FoilCoefA3	=	-1.857173E-01	;	
optode_FoilCoefA4	=	 6.784399E-04	;	
optode_FoilCoefA5	=	-5.597908E-07	;	
optode_FoilCoefA6	=	 1.040158E+01	;	
optode_FoilCoefA7	=	-5.986907E-02	;	
optode_FoilCoefA8	=	 1.360425E-04	;	
optode_FoilCoefA9	=	-4.776977E-07	;	
optode_FoilCoefA10	=	-3.032937E+02	;	
optode_FoilCoefA11	=	 2.530496E+00	;	
optode_FoilCoefA12	=	-1.267045E-02	;	
optode_FoilCoefA13	=	 1.040454E-04	;
optode_FoilCoefB0	=	-3.560390E-07   ;
optode_FoilCoefB1	=	 3.816713E+03   ;	
optode_FoilCoefB2	=	-4.475507E-01	;	
optode_FoilCoefB3	=	 4.386164E-01	;	
optode_FoilCoefB4	=	-7.146342E-03	;	
optode_FoilCoefB5	=	 8.906236E-05   ;	
optode_FoilCoefB6	=	-6.343012E-07	;	
optode_FoilCoefB7	=	0;
optode_FoilCoefB8	=	0;
optode_FoilCoefB9	=	0;
optode_FoilCoefB10	=	0;
optode_FoilCoefB11	=	0;
optode_FoilCoefB12	=	0;
optode_FoilCoefB13	=	0;

% Wetlab Aft cal Constants - Sensor SN 1340, Cal 27-Aug-2015
%  Chlorophyll cal Constants
WETLabsCalData.Chlorophyll.darkCounts=48;
WETLabsCalData.Chlorophyll.scaleFactor=0.0121;
WETLabsCalData.Chlorophyll.maxOutput=4130;
WETLabsCalData.Chlorophyll.resolution=1.0;
WETLabsCalData.Chlorophyll.calTemperature=21.3;
%CDOM or Scattering cal Constants
WETLabsCalData.CDOM.maxOutput=4130;
WETLabsCalData.CDOM.scaleFactor=0.0906;
WETLabsCalData.CDOM.darkCounts=46;
WETLabsCalData.CDOM.resolution=1.0;
WETLabsCalData.CDOM.calTemperature=21.3;
% Scattering Sensor 700 None
WETLabsCalData.Scatter700.wavelength=700;
WETLabsCalData.Scatter700.scaleFactor=3.052E-06;
WETLabsCalData.Scatter700.darkCounts=43;
WETLabsCalData.Scatter700.resolution=1.3;
