Download presentation
Presentation is loading. Please wait.
Published byKathlyn Rosanna Stevens Modified over 9 years ago
1
Sown Code Report: Aggregation Tracking Group Management Pascal A. Vicaire University of Virginia pv9f@cs.virginia.edu
2
Local TrackingM Tracking Sens Control Bottom Sensing GM Control Leds Tracking Timer RC Control Trip Wire Static Leader Aggr Control Aggr Attribute Sensing Base Station SensingC Sensing Std Control BottomSensingC Bottom Sensing Attribute Sensing Std Control Group Management LocalM AggregationC BackboneC Trip WireM ReceiveC Base Station Aggregation Std Control Group ManagementC Static Leader TripWire TimerC Tracking Timer LedsC Leds Report CommC Report Comm Std Control TrackingC Configuration Provided Interface Used Interface Module
3
Local TrackingM Tracking Sens Control Bottom Sensing GM Control Leds Tracking Timer RC Control Trip Wire Static Leader Aggr Control Aggr Attribute Sensing Base Station SensingC Sensing Std Control BottomSensingC Bottom Sensing Attribute Sensing Std Control Group Management LocalM AggregationC BackboneC Trip WireM ReceiveC Base Station Aggregation Std Control Group ManagementC Static Leader TripWire TimerC Tracking Timer LedsC Leds Report CommC Report Comm Std Control TrackingC Studied Modules & Configurations Configuration Provided Interface Used Interface Module
4
Local TrackingM Tracking Sens Control Bottom Sensing GM Control Leds Tracking Timer RC Control Trip Wire Static Leader Aggr Control Aggr Attribute Sensing Base Station … setParameters
5
Local TrackingM Tracking Sens Control Bottom Sensing GM Control Leds Tracking Timer RC Control Trip Wire Static Leader Aggr Control Aggr Attribute Sensing Base Station Initialize: Sensing module. Group management module. ReportComm module. Aggregation module. Leader identifier. TripWire information. init ET_POSITION_Sense init whoIsMyLeader isTripWireBase
6
Local TrackingM Tracking Sens Control Bottom Sensing GM Control Leds Tracking Timer RC Control Trip Wire Static Leader Aggr Control Aggr Attribute Sensing Base Station Start: Sensing module. Group management module. Tracking timer. Report module. Aggregation module. Localization module. start getXstart getY
7
Local TrackingM Tracking Sens Control Bottom Sensing GM Control Leds Tracking Timer RC Control Trip Wire Static Leader Aggr Control Aggr Attribute Sensing Base Station Stop: Sensing module. Group management module. Tracking module. Report module. Aggregation module. stop
8
Local TrackingM Tracking Sens Control Bottom Sensing GM Control Leds Tracking Timer RC Control Trip Wire Static Leader Aggr Control Aggr Attribute Sensing Base Station post GMTask(); if (!_isBaseLeader) { _senseCounter++; if (_senseCounter >= SENSE_CNT_THRESHOLD/ENVIRO_WORKING_CLOCK) { _senseCounter = 0; post SenseTask(); } if (_newSensing) { ET_sendCount ++; if (ET_sendCount >= (REFRESH_INTERVAL/ENVIRO_WORKING_CLOCK)) { ET_sendCount = 0; post sendTask(); } fired GMTask senseTask sendTask aggrTask if (_isLeader) { ET_aggrCount ++; if (ET_aggrCount >= (REFRESH_INTERVAL/ENVIRO_WORKING_CLOCK)) { ET_aggrCount = 0; post aggrTask(); } Periodically Post group management task for this Tracking phase Post sense task If not a base Send Sensing Report (Only non base motes) Aggregate received Data if leader
9
Local TrackingM Tracking Sens Control Bottom Sensing GM Control Leds Tracking Timer RC Control Trip Wire Static Leader Aggr Control Aggr Attribute Sensing Base Station Post sensing done task. Sensing Done SenseDoneTask
10
Local TrackingM Tracking Sens Control Bottom Sensing GM Control Leds Tracking Timer RC Control Trip Wire Static Leader Aggr Control Aggr Attribute Sensing Base Station The mote is a group leader if on_off is true. If it is a leader: green LED off, red LED on. If it is not a leader: green LED off, red LED off. Update variables. LeadergreenOffredOn redOff
11
Local TrackingM Tracking Sens Control Bottom Sensing GM Control Leds Tracking Timer RC Control Trip Wire Static Leader Aggr Control Aggr Attribute Sensing Base Station The mote is a group member if on_off is true. If it is a member: green LED on, red LED off. It it is not a member: green LED off, red LED off. Update variables. MembergreenOffredOff greenOn
12
Local TrackingM Tracking Sens Control Bottom Sensing GM Control Leds Tracking Timer RC Control Trip Wire Static Leader Aggr Control Aggr Attribute Sensing Base Station event result_t RC.receiveReport(RCReport *rcReport) { dbg(DBG_TRACKING, "TrackingM.RC.receiveReport\n"); if (_isBaseLeader) { baseStation_reportPosition_struct *temp; temp = (baseStation_reportPosition_struct*)(rcReport->data); call baseStation.reportPosition(temp); } else { baseStation_reportPosition_struct *temp; temp = (baseStation_reportPosition_struct*)(rcReport->data); call GM.receiveMessage(1, temp->GMInformation); } return SUCCESS; } receiveReportreportPositionreceiveMessage Base mote reports to base station Other motes (only leaders can Receive reports) call the group Management module
13
Local TrackingM Tracking Sens Control Bottom Sensing GM Control Leds Tracking Timer RC Control Trip Wire Static Leader Aggr Control Aggr Attribute Sensing Base Station This function does nothing. aggrSendDone
14
Local TrackingM Tracking Sens Control Bottom Sensing GM Control Leds Tracking Timer RC Control Trip Wire Static Leader Aggr Control Aggr Attribute Sensing Base Station ET_Position_senseDone ET_ATTRIBUTES.ET_POSITION=value.
15
Local TrackingM Tracking Sens Control Bottom Sensing GM Control Leds Tracking Timer RC Control Trip Wire Static Leader Aggr Control Aggr Attribute Sensing Base Station Start group management heart beat. GMTask fireHeartBeart
16
Local TrackingM Tracking Sens Control Bottom Sensing GM Control Leds Tracking Timer RC Control Trip Wire Static Leader Aggr Control Aggr Attribute Sensing Base Station Initiate sensor reading SenseTask conditionSense
17
Local TrackingM Tracking Sens Control Bottom Sensing GM Control Leds Tracking Timer RC Control Trip Wire Static Leader Aggr Control Aggr Attribute Sensing Base Station SenseDoneTask joinleave if (_newSensing) { if (_sensing == FALSE) { _sensing = TRUE; call GM.join(); } else { if (_sensing == TRUE) { _sensing = FALSE; if (!_isLeader || _sent) { call GM.leave(); } If there is a new sensing report, and the mote was not currently sensing, Seek to join group. If there is no new sensing report, And the mote was currently sensing, Seek to leave group.
18
Local TrackingM Tracking Sens Control Bottom Sensing GM Control Leds Tracking Timer RC Control Trip Wire Static Leader Aggr Control Aggr Attribute Sensing Base Station Only non base motes. Call aggregation module. SendTask sendData
19
Local TrackingM Tracking Sens Control Bottom Sensing GM Control Leds Tracking Timer RC Control Trip Wire Static Leader Aggr Control Aggr Attribute Sensing Base Station baseStation_reportPosition_struct temp; tos_time_t timeStamp; dbg(DBG_TRACKING, "TrackingM.aggrTask\n"); ET_AGGRATTRIBUTES = call Aggr.aggregate(); _GMInfo = call GM.getState(); if ((ET_AGGRATTRIBUTES.degreeA + _GMInfo.groupAge) < DEGREE_OF_AGGREGATION) { if (!_sensing) { call GM.leave(); } return; } aggrTask aggregategetStateLeavesendReport setState _GMInfo.groupAge += ET_AGGRATTRIBUTES.degreeA; call GM.setState(_GMInfo); temp.GMInformation = _GMInfo; temp.position.x = (uint16_t)(ET_AGGRATTRIBUTES.A.x); temp.position.y = (uint16_t)(ET_AGGRATTRIBUTES.A.y); call GlobalAbsoluteTimer.getGlobalTime(&timeStamp); temp.timeStamp = timeStamp.low32/100; temp.leaderID = TOS_LOCAL_ADDRESS; temp.degreeOfAggregation = ET_AGGRATTRIBUTES.degreeA; temp.degreeOfMag = ET_AGGRATTRIBUTES.degreeA; temp.degreeOfPIR = 0; temp.degreeOfAccoustic = 0; if (_isLeader) { call RC.sendReport((char *)&temp, BROADCAST_TYPE); _sent = TRUE; if (!_sensing) { call GM.leave(); } Only Leader Aggregate sensing Data If leader did not receive enough sensing Data and is not currently sensing, Leave group without sending report. Otherwise, send Tracking report and leave group If not sensing.
20
ReportCommM SendMsgByIDTLedsTripWireBackboneReceiveRoutingMsgSendMsgByBct ReportCommStdControl ReportCommC RoutingC RoutingSendByBroadcast [RC_ROUTING_PORT] RoutingSendByAddress [RC_ROUTING_PORT] RoutingReceive [RC_ROUTING_PORT] BackboneMTripWireM
21
ReportCommM SendMsgByIDTLedsTripWireBackboneReceiveRoutingMsgSendMsgByBct ReportCommStdControl Init some parameters init
22
ReportCommM SendMsgByIDTLedsTripWireBackboneReceiveRoutingMsgSendMsgByBct ReportCommStdControl Does nothing. start
23
ReportCommM SendMsgByIDTLedsTripWireBackboneReceiveRoutingMsgSendMsgByBct ReportCommStdControl Does nothing. stop
24
ReportCommM SendMsgByIDTLedsTripWireBackboneReceiveRoutingMsgSendMsgByBct ReportCommStdControl … sendReport currentParentsend getCurrentTripWireIDreceive
25
ReportCommM SendMsgByIDTLedsTripWireBackboneReceiveRoutingMsgSendMsgByBct ReportCommStdControl sendDone No message waiting to be sent.
26
ReportCommM SendMsgByIDTLedsTripWireBackboneReceiveRoutingMsgSendMsgByBct ReportCommStdControl sendDone No message waiting to be sent.
27
ReportCommM SendMsgByIDTLedsTripWireBackboneReceiveRoutingMsgSendMsgByBct ReportCommStdControl receive Post process receive message if no other message is already waiting to be processed. ProcessReceiveMessage
28
ReportCommM SendMsgByIDTLedsTripWireBackboneReceiveRoutingMsgSendMsgByBct ReportCommStdControl If group leader, send report. ProcessReceiveMessage receiveReportsendReport
29
ReportCommM SendMsgByIDTLedsTripWireBackboneReceiveRoutingMsgSendMsgByBct ReportCommStdControl Does nothing. GenericReceive
30
ReceiveM SendToUARTTLeds baseStation RoutingC ReceiveC RoutingSendByAddress [255] Role: debugging messages?
31
ReceiveM SendToUARTTLeds baseStation Return leaderID processReport
32
ReceiveM SendToUARTTLeds baseStation Does nothing. reportPosition
33
ReceiveM SendToUARTTLeds baseStation Does nothing. sendDone
34
AggregationM SendMsgByBctReceiveRoutingMsg Aggregation GM StdControl RoutingC RoutingSendByBroadcast [AGGR_ROUTING_PORT] RoutingReceive [AGGR_ROUTING_PORT] AggregationC Group ManagementC
35
AggregationM SendMsgByBctReceiveRoutingMsg Aggregation Does nothing. GM StdControl start
36
AggregationM SendMsgByBctReceiveRoutingMsg Aggregation Does nothing. GM StdControl stop
37
AggregationM SendMsgByBctReceiveRoutingMsg Aggregation Uses averaging functions to aggregate sensing data. Return aggregation degree. GM StdControl aggregate
38
AggregationM SendMsgByBctReceiveRoutingMsg Aggregation dbg(DBG_USR2, "AggregationM.sendData(leaderID:%d)\n", leaderID); if ((leaderID == TOS_LOCAL_ADDRESS) && !_receivePending) { _receivePending = TRUE; RxBuffer = report; add(); _receivePending = FALSE; signal Aggregation.aggrSendDone(SUCCESS); return SUCCESS; } if (!_sendPending){ _sendPending = TRUE; if ((TxBuffer = (AttrReport*)initRoutingMsg(&_TxMsg, sizeof(AttrReport))) == 0) { GM StdControl sendDataaggregationSendDone send dbg(DBG_USR2, "\t\tinitRoutingMsg fail\n"); _sendPending = FALSE; return FAIL; } *TxBuffer = *report; if (call SendMsgByBct.send(1, &_TxMsg) == FAIL) { dbg(DBG_USR2, "\t\tSendMsgByBct.sendto:%d fail\n", leaderID); _sendPending = FALSE; return FAIL; } dbg(DBG_TEMP, "RSEVENT: %i.%08i: SENDMSG: %d\n", (uint32_t) (tos_state.tos_time / 4000000), (uint32_t) (tos_state.tos_time % 4000000 * 25), leaderID); return SUCCESS; } else { dbg(DBG_USR2, "\t\t_sendPending fail\n"); return FAIL; } If node is leader, do not send Otherwise, send by Broadcast to leader
39
AggregationM SendMsgByBctReceiveRoutingMsg Aggregation GM StdControl aggregationSendDone sendDone
40
AggregationM SendMsgByBctReceiveRoutingMsg Aggregation GM StdControl receive ProcessReceiveAggr dbg(DBG_USR2, "AggregationM.ReceiveRoutingMsg.receive\n"); if(!_receivePending) { TOS_MsgPtr p = _RxMsgP; _receivePending = TRUE; _RxMsgP = msg; if(!post ProcessReceiveAggr()) _receivePending = FALSE; return p; } else { return msg; } Post processReceiveAggr task If no such task pending.
41
AggregationM SendMsgByBctReceiveRoutingMsg Aggregation GM StdControl receiveMessage ProcessReceiveAggr dbg(DBG_USR2, "AggregationM.ProcessReceiveAggr task\n"); if ((RxBuffer = (AttrReport*)popFromRoutingMsg(_RxMsgP, sizeof(AttrReport))) == 0) { dbg(DBG_USR2, "\tpopFromRoutingMsg fail\n"); _receivePending = FALSE; return; } call GM.receiveMessage(2, RxBuffer->GMInformation); if (RxBuffer->GMInformation.leaderID == TOS_LOCAL_ADDRESS) { dbg(DBG_USR2, "add!\n"); add(); } else { dbg(DBG_USR2, "not add!\n"); } _receivePending = FALSE; Call Group Management Message contents added to message table If node is leader.
42
AggregationM SendMsgByBctReceiveRoutingMsg Aggregation GM StdControl leader Does nothing.
43
AggregationM SendMsgByBctReceiveRoutingMsg Aggregation GM StdControl member Does nothing.
44
GroupManagementM RandomLocal Group Management Static Leader StdControl RandomLFSRLocalMBackboneM GroupManagementC
45
GroupManagementM RandomLocal Group Management … Static Leader StdControl setParameters
46
GroupManagementM RandomLocal Group Management Static Leader StdControl init
47
GroupManagementM RandomLocal Group Management Static Leader StdControl start getXgetY
48
GroupManagementM RandomLocal Group Management Static Leader StdControl stop
49
GroupManagementM RandomLocal Group Management Initiate group management timer. Static Leader StdControl fireHeartBeat
50
GroupManagementM RandomLocal Group Management No status: node becomes member. Follower: node becomes member. Leader Candidate: node becomes leader. Static Leader StdControl join NodeNumberrand memberleader
51
GroupManagementM RandomLocal Group Management Member: node becomes follower. Leader: node becomes leader candidate. Static Leader StdControl leavememberleader
52
GroupManagementM RandomLocal Group Management … Static Leader StdControl setState
53
GroupManagementM RandomLocal Group Management … Static Leader StdControl getState
54
GroupManagementM RandomLocal Group Management None: follower. Follower: check for group competition. Member: check for group competition. Leader candidate: check for group competition. Leader: check for group competition. Static Leader StdControl ProcessRecuritMessage leader
55
GroupManagementM RandomLocal Group Management Check if already processing such a message. Static Leader StdControl ProcessRecuritMessage receiveMessage
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.