Home > pointing > mount2apparent.m

mount2apparent

PURPOSE ^

function d=mount2apparent(d)

SYNOPSIS ^

function d=mount2apparent(d)

DESCRIPTION ^

  function d=mount2apparent(d)

 Convert ideal iaz,iel to model maz,mel using pointing model
 parameters tm

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function d=mount2apparent(d)
0002 %  function d=mount2apparent(d)
0003 %
0004 % Convert ideal iaz,iel to model maz,mel using pointing model
0005 % parameters tm
0006 
0007 d2r=pi/180;
0008 
0009 % first we get the values of all our parameters, etc etc.
0010 mount_az = d.antenna0.servo.az*d2r;
0011 mount_el = d.antenna0.servo.el*d2r;
0012 
0013 model(:,1)=d.antenna0.tracker.flexure(:,1);
0014 model(:,2)=d.antenna0.tracker.flexure(:,2);
0015 model(:,3)=d.antenna0.tracker.tilts(:,1);
0016 model(:,4)=d.antenna0.tracker.tilts(:,2);
0017 model(:,5)=d.antenna0.tracker.tilts(:,3);
0018 model(:,6)=d.antenna0.tracker.fixedCollimation(:,1);
0019 model(:,7)=d.antenna0.tracker.fixedCollimation(:,2);
0020 model(:,8)=d.antenna0.tracker.encoder_off(:,1);
0021 model(:,9)=d.antenna0.tracker.encoder_off(:,2);
0022 
0023 model = model*d2r;
0024 
0025 % now we work our way back.
0026 
0027 % refraction correction.
0028 % need to re-interpolate the utc for the refraction corrections.
0029 Avals = d.antenna0.tracker.refraction(:,1);
0030 Bvals = d.antenna0.tracker.refraction(:,2);
0031 A = interp1(d.array.frame.utc, Avals, d.antenna0.receiver.utc);
0032 B = interp1(d.array.frame.utc, Bvals, d.antenna0.receiver.utc);
0033 % apply refraction corrections
0034 Pvals = d.array.weather.pressure;
0035 Tvals = d.array.weather.airTemperature;
0036 P = interp1(d.array.frame.utc, Pvals, d.antenna0.receiver.utc);
0037 T = interp1(d.array.frame.utc, Tvals, d.antenna0.receiver.utc);
0038 
0039 R = 0.00452.*P./( (273.15+T ).*tan(mount_el))*pi/180;
0040 el = mount_el - R;
0041 
0042 % Encoder zero points
0043 az = mount_az - model(8);
0044 el = el - model(9);
0045 
0046 % El collimation
0047 % Exactly the same as el zero point shift
0048 el = el - model(7);
0049 
0050 % Cross-el Collimation
0051 el = asin(sin(el).*cos(model(6)));
0052 el(imag(el)~=0) = nan;
0053 az = az + asin(-sin(model(6))./cos(el));
0054 az(imag(az)~=0) = nan;
0055 
0056 
0057 % El tilt
0058 el = asin(sin(el).*cos(model(5)));
0059 el(imag(el)~=0)=NaN;
0060 az = az + asin(tan(model(5)).*sin(el)./cos(el));
0061 az(imag(az)~=0)=NaN;
0062 
0063 % Az tilt
0064 
0065 % astronomy az is clockwise from north
0066 % but want to work in frame with az anticlock from x as for matlab
0067 % sph2cart function etc. Also x-east, y-north, z-up seems most
0068 % natural.
0069 az = -az + pi/2;
0070 % Get normal vector to tilt plane
0071 c=cross([1,0,tan(model(3))],[0,1,tan(-model(4))]);
0072 % Find magnitude and dir of tilt
0073 phi=atan2(c(2),c(1));
0074 theta=atan(sqrt(c(1)^2+c(2)^2)/c(3));
0075 % Apply rotation
0076 [x,y,z]=sph2cart(az,el,ones(size(az)));
0077 [x,y,z]=rotaboutz(x,y,z,+phi);  % rotate to x along tilt dir
0078 [x,y,z]=rotabouty(x,y,z,-theta); % rotate by negative tilt angle
0079 [x,y,z]=rotaboutz(x,y,z,-phi);   % rotate back
0080 [az,el]=cart2sph(x,y,z);
0081 % Convert back to az clock from north
0082 az = -az + pi/2;
0083 
0084 
0085 % Flexure
0086 toc
0087 tic 
0088 for m=1:length(el)
0089   el(m) = fzero(@(x) (x-model(2)*cos(x) - el(m)), el(m));
0090   el(m) = fzero(@(x) (x-model(1)*sin(x) - el(m)), el(m));
0091 end
0092 toc
0093 
0094 % and now, refraction corrections.
0095 
0096 
0097 return

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