clear % INITIALIZE DDE CHANNEL chan1 = DDEInit('OSLODDE', 'OSLO_Command'); % OPEN LENS FILE IN OSLO chk = DDEExec (chan1, 'open len pri len gem_simple.len'); if chk ~=1 error('Cannot open lens file') end % DECENTER THE SECONDARY (3rd SURFACE) IN X DIRECTION surface = '3'; % surface label dir = 'x'; % direction of decenter x_decenter = 0.1; % amount of decenter data = num2str(x_decenter); message = ['dc' dir ' ' surface ' ' data]; chk = DDEExec (chan1,message); if chk ~=1 error('Cannot execute OSLO command') end % TILT THE SECONDARY (3rd SURFACE) ABOUT X AXIS surface = '3'; % surface label dir = 'a'; % axis of tilt x_tilt = 0.2; % amount of tilt data = num2str(x_tilt); message = ['tl' dir ' ' surface ' ' data]; chk = DDEExec (chan1,message); if chk ~=1 error('Cannot execute OSLO command') end % DO THE RAYTRACE message = ['sbr']; % spreadsheet buffer reset chk = DDEExec (chan1,message); if chk ~=1 error('Cannot reset the spreadsheet in OSLO') end message = ['trr']; % trace reference ray chk = DDEExec (chan1,message); if chk ~=1 error('Cannot trace reference ray in OSLO') end % RETRIVE THE RAY INTERCEPT IN THE PUPIL message = '+ssb(3,1)'; % y coordinate of intercept y_intercept = DDEReq(chan1, message); message = '+ssb(3,2)'; % x coordinate of intercept x_intercept = DDEReq(chan1, message); % CLOSE DDE CHANNEL DDETerm (chan1);