sat-teledesic-nodes.tcl
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:3k
源码类别:

通讯编程

开发平台:

Visual C++

  1. # Copyright (c) 1999 Regents of the University of California.
  2. # All rights reserved.
  3. #
  4. # Redistribution and use in source and binary forms, with or without
  5. # modification, are permitted provided that the following conditions
  6. # are met:
  7. # 1. Redistributions of source code must retain the above copyright
  8. #    notice, this list of conditions and the following disclaimer.
  9. # 2. Redistributions in binary form must reproduce the above copyright
  10. #    notice, this list of conditions and the following disclaimer in the
  11. #    documentation and/or other materials provided with the distribution.
  12. # 3. All advertising materials mentioning features or use of this software
  13. #    must display the following acknowledgement:
  14. #       This product includes software developed by the MASH Research
  15. #       Group at the University of California Berkeley.
  16. # 4. Neither the name of the University nor of the Research Group may be
  17. #    used to endorse or promote products derived from this software without
  18. #    specific prior written permission.
  19. #
  20. # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  21. # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23. # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  24. # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  25. # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  26. # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  27. # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  28. # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  29. # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30. # SUCH DAMAGE.
  31. #
  32. # Contributed by Tom Henderson, UCB Daedalus Research Group, June 1999
  33. #
  34. if {![info exists ns]} {
  35. puts "Error: sat-teledesic-nodes.tcl is a supporting script for the "
  36. puts "       sat-teledesic.tcl script-- run `sat-teledesic.tcl' instead"
  37. exit
  38. }
  39. # 1. Configure initial classifier
  40. # 2. Label plane that the satellite is in (used to identifying intraplane isl)
  41. # 3. In each orbital plane, we need to "set_next" (set one-behind in orbit)
  42. #      (this is a mandatory optimization to reduce handoff lookups)
  43. for {set a 1} {$a <= 12} {incr a} {
  44. for {set i [expr $a * 100]} {$i < [expr $a * 100 + 24]} {incr i} {
  45. if {$a % 2} {
  46. set stagger 0
  47. } else { 
  48. set stagger 7.5 
  49. }
  50. set imod [expr $i % 100]
  51. set n($i) [$ns node]
  52. $n($i) set-position $alt $inc [expr 15 * ($a - 1)] 
  53.     [expr $stagger + $imod * 15] $a 
  54. }
  55. }
  56. # Set up next pointer
  57. for {set a 1} {$a <= 12} {incr a} {
  58. for {set i [expr $a * 100]} {$i < [expr $a * 100 + 24]} {incr i} {
  59. if {$i % 100} {
  60. set next [expr $i - 1]
  61. } else {
  62. set next [expr $a * 100 + 23]
  63. }
  64. $n($i) set_next $n($next)
  65. }
  66. }