Statistics for Optimal Energy Management of Distribution Systems and Industrial Energy Hubs in Smart Grids