Joint Communication and Energy-Based Density Aware Smart Grid Node Resource Allocation in Heterogeneous Networks