--+------------------------------------------------------------------------+ --+ SOHO Project -- Control File --+ ---------------------------- --+ --+ Name : MDI_LSRETC , !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 : Jon B. CARTER --+------------------------------------------------------------------------+ --+ 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 19:49 08/02/94 Jon B.CARTER -- Conversion from MDI language. --+ 1/02 360 11:56 05/05/94 Ed COBB/Ph. IATRINO -- Rationalization --+ 1/03 393 15:20 20/05/94 Ed COBB -- MDI Updates --+ 1/04 406 13:45 24/05/94 Ed COBB -- MDI Updates --+ 2/01 477 19:33 19/09/94 Ed COBB/Ph. IATRINO -- 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 Str(80) !GM_S0 Str(80) !GM_S8 Int !GM_I0 Int !GM_I1 Int !GM_I2 Int !GM_I3 Int !GM_I4 Int !GM_I5 Int !GM_I9 End Common -------------------------------------------------------------------------------< Extern Cfile MDI_DIST , MDI_LAM , MDI_LLT , PLM_BLOCK 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_LSRETC , Unique Defarg Str(80) !Proc_s Str(3) !Print = "yes" End Defarg Var Str( 3) !ExpName = "MDI" Int !NbErr = 0 Str(49) !Title = " " str(80) !S = &80s(" ") Main @OpenWindow() Select !Proc_s Case "lasdtune" @lasdtune() Case "lasdust" @lasdust() Case "legsgoto" @legsgoto() Case "fdlscan" @fdlscan() 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 lasdtune ( ) --. --. This procedure performs a detune M1 through FSR (90deg) --. with 5 motor steps, then M1 through FSR (90deg) with 5 steps. --. IT REQUIRES !GM_I4 & !GM_I5 TO BE SET TO THE PROPER M1/M2 --. CONTINUUM TUNING FOR THE LASER !!!! --. 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: lasdtune." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) @Time_To_Text( !GM_I9 , *!Time ) @varcmd ( "MBDPCONF" , "0X0100 , 0x0100" ) -- make mtm go CW @WaitTime ( "00h00m01s" , *!S ) !Title = "~1. TUNING SET: rotating M1" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "26 , " + &d( !GM_I5 ) ) @SendCommand ( "MBCMTP1R" , "26 , " + &d( !GM_I5 ) + " , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) @varcmd ( "MBDPCONF" , "31" ) @SendCommand ( "MBCMTP1R" , "31 , " + &d( !GM_I5 ) + " , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) @varcmd ( "MBDPCONF" , "36" ) @SendCommand ( "MBCMTP1R" , "36 , " + &d( !GM_I5 ) + " , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) @varcmd ( "MBDPCONF" , "41" ) @SendCommand ( "MBCMTP1R" , "41 , " + &d( !GM_I5 ) + " , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) @varcmd ( "MBDPCONF" , "46" ) @SendCommand ( "MBCMTP1R" , "46 , " + &d( !GM_I5 ) + " , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) @varcmd ( "MBDPCONF" , "51" ) @SendCommand ( "MBCMTP1R" , "51 , " + &d( !GM_I5 ) + " , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) @varcmd ( "MBDPCONF" , "56" ) @SendCommand ( "MBCMTP1R" , "56 , " + &d( !GM_I5 ) + " , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) @varcmd ( "MBDPCONF" , "61" ) @SendCommand ( "MBCMTP1R" , "61 , " + &d( !GM_I5 ) + " , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) @varcmd ( "MBDPCONF" , "66" ) @SendCommand ( "MBCMTP1R" , "66 , " + &d( !GM_I5 ) + " , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) @varcmd ( "MBDPCONF" , "71" ) @SendCommand ( "MBCMTP1R" , "71 , " + &d( !GM_I5 ) + " , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) !Title = "~2. TUNING SET: rotating M2" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , &d( !GM_I4 ) + " , 78" ) @WaitTime ( "00h00m01s" , *!S ) @SendCommand ( "MBCMTP1R" , &d( !GM_I4 ) + " , 78 , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 83" ) @SendCommand ( "MBCMTP1R" , &d( !GM_I4 ) + " , 83 , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 88" ) @SendCommand ( "MBCMTP1R" , &d( !GM_I4 ) + " , 88 , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 93" ) @SendCommand ( "MBCMTP1R" , &d( !GM_I4 ) + " , 93 , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 98" ) @SendCommand ( "MBCMTP1R" , &d( !GM_I4 ) + " , 98 , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 103" ) @SendCommand ( "MBCMTP1R" , &d( !GM_I4 ) + " , 103 , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 108" ) @SendCommand ( "MBCMTP1R" , &d( !GM_I4 ) + " , 108 , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 113" ) @SendCommand ( "MBCMTP1R" , &d( !GM_I4 ) + " , 113 , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 118" ) @SendCommand ( "MBCMTP1R" , &d( !GM_I4 ) + " , 118 , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) @varcmd ( "MBDPCONF" , "0XFFFF , 123" ) @SendCommand ( "MBCMTP1R" , &d( !GM_I4 ) + " , 123 , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) !GM_NbErr = !GM_NbErr + !NbErr !Title = "-FINISHED PROCEDURE: lasdtune." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) Return End Procedure -------------------------------------------------------------------------------< Procedure lasdust ( ) --. --. Takes images in FD OBS at nominal focus & PAW, then --. FD CAL at every PAW position and HR CAL at nominal PAW. --. The series is meant for "dust-hunting with laser. --. IT REQUIRES !GM_I4 & !GM_I5 TO BE SET TO THE PROPER M1/M2 --. CONTINUUM TUNING FOR THE LASER !!!! --. 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: lasdust." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) @Time_To_Text( !GM_I9 , *!Time ) !Title = "~Pointing: " + !GM_S0 @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "0X0100 , 0X0100 , 0X0100 , 0X0100 , 0x0100" ) @varcmd ( "MBDPCONF" , &d( !GM_I4 ) + " , " + &d( !GM_I5 ) + \ " , 125 , 91 , 89" ) !Title = "~FD OBS mode image, exp = " + &d( !GM_I1 ) @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @SendCommand ( "MBCMTP1R" , "0XC014 , " + &d( !GM_I1 ) + " , " + &d( !GM_I1 ) ) @WaitTime ( !Time , *!S ) @varcmd ( "MBDPCONF" , &d( !GM_I4 ) + " , " + &d( !GM_I5 ) + \ " , 125 , 19 , 125" ) !Title = "~FD CAL at PAW positions 17, 53, 89, 125" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) PERFORM/NO MDI_DIST , "fdprot" , "no" !Title = "~HR OBS at nominal PAW (125)" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @SendCommand ( "MBCMTP3R" , "0XC014 , " + &d( !GM_I0 ) + " , " + &d( !GM_I0 ) ) @WaitTime ( !Time , *!S ) !GM_NbErr = !GM_NbErr + !NbErr !Title = "-FINISHED PROCEDURE: lasdust." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) Return End Procedure -------------------------------------------------------------------------------< Procedure legsgoto ( ) --. --. !GM_I2 = X (L/R screen direction = vertical on IDL screen, --. horizontal in 3D space. Positive X means positive --. x-erorr signal --. !GM_I3 = Y (U/D screen direction = horizontal on IDL screen, --. vertical in 3D space. Positive Y means positive --. y-erorr signal --. Var Str( 3) !ExpName = "MDI" Str(10) !Phase = " " Str(49) !Title = " " Str(80) !S = &80s(" ") Str(10) !Time = " " Int !NbErr = 0 Int !LM_I0 Int !LM_I1 Int !LM_I2 Int !LM_I3 Main !Title = "-EXECUTING PROCEDURE: legsgoto." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) Inhibit "M+15MTR" Inhibit "M+75LT" !LM_I0 = ( !GM_I3 / 2 ) -- arcsec / leg step !LM_I1 = ( !GM_I2 / 2 ) -- arcsec / leg step !Title = "LX " + &3d( !LM_I1 ) + " LY " + &3d( !LM_I0 ) @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !LM_I1 = Int( Real( !LM_I1 ) * .824 ) !LM_I0 = Int( Real( !LM_I0 ) * .627 ) !LM_I2 = !LM_I1 + !LM_I0 !LM_I3 = !LM_I0 - !LM_I1 If !LM_I2 > 0 Then @SendCommand ( "MBAM1INC" , &d( !LM_I2 ) ) !LM_I0 = !LM_I2 / 4 !LM_I0 = !LM_I0 + 20 @Time_To_Text( !LM_I0 , *!Time ) @WaitTime ( !Time , *!S ) End If If !LM_I2 < 0 Then !LM_I2 = -1 * !LM_I2 @SendCommand ( "MBAM1DEC" , &d( !LM_I2 ) ) !LM_I0 = !LM_I2 / 4 !LM_I0 = !LM_I0 + 20 @Time_To_Text( !LM_I0 , *!Time ) @WaitTime ( !Time , *!S ) End If If !LM_I3 > 0 Then @SendCommand ( "MBAM2INC" , &d( !LM_I3 ) ) !LM_I0 = !LM_I3 / 4 !LM_I0 = !LM_I0 + 20 @Time_To_Text( !LM_I0 , *!Time ) @WaitTime ( !Time , *!S ) End If If !LM_I3 < 0 Then !LM_I3 = -1 * !LM_I3 @SendCommand ( "MBAM2DEC" , &d( !LM_I3 ) ) !LM_I0 = !LM_I3 / 4 !LM_I0 = !LM_I0 + 20 @Time_To_Text( !LM_I0 , *!Time ) @WaitTime ( !Time , *!S ) End If Enable "M+15MTR" Enable "M+75LT" !GM_NbErr = !GM_NbErr + !NbErr !Title = "-FINISHED PROCEDURE: legsgoto." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) Return End Procedure -------------------------------------------------------------------------------< Procedure fdlscan ( ) --. --. This procedure performs a Full Disk lambda scan --. Var Str( 3) !ExpName = "MDI" Str(10) !Phase = " " Str(49) !Title = " " Str(80) !S = &80s(" ") Int !NbErr = 0 Main !Title = "-EXECUTING PROCEDURE: fdlscan." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) !Title = "~Starting l-scan FULL DISK mode" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Title = "~Starting lambda-scan" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Title = "1/12" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "26 , 78" ) @WaitTime ( "00h00m01s" , *!S ) @SendCommand ( "MBCMTP1R" , "26 , 78 , " + &d( !GM_I0 ) ) @WaitTime ( "00h00m15s" , *!S ) !Title = "2/12" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "34 , 82" ) @WaitTime ( "00h00m01s" , *!S ) @SendCommand ( "MBCMTP1R" , "34 , 82 , " + &d( !GM_I0 ) ) @WaitTime ( "00h00m15s" , *!S ) !Title = "3/12" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "42 , 86" ) @WaitTime ( "00h00m01s" , *!S ) @SendCommand ( "MBCMTP1R" , "42 , 86 , " + &d( !GM_I0 ) ) @WaitTime ( "00h00m15s" , *!S ) !Title = "4/12" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "50 , 90" ) @WaitTime ( "00h00m01s" , *!S ) @SendCommand ( "MBCMTP1R" , "50 , 90 , " + &d( !GM_I0 ) ) @WaitTime ( "00h00m15s" , *!S ) !Title = "5/12" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "58 , 94" ) @WaitTime ( "00h00m01s" , *!S ) @SendCommand ( "MBCMTP1R" , "58 , 94 , " + &d( !GM_I0 ) ) @WaitTime ( "00h00m15s" , *!S ) !Title = "6/12" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "66 , 98" ) @WaitTime ( "00h00m01s" , *!S ) @SendCommand ( "MBCMTP1R" , "66 , 98 , " + &d( !GM_I0 ) ) @WaitTime ( "00h00m15s" , *!S ) !Title = "7/12" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "74 , 102" ) @WaitTime ( "00h00m01s" , *!S ) @SendCommand ( "MBCMTP1R" , "74 , 102 , " + &d( !GM_I0 ) ) @WaitTime ( "00h00m15s" , *!S ) !Title = "8/12" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "82 , 106" ) @WaitTime ( "00h00m01s" , *!S ) @SendCommand ( "MBCMTP1R" , "82 , 106 , " + &d( !GM_I0 ) ) @WaitTime ( "00h00m15s" , *!S ) !Title = "9/12" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "90 , 110" ) @WaitTime ( "00h00m01s" , *!S ) @SendCommand ( "MBCMTP1R" , "90 , 110 , " + &d( !GM_I0 ) ) @WaitTime ( "00h00m15s" , *!S ) !Title = "10/12" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "98 , 114" ) @WaitTime ( "00h00m01s" , *!S ) @SendCommand ( "MBCMTP1R" , "98 , 114 , " + &d( !GM_I0 ) ) @WaitTime ( "00h00m15s" , *!S ) !Title = "11/12" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "106 , 118" ) @WaitTime ( "00h00m01s" , *!S ) @SendCommand ( "MBCMTP1R" , "106 , 118 , " + &d( !GM_I0 ) ) @WaitTime ( "00h00m15s" , *!S ) !Title = "12/12" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @varcmd ( "MBDPCONF" , "114 , 122" ) @WaitTime ( "00h00m01s" , *!S ) @SendCommand ( "MBCMTP1R" , "114 , 122 , " + &d( !GM_I0 ) ) @WaitTime ( "00h00m15s" , *!S ) !GM_NbErr = !GM_NbErr + !NbErr !Title = "-FINISHED PROCEDURE: fdlscan." @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(80) !Cmd_data_s Str(80) !S = &80s(" ") Str( 3) !ExpName = "MDI" Str(10) !Phase = " " Str(49) !Title = " " Main !Expt_s = Extract( !Cmd_name , 1 , 1 ) If !Expt_s <> "M" Then !Title = "*ERROR: Non-MDI Command " + !Cmd_name @Message("DC" , "time" , !ExpName , " " , !Title , *!S) -- Beep Halt !Title = "*Operator CONTinue" @Message("DC" , "time" , !ExpName , " " , !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" , !ExpName , " " , !Title , *!S) -- Beep Halt !Title = "*Operator CONTinue" @Message("DC" , "time" , !ExpName , " " , !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 -------------------------------------------------------------------------------------