Economic evaluation and optimization of solar systems for space and domestic water heating