A Cross-Layer Approach to Minimize the Energy Consumption in Wireless Sensor Networks. (29th December 2013)