Design of graphical user interface-MATLAB-based simulation for battery energy storage system integrated with solar PV for campus under peak shaving operation
Abstract
The increasing adoption of renewable energy sources, particularly solar photovoltaic (PV), has created new challenges in managing grid stability and peak demand in commercial and campus-scale energy systems. High maximum demand (MD) charges and unoptimized operation of Battery Energy Storage Systems (BESS) can limit the operational benefits of solar integration. This paper presents the development of a MATLAB-based Graphical User Interface (GUI) designed to simulate the operation of a hybrid BESS integrated with PV under peak-shaving mode. The GUI enables users to upload real PV and load data, assign key system parameters, simulate energy flows, detect anomalies, and export detailed results. The simulation algorithm is built on a condition-response logic framework that accounts for State of Charge (SOC) limits, demand threshold (DT), charging schedules, and inverter limitations. Two system modes, BESS and PV-only, are supported to facilitate comparative analysis. Validation using on-site data from the Semsportal (a commercial cloud-based system developed by GoodWe) shows high simulation accuracy, with low error metrics across PV, load, battery, and grid power, as well as battery SOC. The virtual model identified an optimal DT value of 19 kW, resulting in the lowest MD for the case study at Pusat Islam, Universiti Teknologi MARA Cawangan Pulau Pinang, Kampus Permatang Pauh, achieving 19.04 kW compared to the actual on-site MD of 20.15 kW using a DT of 20 kW. These findings demonstrate the effectiveness of the GUI in supporting energy management planning and peak shaving analysis in commercial systems under Net Energy Metering (NEM) in Malaysia.