The growing adoption of microgrids necessitates efficient management of electrical energy storage units to ensure reliable and sustainable power supply. This paper investigates a thermal management system (TMS) for maintaining the longevity of large-scale batteries. To streamline the thermal modeling of batteries, the McCormick relaxation method is employed to linearize a nonlinear and interdependent heat generation model. The thermal model of the battery follows a nonlinear behavior where the generated heat makes the battery system temperature soar, thereby affecting the thermal performance of the battery. To showcase the efficacy of the proposed approach, four distinct case scenarios are studied, highlighting the critical importance of batteries within microgrid operations. A comparative analysis is conducted between linear and nonlinear models for TMS performance. A quantitative assessment based on simulation results demonstrates the precision of the linearized model, particularly in a multitemporal optimal power flow and day-ahead scheduling of microgrids incorporating energy storage units. Controlling the battery temperature within a permissible range (from 15 °C to 40 °C) is achieved by using a heating, ventilation, and air conditioning (HVAC) system. The paper explores the economic implications of energy storage units in microgrids by extracting and comparing daily operational costs with and without battery integration. The findings reveal that the inclusion of energy storage units yields substantial economic benefits, with potential profit margins of approximately 20 % during typical working days and 60 % on weekends.