Vanetza
 
Loading...
Searching...
No Matches
dcc_information_sharing.hpp
1#ifndef DCC_INFORMATION_SHARING_HPP_GZCSHZLD
2#define DCC_INFORMATION_SHARING_HPP_GZCSHZLD
3
4#include <vanetza/common/clock.hpp>
5#include <vanetza/common/hook.hpp>
6#include <vanetza/common/unit_interval.hpp>
7#include <vanetza/geonet/cbr_aggregator.hpp>
8#include <vanetza/geonet/dcc_field_generator.hpp>
9
10namespace vanetza
11{
12
13class Runtime;
14
15namespace geonet
16{
17
18class LocationTable;
19
20/**
21 * DccInformationSharing realises the DCC_net behaviour for ITS-G5
22 * \see TS 102 636-4-2 V1.1.1
23 *
24 * CBR_target mentioned in TS 102 636-4-2 V1.1.1 is probably the same constant as
25 * NDL_maxChannelUse mentioned in TS 102 687 V1.1.1. However, no value is given:
26 * Table A.3 in TS 102 687 declares them (implicitly through NDL_tmPacketArrivalrate) "n.a.".
27 * Thus, we simply assume CBR_target = NDL_maxChannelUse = NDL_maxChannelLoad.
28 */
30{
31public:
32 /**
33 * Create DCC_net instance
34 *
35 * \param rt Runtime for scheduling periodic update cycles
36 * \param lt Location Table with LocTEX_G5 entries
37 * \param target CBR_target value (usually NDL_maxChannelLoad)
38 * \param delay Delaying first update cycle randomly
39 *
40 * \note Set random delay interval when multiple stations are created at the same time!
41 * Values shall be distributed uniformly across full integer range.
42 */
45
46 DccField generate_dcc_field() override;
47
48 /**
49 * Update local CBR measurement
50 *
51 * Local measurement rate is decoupled from processing in DCC_net,
52 * i.e. DccInformationSharing buffers the given value and the latest
53 * measurement value when its internal update cycle runs.
54 *
55 * \param cbr local CBR measurement
56 */
58
59private:
60 void trigger();
61
62 Runtime& m_runtime;
63 const LocationTable& m_location_table;
64 const dcc::ChannelLoad m_cbr_target;
65 dcc::ChannelLoad m_cbr_local;
66 CbrAggregator m_aggregator;
67 Clock::duration m_trigger_interval;
68 Timestamp m_last_aggregation;
69 Hook<const CbrAggregator&> m_update_hook;
70
71public:
72 /**
73 * on_global_cbr_update is called at each update cycle,
74 * i.e. when a new global CBR has been calculated
75 */
77};
78
79} // namespace geonet
80} // namespace vanetza
81
82#endif /* DCC_INFORMATION_SHARING_HPP_GZCSHZLD */
83
HookRegistry< const CbrAggregator & > on_global_cbr_update