## 2 Experimental Setup and Proposed Method
### Battery Sizing and Modeling  
Many different optimization algorithms have been developed for sizing ESSs, taking into account various factors such as aging, cost, propulsion strategies, durability, and \begin{table}
\begin{tabular}{c c} \hline Maximum Power at STC (\(P_{mp}\)) & 455 W \\ Open Circuit Voltage (\(V_{oc}\)) & 50.3 V \\ Short Circuit Current (\(I_{sc}\)) & 11.48 A \\ Maximum Power Voltage (\(V_{mp}\)) & 42 V \\ Maximum Power Current (\(I_{mp}\)) & 10.84 A \\ Module Efficiency at STC (\(\eta_{m}\)) & 20.93 \\ Pmax Temperature Coefficient & \(-\)0.34 \%/\({}^{\circ}\)C \\ Nominal Operating Temperature & 45 \({}^{\circ}\)C \\ \hline \end{tabular}
\end{table} 
Table 1: Specification of the PV panel. Figure 3: Demand and generated energy. carbon emissions. The main goal in business enterprises is to optimize financial return in the form of bill savings, revenue generation, or a combination of the two. There are periods during which the energy demand of the building is higher than the maximum average daily demand of the building at certain times during the day. The battery that can best meet this peak demand and the maximum demand difference can be determined as the most appropriate EES size [52]. The capacity of ESSs is determined following the regulations published by the Republic of Turkiye Energy Market Regulatory Authority. However, to optimize the capacity of the ESS, an objective function for the ESS capacity selection has been established for minimum network power losses and voltage fluctuations. Also, the period in which the ESS will be charged is determined by the optimization technique depending on the amount of energy produced by the PV system. Since ESSs are not currently established in this commercial enterprise, an ESS model was created to analyze the effect of ESS in this study.In this study, MATLAB [53] was utilized for the mathematical optimization of the ESS. The optimization algorithm considered factors such as load demand, energy costs, and the state of charge (SOC) of the battery system. The constraints and objective functions were formulated and solved within the MATLAB environment (this study utilized MATLAB software under the academic campus license provided by Manisa Celal Bayar University). The capacity and charge/discharge efficiency of the ESS are important technical parameters. The SOC, defined as the ratio of current energy level to rated full capacity, is commonly used to model batteries [54]. The SOC is obtained by Equation (1). \[SOC(t)=SOC(t-1)+[\eta_{ch}\cdot P_{ch}(t)-\frac{P_{dis}(t)}{\eta_{dis}}]\frac {\Delta t}{C_{batt}}, \tag{1}\]  
where \(P_{ch}(t)\) and \(P_{dis}(t)\) are the charging and discharging power of the ESS (kW), \(\eta_{ch}\) and \(\eta_{dis}\) are the charging and discharging efficiency of the ESS, \(C_{batt}\) is the battery capacity (kWh), and \(\Delta t\) is the time step and was set to 1 h. The reason for selecting a 1-hour time step is that the irradiance, temperature, and PV power data used in the analysis were collected on an hourly basis. Using a time step consistent with the resolution of the input data ensures the accuracy of the simulation and prevents unnecessary interpolation, which could introduce errors. Additionally, an hourly resolution is commonly employed in energy management studies to balance computational efficiency and data availability. Energy flow during battery charging and discharging is obtained by Equations (2) and (3), respectively [55]. \[E_{bat}(t)=[E_{PV}(t)-\frac{E_{Load}(t)}{\eta_{inv}}]\cdot\eta_{ch}, \tag{2}\]  
\[E_{bat}(t)=[\frac{E_{Load}(t)}{\eta_{inv}}-E_{PV}(t)]\cdot\eta_{dis}, \tag{3}\]  
where \(E_{bat}(t)\) is the battery energy level, \(E_{PV}(t)\) is the energy generated by PV, \(E_{Load}(t)\) is the load demand during a time interval t, and \(\eta_{inv}\) is the inverter efficiency.