Electrical energy and cost calculation