Optimization models for resource planning in urban energy systems