Update of /cvsroot/firebug/firebug/project/src/multihop
In directory sc8-pr-cvs1:/tmp/cvs-serv3965
Modified Files:
BaseStationM.nc CollectDataMFB.nc
Log Message:
Added Gaussian density generation to multihop for simulation.
Index: BaseStationM.nc
===================================================================
RCS file: /cvsroot/firebug/firebug/project/src/multihop/BaseStationM.nc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** BaseStationM.nc 19 May 2003 20:03:30 -0000 1.6
--- BaseStationM.nc 22 May 2003 22:39:51 -0000 1.7
***************
*** 92,120 ****
* @return: void
*/
- /* Some temporary code for generating gaussian density.
- * This can be moved out of here later. However, it
- * does compile.
- * @url http://www.taygeta.com/random/gaussian.html
- */
event void MultiHopSend.sendDone(TOS_MsgPtr msg, uint8_t success) {
- #if 0
- int randnum;
- int max = RAND_MAX;
- float x1,x2,w,y1,y2;
-
- do {
- x1 = (2*(rand()/max)) - 1;
- x2 = (2*(rand()/max)) - 1;
- w = x1*x1 + x2*x2;
- } while (w >= 1.0);
-
- w = sqrt( (-2.0*log(w))/w);
- y1 = x1*w;
- y2 = x2*w;
- #endif
-
sending = 0;
-
}
--- 92,98 ----
Index: CollectDataMFB.nc
===================================================================
RCS file: /cvsroot/firebug/firebug/project/src/multihop/CollectDataMFB.nc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** CollectDataMFB.nc 21 May 2003 22:39:15 -0000 1.3
--- CollectDataMFB.nc 22 May 2003 22:39:51 -0000 1.4
***************
*** 44,48 ****
//uint8_t cnt;
//uint8_t sampledata;
! uint16_t temp;
//uint16_t rel_hum;
//uint16_t baro;
--- 44,50 ----
//uint8_t cnt;
//uint8_t sampledata;
!
! //uint16_t temp;
! float temp;
//uint16_t rel_hum;
//uint16_t baro;
***************
*** 73,76 ****
--- 75,104 ----
+ /* Some temporary code for generating gaussian density.
+ * This can be moved out of here later. However, it
+ * does compile.
+ * @url http://www.taygeta.com/random/gaussian.html
+ */
+ float get_temp() {
+
+ //#if 0
+ int randnum;
+ int max = RAND_MAX;
+ float x1,x2,w,y1,y2;
+
+ do {
+ x1 = (2*(rand()/max)) - 1;
+ x2 = (2*(rand()/max)) - 1;
+ w = x1*x1 + x2*x2;
+ } while (w >= 1.0);
+
+ w = sqrt( (-2.0*log(w))/w);
+ y1 = x1*w;
+ y2 = x2*w;
+ //#endif
+
+ return x1;
+ }
+
/**
***************
*** 98,105 ****
//df->cnt = counter++;
//df->sampledata=TOS_LOCAL_ADDRESS;
! //more sensor data put here
//....
! df->temp=0x04CE;
!
sending = 1;
result = call MultiHopSend.send(&msgToSend, sizeof(struct DataFormat_t));
--- 126,133 ----
//df->cnt = counter++;
//df->sampledata=TOS_LOCAL_ADDRESS;
! //put more sensor data here
//....
! //df->temp=0x04CE;
! df->temp = get_temp();
sending = 1;
result = call MultiHopSend.send(&msgToSend, sizeof(struct DataFormat_t));
|