Contributed by Jianping Pan (jpan@bbcr.uwaterloo.ca).

The multi-state error model implements time-based error state transitions. Transitions to the next error state occur at the end of the duration of the current state. The next error state is then selected using the transition state matrix.

To create a multi-state error model, the following parameters should be supplied (as defined in ns/tcl/lib/ns-errmodel.tcl):

`states`: an array of states (error models).`periods`: an array of state durations.`trans`: the transition state model matrix.`transunit`: one of`[pkt|byte|time]`.`sttype`: type of state transitions to use: either`time`or`pkt`.`nstates`: number of states.`start`: the start state.

Here is a simple example script to create a multi-state error model:

set tmp [new ErrorModel/Uniform 0 pkt] set tmp1 [new ErrorModel/Uniform .9 pkt] set tmp2 [new ErrorModel/Uniform .5 pkt] # Array of states (error models) set m_states [list $tmp $tmp1 $tmp2] # Durations for each of the states, tmp, tmp1 and tmp2, respectively set m_periods [list 0 .0075 .00375] # Transition state model matrix set m_transmx { {0.95 0.05 0} {0 0 1} {1 0 0} } set m_trunit pkt # Use time-based transition set m_sttype time set m_nstates 3 set m_nstart [lindex $m_states 0] set em [new ErrorModel/MultiState $m_states $m_periods $m_transmx \\ $m_trunit $m_sttype $m_nstates $m_nstart]

Tom Henderson 2011-11-05