SGLSim: tool for smart glazing energy performance analysis

.

cause overheating or underheating in the indoor environment, seriously impacting thermal comfort, human health, and building energy consumption. Newer technologies such as building-integrated photovoltaics (BIPV), dynamic blinds, and electrochromic (EC) glazing have been deployed in building facades or windows to conserve energy consumption and maintain the occupants' thermal and visual comfort.
In the recent decade, solar photovoltaics (PV), which convert sunlight directly into electricity, have been more widely used (Zhang and Lu 2019). Due to limited land resources, integrating PV modules into buildings, such as roofs, facades, and skylights, to construct BIPV systems is one of the most effective ways to promote sustainable energy. In addition, unlike wind energy which requires enormous wind farms, PV installation is easy-going in urban areas. Moreover, dynamic blinds in buildings reduce building energy consumption while providing a desirable indoor environment for building occupants. Similarly, EC glazing is another dynamic technology that changes its tint to improve occupant comforts, maximize daylight access and reduce energy consumption. In general, windows are passive components, but the addition of these technologies transformed these windows into active systems. These systems are smart windows in this research.
The performance of a window system depends on the glazing's optical, thermal, and electrical parameters. These properties affect the building energy demand, and in the case of the semi-transparent photovoltaic (STPV) system, it affects the power generation capabilities of the module (Miyazaki et al. 2005;Olivieri et al. 2014). An STPV window with low transparency may produce high electrical energy; however, it may increase the lighting load of the building. In contrast, a highly transparent STPV window allows more visible light to enter interior spaces, thereby reducing the lighting load of the building. Moreover, the high solar component in the infrared and ultraviolet range may increase the building's cooling load besides generating less electrical energy. Blinds, on the other hand, affect interior lighting loads, space heating, and cooling loads by regulating the quantity of daylight and incoming solar radiation via the window. Integrating dynamic internal blinds with STPV glazing further reduces the building energy consumption by reducing the solar heat gain. Similarly, EC glazing reduces the building energy consumption by changing its tint, thereby reducing the solar heat transmission inside the building based on some control parameters.
To conduct parametric energy simulations of STPV, STPV with dynamic blind, and EC glazing requires proficiency in building simulation, which is repetitive and error-prone. A miscalculation in any energy simulation step can drastically alter the results. Hence, there is a need for a tool that can perform parametric simulations for multiple window systems using the inputs the user provides with the least amount of error. In this research, a web tool is developed to take the users' input about the building and simulate different window systems in EnergyPlus for various orientations and WWR. After completing all the simulations, it sends the graphical results back to the users to make an informed decision.

Objectives
This study aims to develop a tool for performing parametric simulations of several types of smart glazings, such as EC, STPV with dynamic blind, and STPV glazing. The parametric energy simulation is performed to compute, analyze, and assess the impact of smart glazing on the net annual electricity consumption of the building.
To perform the comparative energy performance analysis of smart glazing with traditional glazing, annual energy simulations with varying envelope variables, WWR, and orientation are necessary. The variation in glazing parameters, direction, and WWR helps comprehend the impact of different glazing and dwelling parameters on building energy performance. It also helps identify the optimal operating condition (WWR, orientation, window type) under different climatic zones.

Methodology
Evaluation of smart glazings such as building-integrated STPV, STPV with dynamic blinds, and EC glazing is performed using a parametric annual energy simulation-based methodology. To understand the impact of smart windows on energy consumption and find the optimal building configuration, building energy modeling (BEM) is essential. EnergyPlus v9.2 (EnergyPlus 2021a) is used in this study because it has been validated under the ASHRAE standard 140-2017 validation test, a traditional comparative method for evaluating building energy analysis computer programs. It is the third-generation dynamic building energy simulation engine developed by the United States Department of Energy for simulating building, heating, cooling, lighting, ventilation, and other energy flows. The program was established in the 1990s using the BLAST and DOE-2 simulation engines.
A significant portion of the building energy consumption depends on the glazing installed in the building. Glazing can alter the solar heat gain inside the room and light transmittance, which can increase/decrease the energy consumption in cooling/heating depending upon the season, i.e., summer or winter. EnergyPlus requires the window system's optical and thermal performance indices (i.e., U-values, SHGC, and VLT) to model traditional glazing in a window. The building energy performance depends on the optothermal parameters. Moreover, PV glazing impacts the net annual electricity consumption of the building by generating electricity. The generated electricity from the STPV system is accounted as well in EnergyPlus.
Post modeling, the annual energy simulation for a window system is performed in various orientations and WWR. The energy performance of a system depends on the electricity benefits it provides. The net annual electricity consumption depends on electricity generation and consumption of the building. It is the summation of all the electricity consumption and generation in the building whereas the values corresponding to the electricity consumption are positive, and electricity generation is negative. The lower the net annual electricity consumption value compared to the baseline, the better the glazing performance.
The SGLSim tool performs a parametric simulation of different window systems. It calculates and compares the net annual electricity consumption of the selected window system in different configurations. Finally, it provides a straightforward graphical interpretation of results describing the energy-saving potential of various glazing systems to the end-user.

Development of the tool
A web-based tool called SGLSim has been developed to perform parametric simulations of the different window systems. The software details and architecture has been described in this section. The tool gives a simple interface to the users to model the building and window as per their requirements. It then computes and compares the net annual electricity consumption of the selected glazing systems in different configurations. Finally, it provides a graphical interpretation of results demonstrating the energy-saving potential of various glazing systems to the end-user. No other opensource tool exists which supports the same functionality and feature as provided by SGLSim. Energy enthusiasts, researchers, and building simulation engineers can use this easy-to-use tool to determine the efficiency of different glazing systems.

Tool description
This tool is the first of its kind and can be used for energy analysis of conventional glazing with PV systems. The software stack helped in building a convenient and user-friendly application. The tool requires computation memory and storage for running EnergyPlus parametric simulation and saving the results with both web application and simulation server running on the same instance. It provides the user with graphical results comparing the net annual electricity consumption of different window systems. It also provides users with tabular yearly energy consumption data.

Software stack
Python-based software development has become popular owing to its simplicity, flexibility, and ease of learning. Python (https:// www. python. org/) has extensive library options, which can help a lot in the automation of various tasks. Also, unlike most other modern programming languages, python is much more user-friendly and reliable. The entire web application is built in Flask (https:// flask. palle tspro jects. com/ en/2. 1.x/). It is a lightweight web server gateway interface (WSGI) web application framework and offers much flexibility in structuring the application. Redis (Redis 2021) list allows to push and pop items from both ends using commands. Thus, it creates a first-in, first-out queue that maintains the task queues. MySQL database was used to store user data, and Flask SQL Alchemy was used to implement and communicate with the database. Table 1 shows the technologies used in the development of the tool.

Tool architecture
The entire application architecture consists of three parts: (1) Front End or web client, which includes a user interface that allows users to register, log in, and submit the required parameters for the simulation. (2) A Flask app interconnects the database, task queues, web client, and simulation server. (3) A Simulation server generates an Ener-gyPlus input data file (IDF), performs energy simulation, generates results, and sends it back to the user. Figure 1 shows the system design of the tool. Each component of the system has been explained in detail in this section.

Web client
The web client consists of web pages that act as an interface to submit the simulation parameters and construct the building model. The user interface and the simulation form were developed using the technologies such as HTML, CSS, JavaScript, and Bootstrap. The simulation parameters consist of two different types: Fixed and Parametric. WTForms (https:// wtfor ms. readt hedocs. io/ en/3. 0.x/) is used for form validation as it is a flexible forms validation library for Python web development. It notifies the user if any field is incorrectly filled, and in case all the fields are correct, the tool sends the data to the Flask app using a POST API request. Figure 2 shows a screenshot of the user interface of the SGLSim tool. Since the simulation usually takes a long time, the user is redirected to the home page after successfully submitting the simulation parameters. Meanwhile, the simulation is performed on the server; postcompletion, the results are mailed to the user by the tool using python-emails (email PyPI 2022), a python library for emails. The results include the building's net annual electricity consumption for different window systems and configurations and tabular load consumption data.

Flask app
Flask is a python-based web application framework with a simple and scalable core. It's a micro-framework built on the Werkzeg WSGI toolkit and the Jinja2 template engine. Werkzeug is a WSGI toolkit that implements requests, response objects, and utility functions and allows for creating a web frame. Jinja2 is a popular python template engine that enables you to create dynamic web pages. It does not provide an Object Relational Manager (ORM); however, Flask SQLAlchemy is used as an ORM to communicate with the database. Both Flask app and simulation server is hosted on the same server in different instance. Flask app renders pages for the web client. When the application receives a simulation request, it validates to check for any errors. It then serializes the user input into a JSON object and stores it in the task queue. After successfully storing the input data, the application redirects the user back to the home page.

Simulation server
The simulation server is the standalone and most crucial component of the tool. The core of the simulation server is developed in python using various open-source libraries such as Eppy (eppy PyPI 2022), NumPy (NumPy 2022), Pandas (https:// pandas. pydata. org/), etc. Eppy is a scripting language for EnergyPlus input and output files. It is written in the python programming language; hence, it fully utilizes the rich data structure and idioms offered in python. NumPy and Pandas were used during the post-processing of results. The simulation server connects the Flask app with the building simulation software EnergyPlus. It takes the input from the task queues using the first-in, first-out (FIFO) algorithm and then deserializes it to generate the simulation's EnergyPlus input data files. As soon as file generation is completed, it starts simulating the IDF files, successively storing the net annual electricity consumption for the various parametric combination of the building model. This annual energy consumption is later graphically plotted using Plotly (https:// plotly. com/) and sent back to the user. Figure 3 shows the working of the tool. Since the parametric simulation can take a long time, all the essential steps are performed in the server, so the web client is free to take requests from the users and store them in the task queue. The application allows the user to install different kinds of glazing and PV on windows and observe their effect on annual electricity consumption. The tool has a primary input data file on which all these user inputs are appended.

Features
The tools aim to automate the entire process of comparative energy analysis of different glazing systems, such as PV, Low-E, and standard glazing. It provides the net annual electricity consumption of the same building model with various window systems, which can help the user understand the optimal orientation, WWR, and glazing for a particular climatic zone. A sample of graphical results sent by the tool is shown in Fig. 4, a graph of the net annual electricity comparison of two glazing systems A and B in West orientation. Table 2 shows the number of features developed in this tool.

Simulation model
The input to the SGLSim tool consists of all the parameters required to construct a single-zone model with the smart window functionalities. The input can be categorized into fixed and variable parameters, as shown in Table 3. The fixed parameters include the building name, location, dimension, blind control, building type, daylight control, heating, ventilation, and air conditioning (HVAC) type. In contrast, the variable parameters are orientation, WWR, and glazing properties such as solar heat gain coefficient (SHGC), thermal transmittance (U-value), visible light transmittance (VLT), and PV generator properties. Further details about the other parameters can be found in the EnergyPlus input-output reference guide (EnergyPlus 2021b).

Window geometry and construction
The building model has a window in one of the walls to install the glazing and to study the effect of changes in WWR on the net annual electricity consumption of the building. The WWR of the building changes by modifying the dimension of the window. In Ener-gyPlus, calculating the window parameters such as length, height, starting X coordinate, and Z coordinate is necessary for making changes in the WWR.
The window dimensions and the starting X and Z coordinates of the window are calculated before each IDF generation to change the WWR of the model. The Z

Modeling STPV glazing
STPV glazing generates electrical power based on the fraction of sunlight on the window surface absorbed by the panel, which otherwise would have penetrated the room. Increasing the coverage area of the STPV glazing may increase power generation, but the daylight entering the room reduces, thereby increasing artificial lighting consumption. As a result, solar cells on the glass minimize transmitted solar heat gain, potentially resulting in a higher heating load in the winter and a lower cooling load in the summer than standard glazing. When the glazing has STPV, it generates electricity that the building can use, and therefore, it is deducted from the total electricity consumption. The double-pane semi-transparent CdTe PV glazing was modeled using the Sandia model as a PV performance object. It uses PV panel coefficients to calculate the electrical production capabilities of the STPV window. Sandia model is intrinsically linked to the surface heat equilibrium and uses surface temperature as the operating temperature of the solar cell (Peng et al. 2015). The PV arrays are connected to a single electric load center containing a list of electric power generators required in the simulation and an inverter that converts direct current (DC) to alternating current (AC) and has a fixed efficiency.
The study compares the energy performance of double-pane STPV glazing systems with standard glazing. The window configuration and electrical properties of the selected STPV glazing are referred from earlier study (Raihan et al. 2022), as shown in Table 4 and Table 5. The conventional glazing is assumed to have the same U-factor, SHGC, and VLT as in Table 4 without the electrical parameters of the STPV.

Modeling STPV glazing with dynamic blind
Blinds control the amount of sunlight entering the room. Depending on how it is mounted on the window, blinds can be classified into three categories: external, internal, and intermediate. There are two kinds of blind control: Static and Dynamic. Static blind control is always on or off and manually operated by the occupants. A dynamic blind system allows control of the blinds based on the room's dynamics. EnergyPlus allows more than fifteen control types for the blinds based on solar radiation, horizontal solar radiation, slat angle, outdoor temperature, zone temperature, glare, and zone cooling, depending upon the requirements of the building. In EnergyPlus, a blind is modeled as a window material integrated into the window as a construction layer. Further, to dynamically control the blind, window shading control is used to fix the setpoint, schedule, and shading control type. This study modeled a dynamic internal blind with glare control in EnergyPlus. The blind lowers if the glare at the zone's first daylighting reference point from the window exceeds the maximum glare index specified in the daylighting input for the building.

Modeling electrochromic glazing
In EnergyPlus, Electrochromic (EC) glazing can be modeled as a switchable glazing shading device that allows electrochromic glazing to switch from clear (high transmittance) to dark (low transmittance) based on user-defined control type and setpoint. EnergyPlus allows various control types based on temperature, solar radiation, glare, and cooling. As reported in multiple studies, EC control based on daylight illuminance and solar radiation has resulted in maximum energy saving (Sullivan et al. 1994;Maria et al. 2000). The limitation of this modeling method is that it allows only two states; however, current EC glass allows intermediate conditions between the clear and fully tinted state. Another method to model EC glazing is through Energy Management System (EMS) program in EnergyPlus. It is developed to incorporate many control algorithms with the previous generation of the Building Performance Simulation (BPS) program. EMS uses a programming language called EnergyPlus Runtime Language (ERL) to describe the control algorithms. EMS program broadly contains two kinds of objects: Sensor and  Actuator. The sensor object declares an ERL variable that uses the standard EnergyPlus variable to calculate the parameter used in the control algorithm. In contrast, the actuator overrides the predefined construction states assigned to specific components such as surface constructions, thermostat setpoints, and internal shades (Crawley et al. 2007). This study evaluates a 4-tint states SAGE EC product (SAGEGLASS ® ) with a control algorithm modeled using the EMS program. The spectral properties of the EC glazing are available in the electrochromic parameter folder in the GitHub repository. The sensor object used in the EMS program calculates the solar radiation falling per unit area on the window. This variable is used in the control algorithm to determine the tint state of the window. EMS Actuator object contains the name of the component controlled and its type. It also specifies the control type since some elements have more than one control type, such as flow rate or temperature. For our case, we have used the surface actuator with the control types of construction state (Dutta 2018). EMS construction index variable declares an EMS variable that identifies a construction. The default construction assigned is clear, which has the highest transmittance. The following two represent the intermediate states, and the last depicts the darkest tint.

Case study
The simulation model for the case study was referred from earlier study (Raihan et al. 2022). Input parameters for the case study are mentioned in Tables 6 and 7, showing the fixed and variable parameters of the case study, respectively. Kolkata (22.5726° N,88.3639° E) has a warm and humid climate with hot and humid summer and pleasant winter. The Bay of Bengal heavily influences its environment. Kolkata has three seasons-summer, monsoon, and winter. The annual mean temperature is 26.8 °C, whereas the monthly mean temperature ranges from 15 to 30 °C. Summer has a monthly mean temperature of 30 °C, but the maximum temperature often exceeds 40 °C, whereas, during winters, the temperature dips to 12 °C between December and January. Most of the city's annual rainfall is brought by the Bay of Bengal rains, which lash the city between June and September. Figure 5 shows the dry bulb temperature and relative humidity of Kolkata.

Results
The net annual electricity consumption of the STPV and standard window systems in the four primary orientations in Kolkata is shown in Fig. 6. The dashed black line denotes the PV window system, whereas the solid red line indicates the performance of the traditional glazing system.
The graphs show that the PV window system is energy efficient compared to the standard glazing system. The lowest net annual electricity consumption was achieved in the North orientation due to less solar radiation, causing a low cooling load, as shown in Table 8. The West orientation is the next optimal orientation for PV installation in Kolkata.  The minimum net annual electricity consumption achieved by the window systems in different orientations and the corresponding WWR has been mentioned in Table 9. The table shows the best performance of window systems in various configurations and orientations. It also shows that the optimal net annual electricity consumption in the case of STPV windows is less than 10-12% compared to the standard glazing having the same optical and thermal characteristics. Moreover, it shows that with the help of the STPV window, a larger WWR is possible. Figure 7 shows a window system's comparative energy performance analysis in three different configurations. Dashed blue and solid red lines denote the STPV and standard glazing, respectively, whereas the dotted green line represents the STPV with a dynamic internal blind. The glare-controlled dynamic interior blind installation with STPV further reduces the net annual electricity compared to the STPV window systems. With  the increase in WWR, the difference in net annual electricity between the STPV window system and STPV with dynamic blind increases. The STPV, with an active internal blind window system, achieved the lowest annual electricity in the North orientation. The glare-controlled dynamic internal blind can save up to 4% compared to the STPV window system and up to 14% net annual electricity consumption compared to a simple window system. Figure 8 shows the comparative energy performance analysis of EC and standard glazing. The solid red line represents the standard glazing system W1, whereas the EC glazing is denoted by the black dashed line. The EC glazing consumes less electricity compared to conventional glazing. The installation of EC glazing results in more than 3% annual electricity savings compared to a simple window system. In this graph, the W1 system represents the standard glazing without any electrical properties for energy generation.

Conclusions
A web-based tool has been developed for parametric simulations for different glazing systems to find the optimal window-to-wall ratio, orientation, and glazing type for a particular climate zone. The tool allows users to compare two glazing systems with or without an STPV on the window. Some of the benefits of the SGLSim tool are: • The optimal window-to-wall ratio and orientation can be calculated easily for different glazing systems for a selected city. • It reduces the time to perform parametric simulations of various glazing systems as the program automates the entire simulation process. • It reduces the error in various calculations, such as the window-to-wall ratio.
• It provides the user with graphical results. • Accessibility. The application of the tool is shown through case studies in India's warm and humid climatic zone. The study suggests that the North orientation has the lowest net annual electricity consumption for Kolkata compared to other directions. In the North orientation, the window with WWR up to 90% can be installed. Moreover, West is the next optimal orientation for installing PV facades, with the lowest annual electricity achieved at WWR between 40 and 70%.
The study further suggests that installing glare-controlled dynamic blinds in an STPV system avoids the glare problem and reduces the net annual electricity consumption compared to STPV and simple window systems. An adequately modeled dynamic blind system can result in an additional 15% more annual electricity reduction than conventional glazing while maintaining the glare throughout the room. Finally, installing the EC glazing saves up to 5% net annual electricity consumption compared to the traditional window.