Home > matutils > calcAzEl2.m

calcAzEl2

PURPOSE ^

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

SYNOPSIS ^

function [az, el] = calcAzEl2(az,el,d)

DESCRIPTION ^

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

 function [az, el] = calcAzEl2(az,el,d)
 
  applies the corrections to the a set of az/el values (az,el inputs)in order to
  iteratively remove the poining corrections. Uses pointing/refraction
  data stored in the d data structure-
  

  charles copley-borrowed from SJCM
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [az, el] = calcAzEl2(az,el,d)
0002 
0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0004 %
0005 % function [az, el] = calcAzEl2(az,el,d)
0006 %
0007 %  applies the corrections to the a set of az/el values (az,el inputs)in order to
0008 %  iteratively remove the poining corrections. Uses pointing/refraction
0009 %  data stored in the d data structure-
0010 %
0011 %
0012 %  charles copley-borrowed from SJCM
0013 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0014 % %
0015 utc = d.antenna0.receiver.utc;
0016 azVal = az;
0017 elVal = el;
0018 
0019 % need to re-interpolate the utc for the refraction corrections.
0020 Avals = d.antenna0.tracker.refraction(:,1);
0021 Bvals = d.antenna0.tracker.refraction(:,2);
0022 A = interp1(d.array.frame.utc, Avals, utc);
0023 B = interp1(d.array.frame.utc, Bvals, utc);
0024 % apply refraction corrections
0025 Pvals = d.array.weather.pressure;
0026 Tvals = d.array.weather.airTemperature;
0027 P = interp1(d.array.frame.utc, Pvals, utc);
0028 T = interp1(d.array.frame.utc, Tvals, utc);
0029 
0030 long =d.antenna0.tracker.siteActual(1,1);
0031 lat  =d.antenna0.tracker.siteActual(1,2);
0032 el   =d.antenna0.tracker.siteActual(1,3);
0033 
0034 % now we calculate the lst
0035 %jd = utc + 2400000.5;
0036 %jd0 = floor(utc) + 2400000.5;
0037 %H = 24*(jd - jd0);
0038 %D = jd - 2451545.0;
0039 %D0 = jd0 - 2451545.0;
0040 
0041 % now we get the LST:
0042 %GMT = 6.697374558 + 0.06570982441908*D0 + 1.00273790935*H;
0043 %GMT = rem(GMT, 24);
0044 %eps = 23.4393 - 0.0000004*D;
0045 %L = 280.47 + 0.98565*D;
0046 %omega = 125.04 - 0.052954*D;
0047 %deltaPsi = -0.000319*sin(omega) - 0.000024*sin(2*L);
0048 %eqeq = deltaPsi.*cos(eps);
0049 %GAST = GMT + eqeq;
0050 %lst2 = GAST + long/15;
0051 %lst2(lst2<0) = lst2(lst2<0)+24;
0052 %lst = lst2*15;
0053 
0054 lst = interp1(d.array.frame.utc, d.antenna0.tracker.lst, utc)*15; % in degrees
0055 
0056 % now for hour angle:
0057 %ra = interp1(d.array.frame.utc, d.antenna0.tracker.equat_geoc(:,1), utc);
0058 %ra = ra*15; % in degrees
0059 %dec = interp1(d.array.frame.utc, d.antenna0.tracker.equat_geoc(:,2), utc); % in degrees
0060 %ha = lst - ra;  % also in degrees
0061 %
0062 %% convert all to radians:
0063 %HA = ha*pi/180;
0064 %de = dec*pi/180;
0065 %La = lat*pi/180;
0066 %
0067 %[az, el] = hdl2ae(HA,de,La);
0068 %az=deg2rad(azVal);
0069 %el=deg2rad(elVal);
0070 
0071 az = azVal*pi/180;
0072 el = elVal*pi/180;
0073 
0074 % apply refraction correction.
0075 R = 0.00452.*P./( (273.15+T ).*tan(el))*pi/180;
0076 el = el+R;
0077 
0078 az = az*180/pi;
0079 el = el*180/pi;
0080 az(az<0) = az(az<0)+360;
0081 
0082 % we need to determine which pointing model to be applied.
0083 model = getPointingModel(d);
0084 
0085 % apply the pointing model
0086 [az, el] = pointing_model(model, az, el);
0087 
0088 %daz = azVal-az;
0089 %del= elVal-el;
0090 return;

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