Numerical Modeling and Heuristic Algorithms for Nanogenerator Behavior Analysis