Performance Analysis and Optimization of a SnSe-Based Thermoelectric Generator