A linear optimisation model for localised energy systems