Mathematical models for simulation and optimization of multi-carrier energy systems