%create_acm_calfile
%  a routine for manual entry of ACM calibration constants and creation
%  of the mat file that will be accessed by the MMP_pgrid routine

disp(['Routine for manual entry of ACM calibration constants']);

	disp([' ']);

		serial_ID=input('Enter serial number ID of this ACM sensor : ');
                myname=input('Enter your name :  ','s');
         	disp([' '])
                spinperson=input('Enter the name of the person who did the ACM spin test:   ','s');
                spindate=input('Enter the date of ACM spin test:    ','s');
         	disp([' '])
                coefperson=input('Enter the name of the person who decided on these final coeffients:   ','s');
                coefdate=input('Enter the date that these final coefficients were determined:    ','s');
                coeffile=input('For reference, enter the path and name of the data file those coefficients are in:  ','s');
         	disp([' '])
         	disp([' '])
         	disp(['Enter any specific comments which need to be carried along']);
         	disp(['regarding this sensor and it''s calibration:']);
         	disp(['(Do not press return until finished with comments!)']);
                disp(' ');
                comments=input('         ','s');
                create_date=date;

         	disp([' '])
        	disp([' ']);
disp([' We begin with the compass coefficients from the following: ']);
disp(['  [(aHx-Hx_bias)/Hx_range]^2 + [(aHy-Hy_bias)/Hy_range]^2 = 1']);

	disp([' ']);
		Hx_bias=input('Enter Hx_bias: ');
		Hy_bias=input('Enter Hy_bias: ');
		Hx_range=input('Enter Hx_range: ');
		Hy_range=input('Enter Hy_range: ');

	disp([' ']);
disp([' Now for the direction bias that appears in this equation: ']);
disp([' true_direction = dir_sign*atan2(hy,hx)+compass_bias ']);

	disp([' ']);
		dir_sign=input('Enter dir_sign as +1 or -1: ');

	disp([' ']);
		compass_bias=input('Enter the compass_bias: ');
	disp([' ']);
	disp([' ']);

disp([' Next we input the velocity sensor biases and scale factor as: ']);
disp([' true_speed = (raw_speed-bias) * velocity_scale ']);

	disp([' ']);
		Vab_bias=input('Enter Vab_bias: ');
		Vcd_bias=input('Enter Vcd_bias: ');
		Vef_bias=input('Enter Vef_bias: ');
		Vgh_bias=input('Enter Vgh_bias: ');

	disp([' ']);
		velocity_scale=input('Enter the velocity_scale:');
		
	disp([' ']);
	disp([' ']);
outfile=input('FINALLY, Please enter the path and name of the new file to write with these data: ','s');

                documentation=(['This matlab file, ',outfile,',',...
                sprintf('\n'),'     was created by ',myname,' on ',date,...
                sprintf('\n'),'     using mfile, create_acm_calfile.m.',...
                sprintf('\n'),...
                sprintf('\n'),'The coefficient terms  were determined by looking at various aspects',...
                sprintf('\n'),'    of the laboratory spin test data and, also, the actual at-sea data.',...
                sprintf('\n'),...
                sprintf('\n'),'The spin test was performed by ',spinperson,'  on ',spindate,'.  ',...
                sprintf('\n'),'Coefficient analyses were performed by ',coefperson,'  on ',coefdate,' .  ',...
                sprintf('\n'),...
                sprintf('\n'),'The name of ',coefperson,'''s output coefficient file is:    ',...
                sprintf('\n'),'        ',coeffile,...
                sprintf('\n'),sprintf('\n'),sprintf('\n'),'Special comments:  ',sprintf('\n'),comments]);

eval(['save ',outfile,' serial_ID Hx_bias Hx_range Hy_bias Hy_range dir_sign compass_bias Vab_bias Vcd_bias ',...
      'Vef_bias Vgh_bias velocity_scale documentation']);



