A reliable, secure, and energy efficient smart grid node allocation algorithm for heterogeneous network scenarios