Changeset 489
- Timestamp:
- Apr 10, 2009 8:45:38 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/RealTimeUpdate_RT.ipf
r486 r489 27 27 Proc Init_for_RealTime() 28 28 // initialize the reduction folders as for normal SANS Reduction, but don't draw the main Reduction control panel 29 DoWindow/K RT_Panel 29 30 InitFolders() 30 31 InitFakeProtocols() … … 89 90 Variable/G totalCounts=0 90 91 endif 92 NVAR countTime = root:myGlobals:RT:countTime 93 if(NVAR_Exists(countTime)==0) 94 Variable/G countTime = 0 95 endif 96 NVAR countRate = root:myGlobals:RT:countRate 97 if(NVAR_Exists(countRate)==0) 98 Variable/G countRate = 0 99 endif 100 NVAR monitorCountRate = root:myGlobals:RT:monitorCountRate 101 if(NVAR_Exists(monitorCountRate)==0) 102 Variable/G monitorCountRate = 0 103 endif 104 NVAR monitorCounts = root:myGlobals:RT:monitorCounts 105 if(NVAR_Exists(monitorCounts)==0) 106 Variable/G monitorCounts = 0 107 endif 91 108 92 109 // set the explicit path to the data file on "relay" computer (the user will be propmted for this) … … 109 126 // set the background task 110 127 SetBackground BkgUpdateHST() 111 CtrlBackground period=(updateInt*60),noBurst= 1//noBurst prevents rapid "catch-up calls128 CtrlBackground period=(updateInt*60),noBurst=0 //noBurst prevents rapid "catch-up calls 112 129 return(0) 113 130 End … … 117 134 Proc RT_Panel() 118 135 PauseUpdate; Silent 1 // building window... 119 NewPanel /W=(300,350,602, 480) /K=2136 NewPanel /W=(300,350,602,580) /K=2 120 137 DoWindow/C RT_Panel 121 138 DoWindow/T RT_Panel,"Real Time Display Controls" … … 141 158 SetVariable setvar_4,help={"This is the period of the update"} 142 159 SetVariable setvar_4,limits={1,3600,0},value= root:myGlobals:RT:updateInt 143 SetVariable setvar_5,pos={11,56},size={150,20},title="Timeout Interval (s)"144 SetVariable setvar_5,help={"After the timeout interval has expired, the update process will automatically stop"}145 SetVariable setvar_5,limits={1,3600,0},value= root:myGlobals:RT:timeout160 // SetVariable setvar_5,pos={11,56},size={150,20},title="Timeout Interval (s)" 161 // SetVariable setvar_5,help={"After the timeout interval has expired, the update process will automatically stop"} 162 // SetVariable setvar_5,limits={1,3600,0},value= root:myGlobals:RT:timeout 146 163 Button button_1,pos={170,29},size={120,20},proc=LoadRTButtonProc,title="Load Live Data" 147 164 Button button_1,help={"Load the data file for real-time display"} … … 150 167 //Button button_3,pos={230,80},size={60,20},proc=RT_DoneButtonProc,title="Done" 151 168 //Button button_3,help={"Closes the panel and stops the updating process"} 152 SetVariable setvar_6,pos={11, 82},size={200,20},title="Total Detector Counts"153 SetVariable setvar_6,help={"Total counts on the detector, as displayed"} 169 SetVariable setvar_6,pos={11,105},size={250,20},title="Total Detector Counts" 170 SetVariable setvar_6,help={"Total counts on the detector, as displayed"},disable=2 154 171 SetVariable setvar_6,limits={0,Inf,0},value= root:myGlobals:RT:totalCounts 172 SetVariable setvar_7,pos={11,82},size={250,20},title=" Count Time" 173 SetVariable setvar_7,help={"Count time, as displayed"},disable=2 174 SetVariable setvar_7,limits={0,Inf,0},value= root:myGlobals:RT:countTime 175 SetVariable setvar_8,pos={11,127},size={250,20},title=" Detector Count Rate" 176 SetVariable setvar_8,help={"Count rate, as displayed"},disable=2 177 SetVariable setvar_8,limits={0,Inf,0},value= root:myGlobals:RT:countRate 178 SetVariable setvar_9,pos={11,149},size={250,20},title=" Monitor Counts" 179 SetVariable setvar_9,help={"Count rate, as displayed"},disable=2 180 SetVariable setvar_9,limits={0,Inf,0},value= root:myGlobals:RT:monitorCounts 181 SetVariable setvar_10,pos={11,171},size={250,20},title=" Monitor Count Rate" 182 SetVariable setvar_10,help={"Count rate, as displayed"},disable=2 183 SetVariable setvar_10,limits={0,Inf,0},value= root:myGlobals:RT:monitorCountRate 155 184 EndMacro 156 185 … … 308 337 309 338 //data is displayed here, and needs header info 310 339 WAVE data = $"root:Packages:NIST:RealTime:data" 340 NVAR totCounts = root:myGlobals:RT:totalCounts 341 NVAR countTime = root:myGlobals:RT:countTime 342 NVAR countRate = root:myGlobals:RT:countRate 343 NVAR monitorCounts = root:myGlobals:RT:monitorCounts 344 NVAR monitorCountRate = root:myGlobals:RT:monitorCountRate 345 SVAR title = root:myGlobals:gCurDispFile 346 347 title="Real-Time : "+filename 348 //sum the total counts, global variable will automatically update 349 WAVE/Z linear_data = $"root:Packages:NIST:RealTime:linear_data" 350 if(WaveExists(linear_data)) 351 totCounts = sum(linear_data, -Inf, Inf ) 352 else 353 WAVE/Z data = $"root:Packages:NIST:RealTime:data" 354 totCounts = sum(data, -Inf, Inf ) 355 endif 356 //Update other live values 357 Wave intw = root:Packages:NIST:RealTime:IntegersRead 358 Wave realw = root:Packages:NIST:RealTime:RealsRead 359 countTime = intw[2] 360 countRate = totCounts/countTime 361 monitorCounts = realw[0] 362 monitorCountRate = monitorCounts/countTime 363 311 364 fRawWindowHook() 312 365 … … 488 541 489 542 WAVE data = $"root:Packages:NIST:RealTime:data" 543 Wave intw = root:Packages:NIST:RealTime:IntegersRead 544 Wave realw = root:Packages:NIST:RealTime:RealsRead 545 Wave/T textw = root:Packages:NIST:RealTime:TextRead 546 490 547 NVAR elapsed=root:myGlobals:RT:elapsed 491 548 NVAR timeout=root:myGlobals:RT:timeout 492 549 NVAR updateInt=root:myGlobals:RT:updateInt 493 NVAR totCounts=root:myGlobals:RT:totalCounts 494 550 NVAR totCounts = root:myGlobals:RT:totalCounts 551 NVAR countTime = root:myGlobals:RT:countTime 552 NVAR countRate = root:myGlobals:RT:countRate 553 NVAR monitorCounts = root:myGlobals:RT:monitorCounts 554 NVAR monitorCountRate = root:myGlobals:RT:monitorCountRate 555 SVAR title=root:myGlobals:gCurDispFile 556 SVAR sampledesc=root:myGlobals:gCurTitle 557 495 558 Variable err=0 496 559 // Variable t1=ticks … … 499 562 elapsed += updateInt 500 563 // get the new data by re-reading the datafile from the relay computer 501 if(elapsed<timeout)564 // if(elapsed<timeout) 502 565 503 566 if(WinType("SANS_Data")==0) … … 510 573 return(1) //display not RealTime 511 574 Endif 512 SVAR title=root:myGlobals:gCurDispFile513 575 title="Reading new data..." 514 576 ControlUpdate/W=SANS_Data/A … … 530 592 MapSliderProc("reset", 0, 1) 531 593 532 title="Real-Time Data Display" 594 title=textw[0] 595 sampledesc=textw[6] 533 596 //sum the total counts, global variable will automatically update 534 597 WAVE/Z linear_data = $"root:Packages:NIST:RealTime:linear_data" … … 539 602 totCounts = sum(data, -Inf, Inf ) 540 603 endif 604 //Update other live values 605 countTime = intw[2] 606 countRate = totCounts/countTime 607 monitorCounts = realw[0] 608 monitorCountRate = monitorCounts/countTime 609 541 610 542 611 // print "Bkg task time (s) =",(ticks-t1)/60.15 543 612 return 0 //keep the process going 544 else545 //timeout, stop the process, reset the button label546 elapsed=0547 Button $"bkgStop",win=RT_Panel,title="Start Updating",rename=bkgStart548 return(1)549 endif613 // else 614 // //timeout, stop the process, reset the button label 615 // elapsed=0 616 // Button $"bkgStop",win=RT_Panel,title="Start Updating",rename=bkgStart 617 // return(1) 618 // endif 550 619 551 620 End … … 566 635 Make/O/N=52 $"root:Packages:NIST:RealTime:RealsRead" 567 636 Make/O/T/N=11 $"root:Packages:NIST:RealTime:TextRead" 637 Make/O/N=7 $"root:Packages:NIST:RealTime:LogicalsRead" 638 568 639 569 640 Wave intw=$"root:Packages:NIST:RealTime:IntegersRead" 570 641 Wave realw=$"root:Packages:NIST:RealTime:RealsRead" 571 642 Wave/T textw=$"root:Packages:NIST:RealTime:TextRead" 643 Wave logw=$"root:Packages:NIST:RealTime:LogicalsRead" 572 644 573 645 //***NOTE **** … … 685 757 intw[22] = integer 686 758 759 //Get Logicals 760 //Read logicals as int - ICE is writing integers here 761 FSetPos refNum,304 762 FBinRead/F=3/B=3 refNum, integer 763 logw[0] = integer 764 FSetPos refNum,316 765 FBinRead/F=3/B=3 refNum, integer 766 logw[1] = integer 767 FSetPos refNum,340 768 FBinRead/F=3/B=3 refNum, integer 769 logw[2] = integer 770 FSetPos refNum,344 771 FBinRead/F=3/B=3 refNum, integer 772 logw[3] = integer 773 FSetPos refNum,446 774 FBinRead/F=3/B=3 refNum, integer 775 logw[4] = integer 776 FSetPos refNum,462 777 FBinRead/F=3/B=3 refNum, integer 778 logw[5] = integer 779 FSetPos refNum,466 780 FBinRead/F=3/B=3 refNum, integer 781 logw[6] = integer 782 783 687 784 Close refNum 688 785 … … 837 934 838 935 //clean up - get rid of w = $"root:Packages:NIST:RAW:tempGBWave0" 839 //KillWaves/Z w936 KillWaves/Z w 840 937 841 938 //return the data folder to root
Note: See TracChangeset
for help on using the changeset viewer.