Email Record: Optimized Energy Management and Storage Sizing in Smart Homes with Renewable Energy Sources Under Safe Operating Conditions