Skip to content

Commit 7e62e9e

Browse files
committed
change transmittion calculating, energy model params to public
1 parent 84e7ab4 commit 7e62e9e

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

EnergyCalculator.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ class EnergyCalculator // DEEC algorithm
1212
int stationUsedE = 0; //energy used by station
1313

1414
//--------- 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
2121
//int package = Calculator.genRandInt(20, 65535);
2222
//----------------------------------------------------
2323

@@ -241,13 +241,13 @@ public int PPConnection(Point node, Point station, int stationHeight, int packet
241241
graphic.DrawLine(node, station, Color.LimeGreen);
242242
}
243243
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
245245
//E_transmission = 0; // no transmittion
246246
graphic.DrawLine(node, station, Color.IndianRed);
247247
}
248248

249249

250-
double E_receive = (package*packetCount) * E_elec;
250+
double E_receive = (package * packetCount) * E_elec;
251251

252252
//minus used energy from nodes charge
253253
if (nodesLevelCharge.TryGetValue(node, out int oldCharge))

Form1.Designer.cs

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Form1.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,5 +581,12 @@ private int getCountOfAvailableNodes() {
581581

582582
return count;
583583
}
584+
585+
private void buttonEnergyModel_Click(object sender, EventArgs e)
586+
{
587+
588+
labelInfo.Text = "";
589+
590+
}
584591
}
585592
}

0 commit comments

Comments
 (0)