Wiselib
Public Types | Public Member Functions
wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P > Class Template Reference

Module implementing DV-hop. More...

#include <localization_dv_hop_module.h>

Inherits wiselib::LocalizationModule< OsModel_P, Radio_P, SharedData_P >.

List of all members.

Public Types

typedef OsModel_P OsModel
typedef Radio_P Radio
typedef Clock_P Clock
typedef Debug_P Debug
typedef SharedData_P SharedData
typedef NodeSet_P NodeSet
typedef Arithmatic_P Arithmatic
typedef
LocalizationDvHopModule
< OsModel, Radio, Clock, Debug,
SharedData, NodeSet,
Arithmatic
self_type
typedef LocalizationModule
< OsModel, Radio, SharedData
base_type
typedef Radio::size_t size_t
typedef Radio::node_id_t node_id_t
typedef Radio::block_data_t block_data_t
typedef Clock_P::time_t time_t
typedef
LocalizationDvHopMessage
< OsModel, Radio, Arithmatic
DvHopMessage
typedef
LocalizationDvCalMessage
< OsModel, Radio, Arithmatic
DvCalMessage
typedef
SharedData::Neighborhood::NeighborhoodIterator 
NeighborhoodIterator
typedef SharedData::Neighborhood Neighborhood
typedef
SharedData::LocalCoordinateSystem 
LocalCoordinateSystem

Public Member Functions

void rollback (void)
void init (Radio &radio, Clock &clock, Debug &debug, SharedData &shared_data)
construction / destruction
 LocalizationDvHopModule ()
 ~LocalizationDvHopModule ()
standard methods startup/simulation steps
void receive (node_id_t from, size_t len, block_data_t *data)
 Handling of DV-Hop-Messages.
void work (void)
 Check, whether state can be set to finished or not.
module status info
bool finished (void)
basic access to owner, observer, neighborhood and local coordinate system
void set_shared_data (SharedData &shared_data)
 This method sets the shared data object, which can be accessed by all available modules.
SharedDatashared_data (void)
Neighborhoodneighborhood (void)
LocalCoordinateSystemlocal_coord_sys (void)

Protected Member Functions

message handling methods
bool process_dv_hop_message_anchor (node_id_t from, size_t len, block_data_t *data)
 Message handling by anchors.
bool process_dv_hop_message_unknown (node_id_t from, size_t len, block_data_t *data)
 Message handling by unknowns.
bool process_dv_cal_message (node_id_t from, size_t len, block_data_t *data)
 If an unknown receives dv-hop calibration message containing an average hop distance, the hops to known anchors are converted into distances by multiplying them with each other.

Detailed Description

template<typename OsModel_P, typename Radio_P, typename Clock_P, typename Debug_P, typename SharedData_P, typename NodeSet_P, typename Arithmatic_P>
class wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >

Module implementing DV-hop.

This module implements DV-hop. On the one hand, unknown nodes store the minimal hop count to at most 'floodlimit' anchors, where the floodlimit is taken from the LocalizationObserver. On the other hand, anchors compute an average hop distance between each other and send this information out. The unknowns again convert their minimal hop counts via the average hop distance into distances to anchors.


Member Typedef Documentation

template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
typedef Arithmatic_P wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::Arithmatic
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
typedef LocalizationModule<OsModel, Radio, SharedData> wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::base_type
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
typedef Radio::block_data_t wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::block_data_t
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
typedef Clock_P wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::Clock
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
typedef Debug_P wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::Debug
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
typedef LocalizationDvCalMessage<OsModel, Radio, Arithmatic> wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::DvCalMessage
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
typedef LocalizationDvHopMessage<OsModel, Radio, Arithmatic> wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::DvHopMessage
template<typename OsModel_P , typename Radio_P , typename SharedData_P >
typedef SharedData::LocalCoordinateSystem wiselib::LocalizationModule< OsModel_P, Radio_P, SharedData_P >::LocalCoordinateSystem [inherited]
template<typename OsModel_P , typename Radio_P , typename SharedData_P >
typedef SharedData::Neighborhood wiselib::LocalizationModule< OsModel_P, Radio_P, SharedData_P >::Neighborhood [inherited]
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
typedef SharedData::Neighborhood::NeighborhoodIterator wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::NeighborhoodIterator
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
typedef Radio::node_id_t wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::node_id_t
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
typedef NodeSet_P wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::NodeSet
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
typedef OsModel_P wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::OsModel
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
typedef Radio_P wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::Radio
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
typedef LocalizationDvHopModule<OsModel, Radio, Clock, Debug, SharedData, NodeSet,Arithmatic> wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::self_type
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
typedef SharedData_P wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::SharedData
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
typedef Radio::size_t wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::size_t
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
typedef Clock_P::time_t wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::time_t

Constructor & Destructor Documentation

template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::LocalizationDvHopModule ( )
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::~LocalizationDvHopModule ( )

Member Function Documentation

template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
bool wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::finished ( void  )
Returns:
true, if module is finished. false otherwise
See also:
LocalizationModule::finished()
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
void wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::init ( Radio radio,
Clock clock,
Debug debug,
SharedData shared_data 
) [inline]
template<typename OsModel_P , typename Radio_P , typename SharedData_P >
LocalCoordinateSystem& wiselib::LocalizationModule< OsModel_P, Radio_P, SharedData_P >::local_coord_sys ( void  ) [inline, inherited]
Returns:
Writable shared LocalizationLocalCoordinateSystem.
template<typename OsModel_P , typename Radio_P , typename SharedData_P >
Neighborhood& wiselib::LocalizationModule< OsModel_P, Radio_P, SharedData_P >::neighborhood ( void  ) [inline, inherited]
Returns:
Writable shared LocalizationNeighborhood.
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
bool wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::process_dv_cal_message ( node_id_t  from,
size_t  len,
block_data_t data 
) [protected]

If an unknown receives dv-hop calibration message containing an average hop distance, the hops to known anchors are converted into distances by multiplying them with each other.

See also:
LocalizationDVcalMessage
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
bool wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::process_dv_hop_message_anchor ( node_id_t  from,
size_t  len,
block_data_t data 
) [protected]

Message handling by anchors.

If anchor receives a dv-hop message, it computes the real distance between them and devides it by the hop count to get an average hop distance.

This is done for each received message (as long as floodlimit is not reached), so that the mean of average hop distances can be builded to send out a calibration message.

See also:
LocalizationDVhopMessage
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
bool wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::process_dv_hop_message_unknown ( node_id_t  from,
size_t  len,
block_data_t data 
) [protected]

Message handling by unknowns.

If unknown receives a dv-hop message, it decides, whether anchor and hop count should be stored or not.

If a message about a new anchor arrived and floodlimit is not reached, or the received hop count is lower than known one, information is stored and a new message containing this is sent out.

See also:
LocalizationDVhopMessage
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
void wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::receive ( node_id_t  from,
size_t  len,
block_data_t data 
)

Handling of DV-Hop-Messages.

See also:
LocalizationModule::process_message()
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
void wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::rollback ( void  )
template<typename OsModel_P , typename Radio_P , typename SharedData_P >
void wiselib::LocalizationModule< OsModel_P, Radio_P, SharedData_P >::set_shared_data ( SharedData shared_data) [inline, inherited]

This method sets the shared data object, which can be accessed by all available modules.

Parameters:
LocalizationSharedDataShared data between all modules.
template<typename OsModel_P , typename Radio_P , typename SharedData_P >
SharedData& wiselib::LocalizationModule< OsModel_P, Radio_P, SharedData_P >::shared_data ( void  ) [inline, inherited]
Returns:
LocalizationSharedData shared by all modules.
writable LocalizationSharedData shared by all modules.
template<typename OsModel_P , typename Radio_P , typename Clock_P , typename Debug_P , typename SharedData_P , typename NodeSet_P , typename Arithmatic_P >
void wiselib::LocalizationDvHopModule< OsModel_P, Radio_P, Clock_P, Debug_P, SharedData_P, NodeSet_P, Arithmatic_P >::work ( void  )

Check, whether state can be set to finished or not.

Moreover, if owner is an anchor, initial and calibrating message are send.

See also:
LocalizationModule::work()

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines