#pragma rtGlobals=1 // Use modern global access method. #pragma ModuleName=beamProc #include "epics" Menu "Data" Submenu "EPICS" "spec Status",specStatus() "BeamStatus",BeamStatus() "Wake up when Beam",WakeUpForBeam() End End Function/T specStatus() Variable printOn = (ItemsInList(GetRTStackInfo(0))<2) Variable scanning = get_PV_num("jfk:bit11") Variable scanNum = get_PV_num("jfk:long11") String list="" list = ReplaceNumberByKey("spec_scanning",list,scanning,"=") list = ReplaceNumberByKey("spec_scanNum",list,scanNum,"=") if (printOn) printf "spec_scanning = %d, on scan number %d\r",scanning,scanNum endif String val="",pv,desc Variable i for (i=11;i<=17;i+=1) pv = "jfk:string"+num2istr(i) val=get_PV_str(pv) desc=get_PV_str(pv+".DESC") desc = TrimTraiingWhiteSpace(desc) desc = TrimLeadingWhiteSpace(desc) desc = CleanupName(desc,0) val = TrimTraiingWhiteSpace(val) val = TrimLeadingWhiteSpace(val) if (strlen(val)) if (strsearch(val," ",0) || strsearch(val,"=",0)) val = "'"+val+"'" endif list = ReplaceStringByKey(desc, list, val,"=") if (printOn) // print pv," ",desc," ",val print desc," ",val endif endif endfor return list End Static Function/T TrimLeadingWhiteSpace(str) // remove any leading white space from str String str Variable i i = -1 do i += 1 while (char2num(str[i])<=32) return str[i,strlen(str)-1] End Static Function/T TrimTraiingWhiteSpace(str) // remove any trailing white space from str String str Variable i i = strlen(str) do i -= 1 while (char2num(str[i])<=32) return str[0,i] End Function BeamStatus() Variable current=get_PV_num("BL33:srCurrent") if (current > 0) print get_PV_str("BL33:srCurrent")+" mA with "+get_PV_str("S:SRlifeTimeHrsCC")+" hours lifetime" print "UNICAT ID is at "+get_PV_str("ID33:Gap.VAL")+" mm which is "+get_PV_str("ID33:Energy.VAL")+" keV" else print "No Beam" endif Variable i=2 // OPS:message1 is the machine operators do PrintStrings ("OPS:message"+num2istr(i)) i += 1 while(i<16) Variable mono,white mono = get_PV_num("33id:plc:monoShutter") // 0=open, 1=closed white = get_PV_num("FE:33:ID:FEshutter") // 1=open, 0=closed print "White shutter is "+SelectString(white, "Closed", "Open")+" and Mono shutter is "+SelectString(mono, "Closed", "Open") End Static Function PrintStrings(val) String val String str=get_PV_str(val) if (stringmatch(str,"! ")) // something other than spaces print str endif return 0 End // set_ca_addr_list("") // // Macro BeamStatus() // Silent 1 // set_ca_addr_list("") // Variable current=ezca_get("BL33:srCurrent") // if (current > 0) // print num2str(ezca_get("BL33:srCurrent"))+" mA with "+num2str(ezca_get("S:SRlifeTimeHrsCC"))+" hours lifetime" // print "UNICAT ID is at "+num2str(ezca_get("ID33:Gap.VAL"))+" mm which is "+num2str(ezca_get("ID33:Energy.VAL"))+" keV" // else // print "No Beam" // endif // Variable i=2 // OPS:message1 is the machine operators // do // PrintEzCAStrings ("OPS:message"+num2istr(i)) // i += 1 // while(i<16) // Variable mono,white // mono = ezca_get("33id:plc:monoShutter") // 0=open, 1=closed // white = ezca_get("FE:33:ID:FEshutter") // 1=open, 0=closed // print "White shutter is "+SelectString(white, "Closed", "Open")+" and Mono shutter is "+SelectString(mono, "Closed", "Open") // End // // Function PrintEzCAStrings(val) // String val // String str // = ezca_get_string (val) // if (char2num(str[0,0])>=32) // print str // endif // return 0 // End Function WakeUpForBeam() for (;get_PV_num("S:ActualMode")!=4;) Sleep /C=0/S 3 endfor Variable i for (i=0;i<8;i+=1) beep Sleep /C=5/S 1 endfor End // Macro WakeUpForBeam() // Variable mode=0 // do // Sleep /C=0/S 5 // mode = ezca_get("S:ActualMode") // while(mode!=4) // // Variable i=0 // do // if (exists("speak")==3) // speak("wake up") // else // beep // endif // Sleep /C=5/S 3 // i += 1 // while (i<8) // EndMacro