Analytical Modeling and Numerical Simulation of a Thermoelectric Generator Including Contact Resistances