Machine Learning based Energy Communities Management Considering Distribution System Operational Constraints Grade Msc