Cooling, heating and power system