본문 바로가기

네트워크

.tcl 파일 읽기

교수님이
어느정도 읽고 수정할줄 알라고 하셨다.

일단...보고 이해중인뎅
어렵당 ㅠㅠ

일단 내가 수정하기 위해서
교수님이 주신 streamsim.tcl 파일을
이해해야할 부분 하나씩 살펴보기로 했다!

set temp {1.0.0 1.0.1 1.0.2 1.0.3}
  set BS(0) [$ns_ node [lindex $temp 0]]
  set BS(1) [$ns_ node 2.0.0]
  $BS(0) random-motion 0
  $BS(1) random-motion 0

  $BS(0) set X_ 1.0
  $BS(0) set Y_ 2.0
  $BS(0) set Z_ 0.0

  $BS(1) set X_ 650.0
  $BS(1) set Y_ 600.0
  $BS(1) set Z_ 0.0

  #configure for mobilenodes
  $ns_ node-config -wiredRouting OFF

  for {set j 0} {$j < $opt(nn)} {incr j} {
    set node_($j) [ $ns_ node [lindex $temp \
            [expr $j+1]] ]
    $node_($j) base-station [AddrParams addr2id [$BS(0) node-addr]]
  }
==>알고싶은데 아직 잘 모르겠는 부분이다..
     BS들에..대해..설정해주는 부분인것도같은데..아직은 잘 모르겠다


#create links between wired and AB nodes 
  $ns_ duplex-link $W(0) $W(1) 5Mb 2ms DropTail
  $ns_ duplex-link $W(1) $BS(0) 100Mb 20ms DropTail
  $ns_ duplex-link $W(1) $BS(1) 5Mb 2ms DropTail
 
==>$ns링크연결명령어, 노드1 , 노드2, 대역폭, Bandwidth TransmisionDelay(전송지연), 큐종류



  $ns_ duplex-link-op $W(0) $W(1) orient down
  $ns_ duplex-link-op $W(1) $BS(0) orient left-down
  $ns_ duplex-link-op $W(1) $BS(1) orient right-down
==>어떤식으로 연결할것인지 (시각적으로)


  # setup TCP connections
  set tcp1 [new Agent/TCP]
  $tcp1 set class_ 1
  set sink1 [new Agent/TCPSink]
  $ns_ attach-agent $node_(0) $tcp1
  $ns_ attach-agent $W(0) $sink1
  $ns_ connect $tcp1 $sink1
==> TCP(tcp1)를 생성하고 node(0),W(0)에 붙여 연결한다.
==> tfrc2와 트래픽싱크 sink2를 연결시킨다..

 
set ftp1 [new Application/FTP]
  $ftp1 attach-agent $tcp1
  $ns_ at 150 "$ftp1 start"
==>  ftp1을 tcp1연결에 붙인다..?

  # setup TFRC connections
  set tfrc2 [new Agent/TFRC]
  $tfrc2 set class_ 2
  set sink2 [new Agent/TFRCSink]
  $ns_ attach-agent $node_(1) $sink2
  $ns_ attach-agent $W(1) $tfrc2
  $ns_ connect $tfrc2 $sink2
==> TFRC연결을 생성하고, node(1), W(1)에 붙여 연결한다..(tfrc2)
==> tfrc2와 트래픽싱크 sink2를 연결시킨다..

  set ftp2 [new Application/FTP]
  $ftp2 attach-agent $tfrc2
  $ns_ at 200 "$ftp2 start"
  ==>ftp2를 생성해, tfrc2에 연결한다



  for {set i 0} {$i < $opt(nn)} {incr i} {
      $ns_ initial_node_pos $node_($i) 20
   }

  for {set i } {$i < $opt(nn) } {incr i} {
      $ns_ at $opt(stop).0000010 "$node_($i) reset";
  }
  $ns_ at $opt(stop).0000010 "$BS(0) reset";

  $ns_ at $opt(stop).1 "puts \"NS EXITING...\" ; $ns_ halt"

  puts "Starting Simulation..."
  $ns_ run




그외엔...블라블라블라.............

일단 눈에 띄고 , 좀 알아야하는것만 좀 찾아 이해하려고 한건데..

모르겠다잘.....이게먼지...

'네트워크' 카테고리의 다른 글

awk  (0) 2010.08.17
Cygwin과 ns2  (3) 2010.08.05