General methodology and optimization for the analysis of bottoming cycle cogeneration