Cost-Aware Solar-Storage Integration for Enhanced Stability and Energy Resilience