1 / 55

Sown Code Report: Aggregation Tracking Group Management

Sown Code Report: Aggregation Tracking Group Management. Pascal A. Vicaire University of Virginia pv9f@cs.virginia.edu. Sensing. Std Control. SensingC. Report Comm. Std Control. Report CommC. Leds. LedsC. Tracking Timer. TimerC. Tracking. TrackingM. Sens. Sens Control.

liang
Download Presentation

Sown Code Report: Aggregation Tracking Group Management

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Sown Code Report:AggregationTrackingGroup Management Pascal A. Vicaire University of Virginia pv9f@cs.virginia.edu

  2. Sensing Std Control SensingC Report Comm Std Control Report CommC Leds LedsC Tracking Timer TimerC Tracking TrackingM Sens Sens Control Bottom Sensing GM GM Control Local Leds Tracking Timer RC RC Control BaseStation Attribute Sensing Aggr Aggr Control Static Leader Trip Wire Local TripWire LocalM Trip WireM Static Leader Group Management Std Control BackboneC Group ManagementC Base Station Aggregation Std Control ReceiveC AggregationC Bottom Sensing Attribute Sensing BottomSensingC TrackingC Configuration Provided Interface Used Interface Module

  3. Sensing Std Control SensingC Report Comm Std Control Report CommC Leds LedsC Tracking Timer TimerC Tracking TrackingM Sens Sens Control Bottom Sensing GM GM Control Local Leds Tracking Timer RC RC Control BaseStation Attribute Sensing Aggr Aggr Control Static Leader Trip Wire Local TripWire LocalM Trip WireM Static Leader Group Management Std Control BackboneC Group ManagementC Base Station Aggregation Std Control ReceiveC AggregationC Bottom Sensing Attribute Sensing BottomSensingC TrackingC Configuration Provided Interface Studied Modules & Configurations Used Interface Module

  4. setParameters Tracking TrackingM Sens Sens Control Bottom Sensing GM GM Control Local Leds Tracking Timer RC RC Control BaseStation Attribute Sensing Aggr Aggr Control Static Leader Trip Wire setParameters setParameters • …

  5. init Tracking TrackingM Sens Sens Control Bottom Sensing GM GM Control Local Leds Tracking Timer RC RC Control BaseStation Attribute Sensing Aggr Aggr Control Static Leader Trip Wire init init init init ET_POSITION_Sense whoIsMyLeader isTripWireBase • Initialize: • Sensing module. • Group management module. • ReportComm module. • Aggregation module. • Leader identifier. • TripWire information.

  6. start Tracking TrackingM Sens Sens Control Bottom Sensing GM GM Control Local Leds Tracking Timer RC RC Control BaseStation Attribute Sensing Aggr Aggr Control Static Leader Trip Wire start start getX getY start start start • Start: • Sensing module. • Group management module. • Tracking timer. • Report module. • Aggregation module. • Localization module.

  7. stop Tracking TrackingM Sens Sens Control Bottom Sensing GM GM Control Local Leds Tracking Timer RC RC Control BaseStation Attribute Sensing Aggr Aggr Control Static Leader Trip Wire stop stop stop stop stop • Stop: • Sensing module. • Group management module. • Tracking module. • Report module. • Aggregation module.

  8. Tracking TrackingM Sens Sens Control Bottom Sensing GM GM Control Local Leds Tracking Timer RC RC Control BaseStation Attribute Sensing Aggr Aggr Control Static Leader Trip Wire fired sendTask GMTask Periodically senseTask aggrTask Post group management task for this Tracking phase if (_isLeader) { ET_aggrCount ++; if (ET_aggrCount >= (REFRESH_INTERVAL/ENVIRO_WORKING_CLOCK)) { ET_aggrCount = 0; post aggrTask(); } } 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(); } } Post sense task If not a base Aggregate received Data if leader Send Sensing Report (Only non base motes)

  9. Tracking TrackingM Sens Sens Control Bottom Sensing GM GM Control Local Leds Tracking Timer RC RC Control BaseStation Attribute Sensing Aggr Aggr Control Static Leader Trip Wire Sensing Done SenseDoneTask • Post sensing done task.

  10. Tracking TrackingM Sens Sens Control Bottom Sensing GM GM Control Local Leds Tracking Timer RC RC Control BaseStation Attribute Sensing Aggr Aggr Control Static Leader Trip Wire Leader greenOff redOn redOff • 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.

  11. Tracking TrackingM Sens Sens Control Bottom Sensing GM GM Control Local Leds Tracking Timer RC RC Control BaseStation Attribute Sensing Aggr Aggr Control Static Leader Trip Wire Member greenOff redOff greenOn • 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.

  12. Tracking TrackingM Sens Sens Control Bottom Sensing GM GM Control Local Leds Tracking Timer RC RC Control BaseStation Attribute Sensing Aggr Aggr Control Static Leader Trip Wire receiveMessage receiveReport reportPosition Base mote reports to 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; } Other motes (only leaders can Receive reports) call the group Management module

  13. Tracking TrackingM Sens Sens Control Bottom Sensing GM GM Control Local Leds Tracking Timer RC RC Control BaseStation Attribute Sensing Aggr Aggr Control Static Leader Trip Wire aggrSendDone • This function does nothing.

  14. Tracking TrackingM Sens Sens Control Bottom Sensing GM GM Control Local Leds Tracking Timer RC RC Control BaseStation Attribute Sensing Aggr Aggr Control Static Leader Trip Wire ET_Position_senseDone • ET_ATTRIBUTES.ET_POSITION=value.

  15. Tracking TrackingM Sens Sens Control Bottom Sensing GM GM Control Local Leds Tracking Timer RC RC Control BaseStation Attribute Sensing Aggr Aggr Control Static Leader Trip Wire fireHeartBeart GMTask • Start group management heart beat.

  16. Tracking TrackingM Sens Sens Control Bottom Sensing GM GM Control Local Leds Tracking Timer RC RC Control BaseStation Attribute Sensing Aggr Aggr Control Static Leader Trip Wire conditionSense SenseTask • Initiate sensor reading

  17. Tracking TrackingM Sens Sens Control Bottom Sensing GM GM Control Local Leds Tracking Timer RC RC Control BaseStation Attribute Sensing Aggr Aggr Control Static Leader Trip Wire join leave SenseDoneTask 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. Tracking TrackingM Sens Sens Control Bottom Sensing GM GM Control Local Leds Tracking Timer RC RC Control BaseStation Attribute Sensing Aggr Aggr Control Static Leader Trip Wire sendData SendTask • Only non base motes. • Call aggregation module.

  19. Tracking TrackingM Sens Sens Control Bottom Sensing GM GM Control Local Leds Tracking Timer RC RC Control BaseStation Attribute Sensing Aggr Aggr Control Static Leader Trip Wire Leave getState sendReport aggregate setState aggrTask Only Leader _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(); } } Aggregate sensing Data 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; } 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. ReportComm StdControl ReportCommM SendMsgByID SendMsgByBct ReceiveRoutingMsg Backbone TripWire TLeds RoutingSendByAddress [RC_ROUTING_PORT] RoutingSendByBroadcast [RC_ROUTING_PORT] RoutingReceive [RC_ROUTING_PORT] BackboneM TripWireM RoutingC ReportCommC

  21. init ReportComm StdControl ReportCommM SendMsgByID SendMsgByBct ReceiveRoutingMsg Backbone TripWire TLeds • Init some parameters

  22. start ReportComm StdControl ReportCommM SendMsgByID SendMsgByBct ReceiveRoutingMsg Backbone TripWire TLeds • Does nothing.

  23. stop ReportComm StdControl ReportCommM SendMsgByID SendMsgByBct ReceiveRoutingMsg Backbone TripWire TLeds • Does nothing.

  24. sendReport ReportComm StdControl ReportCommM SendMsgByID SendMsgByBct ReceiveRoutingMsg Backbone TripWire TLeds send send receive currentParent getCurrentTripWireID • …

  25. ReportComm StdControl ReportCommM SendMsgByID SendMsgByBct ReceiveRoutingMsg Backbone TripWire TLeds sendDone • No message waiting to be sent.

  26. ReportComm StdControl ReportCommM SendMsgByID SendMsgByBct ReceiveRoutingMsg Backbone TripWire TLeds sendDone • No message waiting to be sent.

  27. ReportComm StdControl ReportCommM SendMsgByID SendMsgByBct ReceiveRoutingMsg Backbone TripWire TLeds receive ProcessReceiveMessage • Post process receive message if no other message is already waiting to be processed.

  28. receiveReport sendReport ReportComm StdControl ReportCommM SendMsgByID SendMsgByBct ReceiveRoutingMsg Backbone TripWire TLeds ProcessReceiveMessage • If group leader, send report.

  29. ReportComm StdControl ReportCommM SendMsgByID SendMsgByBct ReceiveRoutingMsg Backbone TripWire TLeds GenericReceive • Does nothing.

  30. baseStation ReceiveM SendToUART TLeds RoutingSendByAddress [255] RoutingC ReceiveC • Role: debugging messages?

  31. processReport baseStation ReceiveM SendToUART TLeds • Return leaderID

  32. reportPosition baseStation ReceiveM SendToUART TLeds • Does nothing.

  33. baseStation ReceiveM SendToUART TLeds sendDone • Does nothing.

  34. Aggregation StdControl AggregationM SendMsgByBct ReceiveRoutingMsg GM RoutingSendByBroadcast [AGGR_ROUTING_PORT] RoutingReceive [AGGR_ROUTING_PORT] Group ManagementC RoutingC AggregationC

  35. start Aggregation StdControl AggregationM SendMsgByBct ReceiveRoutingMsg GM • Does nothing.

  36. stop Aggregation StdControl AggregationM SendMsgByBct ReceiveRoutingMsg GM • Does nothing.

  37. aggregate Aggregation StdControl AggregationM SendMsgByBct ReceiveRoutingMsg GM • Uses averaging functions to aggregate sensing data. • Return aggregation degree.

  38. aggregationSendDone sendData Aggregation StdControl AggregationM SendMsgByBct ReceiveRoutingMsg GM 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; } 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) { Otherwise, send by Broadcast to leader If node is leader, do not send

  39. aggregationSendDone Aggregation StdControl AggregationM SendMsgByBct ReceiveRoutingMsg GM sendDone

  40. Aggregation StdControl AggregationM SendMsgByBct ReceiveRoutingMsg GM 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. Aggregation StdControl AggregationM SendMsgByBct ReceiveRoutingMsg GM 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. Aggregation StdControl AggregationM SendMsgByBct ReceiveRoutingMsg GM leader • Does nothing.

  43. Aggregation StdControl AggregationM SendMsgByBct ReceiveRoutingMsg GM member • Does nothing.

  44. Group Management StdControl GroupManagementM Random Local Static Leader RandomLFSR LocalM BackboneM GroupManagementC

  45. setParameters Group Management StdControl GroupManagementM Random Local Static Leader • …

  46. init Group Management StdControl GroupManagementM Random Local Static Leader init

  47. start Group Management StdControl GroupManagementM Random Local Static Leader getX getY

  48. stop Group Management StdControl GroupManagementM Random Local Static Leader

  49. fireHeartBeat Group Management StdControl GroupManagementM Random Local Static Leader • Initiate group management timer.

  50. join leader member Group Management StdControl GroupManagementM Random Local Static Leader rand NodeNumber • No status: node becomes member. • Follower: node becomes member. • Leader Candidate: node becomes leader.

More Related