⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simplekey.tcl

📁 可以在ns-2中进行仿真的SPIN路由协议的源码
💻 TCL
字号:
puts "Sourcing data setup script now"puts "We currently think that there are $opt(nn) nodes in the net"# This file will set up disjoint keys# for a layout of num_nodesset metadatatype KeyMetaData# This is the global wants list# We'll lengthen or shorten it, depending upon how many nodes# are in the simulation.set baselength 26set baselist [list A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]if {$opt(nn) == $baselength} {        set wantslist $baselist} elseif {$opt(nn) < $baselength} {    #set wantslist [lreplace $baselist $opt(nn) end]    set wantslist [list A]} else {    set wantslist ""    for {set i 1} {$i <= $opt(nn)} {incr i} {	set block [expr $i / $baselength]	set el [lindex $baselist [expr $i % $baselength]]		set newel "$el$block"		set wantslist [concat $wantslist $newel]    }}	puts "wantslist is now $wantslist"proc find_haslist {id} {    global wantslist opt    set haslist ""        if {$id == 1} {	 	set haslist [concat $haslist [lindex $wantslist 0]]	}        #for {set j 0} {$j < $opt(overlap)} {incr j} {	#	set index [expr ($id + $j) % [llength $wantslist]]	#	set haslist [concat $haslist [lindex $wantslist $index]]    #}    return $haslist}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -