Efficient Optimal Energy Management And Cyber Security In Residential Buildings With Phase Change Material