After setting the initial energy of your nodes, you need to update it according to an energy model such as the first order radio model or the discrete radio model. You need to select the energy model most appropriate to your nodes and application at hand.
In communication networks, a node is either a connection point, a redistribution point (e.g. data communications equipment), or a communication endpoint (e.g. data terminal equipment).
Karima , you can use the collect view to determine the power consumed by the nodes and before that you must find out the initial energy of the motes that u r using i.e Z1 mote or whatever , the simplest way is to find the initial energy in the mote data sheet then subtract the power consumed from it.
there are also many ways u can find them in the contiki mailing list
After setting the initial energy of your nodes, you need to update it according to an energy model such as the first order radio model or the discrete radio model. You need to select the energy model most appropriate to your nodes and application at hand.
You have to use a specific energy model to calculate the remaining energy of nodes. However, the lifetime is calculated for the network which can be defined as the time till the first node of a network drains out.
I have developed an extended version of Powertrace that uses original Powertrace code to provide the remaining energy in the battery. More info and source code: https://github.com/KineticBattery/Powertrace
A simple energy model is Radio energy dissipation model.
where the transmitter dissipates energy to run the radio electronics and the power amplifier, and the receiver dissipates energy to run the radio electronics. The energy required to send data depends on the distance between the nodes and the number of bits which are being transmitted. The energy required for receiving also depends on the number of bits being received. Using this radio model, to transmit k-bit of message at distance‘d’ the radio expends energy as per equation (1) and (2):
ETx (k, d) = ETx-elec (k) + ETx-amp (k, d) (1)
ETx (k, d) = Eelec*k + εamp*k*d2 (2)
Where ETx is the total energy needed to transmit a single k-bit packet to a receiver over a single link of distance d; Eelec is the basic energy to run the transmitter; εamp is the multi-path fading coefficient that depends on the transmitter amplifier model and it is the energy required for transmitter amplifier circuit. To receive this message, the radio expends energy as per equation (3) and (4):
ERx (k) = ERx-elec (k) (3)
ERx (k) = Eelec * k (4)
Where ERx is the total energy needed to receive a single k-bit packet from a transmitter.
Energy Consumption of Sensor network
This section describes formula for energy and distance.
Consider N be the set of all nodes present in the network.
N = {n1, n2, n3, ….}
Energy consumed by a node Ec is given by equation (5).
Ec = Ei – Er (5)
where, Ei = Initial Energy of a node and Er = Residual Energy of a node
Total energy consumed TEC is given by equation (6).
TEC = Σ 𝑁𝑖=1[Ei - Er] (6)
Average Energy Consumption (AEC) is given by equation (7).
AEC = Σ 𝑁𝑖=1 [𝐸𝑖 − 𝐸𝑟] 𝑁𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑁𝑜𝑑𝑒𝑠 (7)
The distance ‘D’ between any two nodes with x & y coordinates (X1, Y1) and (X2, Y2) is calculated by using the Euclidean distance formula and is given by equation (8).