[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] Bug in Error Model Tcl lib file
There is a bug in the Error Model Tcl lib file---the ErrorModel/TwoStateMarkov
class is initialised incorrectly:
Class ErrorModel/TwoStateMarkov -superclass ErrorModel/TwoState
ErrorModel/TwoStateMarkov instproc init {rate eu {transition}} {
$self next
$self unit time
set rv0 [new RandomVariable/Exponential]
set rv1 [new RandomVariable/Exponential]
$rv0 set avg_ [lindex $rate 0]
$rv1 set avg_ [lindex $rate 1]
$self ranvar 0 $rv0
$self ranvar 1 $rv1
# set p01 [lindex $transition 0]
# set p10 [lindex $transition 1]
# set trans [list [list [expr 1 - $p01] $p01] \
# [list [expr 1 - $p01] $p01]]
# # state 0 is the start state
# $self next $states_ $trans $eu $i [lindex $states_ 0]
}
Considering that the init procedure for ErrorModel/TwoState requires the
arguments:
ErrorModel/TwoState instproc init {rv0 rv1 {unit "pkt"}} {
...
}
the init procedure for the TwoStateMarkov class should be as follows:
ErrorModel/TwoStateMarkov instproc init {rate eu {transition}} {
# Bug fix by Sven Ostring 2000/11/24
# $self next
# $self unit time
set rv0 [new RandomVariable/Exponential]
set rv1 [new RandomVariable/Exponential]
$rv0 set avg_ [lindex $rate 0]
$rv1 set avg_ [lindex $rate 1]
set unit time
# Bug fix by Sven Ostring 2000/11/24
# $self ranvar 0 $rv0
# $self ranvar 1 $rv1
$self next $rv0 $rv1 $unit
# set p01 [lindex $transition 0]
# set p10 [lindex $transition 1]
# set trans [list [list [expr 1 - $p01] $p01] \
# [list [expr 1 - $p01] $p01]]
# # state 0 is the start state
# $self next $states_ $trans $eu $i [lindex $states_ 0]
}
Cheers,
Sven.