--+------------------------------------------------------------------------+ --+ SOHO Project -- Control File --+ ---------------------------- --+ --+ Name : MDI_LCM , !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 20:22 13/01/94 A.J. TURK -- Conversion from MDI. --+ 1/01 289 19:24 07/02/94 A.J. Turk -- During debug phase. --+ 1/02 360 10:43 26/04/94 Ed COBB -- Rationalization --+ 1/03 393 10:16 20/05/94 Ed COBB -- MDI Updates --+ 1/04 406 13:21 24/05/94 Ed COBB -- MDI Updates --+ 1/07 443 15:49 17/06/94 Ed COBB -- CF Errors. --+ 1/11 453 14:10 27/06/94 Ed COBB -- CF Errors. --+ --+------------------------------------------------------------------------+ 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) Str(80) !GM_Display Int !GM_NbErr -- MDI Global Error Count Int !GM_Conf -- MDI Configuration Str(80) !GM_S0 Int !GM_I0 Int !GM_I1 Int !GM_I9 End Common -------------------------------------------------------------------------------< Extern Cfile 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_LCM , 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 "lcmcom" @lcmcom() Case "lcmoff" @lcmoff() Case "lcmon" @lcmon() Case "lcmtap" @lcmtap() 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 lcmcom ( ) --. --. Performs a CCD camera check. --. Var Str( 3) !ExpName = "MDI" Str(10) !Phase = " " Str(49) !Title = " " Str(80) !S = &80s("") Str(80) !Question = "" Str(80) !Check = "" Str(80) !Resp_s = "" Int !NbErr = 0 Main !Title = "-EXECUTING PROCEDURE: lcmcom." @Message( "DC" , "date" , !ExpName , !Phase , !Title , *!S ) !GM_I9 = 120 !GM_Display = "Full 1024x1024 with " + &4d( !GM_I9 ) + " second waits" @Message( "DC" , "time" , !ExpName , !Phase , !GM_Display , *!S ) @SendCommand ( "MBIPLBIC" , "3 , 3" ) @WaitTime ( "00h00m15s" , *!S ) If !GM_Conf = 2 Then PERFORM/NO MDI_LIP , "liptlm2" , "no" End If @SendCommand ( "MBCMHDR1" , "0X4040 , 0X4040 , 0 , 1 , 0" ) @WaitTime ( "00h00m15s" , *!S ) !Title = "~CCD summing mode: 1x1 " @Display_string ( !Title , 40 ) @Message( "D" , "time" , !ExpName , !Phase , !GM_Display , *!S ) @Message( "C" , "time" , !ExpName , !Phase , !Title , *!S ) @SendCommand ( "MBCMSUMM" , "1 , 1" ) !GM_I0 = 1000 !GM_I1 = 1 !Title = "~CCD sum 1x1, amp A, offset 3 " @Display_string ( !Title , 40 ) @Message( "D" , "time" , !ExpName , !Phase , !GM_Display , *!S ) @Message( "C" , "time" , !ExpName , !Phase , !Title , *!S ) @SendCommand ( "MBCMAADC" , "3" ) !Question = "MDI Open Decom file(Y)" !Check = "in Y, y" @AskStr ( !Question , !Check , *!GM_S0 , *!S , *!NbErr ) @lcmtap() !Title = "~CCD sum 1x1, amp B, offset 3 " @Display_string ( !Title , 40 ) @Message( "D" , "time" , !ExpName , !Phase , !GM_Display , *!S ) @Message( "C" , "time" , !ExpName , !Phase , !Title , *!S ) @SendCommand ( "MBCMBADC" , "3" ) @lcmtap() !Title = "~CCD summing mode: 2x2 " @Display_string ( !Title , 40 ) @Message( "D" , "time" , !ExpName , !Phase , !GM_Display , *!S ) @Message( "C" , "time" , !ExpName , !Phase , !Title , *!S ) @SendCommand ( "MBCMSUMM" , "2 , 2" ) !GM_I0 = 2000 !Title = "~CCD sum 2x2, amp A, offset 3 " @Display_string ( !Title , 40 ) @Message( "D" , "time" , !ExpName , !Phase , !GM_Display , *!S ) @Message( "C" , "time" , !ExpName , !Phase , !Title , *!S ) @SendCommand ( "MBCMAADC" , "3" ) @lcmtap() !Title = "~CCD sum 2x2, amp B, offset 3 " @Display_string ( !Title , 40 ) @Message( "D" , "time" , !ExpName , !Phase , !GM_Display , *!S ) @Message( "C" , "time" , !ExpName , !Phase , !Title , *!S ) @SendCommand ( "MBCMBADC" , "3" ) @lcmtap() !GM_I9 = 10 !GM_Display = "~Extract Centre 256x256 with " + &4d( !GM_I9 )\ + " second waits" @Message( "DC" , "time" , !ExpName , !Phase , !GM_Display , *!S ) @SendCommand ( "MBIPLBIC" , "4 , 4" ) @WaitTime ( "00h00m15s" , *!S ) If !GM_Conf = 2 Then PERFORM/NO MDI_LIP , "liptlm2" , "no" End If @SendCommand ( "MBCMHDR1" , "0X4040 , 0X4040 , 0 , 1 , 0" ) @WaitTime ( "00h00m15s" , *!S ) !Title = "~Reset summing mode to 1x1 " @Display_string ( !Title , 40 ) @Message( "D" , "time" , !ExpName , !Phase , !GM_Display , *!S ) @Message( "C" , "time" , !ExpName , !Phase , !Title , *!S ) @SendCommand ( "MBCMSUMM" , "1,1" ) !Title = "~CCD sum 1x1, amp B, offset 0 " @Display_string ( !Title , 40 ) @Message( "D" , "time" , !ExpName , !Phase , !GM_Display , *!S ) @Message( "C" , "time" , !ExpName , !Phase , !Title , *!S ) @SendCommand ( "MBCMBADC" , "0" ) !GM_I0 = 64000 !GM_I1 = 3 !GM_I9 = 45 @lcmtap() !Title = "~CCD sum 1x1, amp B, offset 15" @Display_string ( !Title , 40 ) @Message( "D" , "time" , !ExpName , !Phase , !GM_Display , *!S ) @Message( "C" , "time" , !ExpName , !Phase , !Title , *!S ) @SendCommand ( "MBCMBADC" , "15" ) !GM_I0 = 1000 !GM_I1 = 1 !GM_I9 = 30 @lcmtap() !Title = "~CCD amp A, offset 3 " @Display_string ( !Title , 40 ) @Message( "D" , "time" , !ExpName , !Phase , !GM_Display , *!S ) @Message( "C" , "time" , !ExpName , !Phase , "/" + !Title , *!S ) @SendCommand ( "MBCMAADC" , "3" ) !Question = "MDI Close Decom file(Y)" !Check = "in Y, y" @AskStr ( !Question , !Check , *!GM_S0 , *!S , *!NbErr ) !GM_NbErr = !GM_NbErr + !NbErr !Title = "-FINISHED PROCEDURE: lcmcom." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) Return End Procedure -------------------------------------------------------------------------------< Procedure lcmon ( ) --. --. This procedure powers ON the CCD Camera. --. Var Str( 3) !ExpName = "MDI" Str(10) !Phase = " " Str(49) !Title = " " Str(80) !S = &80s("") Int !NbErr = 0 Str(80) !Question = "" Str(80) !LM_S1 = "" Main !Title = "-EXECUTING PROCEDURE: lcmon." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) !GM_Display = "~Switching ON CCD camera." @Message( "DC" , "time" , !ExpName , !Phase , !GM_Display , *!S ) @SendCommand ( "MBPWCMON" , "" ) -- CCD camera on @WaitTime ( "00h00m10s" , *!S ) @SendCommand ( "MBCMRES" , "" ) -- Reset camera @WaitTime ( "00h00m05s" , *!S ) !Title = "~ CCD Amp A, offset 3 " @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @WaitTime( "00h00m05s" , *!S ) PERFORM/NO MDI_LIP , "lipreset" , "no" @SendCommand ( "MBCMAADC" , "3" ) @WaitTime( "00h00m45s" , *!S ) Expect "MKPWCM" , "ON" , 1 Enable "MKPWCM" -- Beep select !GM_Conf case 1 @PrintParam ( "MIPWA", "ANA") case 2 @PrintParam ( "MIPWB", "ANA") Default End Select !LM_S1 = Get( "MKPWCM" ) If !LM_S1 <> "ON" Then !GM_Display = "*CCD camera is NOT ON - procedure halted" @Message( "DC" , "time" , !ExpName , !Phase , !GM_Display , *!S ) Halt !Title = "*Operator CONTinue" @Message("DC" , "time" , !ExpName , " " , !Title , *!S) End If @CheckDig( "MKPWCM" , "= ON" , *!NbErr ) !GM_NbErr = !GM_NbErr + !NbErr !Title = "-FINISHED PROCEDURE: lcmon." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) Return End Procedure -------------------------------------------------------------------------------< Procedure lcmoff ( ) --. --. This procedure powers OFF the CCD Camera. --. Var Str( 3) !ExpName = "MDI" Str(10) !Phase = " " Str(49) !Title = " " Str(80) !S = &80s("") Int !NbErr = 0 Str(80) !Question = "" Str(80) !LM_S1 = "" Main !Title = "-EXECUTING PROCEDURE: lcmoff." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) !GM_Display = "~Switching OFF CCD camera" @Message( "DC" , "time" , !ExpName , !Phase , !GM_Display , *!S ) @SendCommand ( "MBPWCMOF" , "" ) -- CCD camera off @WaitTime( "00h00m45s" , *!S ) Expect "MKPWCM" , "OFF" , 1 Enable "MKPWCM" -- Beep Select !GM_Conf Case 1 @PrintParam ( "MIPWA", "ANA") Case 2 @PrintParam ( "MIPWB", "ANA") Default End Select !LM_S1 = Get( "MKPWCM" ) If !LM_S1 <> "OFF" Then !GM_Display = "*CCD camera is NOT OFF " @Message( "DC" , "time" , !ExpName , !Phase , !GM_Display , *!S ) Halt !Title = "*Operator CONTinue" @Message("DC" , "time" , !ExpName , " " , !Title , *!S) End If @CheckDig( "MKPWCM" , "= OFF" , *!NbErr ) !GM_NbErr = !GM_NbErr + !NbErr !Title = "-FINISHED PROCEDURE: lcmoff." @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) Return End Procedure -------------------------------------------------------------------------------< Procedure lcmtap ( ) --. --. This procedure file exercises the shutter by taking a picture with --. the parameters specified below and logging the actual shutter times. --. --. !GM_I0 = exposure time in shutter ticks (0.25 msec/tick) --. !GM_I1 = shutter path; 1 - 1x ; 3 - 3x --. !GM_I9 = wait time after exposure command in seconds --. Var Str( 3) !ExpName = "MDI" Str(10) !Phase = " " Str(49) !Title = " " Str(80) !S = "" Str(10) !Time Int !NbErr = 0 Int !LM_I1 = 0 Int !LM_I2 = 0 Int !LM_I3 = 0 Int !LM_I4 = 0 Int !LM_I5 = 0 Int !LM_I6 = 0 Int !LM_I7 = 0 Int !LM_I8 = 0 Real !LM_R1 = 0.0 Real !LM_R2 = 0.0 Main !Title = "-EXECUTING PROCEDURE: lcmtap" @Message( "DCL" , "date" , !ExpName , !Phase , !Title , *!S ) @Time_To_Text( !GM_I9 , *!Time ) If !GM_I1 = 1 Then !Title = "~Taking a 1x image" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Title = "Exposure of " + &6d( !GM_I0 ) + " ticks" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @SendCommand ( "MBCMTP1" , "0,0," + &d( !GM_I0 ) ) End If If !GM_I1 = 3 Then !Title = "~Taking a 3x image" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Title = "Exposure of " + &6d( !GM_I0 ) + " ticks" @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) @SendCommand ( "MBCMTP3" , "0,0," + &d( !GM_I0 ) ) End If If !GM_I9 > 25 Then @WaitTime ( !Time , *!S ) Else @WaitTime ( "00h00m45s" , *!S ) End If !LM_I3 = Get( "MKSHNEXP" ) !LM_I4 = Get( "MKSQFQPP" ) If !LM_I4 = 0 Then !LM_I5 = Get( "MKSQSHO4" ) !LM_I6 = Get( "MKSQSHC4" ) End If If !LM_I4 = 1 Then !LM_I5 = Get( "MKSQSHO1" ) !LM_I6 = Get( "MKSQSHC1" ) End If If !LM_I4 = 2 Then !LM_I5 = Get( "MKSQSHO2" ) !LM_I6 = Get( "MKSQSHC2" ) End If If !LM_I4 = 3 Then !LM_I5 = Get( "MKSQSHO3" ) !LM_I6 = Get( "MKSQSHC3" ) End If !LM_I7 = !LM_I3 * 64 !LM_R1 = Real( !LM_I7 + !LM_I5 ) !LM_R1 = !LM_R1 / 65535.0 !LM_I8 = Int( !LM_R1 ) !LM_R2 = Real( !LM_I8 * 65535 ) !LM_R2 = !LM_R2 + Real( !LM_I6 ) !LM_R2 = !LM_R2 - Real( !LM_I5 ) !LM_R2 = !LM_R2 / 256.0 !Title = "Nominal shutter exposure time (ticks) = " + &6d( !LM_I3 ) @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Title = "Sequence Frame Queue Packet Pointer = " + &6d( !LM_I4 ) @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Title = "Opening count = " + &6d( !LM_I5 ) @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Title = "Closing count = " + &6d( !LM_I6 ) @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Title = "Shutter closing time overflows = " + &6d( !LM_I8 ) @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !Title = "Shutter exposure time (msecs) = " + &9.2f( !LM_R2 ) @Message( "DC" , "time" , !ExpName , !Phase , !Title , *!S ) !GM_NbErr = !GM_NbErr + !NbErr !Title = "-FINISHED PROCEDURE: lcmtap" @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 -------------------------------------------------------------------------------< Procedure Display_string ( Str(80) !Add_Display , Int !Start_Pos ) Var Int !Len1 Int !Len2 Str(80) !Full_Display1 Str(80) !Full_Display2 Main !Len1 = Len( !GM_Display ) !Len2 = Len( !Add_Display ) If !Len1 <= ( !Start_Pos - 1 ) Then !Full_Display1 = !GM_Display Do Exit If !Len1 >= ( !Start_Pos - 1 ) !Full_Display1 = !Full_Display1 + " " !Len1 = !Len1 + 1 End Do !Full_Display2 = "" End If If !Len1 > ( !Start_Pos - 1 ) Then !Full_Display1 = Extract( !GM_Display , 1 , ( !Start_Pos - 1 ) ) If !Len1 > ( !Start_Pos + !Len2 - 1 ) Then !Full_Display2 = Extract( !GM_Display , \ ( !Start_Pos + !Len2 - 1 ) , \ ( !Len1 - !Start_Pos - !Len2 + 1 ) ) Else !Full_Display2 = "" End If End If !GM_Display = !Full_Display1 + !Add_Display + !Full_Display2 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 -------------------------------------------------------------------------------------