Algorithm for Energy Resource Allocation and Sensor-Based Clustering in M2M Communication Systems. (22nd April 2022)