Vanetza
 
Loading...
Searching...
No Matches
channel_load.cpp
1#include "channel_load.hpp"
2
3namespace vanetza
4{
5namespace dcc
6{
7
8ChannelLoad::ChannelLoad(const UnitInterval& interval) :
9 UnitInterval(interval)
10{
11}
12
13ChannelLoad::ChannelLoad(unsigned probes_busy, unsigned probes_total) :
14 UnitInterval(create_from_probes(probes_busy, probes_total))
15{
16}
17
18UnitInterval ChannelLoad::create_from_probes(unsigned probes_busy, unsigned probes_total)
19{
20 double fraction = 0.0;
21 if (probes_total != 0) {
22 fraction = probes_busy;
23 fraction /= probes_total;
24 }
25
26 return UnitInterval(fraction);
27}
28
29} // namespace dcc
30} // namespace vanetza
31
static UnitInterval create_from_probes(unsigned probes_busy, unsigned probes_total)