@@ -12,12 +12,12 @@ class EnergyCalculator // DEEC algorithm
12
12
int stationUsedE = 0 ; //energy used by station
13
13
14
14
//--------- Energy consumption parameters ------------
15
- double E_fs = 0.01 ; //nJ(10^-9) amplifier energy, free space model (short distance) | d<d0
16
- double E_mp = 0.0000013 ; //nJ // multipath fading model (large distance) | d >= d0
17
- int E_elec = 50 ; //nJ/bit, energy for work signal transmission/recieve
18
- int node_E = 500000000 ; //nJ; = 0,5J // initial node energy
19
- double d0 = 87.7 ; // (m) distance threshold for swapping amplification models
20
- int package = 32000 ; // bits, package size
15
+ public double E_fs = 0.01 ; //nJ(10^-9) amplifier energy, free space model (short distance) | d<d0
16
+ public double E_mp = 0.0000013 ; //nJ // multipath fading model (large distance) | d >= d0
17
+ public int E_elec = 50 ; //nJ/bit, energy for work signal transmission/recieve
18
+ public int node_E = 500000000 ; //nJ; = 0,5J // initial node energy
19
+ public double d0 = 87.7 ; // (m) distance threshold for swapping amplification models
20
+ public int package = 32000 ; // bits, package size
21
21
//int package = Calculator.genRandInt(20, 65535);
22
22
//----------------------------------------------------
23
23
@@ -241,13 +241,13 @@ public int PPConnection(Point node, Point station, int stationHeight, int packet
241
241
graphic . DrawLine ( node , station , Color . LimeGreen ) ;
242
242
}
243
243
else {
244
- E_transmission = package * E_elec + package * E_mp * Math . Pow ( dist , 4 ) ; // nJ
244
+ E_transmission = ( package * packetCount ) * E_elec + ( package * packetCount ) * E_mp * Math . Pow ( dist , 4 ) ; // nJ
245
245
//E_transmission = 0; // no transmittion
246
246
graphic . DrawLine ( node , station , Color . IndianRed ) ;
247
247
}
248
248
249
249
250
- double E_receive = ( package * packetCount ) * E_elec ;
250
+ double E_receive = ( package * packetCount ) * E_elec ;
251
251
252
252
//minus used energy from nodes charge
253
253
if ( nodesLevelCharge . TryGetValue ( node , out int oldCharge ) )
0 commit comments