--+---------------------------------------------------------------------------+ --+ SOHO Project -- Control File --+ ---------------------------- --+ --+ Name : MDI_FOCUS , !Proc_s , !Print --+ Purpose : (See Procedure headers) --+ --+ Sub_system : PLM --+ Drawing No : 3137-ZA042-SCB Issue : A/00 --+ Project No : SH-MAR-SW-70224 --+ Origin : UK --+ Author : Alan TURK --+---------------------------------------------------------------------------+ --+ Principle : --+ --------- --+ Holding CF for a group of related Procedures, originally written in --+ MDI's own Control File language. --+ --+ Passed parameters : --+ ----------------- --+ !Proc_s : Name of required Procedure. --+ !Print : CF Log print indicator ( "yes" (default) | "no" ). --+ --+ Prerequisites : --+ ------------- --+ Control File MDI_ON must have been successfully performed. --+ --+ History : --+ ------- --+ Issue SIC Note Time Date Name/Updates --+ +---+ +------+ +---+ +------+ +----------------------------------------+ --+ 1/01 289 13:42 4/02/94 Ph. IATRINO -- Debug phase. --+ 1/02 360 17:42 19/04/94 Ed COBB -- Rationalization. --+ 1/03 393 17:04 18/05/94 Ed COBB -- MDI Updates. --+ 1/04 544 17:22 01/02/95 Ph IATRINO -- MDI Updates. --+ 1/05 572 16:00 16/03/95 O. MICHEL -- MDI Updates. --+ --+---------------------------------------------------------------------------+ Common Var Bool !GZ_Window -- Open window flag (on CF start) Bool !GZ_Spool -- Automatic Spool (at End of CF exec) Bool !GZ_Halt -- Check Error flag (to halt if error) Bool !GZ_Test -- Execution test flag (to not send TC) Int !GZ_Trace -- Level of Trace (TBD) Int !GM_NbErr -- MDI Global Error Count Int !GM_Conf -- MDI Configuration Int !GM_I0 Int !GM_I9 End Common ------------------------------------------------------------------------------+ Extern Cfile MDI_MODE , PLM_BLOCK , MDI_LIP Group MWTM , PWP12TM Procedure AskReal , AskStr , AskInt Procedure CheckAna , CheckDig , CheckReg Procedure CheckArgReal , CheckArgStr , CheckArgInt Procedure DispMess Procedure ExConnect , ExDisconnect Procedure ExitCF Procedure Message Procedure OpenWindow Procedure PrintAna , PrintDig , PrintReg , PrintParam Procedure SendCommand Procedure Lower , Upper Procedure WaitAna , WaitDig , WaitReg , WaitTime End Extern ------------------------------------------------------------------------------+ Program MDI_FOCUS , Unique Defarg Str(80) !Proc_s Str(3) !Print = "yes" End Defarg Var Str( 3) !ExpName = "MDI" Str(10) !Phase = " " Str(49) !Title = " " Str(80) !S = "" Str(80) !Question = &80s(" ") Str(80) !Check = "" Int !NbErr = 0 Main @OpenWindow() !GM_I0 = 16000 !GM_I9 = 15 Select !Proc_s Case "fdfocser" @fdfocser() Case "hrfocser" @hrfocser() Case "sptfdfoc" @sptfdfoc() Case "spthrfoc" @spthrfoc() Case "mdifocus" @mdifocus() Default !Title = "*ERROR: UNKNOWN PROCEDURE: "+!Proc_s @Message("DCL" , "date" , !ExpName , " " , !Title , *!S) -- Beep Halt !Title = "*Operator CONTinue" @Message("DC" , "date" , !ExpName , " " , !Title , *!S) Return !Rstat End Select @ExitCF (!NbErr) @PrintCF (!ExpName , !Print ) Return !Rstat End Program ------------------------------------------------------------------------------+ Procedure fdfocser ( ) --. --. This procedure takes a Full Disk series at all focus positions --. Var Str( 3) !ExpName = "MDI" Str(10) !Phase = " " Str(49) !Title = " " Str(80) !S = &80s("") Int !NbErr = 0 Str(10) !Time = " " Main !Title = "-EXECUTING PROCEDURE: fdfocser." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) !Title = "~Focus series in 1x(FD) path" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Title = "~1. Focus (1/9)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 0XFFFF , 55 , 17" ) @SendCommand ( "MBCMTP1R" , "0XC012 , 0X0001 , " + &d(!GM_I0) ) @Time_To_Text( !GM_I9 , *!Time ) @WaitTime ( !Time , *!S ) !Title = "~2. Focus (2/9)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 0XFFFF , 91" ) @SendCommand ( "MBCMTP1R" , "0XC012 , 0X0002 , " + &d(!GM_I0) ) @WaitTime ( !Time , *!S ) !Title = "~3. Focus (3/9)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 0XFFFF , 127" ) @SendCommand ( "MBCMTP1R" , "0XC012 , 0X0003 , " + &d(!GM_I0) ) @WaitTime ( !Time , *!S ) !Title = "~4. Focus (4/9)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 0XFFFF , 55 , 89" ) @SendCommand ( "MBCMTP1R" , "0XC012 , 0X0004 , " + &d(!GM_I0) ) @WaitTime ( !Time , *!S ) !Title = "~5. Focus (5/9)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 0XFFFF , 91" ) @SendCommand ( "MBCMTP1R" , "0XC012 , 0X0005 , " + &d(!GM_I0) ) @WaitTime ( !Time , *!S ) !Title = "~6. Focus (6/9)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 0XFFFF , 127" ) @SendCommand ( "MBCMTP1R" , "0XC012 , 0X0006 , " + &d(!GM_I0) ) @WaitTime ( !Time , *!S ) !Title = "~7. Focus (7/9)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 0XFFFF , 55 , 53" ) @SendCommand ( "MBCMTP1R" , "0XC012 , 0X0007 , " + &d(!GM_I0) ) @WaitTime ( !Time , *!S ) !Title = "~8. Focus (8/9)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 0XFFFF , 91" ) @SendCommand ( "MBCMTP1R" , "0XC012 , 0X0008 , " + &d(!GM_I0) ) @WaitTime ( !Time , *!S ) !Title = "~9. Focus (9/9)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 0XFFFF , 127" ) @SendCommand ( "MBCMTP1R" , "0XC012 , 0X0009 , " + &d(!GM_I0) ) @WaitTime ( !Time , *!S ) !Title = "~Go back to best focus (55/89)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 0XFFFF , 55 , 89" ) !GM_NbErr = !GM_NbErr + !NbErr !Title = "-FINISHED PROCEDURE: fdfocser." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) Return End Procedure ------------------------------------------------------------------------------+ Procedure hrfocser ( ) --. --. This procedure takes a HR Focus Series at all positions --. Var Str( 3) !ExpName = "MDI" Str(10) !Phase = " " Str(49) !Title = " " Str(80) !S = &80s("") Str(10) !Time = " " Int !NbErr = 0 Main !Title = "-EXECUTING PROCEDURE: hrfocser." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) !Title = "~Focus series in 3x(hi-res) path" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Title = "~1. Focus (1/9)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 0XFFFF , 55 , 17" ) @SendCommand ( "MBCMTP3R" , "0XC012 , 0X8001 , " + &d( !GM_I0 ) ) @Time_To_Text( !GM_I9 , *!Time ) @WaitTime ( !Time , *!S ) !Title = "~2. Focus (2/9)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 0XFFFF , 91" ) @SendCommand ( "MBCMTP3R" , "0XC012 , 0X8002 , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) !Title = "~3. Focus (3/9)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 0XFFFF , 127" ) @SendCommand ( "MBCMTP3R" , "0XC012 , 0X8003 , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) !Title = "~4. Focus (4/9)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 0XFFFF , 55 , 89" ) @SendCommand ( "MBCMTP3R" , "0XC012 , 0X8004 , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) !Title = "~5. Focus (5/9)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 0XFFFF , 91" ) @SendCommand ( "MBCMTP3R" , "0XC012 , 0X8005 , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) !Title = "~6. Focus (6/9)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 0XFFFF , 127" ) @SendCommand ( "MBCMTP3R" , "0XC012 , 0X8006 , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) !Title = "~7. Focus (7/9)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 0XFFFF , 55 , 53" ) @SendCommand ( "MBCMTP3R" , "0XC012 , 0X8007 , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) !Title = "~8. Focus (8/9)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 0XFFFF , 91" ) @SendCommand ( "MBCMTP3R" , "0XC012 , 0X8008 , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) !Title = "~9. Focus (9/9)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 0XFFFF , 127" ) @SendCommand ( "MBCMTP3R" , "0XC012 , 0X8009 , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) !Title = "~Go back to best focus (55/89)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 0XFFFF , 55 , 89" ) !GM_NbErr = !GM_NbErr + !NbErr !Title = "-FINISHED PROCEDURE: hrfocser." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) Return End Procedure ------------------------------------------------------------------------------+ Procedure sptfdfoc ( ) --. --. This procedure takes a focus series @ all PAW positions --. Var Str( 3) !ExpName = "MDI" Str(10) !Phase = " " Str(49) !Title = " " Str(80) !S = &80s("") Int !NbErr = 0 Main !Title = "-EXECUTING PROCEDURE: sptfdfoc." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) PERFORM/NO MDI_MODE , "lobsmode" , "no" !Title = "~Focus series in 1x (full disk) path" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Title = "~Focus series in s-wave (PAW 125)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @fdfocser() !Title = "~Focus series in p-wave (PAW 89)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 89" ) @fdfocser() !Title = "~Focus series in lcp (PAW 17)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 17" ) @fdfocser() !Title = "~Focus series in rcp (PAW 53)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 53" ) @fdfocser() !Title = "~Back to s-wave (PAW 125)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 125" ) !GM_NbErr = !GM_NbErr + !NbErr !Title = "-FINISHED PROCEDURE: sptfdfoc." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) Return End Procedure ------------------------------------------------------------------------------+ Procedure spthrfoc ( ) --. --. This procedure takes a focus series @ all PAW positions --. Var Str( 3) !ExpName = "MDI" Str(10) !Phase = " " Str(49) !Title = " " Str(80) !S = &80s("") Int !NbErr = 0 Str(80) !Question = "" Str(80) !Check = "" Str(80) !Resp_s = "" Main !Title = "-EXECUTING PROCEDURE: spthrfoc." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) PERFORM/NO MDI_MODE , "lobsmode" , "no" !Title = "~Focus series in 3x (hi-rez) path" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Title = "~Focus series in s-wave (PAW 125)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @hrfocser() !Title = "~Focus series in p-wave (PAW 89)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 89" ) @hrfocser() !Title = "~Focus series in lcp (PAW 17)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 17" ) @hrfocser() !Title = "~Focus series in rcp (PAW 53)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 53" ) @hrfocser() !Title = "~Back to s-wave (PAW 125)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 0XFFFF , 125" ) !GM_NbErr = !GM_NbErr + !NbErr !Title = "-FINISHED PROCEDURE: spthrfoc." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) Return End Procedure ------------------------------------------------------------------------------+ Procedure mdifocus ( ) --. --. Performs a focus series at all 4 PAW positions --. Var Str( 3) !ExpName = "MDI" Str(10) !Phase = " " Str(49) !Title = " " Str(80) !S = &80s("") Int !NbErr = 0 Str(80) !Question = "" Str(80) !Check = "" Str(80) !Resp_s = "" Main !Title = "-EXECUTING PROCEDURE: mdifocus." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) @SendCommand ( "MBCMSUMM" , "1 , 1" ) PERFORM/NO MDI_LIP , "liptbic4" , "no" !Title = " Taking central 256x256 - FD & HR OBS mode" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @SendCommand ( "MBCMAADC" , "3" ) !Title = " CCD amplifier A, offset: 3" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Title = " Exposure time (ticks) = " + &6d( !GM_I0 ) @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Title = " Wait time (seconds) = " + &6d( !GM_I9 ) @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Question = "MDI to Open Decom file" !Check = "in DONE, done" @AskStr (!Question, !Check, *!Resp_s, *!S, *!NbErr) !Title = "~Focus series in FULL DISK mode;" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Title = " PAW positions 125, 89, 17, 53" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @sptfdfoc() !Title = "~Focus series in HI-REZ mode;" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Title = " PAW positions 125, 89, 17, 53" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @spthrfoc() @SendCommand ( "MBCMDRKR" , "0XC012 , " + &d(!GM_I0) + " , " + &d(!GM_I0) ) @WaitTime ( "00h00m10s" , *!S ) !Question = "MDI to Close Decom file" !Check = "in DONE, done" @AskStr (!Question, !Check, *!Resp_s, *!S, *!NbErr) !GM_NbErr = !GM_NbErr + !NbErr !Title = "-FINISHED PROCEDURE: mdifocus." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) Return End Procedure ------------------------------------------------------------------------------+ Procedure varcmd( Str(10) !Cmd_name , Str(80) !Cmd_data ) Var Str(1) !Expt_s Int !Code_i Int !Cmd_data_i(30) Int !No_of_cmds_i Int !Data_len_i Str(10) !Data_item_s Int !Commas_i Int !Count Int !Char_pos Str(1) !Char Str(49) !Title = " " Str(80) !Cmd_data_s Str(80) !S = &80s("") Main !Expt_s = Extract( !Cmd_name , 1 , 1 ) If !Expt_s <> "M" Then !Title = "*ERROR: Non-MDI Command " + !Cmd_name @Message( "DC", "time", "MDI", " ", !Title , *!S) -- Beep Halt !Title = "+Operator CONTinue " @Message( "DC", "time", "MDI", " ", !Title , *!S) Return End If Select !Cmd_name Case "MBIPCMD" !Code_i = 0x0E !No_of_cmds_i = 0 Case "MBIPLDIN" !Code_i = 0x12 !No_of_cmds_i = 1 !Cmd_data_i(0) = 4 Case "MBDPML" !Code_i = 0x0A !No_of_cmds_i = 0 Case "MBDPCONF" !Code_i = 0x1D !No_of_cmds_i = 0 Default !Title = "*ERROR: Unrecognised Command " + !Cmd_name @Message( "DC", "time", "MDI", " ", !Title , *!S) -- Beep Halt !Title = "+Operator CONTinue " @Message( "DC", "time", "MDI", " ", !Title , *!S) Return End Select !Cmd_data_s = !Cmd_data + "," !Data_len_i = Len( !Cmd_data_s ) !Commas_i = 0 For !Char_pos = 1 to !Data_len_i !Char = Extract( !Cmd_data_s , !Char_pos , 1 ) If !Char = "," Then !Commas_i = !Commas_i + 1 End If End For For !Count = 1 To !Commas_i !Data_item_s = Splitstr( !Cmd_data_s , "," , !Count ) !Cmd_data_i( !No_of_cmds_i ) = Int( Val( !Data_item_s ) ) !No_of_cmds_i = !No_of_cmds_i + 1 End For PERFORM/NO PLM_BLOCK , "MDI" , !Code_i , !Cmd_data_i() , !No_of_cmds_i Return End Procedure ------------------------------------------------------------------------------+ Procedure PrintCF( str(3) !ExpName, str(8) !Print) --. Print the control file log file if required by !Print ; --. - using the 'Spool' statement if the variable !GZ_Spool is TRUE, --. - using the dialog box window if the variable !GZ_Spool is FALSE. --. Var str(80) !S = &80s("") Main If !Print = "yes" Then If !GZ_Spool = TRUE Then Spool CF Else Cflog @Message ("DC", "date", !ExpName, " ", \ "++++Print the CFLog, then type CONT+++", *!S) Halt @Message ("DC", "date", !ExpName, " ", \ "+Operator continue.", *!S) End If End If Return End Procedure ------------------------------------------------------------------------------+ Procedure Time_To_Text (Int !Stime, Str(10) *!Text) --. Convert a time passed in seconds to a string as "hh:mn:ss". --. The number of hours is limited to 999 with no error reported. Var Int !hour = 0 Int !minute = 0 Int !second = 0 Main CALL Hh_mn_ss(!Stime, *!hour, *!minute, *!second) !Text = &02d(!hour) + "h" + &02d(!minute)+ "m"+ &02d(!second) +"s" Return End Procedure ------------------------------------------------------------------------------+ Procedure Hh_mn_ss(Int !STime, Int *!hour, Int *!minute, Int *!second) --. Compute and return the number of hour, minute and second from an interger --. number of seconds. Var Int !Tmp Main !Tmp = !STime !hour = !Tmp / 3600 !Tmp = !Tmp Mod 3600 !minute = !Tmp / 60 !second = !Tmp Mod 60 Return End Procedure ------------------------------------------------------------------------------+