70 likes | 183 Views
MUC Coursework. Deadline: 16 April Add all files to a folder, and send a compressed version of the folder (.zip or .tar) to niki@dcs.bbk.ac.uk by 26 March The compressed version should be named as follows: Name_Surname.zip or Name_Surname.tar
E N D
MUC Coursework • Deadline: 16 April • Add all files to a folder, and send a compressed version of the folder (.zip or .tar) to niki@dcs.bbk.ac.uk by 26 March • The compressed version should be named as follows: Name_Surname.zip or Name_Surname.tar • Add any comments about your coursework (brief description of files, problems encountered, etc.) into a file called intro.txt
Coursework (1/2) • Problem • 2n+1 nodes, one gateway (with an ID of 0), n nodes with odd IDs, n nodes with even IDs • Nodes with odd IDs collect light readings, those with even IDs collect temperature readings • At every period • the gateway asks the readings of the 2n nodes • the nodes collect the readings and send them back to the gateway • the gateway computes the average light and temperature
Coursework (2/2) • The gateway • Computes the average light and temperature at the beginning of each period (of five seconds) • Sends the average light and temperature in a single packet to the UART • The other nodes • Send their readings after a random interval, so that the messages from different nodes are not sent at the same time
Design • The gateway • has a PeriodTimer • sends BroadcastMsg • receives LightMsg and TempMsg • sends UartMsg • The other nodes • have a Light or Temp sensor • receive BroadcastMsg • have a DelayTimer • send LightMsg or TempMsg
Architecture CourseworkC CourseworkM Makefile Leds Timer Random ADC SendMsg ReceiveMsg StdControl LedsC TimerC RandomLFSR DemoSensorC Temp GenericComm Main
Hints (1/2) • if (TOS_LOCAL_ADDRESS%2==0) { /* even node */ } else { /* odd node */ } • You cannot pass parameters to tasks, you need to use global variables • Write a specific task for each message to send • You can send to the serial port using TOS_UART_ADDRESS (and you can see those messages using export DBG=uart)
Hints (2/2) • The gateway needs four variables to compute the averages • sumLight • numberLight • sumTemp • numberTemp • The nodes need only one variable • lightValue or tempValue