source $cfPath(scan)/scan_common_1.tcl proc ::scan::pre_hmm_scan_prepare {} {} proc ::scan::isc_initialize {} { ::scan::ic_initialize } proc filecounts_log {fname txt} { set fd [open $fname a] puts $fd "$txt" close $fd } proc thresholdscan {minVoltage maxVoltage stepVoltage minBMThreshold manBMThreshold stepBMThreshold scantime} { # following is used to obtain an optimal BM threshold set fileCounts ../log/bmcounts.log set fileCountsDiff ../log/bmcountsdiff.log variable curCount set fd [open $fileCounts w] close $fd set fd [open $fileCountsDiff w] close $fd set txt "" for {set thres $minBMThreshold} {$thres <= $manBMThreshold} {incr thres $stepBMThreshold} { lappend txt $thres } filecounts_log $fileCounts "Thres: $txt" clientput "Start scanning loop now" for {set vol $minVoltage} {$vol <= $maxVoltage} {incr vol $stepVoltage} { emHV1 $vol set curCount "" for {set thres $minBMThreshold} {$thres <= $manBMThreshold} {incr thres $stepBMThreshold} { clientput "set thredshold to $thres" bmthreshold $thres setcounter stop clientput "Threshold= $thres, scanning $scantime seconds now..." setcounter start time=$scantime clientput "Store count now..." lappend curCount [hval /sample/emHV/count1] } set txt "$vol : $curCount" filecounts_log $fileCounts $txt set diff "" for {set ind 1} {$ind < [llength $curCount]} {incr ind} { lappend diff [expr [lindex $curCount $ind]-[lindex $curCount [expr $ind-1]]] } set txt "$vol : $diff" filecounts_log $fileCountsDiff $txt } } publish thresholdscan user