Modeling, control, and optimization of combined heat and power plants