Home > pointing > calcAzEl.m

calcAzEl

PURPOSE ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

SYNOPSIS ^

function [az, el] = calcAzEl(d)

DESCRIPTION ^

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 function [az, el] = calcAzEl(d, secOff)

  calculates the azimuth and elevation of the source to be tracked.

  sjcm
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [az, el] = calcAzEl(d)
0002 
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 %
0005 % function [az, el] = calcAzEl(d, secOff)
0006 %
0007 %  calculates the azimuth and elevation of the source to be tracked.
0008 %
0009 %  sjcm
0010 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0011 
0012 % %
0013 utc = d.antenna0.receiver.utc;
0014 
0015 % need to re-interpolate the utc for the refraction corrections.
0016 Avals = d.antenna0.tracker.refraction(:,1);
0017 Bvals = d.antenna0.tracker.refraction(:,2);
0018 A = interp1(d.array.frame.utc, Avals, utc,'spline');
0019 B = interp1(d.array.frame.utc, Bvals, utc,'spline');
0020 % apply refraction corrections
0021 Pvals = d.array.weather.pressure;
0022 Tvals = d.array.weather.airTemperature;
0023 P = interp1(d.array.frame.utc, Pvals, utc,'spline');
0024 T = interp1(d.array.frame.utc, Tvals, utc,'spline');
0025 
0026 long=-118.2822;
0027 lat=37.2339;
0028 el=1222.00;
0029 
0030 % now we calculate the lst
0031 %jd = utc + 2400000.5;
0032 %jd0 = floor(utc) + 2400000.5;
0033 %H = 24*(jd - jd0);
0034 %D = jd - 2451545.0;
0035 %D0 = jd0 - 2451545.0;
0036 
0037 % now we get the LST:
0038 %GMT = 6.697374558 + 0.06570982441908*D0 + 1.00273790935*H;
0039 %GMT = rem(GMT, 24);
0040 %eps = 23.4393 - 0.0000004*D;
0041 %L = 280.47 + 0.98565*D;
0042 %omega = 125.04 - 0.052954*D;
0043 %deltaPsi = -0.000319*sin(omega) - 0.000024*sin(2*L);
0044 %eqeq = deltaPsi.*cos(eps);
0045 %GAST = GMT + eqeq;
0046 %lst2 = GAST + long/15;
0047 %lst2(lst2<0) = lst2(lst2<0)+24;
0048 %lst = lst2*15;
0049 lst = d.antenna0.tracker.lst*15;
0050 indpos = lst > 180;
0051 lst(indpos) = lst(indpos)-360;
0052 
0053 
0054 lst = interp1(d.array.frame.utc, lst, utc); % in degrees
0055 indpos = interp1(d.array.frame.utc, indpos, utc, 'nearest');
0056 indpos(isnan(indpos)) = 0;
0057 indpos = logical(indpos);
0058 lst(indpos) = lst(indpos)+360;
0059 
0060 % now for hour angle:
0061 ra = interp1(d.array.frame.utc, d.antenna0.tracker.equat_geoc(:,1), utc);
0062 ra = ra*15; % in degrees
0063 dec = interp1(d.array.frame.utc, d.antenna0.tracker.equat_geoc(:,2), utc); % in degrees
0064 ha = lst - ra;  % also in degrees
0065 
0066 % convert all to radians:
0067 HA = ha*pi/180;
0068 de = dec*pi/180;
0069 La = lat*pi/180;
0070 
0071 [az, el] = hdl2ae(unwrap(HA),de,La);
0072 
0073 % apply refraction correction.
0074 R = 0.00452.*P./( (273.15+T ).*tan(el))*pi/180;
0075 el = el+R;
0076 
0077 az = az*180/pi;
0078 el = el*180/pi;
0079 az(az<0) = az(az<0)+360;
0080 % we need to add the online pointing model applied
0081 model = [d.antenna0.tracker.flexure(1,:), d.antenna0.tracker.tilts(1,:), ...
0082       d.antenna0.tracker.fixedCollimation(1,:), ...
0083       d.antenna0.tracker.encoder_off(1,:)];
0084 
0085 % apply the pointing model
0086 [az, el] = pointing_model(model, az, el);
0087 
0088 return;

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005