--+------------------------------------------------------------------------+ --+ SOHO Project -- Control File --+ ---------------------------- --+ --+ Name : MDI_LMCH , !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 : --+ ------------- --+ - --+ --+ History : --+ ------- --+ Issue SIC Note Time Date Name/Updates --+ +---+ +------+ +---+ +------+ +-------------------------------------+ --+ 1/00 211 13:47 17/01/94 A.J. TURK -- Conversion from MDI language. --+ 1/01 289 17:26 07/02/94 Ph. IATRINO -- During debug phase. --+ 1/02 360 08:45 12/05/94 Ed COBB/Ph. IATRINO -- Rationalization --+ 1/03 393 10:48 12/05/94 Ed COBB -- MDI Updates --+ 1/04 406 13:31 24/05/94 Ed COBB -- MDI Updates --+ 1/07 443 16:51 17/06/94 Ed COBB -- MDI Updates --+ 1/08 444 08:28 18/06/94 Ed COBB -- MDI Updates --+ 1/09 448 15:47 21/06/94 Ed COBB -- CF Improvements. --+ --+------------------------------------------------------------------------+ 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 End Common -------------------------------------------------------------------------------< Extern Cfile 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_LMCH , 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 = &80s(" ") Str(80) !Question = "" Str(80) !Check = "" Int !NbErr = 0 Main @OpenWindow() Select !Proc_s Case "lmchscom" @lmchscom() Case "lmchsoff" @lmchsoff() Case "lmchson" @lmchson() Case "lmchsprn" @lmchsprn() 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 lmchscom ( ) --. --. This procedure performs the commissioning of --. MTM1, MTM2, PAW, CAL1, CAL2 --. Var Str( 3) !ExpName = "MDI" Str(10) !Phase = " " Str(49) !Title = " " Str(80) !S = &80s(" ") Int !NbErr = 0 Int !Cmd_data_i(30) Main !Title = "-EXECUTING PROCEDURE: lmchscom" @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) @SendCommand ( "MBSQMTMO" , "0 , 0" ) -- zero MTM offsets !Title = "~Reset Positions" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) Inhibit "MKM1POS" Inhibit "MKM2POS" Inhibit "MKPAPOS" Inhibit "MKC1POS" Inhibit "MKC2POS" @SendCommand ( "MBM1RS" , "" ) @SendCommand ( "MBM2RS" , "" ) @SendCommand ( "MBPARS" , "" ) @SendCommand ( "MBC1RS" , "" ) @SendCommand ( "MBC2RS" , "" ) @WaitTime ( "00h00m45s" , *!S ) @CheckReg( "MKM1POS" , "= 255" , *!NbErr ) @CheckReg( "MKM2POS" , "= 255" , *!NbErr ) @CheckReg( "MKPAPOS" , "= 255" , *!NbErr ) @CheckReg( "MKC1POS" , "= 255" , *!NbErr ) @CheckReg( "MKC2POS" , "= 255" , *!NbErr ) !Title = "~Command motors in CW direction" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) -- CW to 0 (set CW default) !Cmd_data_i(0) = 0X0100 !Cmd_data_i(1) = 0X0100 !Cmd_data_i(2) = 0X0100 !Cmd_data_i(3) = 0X0100 !Cmd_data_i(4) = 0X0100 PERFORM/NO PLM_BLOCK , "MDI" , 0x1D , !Cmd_data_i() , 5 -- move motors @WaitTime ( "00h00m45s" , *!S ) !Title = "Position 1" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Cmd_data_i(0) = 1 !Cmd_data_i(1) = 1 !Cmd_data_i(2) = 125 !Cmd_data_i(3) = 19 !Cmd_data_i(4) = 125 PERFORM/NO PLM_BLOCK , "MDI" , 0x1D , !Cmd_data_i() , 5 -- move motors @WaitTime ( "00h00m45s" , *!S ) @CheckReg( "MKM1POS" , ">= 0 and <= 1" , *!NbErr ) @CheckReg( "MKM2POS" , ">= 0 and <= 1" , *!NbErr ) @CheckReg( "MKPAPOS" , ">= 124 and <= 125" , *!NbErr ) @CheckReg( "MKC1POS" , ">= 18 and <= 19" , *!NbErr ) @CheckReg( "MKC2POS" , ">= 124 and <= 125" , *!NbErr ) !Title = "Position 2" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Cmd_data_i(0) = 21 !Cmd_data_i(1) = 41 !Cmd_data_i(2) = 17 !Cmd_data_i(3) = 55 !Cmd_data_i(4) = 17 PERFORM/NO PLM_BLOCK , "MDI" , 0x1D , !Cmd_data_i() , 5 -- move motors @WaitTime ( "00h00m45s" , *!S ) @CheckReg( "MKM1POS" , ">= 20 and <= 21" , *!NbErr ) @CheckReg( "MKM2POS" , ">= 40 and <= 41" , *!NbErr ) @CheckReg( "MKPAPOS" , ">= 16 and <= 17" , *!NbErr ) @CheckReg( "MKC1POS" , ">= 54 and <= 55" , *!NbErr ) @CheckReg( "MKC2POS" , ">= 16 and <= 17" , *!NbErr ) !Title = "Position 3" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Cmd_data_i(0) = 41 !Cmd_data_i(1) = 81 !Cmd_data_i(2) = 53 !Cmd_data_i(3) = 91 !Cmd_data_i(4) = 53 PERFORM/NO PLM_BLOCK , "MDI" , 0x1D , !Cmd_data_i() , 5 -- move motors @WaitTime ( "00h00m45s" , *!S ) @CheckReg( "MKM1POS" , ">= 40 and <= 41" , *!NbErr ) @CheckReg( "MKM2POS" , ">= 80 and <= 81" , *!NbErr ) @CheckReg( "MKPAPOS" , ">= 52 and <= 53" , *!NbErr ) @CheckReg( "MKC1POS" , ">= 90 and <= 91" , *!NbErr ) @CheckReg( "MKC2POS" , ">= 52 and <= 53" , *!NbErr ) !Title = "Position 4" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Cmd_data_i(0) = 81 !Cmd_data_i(1) = 121 !Cmd_data_i(2) = 89 !Cmd_data_i(3) = 127 !Cmd_data_i(4) = 89 PERFORM/NO PLM_BLOCK , "MDI" , 0x1D , !Cmd_data_i() , 5 -- move motors @WaitTime ( "00h00m45s" , *!S ) @CheckReg( "MKM1POS" , ">= 80 and <= 81" , *!NbErr ) @CheckReg( "MKM2POS" , ">= 120 and <= 121" , *!NbErr ) @CheckReg( "MKPAPOS" , ">= 88 and <= 89" , *!NbErr ) @CheckReg( "MKC1POS" , ">= 126 and <= 127" , *!NbErr ) @CheckReg( "MKC2POS" , ">= 88 and <= 89" , *!NbErr ) !GM_NbErr = !GM_NbErr + !NbErr !Title = "-FINISHED PROCEDURE: lmchscom" @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) Return End Procedure -------------------------------------------------------------------------------< Procedure lmchsoff ( ) --. --. This procedure powers down the internal mechanisms: --. shutter, MTM1, MTM2, CAL1, CAL2, and PAW. --. Var Str( 3) !ExpName = "MDI" Str(10) !Phase = " " Str(49) !Title = " " Str(80) !S = &80s(" ") Str(80) !Get_Dig = "" Int !NbErr = 0 Main !Title = "-EXECUTING PROCEDURE: lmchsoff." @Message( "DC" , "date" , !ExpName , !Phase , !Title , *!S ) !Title = "~Switch OFF internal OP Mechs." @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) Inhibit "MKPWSH" Inhibit "MKPWM1" Inhibit "MKPWM2" Inhibit "MKPWPA" Inhibit "MKPWC1" Inhibit "MKPWC2" @SendCommand ( "MBPWSHOF" , "" ) @SendCommand ( "MBPWM1OF" , "" ) @SendCommand ( "MBPWM2OF" , "" ) @SendCommand ( "MBPWPAOF" , "" ) @SendCommand ( "MBPWC1OF" , "" ) @SendCommand ( "MBPWC2OF" , "" ) @WaitTime ( "00h00m30s" , *!S ) Expect "MKPWSH" , "OFF" , 1 Expect "MKPWM1" , "OFF" , 1 Expect "MKPWM2" , "OFF" , 1 Expect "MKPWPA" , "OFF" , 1 Expect "MKPWC1" , "OFF" , 1 Expect "MKPWC2" , "OFF" , 1 Enable "MKPWSH" Enable "MKPWM1" Enable "MKPWM2" Enable "MKPWPA" Enable "MKPWC1" Enable "MKPWC2" !Title = "~Verify that mechanisms are OFF." @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Get_Dig = Get( "MKPWSH" ) If !Get_Dig <> "OFF" Then !Title = "* Shutter is NOT OFF - procedure halted" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) Halt !Title = "*Operator CONTinue" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) End If !Get_Dig = Get( "MKPWM1" ) If !Get_Dig <> "OFF" Then !Title = "* MTM1 is NOT OFF - procedure halted" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) Halt !Title = "*Operator CONTinue" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) End If !Get_Dig = Get( "MKPWM2" ) If !Get_Dig <> "OFF" Then !Title = "* MTM2 is NOT OFF - procedure halted" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) Halt !Title = "*Operator CONTinue" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) End If !Get_Dig = Get( "MKPWPA" ) If !Get_Dig <> "OFF" Then !Title = "* PAW is NOT OFF - procedure halted" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) Halt !Title = "*Operator CONTinue" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) End If !Get_Dig = Get( "MKPWC1" ) If !Get_Dig <> "OFF" Then !Title = "* CAL1 is NOT OFF - procedure halted" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) Halt !Title = "*Operator CONTinue" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) End If !Get_Dig = Get( "MKPWC2" ) If !Get_Dig <> "OFF" Then !Title = "* CAL2 is NOT OFF - procedure halted" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) Halt !Title = "*Operator CONTinue" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) End If @CheckDig( "MKPWSH" , "= OFF" , *!NbErr ) @CheckDig( "MKPWM1" , "= OFF" , *!NbErr ) @CheckDig( "MKPWM2" , "= OFF" , *!NbErr ) @CheckDig( "MKPWPA" , "= OFF" , *!NbErr ) @CheckDig( "MKPWC1" , "= OFF" , *!NbErr ) @CheckDig( "MKPWC2" , "= OFF" , *!NbErr ) !GM_NbErr = !GM_NbErr + !NbErr !Title = "-FINISHED PROCEDURE: lmchsoff." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) Return End Procedure -------------------------------------------------------------------------------< Procedure lmchson ( ) --. --. This procedure powers up and resets the --. shutter, MTM1, MTM2, CAL1, CAL2, and PAW. --. Var Str( 3) !ExpName = "MDI" Str(10) !Phase = " " Str(49) !Title = " " Str(80) !S = &80s(" ") Int !NbErr = 0 Main !Title = "-EXECUTING PROCEDURE: lmchson." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) @SendCommand ( "MBSHRS" , "" ) @WaitTime ( "00h00m02s" , *!S ) @SendCommand ( "MBPWSHON", "" ) @WaitTime ( "00h00m02s" , *!S ) @SendCommand ( "MBSHRS" , "" ) @WaitTime ( "00h00m02s" , *!S ) @SendCommand ( "MBM1RS" , "" ) @WaitTime ( "00h00m02s" , *!S ) @SendCommand ( "MBPWM1ON", "" ) @WaitTime ( "00h00m02s" , *!S ) @SendCommand ( "MBM1RS" , "" ) @WaitTime ( "00h00m02s" , *!S ) @SendCommand ( "MBM2RS" , "" ) @WaitTime ( "00h00m02s" , *!S ) @SendCommand ( "MBPWM2ON", "" ) @WaitTime ( "00h00m02s" , *!S ) @SendCommand ( "MBM2RS" , "" ) @WaitTime ( "00h00m02s" , *!S ) @SendCommand ( "MBPARS" , "" ) @WaitTime ( "00h00m02s" , *!S ) @SendCommand ( "MBPWPAON", "" ) @WaitTime ( "00h00m02s" , *!S ) @SendCommand ( "MBPARS" , "" ) @WaitTime ( "00h00m02s" , *!S ) @SendCommand ( "MBC1RS" , "" ) @WaitTime ( "00h00m02s" , *!S ) @SendCommand ( "MBPWC1ON", "" ) @WaitTime ( "00h00m02s" , *!S ) @SendCommand ( "MBC1RS" , "" ) @WaitTime ( "00h00m02s" , *!S ) @SendCommand ( "MBC2RS" , "" ) @WaitTime ( "00h00m02s" , *!S ) @SendCommand ( "MBPWC2ON", "" ) @WaitTime ( "00h00m02s" , *!S ) @SendCommand ( "MBC2RS" , "" ) @WaitTime ( "00h00m45s" , *!S ) Expect "MKPWSH" , "ON" , 1 Expect "MKPWM1" , "ON" , 1 Expect "MKPWM2" , "ON" , 1 Expect "MKPWPA" , "ON" , 1 Expect "MKPWC1" , "ON" , 1 Expect "MKPWC2" , "ON" , 1 Enable "MKPWSH" Enable "MKPWM1" Enable "MKPWM2" Enable "MKPWPA" Enable "MKPWC1" Enable "MKPWC2" @CheckDig( "MKPWSH" , "= ON" , *!NbErr ) @CheckDig( "MKPWM1" , "= ON" , *!NbErr ) @CheckDig( "MKPWM2" , "= ON" , *!NbErr ) @CheckDig( "MKPWPA" , "= ON" , *!NbErr ) @CheckDig( "MKPWC1" , "= ON" , *!NbErr ) @CheckDig( "MKPWC2" , "= ON" , *!NbErr ) @CheckReg( "MKM1POS" , "= 255" , *!NbErr ) @CheckReg( "MKM2POS" , "= 255" , *!NbErr ) @CheckReg( "MKPAPOS" , "= 255" , *!NbErr ) @CheckReg( "MKC1POS" , "= 255" , *!NbErr ) @CheckReg( "MKC2POS" , "= 255" , *!NbErr ) !GM_NbErr = !GM_NbErr + !NbErr !Title = "-FINISHED PROCEDURE: lmchson." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) Return End Procedure -------------------------------------------------------------------------------< Procedure lmchsprn ( ) --. --. This procedure prints the command, position and limit status of the --. internal mechanisms: MTM1, MTM2, CAL1, CAL2, and PAW. --. Var Str( 3) !ExpName = "MDI" Str(10) !Phase = " " Str(49) !Title = " " Str(80) !S = &80s(" ") Int !NbErr = 0 Str(80) !LM_S0 = "" Main !Title = "-EXECUTING PROCEDURE: lmchsprn." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) !Title = " MTM1 MTM2 PAW CAL1 CAL2" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !LM_S0 = Get( "MKM1POS" ) !Title = "actual: " + !LM_S0 !LM_S0 = Get( "MKM2POS" ) !Title = !Title + " " + !LM_S0 !LM_S0 = Get( "MKPAPOS" ) !Title = !Title + " " + !LM_S0 !LM_S0 = Get( "MKC1POS" ) !Title = !Title + " " + !LM_S0 !LM_S0 = Get( "MKC2POS" ) !Title = !Title + " " + !LM_S0 @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !LM_S0 = Getmon( "MKM1POS" ) !Title = "limits: " + !LM_S0 !LM_S0 = Getmon( "MKM2POS" ) !Title = !Title + " " + !LM_S0 !LM_S0 = Getmon( "MKPAPOS" ) !Title = !Title + " " + !LM_S0 !LM_S0 = Getmon( "MKC1POS" ) !Title = !Title + " " + !LM_S0 !LM_S0 = Getmon( "MKC2POS" ) !Title = !Title + " " + !LM_S0 @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !GM_NbErr = !GM_NbErr + !NbErr !Title = "-FINISHED PROCEDURE: lmchsprn." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) 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 ----------------------------------------------------------------------------------<