40 parameters_ok =
false;
54 it_assert(Delay >= 0,
"Packet_Channel::set_parameters(): ");
55 it_assert(Pr >= 0.0 && Pr <= 1.0,
"Packet_Channel::set_parameters(): ");
56 it_assert(Block_rate > 0,
"Packet_Channel::set_parameters(): ");
57 it_assert(Max_slots >= 0,
"Packet_Channel::set_parameters(): ");
60 block_time = 1.0 / Block_rate;
61 max_slots = Max_slots;
66 explicit_errors =
false;
74 it_assert(parameters_ok,
"Packet_Channel::handle_input(): ");
75 it_assert(M != NULL,
"Packet_Channel::handle_input(): ");
76 if (explicit_errors) {
94 void Packet_Channel::block_rate_loop()
96 it_assert(parameters_ok,
"Packet_Channel::block_rate_loop(): ");
99 Event_Queue::add(
new Event<Packet_Channel>(
this, &Packet_Channel::block_rate_loop, block_time));
102 void Packet_Channel::handle_start(
const bool run)
104 it_assert(parameters_ok,
"Packet_Channel::handle_start(): ");
105 if (run && !keep_running)
106 Event_Queue::add(
new Event<Packet_Channel>(
this, &Packet_Channel::block_rate_loop, block_time));
110 void Packet_Channel::handle_nof_inputs(
const int Nof_ready_messages)
112 it_assert(Nof_ready_messages >= 0,
"Packet_Channel::handle_nof_inputs(): ");
117 L =
std::min(Nof_ready_messages, 1);
126 it_assert(
min(Lost) >= 0,
"Packet_Channel::set_errors(): ");
129 explicit_errors =
true;
139 parameters_ok =
false;
152 it_assert(Delay >= 0,
"ACK_Channel::set_parameters(): ");
153 it_assert(Pr >= 0.0 && Pr <= 1.0,
"ACK_Channel::set_parameters(): ");
157 explicit_errors =
false;
160 parameters_ok =
true;
163 void ACK_Channel::handle_input(
ACK* M)
165 it_assert(parameters_ok,
"ACK_Channel::handle_input(): ");
166 it_assert(M != NULL,
"ACK_Channel::handle_input(): ");
167 if (explicit_errors) {
188 it_assert(
min(Lost) >= 0,
"ACK_Channel::set_errors(): ");
191 explicit_errors =
true;