70 likes | 191 Vues
This coursework involves developing a system with 2n+1 nodes connected to a gateway, where nodes with odd IDs collect light readings and those with even IDs gather temperature readings. The gateway asks the nodes for readings at specified intervals and computes the average readings to send via UART. Submit all coursework files in a compressed (.zip or .tar) format with your name in the filename by April 16. Additional comments about your work should be included in an intro.txt file. Ensure to follow the provided hints regarding architecture and message handling.
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