Fundamentals of Energy System Analysis