Close
About
FAQ
Home
Collections
Login
USC Login
Register
0
Selected
Invert selection
Deselect all
Deselect all
Click here to refresh results
Click here to refresh results
USC
/
Digital Library
/
University of Southern California Dissertations and Theses
/
Streamlining sustainable design in building information modeling: BIM-based PV design and analysis tools
(USC Thesis Other)
Streamlining sustainable design in building information modeling: BIM-based PV design and analysis tools
PDF
Download
Share
Open document
Flip pages
Contact Us
Contact Us
Copy asset link
Request this asset
Transcript (if available)
Content
STREAMLINING SUSTAINABLE DESIGN IN BUILDING INFORMATION MODELING BIM-BASED PV DESIGN AND ANALYSIS TOOLS by Qihang Lin A Thesis Presented to the FACULTY OF THE USC SCHOOL OF ARCHITECTURE UNIVERSITY OF SOUTHERN CALIFORNIA In Partial Fulfillment of the Requirements for the Degree MASTER OF BUILDING SCIENCE May 2020 Copyright 2020 Qihang Lin ii ACKNOWLEDGEMENTS I would like to express my deep gratitude to my parents, who have been supported my two-year study at USC. I really appreciate my thesis chair professor Karen Kensek for continued guidance and supporting me throughout the research. I would also like to express my appreciation to my thesis member Professor Marc Schiler, and Professor Joon-Ho Choi. I want to have a special thanks to Marc for guidance and many valuable advices on solar energy, solar system and analysis. I also want to have a special thanks to Winston Kahn for holding a meeting with solar expertise in Arup and providing guidance at the beginning of this research. I would like to express my appreciation to people in Autodesk Forum and GitHub for answering my coding questions free and faster. Lastly, I want to thank you to all the students and faculties in our MBS family for supporting and helping me in these two years and throughout the research and development of this thesis. iii TABLE OF CONTENTS Acknowledgements ....................................................................................................................................... ii List of Tables ............................................................................................................................................. viii List of Figures .............................................................................................................................................. ix Abstract ...................................................................................................................................................... xiii Chapter 1 ....................................................................................................................................................... 1 1. Introduction ............................................................................................................................................... 1 1.1. Rationale .......................................................................................................................................... 1 1.2. Solar Energy .................................................................................................................................... 2 1.2.1. Introduction of renewable solar energy .................................................................................. 2 1.2.2. Why solar energy? .................................................................................................................. 4 1.3. Solar Photovoltaic (PV) system ....................................................................................................... 7 1.3.1. PV system components ........................................................................................................... 7 1.3.2. Current status and application of the PV system .................................................................. 11 1.4. PV system design, construction, and management ........................................................................ 12 1.4.1. Key Players in AEC industries ............................................................................................. 12 1.4.2. Pre-design phase ................................................................................................................... 14 1.4.3. Design & construction phase ................................................................................................ 15 1.4.4. Management phase ................................................................................................................ 16 1.4.5. PV system design tools ......................................................................................................... 17 1.5. Building Information Modeling (BIM) .......................................................................................... 18 1.6. Revit programming ........................................................................................................................ 22 1.6.1. Revit API and SDK ............................................................................................................... 23 1.6.2. Dynamo ................................................................................................................................. 25 1.7. Summary ........................................................................................................................................ 26 Chapter 2 ..................................................................................................................................................... 28 2. BIM-based PV System Design and Management ................................................................................... 28 2.1. Understanding the PV system design factors and variables ........................................................... 28 2.1.1. PV design factors .................................................................................................................. 28 2.1.1.1. Weather (Solar insolation, rain pattern, seasonal snow cover) .................................... 29 2.1.1.2. Existing and expected shading and soiling .................................................................. 29 2.1.1.3. Structure (structural load) ............................................................................................ 32 iv 2.1.1.4. Roof and building condition (orientation, condition, available space) ........................ 33 2.1.2. PV system factors ................................................................................................................. 34 2.1.2.1. PV module (tilt angle, azimuth, module spacing) ........................................................ 34 2.1.2.2. PV components and system (AC/DC voltage, component efficiency) ........................ 35 2.2. Understanding the PV system analysis and tools ........................................................................... 37 2.2.1. Solar analysis and tools ......................................................................................................... 37 2.2.2. System analysis and tools. .................................................................................................... 39 2.2.3. Financial analysis and tools .................................................................................................. 40 2.3. Understanding PV workflows ........................................................................................................ 42 2.4. Applying BIM for PV system design and management ................................................................ 43 2.4.1. Solar and energy analysis in BIM ......................................................................................... 43 2.4.2. PV system design in BIM ..................................................................................................... 45 2.4.3. Revit application on PV system design and management .................................................... 46 2.5. Summary ........................................................................................................................................ 48 Chapter 3 ..................................................................................................................................................... 50 3. Methodology ........................................................................................................................................... 50 3.1. Methodology overview .................................................................................................................. 50 3.1.1. Building Geometry (see section 3.2 for further details) ........................................................ 51 3.1.2. Environment (see section 3.3 for further details) .................................................................. 52 3.1.3. PV Module (see section 3.4 for further details) .................................................................... 52 3.1.4. Systems and components (see section 3.5 for further details) .............................................. 52 3.1.5. Finance (see section 3.6 for further details) .......................................................................... 52 3.2. Building Geometry ........................................................................................................................ 53 3.2.1. Building Geometry Preparation ............................................................................................ 53 3.2.2. Roof surface and shading surface analysis ........................................................................... 54 3.2.3. Building Data and Visualization ........................................................................................... 55 3.3. Environment ................................................................................................................................... 56 3.3.1. Environmental preparation .................................................................................................... 57 3.3.2. Environmental analysis ......................................................................................................... 58 3.3.3. Environmental data and visualization ................................................................................... 59 3.4. PV Module ..................................................................................................................................... 60 3.4.1. PV Module Preparation ......................................................................................................... 61 3.4.2. PV array geometry and solar analysis ................................................................................... 62 3.4.3. Module Data and Visualization ............................................................................................ 63 3.5. System and Components ................................................................................................................ 64 3.5.1. System and components preparation..................................................................................... 65 v 3.5.2. System analysis ..................................................................................................................... 66 3.5.3. System data and user control ................................................................................................ 67 3.6. Financial Feasibility ....................................................................................................................... 68 3.6.1. Financial preparation ............................................................................................................ 68 3.6.2. Financial analysis .................................................................................................................. 70 3.6.3. Financial data and visualization ............................................................................................ 72 3.7. Tool Preparation ............................................................................................................................ 72 3.7.1. Tool selection ........................................................................................................................ 72 3.7.2. Model preparation ................................................................................................................. 73 3.8. Summary ........................................................................................................................................ 75 Chapter 4 ..................................................................................................................................................... 77 4. Program Development ............................................................................................................................ 77 4.1. Setting Up ...................................................................................................................................... 78 4.1.1. Coding Environment ............................................................................................................. 78 4.1.2. UI Design .............................................................................................................................. 80 4.2. Building Geometry ........................................................................................................................ 81 4.3. Environment ................................................................................................................................... 84 4.3.1. Environmental Preparation ................................................................................................... 84 4.3.2. Solar Motion Model .............................................................................................................. 86 4.3.3. Shading Analysis .................................................................................................................. 88 4.3.4. Solar Insolation Analysis ...................................................................................................... 91 4.3.5. Solar Data and Visualization ................................................................................................ 92 4.4. PV Module ..................................................................................................................................... 94 4.4.1. PV module preparation ......................................................................................................... 95 4.4.2. PV Array Layout and Solar Analysis .................................................................................... 96 4.4.3. Module Data and Visualization ............................................................................................ 98 4.5. System and Components ................................................................................................................ 99 4.5.1. System Preparation ............................................................................................................... 99 4.5.2. System Analysis .................................................................................................................. 102 4.5.3. System Data and Visualization ........................................................................................... 103 4.6. Financial Feasibility ..................................................................................................................... 104 4.6.1. Financial Preparation .......................................................................................................... 105 4.6.2. Financial Analysis ............................................................................................................... 107 4.6.3. Financial Data and Visualization ........................................................................................ 109 4.7. Summary ...................................................................................................................................... 110 vi Chapter 5 ................................................................................................................................................... 112 5. Case Studies .......................................................................................................................................... 112 5.1. Plug-in Package and Preparation ................................................................................................. 113 5.1.1. PV Link Package and Installation ....................................................................................... 113 5.1.2. Revit Interface ..................................................................................................................... 114 5.1.3. Interfaces of PV Link .......................................................................................................... 116 5.2. Case Study 1 ................................................................................................................................ 119 5.2.1. Building Geometry and Environment ................................................................................. 120 5.2.2. PV Module .......................................................................................................................... 122 5.2.3. PV System ........................................................................................................................... 123 5.2.4. Financial Feasibility ............................................................................................................ 125 5.2.5. Result and Validation .......................................................................................................... 127 5.3. Case Study 2 ................................................................................................................................ 130 5.3.1. Running PV Link ................................................................................................................ 131 5.3.2. Result and Validation .......................................................................................................... 136 5.4. Case Study 3 ................................................................................................................................ 139 5.4.1. Running PV Link ................................................................................................................ 140 5.4.2. Result and Validation .......................................................................................................... 144 5.5. Summary ...................................................................................................................................... 147 Chapter 6 ................................................................................................................................................... 148 6. Discussion and Future Work ................................................................................................................. 148 6.1. Discussion .................................................................................................................................... 148 6.1.1. Evaluation of current workflow .......................................................................................... 148 6.1.2. Examination of tool............................................................................................................. 150 6.1.3. Limitations of the current version of PV Link .................................................................... 151 6.2. Future Work ................................................................................................................................. 153 6.2.1. Improvements ..................................................................................................................... 154 6.2.2. Future Work ........................................................................................................................ 155 6.3. Conclusion ................................................................................................................................... 158 References ................................................................................................................................................. 159 Appendix A ............................................................................................................................................... 163 A.1 Building and Environment Plug-in .............................................................................................. 163 A.1.1 Window Form 1: Environment ........................................................................................... 174 A.2 PV Module Plug-in ...................................................................................................................... 176 vii A.3 PV System Plug-in ....................................................................................................................... 182 A.4 Financial Feasibility Plug-in ........................................................................................................ 189 viii LIST OF TABLES Table 1. 1 Considerations from the perspective of stakeholder (Wijeratne et al. 2019b) ............................................ 13 Table 1. 2 Software used in studies and researches (Wijeratne et al. 2019a) .............................................................. 18 Table 2. 1 Using BIM on PV factors ........................................................................................................................... 33 Table 2. 2 features of the mainstream Solar PV tools .................................................................................................. 40 Table 2. 3 Typical residential PV panel cost (homeadvisor.com) ............................................................................... 41 Table 2. 4 Summary of PV system factors (Wijeratne et al. 2019b) ........................................................................... 48 Table 3. 1 System losses categories and the default value ........................................................................................... 65 Table 3. 2 Estimated cost breakdown for the PV system (Fu, Feldman, and Margolis 2018) ..................................... 68 Table 3. 3 Default electricity usage based on types of buildings (EIA 2016) .............................................................. 70 Table 5. 1 Validation methods ................................................................................................................................... 127 Table 5. 2 Validation methods and results ................................................................................................................. 147 ix LIST OF FIGURES Figure 1. 1 US Energy flow Chart in 2013 (Lawrence Livermore National Laboratory) .............................................. 2 Figure 1. 2 U.S. Total and Renewable Energy Consumption by sources, 2017 (EIA 2018) ......................................... 3 Figure 1. 3 Annual solar irradiances over the surface of the earth (CERES 2014) ........................................................ 5 Figure 1. 4 Nevada Solar One (left) (https://www.energy.gov/lpo/crescent-dunes) ...................................................... 6 Figure 1. 5 Solar panel on street light pole (left) (http://www.bhavisolar.com/), solar panel on roof (top right) (https://www.michiganradio.org/post/solar-installers-say-new-rates-are-slowing-demand-rooftop-solar), solar panel on yard (bottom right) (https://www.energysage.com/project/6650/the-blackwells-ground-mounted-solar-pv- project/) ......................................................................................................................................................................... 6 Figure 1. 6 Typical PV system ...................................................................................................................................... 8 Figure 1. 7 Grid-connected PV system ........................................................................................................................ 10 Figure 1. 8 PV cell technical barriers (Obeidat 2018) ................................................................................................. 11 Figure 1. 9 Solar analysis of a site (Autodesk) ............................................................................................................ 15 Figure 1. 10 solar access and shading analysis for planning patterns (Loghmani 2008) ............................................. 15 Figure 1. 11 Hot spot fault caused by shading (a), soiling and dust (b), fault damage to the panel (c), detected hot spot (d) (Mellit, Tina, and Kalogirou 2018) ................................................................................................................ 17 Figure 1. 12 fault detection based on the I-V and P-V curves (Wu 2011) ................................................................... 17 Figure 1. 13 Computer-aid PV design tools (Horvat and Dubois 2012a) .................................................................... 18 Figure 1. 14 Solar panels with parameters in BIM (Ning et al. 2018) ......................................................................... 19 Figure 1. 15 Example of BIM (STW Architects) ........................................................................................................ 20 Figure 1. 16 BIM and IFC workflow (Redmond and Smith 2012) .............................................................................. 21 Figure 1. 17 BIM lifecycle (Autodesk) ........................................................................................................................ 22 Figure 1. 18 Revit API programming using Visual Studio for mechanical design (Autodesk) ................................... 23 Figure 1. 19 Revit SDK interface ................................................................................................................................ 24 Figure 1. 20 Adding references (left), namespaces (right) in Visual Studio ................................................................ 24 Figure 1. 21 Changing sheet names, view names in CTC tools ................................................................................... 25 Figure 1. 22 Dynamo workflow ................................................................................................................................... 26 Figure 1. 23 Creating parametric bridge using Dynamo .............................................................................................. 26 Figure 2. 1 Types of shadings (U.S. Department of Energy 2014) .............................................................................. 30 Figure 2. 2 Typical shading analysis by sun chart (NREL) ......................................................................................... 31 Figure 2. 3 Sunlight and shading analysis using Ladybug ........................................................................................... 31 Figure 2. 4 PV system structural loads (NREL) .......................................................................................................... 32 Figure 2. 5 Diagram of Positioning factors .................................................................................................................. 35 Figure 2. 6 shading analysis in PV tools ...................................................................................................................... 39 Figure 2. 7 Cost of solar panels break down (Sunmetrix.com) .................................................................................... 41 Figure 2. 8 Workflow of PV project ............................................................................................................................ 42 Figure 2. 9 Solar analysis using Revit’s Insight (Autodesk) ........................................................................................ 44 Figure 2. 10 analysis and visualization in Cove (Covetool.com) ................................................................................ 44 Figure 2. 11 Solar analysis through Ladybug tools (Ladybug) .................................................................................... 45 Figure 2. 12 Electrical flow diagram for BIPV in Revit (Ning et al. 2018) ................................................................. 46 Figure 2. 13 ray projection methods (Ning et al. 2018) ............................................................................................... 47 Figure 3. 1 Traditional methods vs proposed methods ................................................................................................ 50 Figure 3. 2 Overall workflow diagram ........................................................................................................................ 51 Figure 3. 3 Workflow diagram for building geometry ................................................................................................. 53 Figure 3. 4 Example of inner roof obstacles (https://www.rooftechconsultants.ca/resources/top-3-roofing- concerns-for-commercial-buildings/) .......................................................................................................................... 54 Figure 3. 5 Roof surface identification ........................................................................................................................ 55 Figure 3. 6 City GML example in Revit ...................................................................................................................... 55 Figure 3. 7 Workflow diagram for Environment ......................................................................................................... 56 Figure 3. 8 Deployable surfaces (left), Deployable area (right) .................................................................................. 56 Figure 3. 9 TMY 3 data in Excel spreadsheet .............................................................................................................. 57 Figure 3. 10 Default grid setting .................................................................................................................................. 58 Figure 3. 11 Solar maps by PV Link ........................................................................................................................... 60 Figure 3. 12 Workflow diagram for PV Module ......................................................................................................... 61 Figure 3. 13 PV module model in Revit ...................................................................................................................... 61 x Figure 3. 14 Auto-placement of PV panels .................................................................................................................. 64 Figure 3. 15 Workflow diagram for System and Components .................................................................................... 65 Figure 3. 16 Workflow diagram for Financial Feasibility ........................................................................................... 68 Figure 3. 17 Financial costs and benefits analysis in Excel ......................................................................................... 70 Figure 3. 18 Cash flow for payback calculation in Excel ............................................................................................ 71 Figure 3. 19 Charts of financial analysis ..................................................................................................................... 72 Figure 3. 20 tools used ................................................................................................................................................. 72 Figure 3. 21 Debugging in Visual Studio with Revit running ..................................................................................... 73 Figure 3. 22 Case study 1 building (left), case study 2 buildings (right) ..................................................................... 74 Figure 3. 23 Watt Hall ................................................................................................................................................. 74 Figure 3. 24 the Revit model of Watt Hall .................................................................................................................. 75 Figure 3. 25 Overall workflow diagram ...................................................................................................................... 76 Figure 4. 1 Tool Development Diagram ...................................................................................................................... 77 Figure 4. 2 setting up the programming environment in Visual Studio ....................................................................... 79 Figure 4. 3 Code for the addin file ............................................................................................................................... 79 Figure 4. 4 Visual Studio window form toolbox and example of PV Link UI design ................................................. 80 Figure 4. 5 PV Link UI in Revit interface and Plugin program ................................................................................... 81 Figure 4. 6 bounding box for PV panel instance ......................................................................................................... 82 Figure 4. 7 User selection of surface to analyze .......................................................................................................... 82 Figure 4. 8 selection filter class ................................................................................................................................... 83 Figure 4. 9 obtaining information from the selected roof ............................................................................................ 84 Figure 4. 10 distributing points on the face by max and min UV value ...................................................................... 84 Figure 4. 11 UI for Environment section ..................................................................................................................... 85 Figure 4. 12 Example of TMY3 data and its format .................................................................................................... 85 Figure 4. 13 Reading .csv file and extracting the data ................................................................................................. 86 Figure 4. 14 calculation of the hour angle ................................................................................................................... 87 Figure 4. 15 Calculation of solar azimuth angle .......................................................................................................... 87 Figure 4. 16 Sun and shadow setting based on date and times .................................................................................... 88 Figure 4. 17 Modifying dates and time in Revit .......................................................................................................... 89 Figure 4. 18 Transforming and extracting information of sunlight vectors (left), diagram of altitude and azimuth (right)(timeanddate.com) ............................................................................................................................................. 89 Figure 4. 19 Diagram of ray projection method for determining shading rate ............................................................ 90 Figure 4. 20 shading factor class setting up and obtaining the 3D view ...................................................................... 90 Figure 4. 21 Reference Intersector and shading factors ............................................................................................... 90 Figure 4. 22 Example of shading list in the spreadsheet .............................................................................................. 91 Figure 4. 23 Direct normal insolation analysis ............................................................................................................ 91 Figure 4. 24 Example of lists of the beam and diffuse insolation in the spreadsheet .................................................. 92 Figure 4. 25 Export data to Excel ................................................................................................................................ 92 Figure 4. 26 Hour angle, declination, elevation angle and azimuth data exporting to the spreadsheet ....................... 92 Figure 4. 27 setting analysis display style ................................................................................................................... 93 Figure 4. 28 Linking solar analysis of the roof with the display style and displaying the result on view ................... 94 Figure 4. 29 solar map ................................................................................................................................................. 94 Figure 4. 30 Diagram of positioning factors ................................................................................................................ 95 Figure 4. 31 extracting information of parameters for family instance ....................................................................... 95 Figure 4. 32 Sample of PV family and the corresponding parameters ........................................................................ 96 Figure 4. 33 Example of data from preparation ........................................................................................................... 96 Figure 4. 34 divided the surface into grids .................................................................................................................. 97 Figure 4. 35 Points on the grids ................................................................................................................................... 97 Figure 4. 36 Direct normal insolation on tilted solar panel ......................................................................................... 97 Figure 4. 37 Example of the data list and calculated values ........................................................................................ 98 Figure 4. 38 Auto-placement of the solar panels ......................................................................................................... 98 Figure 4. 39 Setting parameter value of the family instance ........................................................................................ 99 Figure 4. 40 Solar panels with a new tilt angle ............................................................................................................ 99 Figure 4. 41 Example of inverter family (ABB.com) ................................................................................................ 100 Figure 4. 42 Adding parameters into family .............................................................................................................. 101 Figure 4. 43 Data Preparation for system analysis and UI ......................................................................................... 101 xi Figure 4. 44 System analysis of PV panel DC output calculation (left), Inverter AC output calculation (right) ....... 102 Figure 4. 45 The insolation collected and DC output of the PV panel ...................................................................... 103 Figure 4. 46 Function asking the user to place the inverter objects ........................................................................... 104 Figure 4. 47 Writing and storing data into inverter family parameters ...................................................................... 104 Figure 4. 48 The cost of a PV system ........................................................................................................................ 105 Figure 4. 49 Estimating electricity consumption for the project ................................................................................ 106 Figure 4. 50 Defining cash flow factors .................................................................................................................... 107 Figure 4. 51 defining lists to store costs and benefits over the lifecycle .................................................................... 107 Figure 4. 52 Cash flow calculation (a) electricity production and its values (left), (b) PBI incentive and relative taxes (right) ................................................................................................................................................................ 108 Figure 4. 53 Cash flow calculation (a) operating cost, cash flow, and accumulated cash flow, (b) expense and income for LCOE calculation .................................................................................................................................... 108 Figure 4. 54 Creating data table and exporting to csv file ......................................................................................... 109 Figure 4. 55 Financial reports and payback period .................................................................................................... 110 Figure 4. 56 Tool Development Diagram .................................................................................................................. 111 Figure 5. 1 Tool used in Case Studies ....................................................................................................................... 112 Figure 5. 2 Projects for Case Study 1,2 and Case Study 3 from (USC FMS) ............................................................ 112 Figure 5. 3 PV Link Packages ................................................................................................................................... 113 Figure 5. 4 Program documentation for Environmental Analysis and its dll files ..................................................... 114 Figure 5. 5 Adding addin file into Revit folder ......................................................................................................... 114 Figure 5. 6 Warning windows in Revit ...................................................................................................................... 115 Figure 5. 7 Changing project locations ...................................................................................................................... 115 Figure 5. 8 Loading Revit families into the projects ................................................................................................. 116 Figure 5. 9 External Tools ribbon to launch plug-ins ................................................................................................ 116 Figure 5. 10 Environmental Analysis UI, TMY3 website and downloaded csv file ................................................. 117 Figure 5. 11 System Analysis UI ............................................................................................................................... 118 Figure 5. 12 Financial Analysis UI ............................................................................................................................ 119 Figure 5. 13 Buildings for Case Study 1 .................................................................................................................... 120 Figure 5. 14 Los Angeles TMY 3 data ...................................................................................................................... 120 Figure 5. 15 Selecting roof surfaces .......................................................................................................................... 121 Figure 5. 16 Dialog showing the process of the plug-in ............................................................................................ 121 Figure 5. 17 Database of solar motion model, shading analysis and solar insolation analysis .................................. 121 Figure 5. 18 Solar Map and corresponding insolation data ....................................................................................... 122 Figure 5. 19 Dialog showing the process of the PV Module plug-in ......................................................................... 122 Figure 5. 20 Automated placement of PV panel and update on its parameters ......................................................... 123 Figure 5. 21 Data for solar insolation on Panels ........................................................................................................ 123 Figure 5. 22 PV system UI and PV panel specifications sheet (Jinkosolar.com) ...................................................... 124 Figure 5. 23 Dialog showing the process of the System Analysis plug-in ................................................................. 124 Figure 5. 24 Solar panel DC power output ................................................................................................................ 124 Figure 5. 25 Plug-in asking the user to place inverter family .................................................................................... 125 Figure 5. 26 Writing final system output data into the parameters of Inverter .......................................................... 125 Figure 5. 27 The UI for Financial Feasibility plug-in ................................................................................................ 126 Figure 5. 28 Dialog showing financial indicators ...................................................................................................... 126 Figure 5. 29 Financial Report .................................................................................................................................... 126 Figure 5. 30 Validation on sun direction ................................................................................................................... 128 Figure 5. 31 Validation of Environmental Analysis plug-in by Solar Insight ........................................................... 129 Figure 5. 32 Validation of Environmental Analysis plug-in by outside sources (left), insolation calculation without using TMY 3 Data ..................................................................................................................................................... 129 Figure 5. 33 Setting on Solar Insight ......................................................................................................................... 130 Figure 5. 34 Validation of PV energy output ............................................................................................................. 130 Figure 5. 35 Case Study 2 perspective and site plan .................................................................................................. 131 Figure 5. 36 Case Study 2 section views ................................................................................................................... 131 Figure 5. 37 Environmental Analysis inputs for Case Study ..................................................................................... 132 Figure 5. 38 Solar map for Case Study 2 ................................................................................................................... 132 Figure 5. 39 PV panel placement and its parameters for Case Study 2 ..................................................................... 133 Figure 5. 40 Spreadsheet for the result of PV Module plug-in .................................................................................. 133 xii Figure 5. 41 PV system input for Case Study 2 ......................................................................................................... 134 Figure 5. 42 Inverter placement and the information of system output for Case Study 2 .......................................... 134 Figure 5. 43 Financial Feasibility inputs for Case Study 2 ........................................................................................ 135 Figure 5. 44 Result of financial indicators with 2% PBI ........................................................................................... 135 Figure 5. 45 Results of financial Indicators without PBI ........................................................................................... 135 Figure 5. 46 Spread Sheet of Financial Report .......................................................................................................... 136 Figure 5. 47 Validation on sun direction ................................................................................................................... 136 Figure 5. 48 Validation on Environmental Analysis plug-in by Solar Insight ........................................................... 137 Figure 5. 49 Comparison of TMY3 data between Phoenix and Los Angeles ............................................................ 137 Figure 5. 50 Result from the new algorithm .............................................................................................................. 138 Figure 5. 51 Setting on Solar Insight ......................................................................................................................... 138 Figure 5. 52 Validation on PV energy output counting cell temperature and its loss(left), counting simply the efficiency ................................................................................................................................................................... 139 Figure 5. 53 Case Study 3 perspective and site plan (USC FMS) ............................................................................. 140 Figure 5. 54 Case Study 3 section views ................................................................................................................... 140 Figure 5. 55 Model simplification for Case Study 3 .................................................................................................. 141 Figure 5. 56 Solar map for Case Study 3 ................................................................................................................... 141 Figure 5. 57 PV panel placement and its parameters for Case Study 3 strategy 1 ..................................................... 142 Figure 5. 58 PV panel placement and its parameter for Case Study 3 strategy 2 ...................................................... 143 Figure 5. 59 System output for Case study 3 Strategy 1 and 2 .................................................................................. 143 Figure 5. 60 Financial reports and payback period for Case Study 3 ........................................................................ 144 Figure 5. 61 Validation on sun direction ................................................................................................................... 145 Figure 5. 62 Validation on Environmental Analysis plug-in by Solar Insight ........................................................... 145 Figure 5. 63 Result from the new algorithm for Case Study 3 .................................................................................. 146 Figure 5. 64 Setting on Solar Insight for Case Study 3.............................................................................................. 146 Figure 5. 65 Validation of PV energy output for Case Study 3 ................................................................................. 146 Figure 6. 1 Methodology diagram ............................................................................................................................. 149 Figure 6. 2 Tool development Diagram ..................................................................................................................... 150 Figure 6. 3 PV Link’s inputs and outputs .................................................................................................................. 151 Figure 6. 4 Validation on solar insolation level ......................................................................................................... 152 Figure 6. 5 Detailed electrical diagram for system designing and testing (MATLAB Simulink PV) ....................... 156 Figure 6. 6 Construction Documentation (solarpartscomponents.com) ..................................................................... 157 Figure 6. 7 Detailed drawings (left) (Solarpv.com), PV system Installation schedule (right) (Pinterest.com) .......... 157 Figure 6. 8 PV system real-time management (right) (El-Leathey 2018). ................................................................. 158 xiii ABSTRACT Replacing the traditional source of electricity in buildings, which accounts for 28% of total greenhouse gas emission, is critical to achieving environmental sustainability. Among sustainable strategies, PV systems are becoming more widely adopted in buildings as their cost comes down and their efficiency of converting solar energy to electricity goes up. A PV system and its efficiency are highly impacted by environmental factors like weather and location including surrounding obstacles. Different types of systems and types of panels are also important factors to be considered. Therefore, if the project teams can consider those factors in the early stage of design, the electricity produced and return on investment can be largely improved. The current BIM-based PV system design process largely depends on transferring the architectural model to the PV special simulation software. However, some critical geometric information is lost during this process, and it is a one-way process with no information flow back. Furthermore, the current process takes time and effort on remodeling and transforming data between two platforms, which is not very suitable for the early design phase which is characterized by quick and iterative processes. An automatic PV system design and management tool was developed, which fully integrates the existing and future information of PV systems in a building information modeling (BIM) platform. The proposed tool, PV for Early Design Phase (PV Link) first analyzes the solar radiation on a selected building façade. Then, it automatically selects the PV panel based on the solar analysis and user options with variables like PV size, roof geometry, and rooftop equipment. Finally, the solar radiation on each panel and the electricity produced are calculated and results shown in a building information model (BIM). The proposed tool has been applied and examined through several case studies. The result shows the tool can help to design systems efficiently while maintaining a high solar harvesting and electricity production of the PV system. With modifying various financial inputs, users can also test different financial strategies to achieve the desired cost and payback period. xiv Research goal: facilitate sustainable design and decision making through the project’s BIM lifecycle by creating a tool for PV placement Research objectives: • To facilitate sustainable design and decision making in the early design stage for PV selection • To maximize the amount of electricity produced based on user inputs • To calculate the cost of the PV systems and payback period based on system output and local solar policies • To allow for the building information model to supply information about the PV system to the facilities manager Keywords: Building information modeling (BIM), sustainable design, photovoltaic (PV) system, Revit API 1 Chapter 1 1. Introduction The rapid development of solar photovoltaic (PV) systems contributed to the increasing use of solar energy in buildings. However, the use of inefficient design and tools will largely drop the performance of the PV system. The integration of Building Information Modeling (BIM) and PV system design has the potential to facilitate an efficient and comprehensive design process of a PV system. This chapter introduces building information modeling (BIM), PV system, and the application of the two combined in the architecture, engineering, and construction (AEC) industry. In addition, major concepts of Solar energy and simulation, Revit programming, and software development methodologies are also introduced. 1.1. Rationale As global warming and other environmental issues become more serious, many industries are putting a lot of resources into dealing with those issues. In 2018, the U.S. consumed 101.3 quadrillions BTU of energy, which represented 19% of global energy consumption. In the United States, the building sector, including residential and commercial buildings, accounted for about 41% of primary energy consumption in 2018 (EIA 2018). Electricity and natural gas now account for nearly equal amounts of energy consumed in buildings. However, due to the high rate of electricity loss during the traditional production and transferring process (around 2/3), the actual energy consumption of energy to produce electricity would be much higher than the other sources (EIA 2017) (Fig. 1.1). This is called the difference between site energy and source energy. It is urgent to reduce energy consumption and the use of unsustainable energy sources in buildings in order to tackle global warming. Among the most promising sustainable strategies, the use of photovoltaic (PV) solar energy as substitution of traditional electricity in building or 2 site is getting popular in recent years (Salimzadeh, Vahdatikhaki, and Hammad 2018). Figure 1. 1 US Energy flow Chart in 2013 (Lawrence Livermore National Laboratory) 1.2. Solar Energy Renewable energy is a sustainable and continually replenished source of energy derived from nature, e.g. wind, hydroelectric, solar, geothermal, biomass. Solar energy is one of the renewable energies that is becoming popularly used in building domain. 1.2.1. Introduction of renewable solar energy Solar energy can be converted directly from sunlight to electricity through photovoltaic (PV) systems and indirectly through concentrating solar power (CSP) systems. Also, solar energy has been used to directly heat up the water in residential buildings through solar thermal systems (Ellabban, Abu-Rub, and Blaabjerg 2014). In the US, renewable energy accounts for 11% of the total energy consumption while solar energy accounts for about 7% of the total renewable energy in 2017 (Fig. 1.2). Even though the total consumption of solar energy is much lower than the other renewable energies like biomass (44.6%), hydroelectric (25.1%), it actually accounts for nearly 55% of newly installed renewable power capacity and 29% of new electricity generating capacity addition. According to the U.S. Department of Energy, 3 solar energy will provide 27% of the electricity use in the US and reduce 28% of greenhouse gas emissions in the electricity sector by 2050 (Energy Patterns of Use, 2018). 、 Figure 1. 2 U.S. Total and Renewable Energy Consumption by sources, 2017 (EIA 2018) The rate of solar energy installation and application is higher than the other renewable energy thanks to the policies, investment, and research support from various public and private organizations (Arduin 2016). To encourage the continued expansion of solar energy installation in the US, the federal government currently (2019) offers a 30% Solar Investment Tax Credit (ITC). In addition to that, some states like California and Texas have their own package of grants and subsidies, which can reduce the net cost of solar energy by 30 to 50% (Arduin 2016). Besides taxes and subsidies, several state governments in the US have their own solar policy to promote the use of solar energy. The state government of California has published the California Energy Efficiency Strategic Plan, which requires that all the new residential construction will be net-zero by 2020 and all the commercial buildings by 2030. The term net-zero requires that the amount of energy used by a facility annually is equal to the amount of renewable energy created on-site or off-site. In the approved 2019 Building Energy Code, all new homes are mandated to be solar-powered starting in 2020, as an addition to the 2020 and 2030 plan (SEIA 2018). The policy will significantly increase the use of PV systems in residential buildings and enhance further growth in the California solar 4 market. Florida, Colorado, and several other states also announced their solar policies and laws in order to enhance the development of solar energy. 1.2.2. Why solar energy? Solar energy is a renewable source of energy that involves harvesting directly from sunlight and converting it to electricity. Also, it is clean and sustainable energy because no harmful emissions are released into the air compared to traditional electricity production by burning fossil fuel. However, it is important to know that the machine and devices of renewable energy also take energy to manufacture, transport and install. According to the report from NERL, the energy taken to make a PV panel is about 600 kWh/m 2 for single-crystal-silicon modules and 420 kWh/m 2 for multi-crystalline silicon, which takes 4 years of its electricity production to offset this energy (NREL, n.d.). Among the renewable energies, solar, biomass and geothermal energy have the potential to produce sufficient heat energy to generate power and electricity (Kabir et al. 2017). Solar energy has the highest potential in terms of global popularization and sources because the sources of biomass are not entirely clean or replenished and the geothermal energy is limited by the feasible locations (Kabir et al. 2017). Solar energy can be harvested in many locations on the earth and converted into a considerable amount of electricity. About 30% of the solar energy arrived on earth will be diffused or reflected back to space and about 70% of the incoming solar energy will be absorbed by the earth system. Each hour about 430 quintillion Joules of solar energy hits on the earth, which is sufficient for one-year energy consumption all around the world (Trenberth, Fasullo, and Kiehl 2009). Locations are one factor determining the amount of solar energy that is possible to harvest. The annual effective solar irradiance ranges from 60 to 250 W m 2 worldwide. Africa, Australia, South America, and South Asia have high average solar irradiance above 200 W/m 2 per year for solar energy. In the US, the average irradiance is above 150 W/ m 2 (Fig. 1.3). There is a huge potential for the harvesting and use of solar energy all around the world. 5 Figure 1. 3 Annual solar irradiances over the surface of the earth (CERES 2014) The total electricity generation in the US in 2018 is about 4178 billion kWh. Given the current status of PV efficiency, which is 15%, and the annual solar irradiance in Nevada, which is 5.68 kWh/m 2 /day, the electricity generation is about 414.64 kWh/m 2 in ideal conditions (EIA 2018) (“Solar Energy & Solar Power in Nevada | Solar Energy Local” n.d.). Therefore, to fulfill the US electricity generation, an area of 10076 km 2 covered with PVs will be able to create sufficient electricity, which accounts for only 3.5% of the total land area in Nevada. Storing, converting to AC and distributing such energy remains an issue, especially since it is only available during daylight hours. Concentrated Solar Power (CSP) systems enable harvesting solar energy at a large scale, usually, megawatt sized utility-scale, like many solar farms in Southern California and Nevada (Fig. 1.4). CSP produces electricity by heating the receiver to high temperature via the reflected sunlight from solar collectors, then transforming this heat to electricity (Faraz 2012). CSP system has higher efficiency, larger production, and inherent thermal storage capacity, enabling electricity generation at night and cloudy day, comparing to the Solar PV system (Faraz 2012). However, it usually takes a lot of space and a large investment to build. In addition to the large front cost, the current status of the Ivanpah, one of the famous CSP farms are suffered from the lower production that not meeting any of their goals and may be 6 forced to shut down (Sweet 2016). Comparing with the CSP system, the solar PV system has a relatively small scale, modular equipment, which makes it possible for solar energy to be harvested in various locations, sites, and topographies. In addition, modular PV systems allow harvesting solar energy in places like building rooftop, house courtyard, and even electric line pole (Fig. 1.5). Land can be scarce in cities and building a large power plant in an area with high population density is not feasible because of potential risk, noise, and pollution. Modular PV systems can be installed in the building’s rooftop and façade and generate electricity on-site. Figure 1. 4 Nevada Solar One (left) (https://www.energy.gov/lpo/crescent-dunes) CSP system diagram (right) (https://www.energy.gov/eere/solar/csp-systems-analysis) Figure 1. 5 Solar panel on street light pole (left) ( http://www.bhavisolar.com/ ), solar panel on roof (top right) ( https://www.michiganradio.org/post/solar-installers-say-new-rates-are-slowing-demand-rooftop-solar ), solar panel on yard (bottom right) ( https://www.energysage.com/project/6650/the-blackwells-ground-mounted-solar-pv-project/ ) 7 Currently, 60-65% of commercial rooftops and 22-27% of residential rooftops are suitable for installing the PV system in the US (Ning et al. 2017). With the development of Building Integrated Photovoltaic (BIPV) systems, those existing buildings and new buildings can produce a considerable amount of electricity. Furthermore, PV systems on-site can reduce a large amount of energy and electricity loss in the traditional transferring process that the central power plant requires to produce and distribute electricity through long and complex power lines. 1.3. Solar Photovoltaic (PV) system Solar PV systems represent the sum of all components required in the process of solar collecting, transferring, transforming and storing. The efficiency of each component and during each process has an impact on the amount of electricity production. 1.3.1. PV system components The typical stand-alone PV system contains four main components: module, controller, inverter and battery tank (Fig. 1.6). The PV module contains multiple solar cells, also referred to as “photovoltaic.” Each cell is an individual semiconductor device converting light, any sources of light including sunlight, directly into Direct Current (DC) voltage. This process is called the “photovoltaic effect.” when light hits and is absorbed by the cell, it causes the electron-hole pairs to separate from each other. A built-up barrier, depletion region, helps the loose electrons to flow into the second layer through the P-N junction, leaving a hole in the first (Hosenuzzaman et al. 2015). Finally, the circuits connecting two layers allow the electrons to create a current (Hosenuzzaman et al. 2015). By connecting all the cells as a module, all the currents are integrated and supplied for use. 8 Figure 1. 6 Typical PV system The inverter is in charge of converting the DC voltage generated by the PV module to Alternating Current (AC) voltage at a specific standard voltage such as 110/220 volts. Then, equipment like computers and TVs can use that electricity. Comparing with the central inverter, which many panels connecting to one central inverter, micro-inverter is becoming popular in the solar industries. Micro- inverter is able to install on each of the panels and convert DC to AC individually. The main advantage of microinverters is that it can avoid the drops in efficiency and energy output when the shadow cast on some of the PV panels. The primary disadvantage of microinverter includes higher initial cost and difficulty in maintenance (Hasan et al. 2017). The controller has the function of controlling energy input and output for the battery bank. It provides protection to the batteries by avoiding overcharging or complete discharging. Moreover, it also provides security by sensing electric faults like short circuits and shutting the system down. The battery bank acts as a storage of extra electricity and then uses it at night or cloudy day with lower solar radiation (Gonçalves et al. 2017). Other components such as mounting structure, which allows the panel to be tilted at certain angles on the flat or sloped roof to maximizing the solar harvesting, and electrical meter are also 9 common in the PV system (U.S. Department of Energy 2014). This type of solar PV system mentioned is also called the off-grid system or stand-alone PV system. It is used to meet a specific load that reduces the electricity consumption from the traditional power grids. It is also widely used in rural places with no power grid supply. The off-grid system converts solar energy to electricity and stores the excess generated electricity in a battery bank to be used at a later time. Due to the capacity of the battery bank, an off-grid system is limited in the amount of electricity it can generate and use (Van Sark 2012). Depending on the size of the system, the battery banks typically are wired for 12 volts, 24 volts or 48 volts, which the batteries are usually manufactured in 2, 3, 6 and 12 volts, Different types of battery tank have various efficiency. For example, the efficiency of lead-acid types will be 50% lower than Lithium batteries. However, the cost of lithium batteries is much higher than lead-acid (Wholesale Solar n.d.). A grid-connected PV system is another popular type of PV system, which is common in cities (Fig. 1.7). Grid-connected system size range from a few kWp for residential use to several GWp for solar farms. The main difference between the grid-connected and off-grid system is the grid-connect system connects to the local electrical grid. The installation cost of these types of systems is lower than the off- grid system because a battery bank is not required. The converted electricity could be used immediately or flows into the grid. An export meter can be installed to measure how much electricity flows to the grid and sold at a certain price or simply counted against the energy taken from the grid, but it depends on the local electricity policies. If there is not enough electricity supplied by the PV system, the grid can automatically supply the electricity needed (Ellabban, Abu-Rub, and Blaabjerg 2014). Batteries can also be added into the grid-connected system to further reduce the electricity needed from the grid. 10 Figure 1. 7 Grid-connected PV system One of the benefits of a grid-connected PV system is that it allows users to sell back the extra or un- used electricity to the grid. The net meter will record the amount of electricity sent back and the amount of electricity extracted from the grid. The produced electricity will be used to offset the extracted grid electricity. If the users produced more than used, the electricity company will pay based on the current prices depending on the policy of the local utility company and governments. However, some states like Texas, Florida are not friendly with the selling back policies. The poor state policy landscapes prevent the expansion of the distributed PV market in there (Ryan 2016). Furthermore, cities with old power grids are concerned that increased pressures will have a negative impact on the grid system. In general, the grid-connected system is easier to install than the off-grid system because the off-grid system has extra wiring and safety devices needed for the battery bank. Also, the capacity of the grid- connected system is not limited to the storage capacity of its bank, which can potentially generate more electricity. However, the overall improvement of the public power grid is needed in order to support the large-scale deployment of the grid-connected system. 11 1.3.2. Current status and application of the PV system The photovoltaic cell is the core of the PV system while the materials are the core of the PV cell. The factors like material’s property, conductivity and thickness heavily impacted the efficiency and lifetime of the PV panels, thus the electricity produced (Van Sark 2012). Currently, photovoltaic cell technologies are considered “third-generation” (Fig. 1.8). The first generation of PV systems used the technology of crystalline silicon (c-Si) in its simple crystalline and multi-crystalline form. Currently, the highest efficiency rates of these types of PV can reach above 20% (Hosenuzzaman et al. 2015). The crystalline silicon PV currently composes the majority of the PV market. Figure 1. 8 PV cell technical barriers (Obeidat 2018) Second generation photovoltaic systems are thin-film photovoltaic including materials like amorphous silicon (a-Si), which are mainly used on things like watches and chargers, or in solar farms because it is cheap (Hosenuzzaman et al. 2015). The benefit of these materials is its low cost and easy to produce. However, the problem is its efficiency and lifetime. Finally, amorphous silicon holds promise because it can be deposited directly onto building materials, further reducing first costs. The third generation of the photovoltaic system refers to technologies currently under development like organic PV, concentrating PV. The third generation PV mostly are still in research and test phase (Obeidat 2018). The concentrating PV, now, can reach 41% in efficiency, but it still in the research phase, and the cost is very high. 12 Building Integrated Photovoltaic (BIPV) is another type of PV system, which integrates PV cell with or replaces the conventional elements of building such as rooftop, skylight, façade, and shading devices. It aimed to offset the initial investment cost and material cost by reducing the money spent on conventional building materials and labor while producing electricity (Frontini et al. 2015). Moreover, compared with the traditional rooftop PV system, the harvesting area of a building can be largely increased (James et al. 2011). However, BIPV products suffer from low efficiency because of the lightweight and small thickness. Some products like BIPV glass have to be partially transparent or leave blank space for natural lighting, which will further reduce its efficiency(James et al. 2011). 1.4. PV system design, construction, and management In 2018, the U.S. solar market installed 10.6 GW dc of solar PV, and 314,600 new residential PV systems have been installed. The average system size of a residential project is 6.2 kW and the average system size of a commercial project is about 180 kW (SEIA 2019). Based on the rough calculation, it is about 20 solar PV panels for residential projects, and 500 solar PV panels for commercial projects. For commercial projects, it is a complex system that should be carefully designed, installed, and managed. The PV design and construction team are not only responsible for the design of systems itself such as components sizes, location, and connection between components but also responsible for the overall structural load and electricity load to the building and grid. There are numerous codes that need to be complied with in order to get the PV system built. 1.4.1. Key Players in AEC industries In general, small size PV system for a single-family house, lower than 10kw, can be designed and installed by the local PV system provider because it is not complicated, and they usually have design and installation services for the small projects. Many local codes now cover such installations including safety devices, connection, and disconnection from the grid and even labeling of equipment and safety switches. This is because the systems must be switched off before any electrical work is done in the building. The 13 installer needs to check if the PV system complies with the local PV related code, such as Article 690 (Atmaram n.d.). For a large project, the process of PV design and construction is more complicated and has more players involved. Property owner, design team, construction and installation team, O&M team, utility sectors and government are the main players in the large solar projects. Each player has specific considerations from their perspectives (Table 1.1). Table 1. 1 Considerations from the perspective of stakeholder (Wijeratne et al. 2019b) Players Consideration and Factors Clients Direct and indirect costs O&M costs Reduction of energy bills Tax breaks Performance evaluation Feed in tariffs and other incentives The design team (PV consultants, architects, engineers) Weather and geological data Building type Structural Load Grid (Type. Specifications) Building Energy performance Electrical load Neighboring buildings /objects Building and PV related standards and regulations PV system components System Configuration Performance evaluation Construction team Construction and commissioning process PV system components Grid (Type. Specifications) Building and PV related standards and regulations Balance of systems Safety O&M team Building Energy performance PV system energy generation Feed in tariffs O&M cost Reduction of CO2 emissions Reduction of energy bills Monitoring and control O & M procedures Insurance/warranties/replacement Decommissioning process Utility sectors Grid (Type. Specifications) Feed in tariffs Energy Prices Building Energy performance System energy generation Energy use patterns Governments PV system energy generation The energy fed to the grid Reduction of CO2 emissions Incentive database Tax breaks Regulations /Policies The architect and client are the main decision-makers for utilizing the PV system in the project. Currently, there are some engineering consulting firms and PV system specialists providing solar engineering services for a large project. They are usually hired by the design firm as a sub-contractor to 14 design the system and provide detailed electrical and mechanical drawing and construction documentation. In addition to a PV special designer, the project manager may hire a construction contractor responsible for purchasing, evaluating, and constructing the PV system. After project completion, an O&M contractor should be hired to provide monitoring and maintenance services (U.S. Department of Energy 2014). 1.4.2. Pre-design phase The site assessment is one of the most important tasks in the predesign stage for the PV system to determine whether the site and building are suitable and valuable for installing the PV system. The solar insolation, shading in all months, cloudy day are some of the environmental factors that need to be evaluated in the site assessment (U.S. Department of Energy 2014). A solar analysis is the most important environmental analysis for the PV system to evaluate how much solar irradiance, the output of light energy from the sun received on earth, a site receives (Fig. 1.9). Solar analysis usually takes account of the surrounding shading effects and cloudy days to evaluate the feasibility more accurately (Parida, Iniyan, and Goic 2011). Building and site factors in the site assessment include location, structure, load and power factors, roof orientation, space requirement and, utility interconnection (U.S. Department of Energy 2014). A rough calculation of those factors is needed in site assessment to determine the maximum amount of the panels and the system size. With the solar analysis, the amount of electricity that can be produced, cost and payback period can be roughly calculated to support the decision making. 15 Figure 1. 9 Solar analysis of a site (Autodesk) For large scale planning and planning for a group of high-rise buildings in the predesign phase, the site analysis can be done by analyzing and compare the solar access and shading from different planning patterns (Loghmani 2008). These methods are able to find the best buildings and planning configuration with maximum solar access for passive and active solar strategies and potentially reduction on overall energy consumption (Fig 1.10). Figure 1. 10 solar access and shading analysis for planning patterns (Loghmani 2008) 1.4.3. Design & construction phase There are three main parts in the design phase: system design, electrical design, and structural design. System design includes the PV array layout, system size, panel location, and orientation and how to integrate the system efficiently. Many of the design factors need accurate calculation of the factors in the site assessment. The electrical design response to optimize the performance of the system meets the technical requirement. The safety requirement of the balance of system (BOS), the electrical balance 16 between DC load and AC load, and the interconnection with the public power grid are also included in the electrical design. As for the structural design, it covers the structural analysis of the whole system. Depending on the local building, the structural design may need additional wind load and seismic load calculation for the PV system (Atmaram n.d.) As for construction, there are mainly three parts of work in the construction phase controlled by different sub-contractors: mounting structure and PV array installation, installing the system and electrical connections, and testing and inspecting the final installation. 1.4.4. Management phase It is critical to have ongoing monitoring and maintenance of the PV system through its whole lifecycle in order to secure its safety and performance. All the components of systems need routine inspection especially the battery bank which has more safety concerns and the PV panels, which heavily impact the efficiency and contain contaminated materials. With careful routine maintenance, the system will generally last over 20 years (Jali et al. 2014). The O&M tools for residential and commercial PV systems are evolving to provide real-time detailed data for monitoring and inspection (Dodson, Doyle, and Lockhart n.d.). One of the main tasks in PV system management is detecting the faults in any components (solar panel, wiring line, inverter, etc.) and diagnosing the problems that need to fix. Corrected and quick fault detection and diagnosis (FDD) is important to maintain the PV system’s efficiency, energy production as well as the security and safety of the installed buildings or plants (Mellit, Tina, and Kalogirou 2018). Common types of faults include hot spot fault in PV panel, junction box or diode fault in PV panel connection, etc. (Fig 1.11). 17 Figure 1. 11 Hot spot fault caused by shading (a), soiling and dust (b), fault damage to the panel (c), detected hot spot (d) (Mellit, Tina, and Kalogirou 2018) In order to detect and diagnose the faults in systems, current-voltage (I-V), and power-voltage (P-V) characteristic curves are one of the popular tools to use (Wu 2011). Comparing the real-time characteristic curves with the baseline characteristic curves in normal test conditions, the types of fault and the components affected can be detected based on the fault’s curves characteristic (Fig 1.12). Figure 1. 12 fault detection based on the I-V and P-V curves (Wu 2011) 1.4.5. PV system design tools Currently, there are many PV system computer-aid design tools in the markets for solar analysis, energy calculation, system simulation, layout design and there are more web-based simple design tools for homeowners. However, the design tool’s market is not mature and has a relatively bad performance of the design tools for other building elements like MEP, and structure. Most of the tools are only focus on 18 certain parts of the design or cover every part in an over-simplified way. For example, some popular energy simulation tools like IES VE has relatively well-developed functions on solar analysis and electricity calculation, but not for the whole system design and test. According to the international PV design tool survey, the most commonly used CAAD tools for modeling and visualization were AutoCAD, Google SketchUp, Revit Architecture, ArchiCAD, Vectorworks, and 3dsMax (Fig. 1.13). While RETScreen, Radiance, Polysun, PVSol, PVsyst were the most common tools for simulation (Horvat and Dubois 2012a). Figure 1. 13 Computer-aid PV design tools (Horvat and Dubois 2012a) Table 1. 2 Software used in studies and researches (Wijeratne et al. 2019a) Software used for Software Evaluation of technical feasibility and financial viability RET Screen, Homer Pro, Sunulator Levelized cost of electricity calculation SAM PV system design and performance analysis Polysun, PV Sol Solar irradiation calculation Polysun, PV-GIS Shading loss analysis SAM, Skelion, Ladybug PV Energy output analysis PVsyst, PVwatts, Autodesk Revit, PV-GIS Cell arrays layout optimization PVsyst 3D design Skelion, Rhinocerous 3D-Grasshopper 1.5. Building Information Modeling (BIM) Building Information Modeling (BIM) is the process of creating and managing a three-dimensional model, a rich and integrated database, through its entire life cycle of a project (NBIMS-US, 2013). The 19 database, then, can be used for various purposes like energy simulation, structural analysis, clash detection, cost evaluation, and facility management. Theoretically, the high interoperability of BIM can integrate the data from various software from different disciplines into one digital representation (Kensek 2014). A building information model is object-oriented. Unlike other 3D modeling software based on the geometry, BIM is based on the objects of components like walls, doors, and windows (Kensek 2014b). Other objects like PVs can be added and adjusted for specific needs (Fig 1.14). Each component contains their specific parameters and information forming a rich and organized database for the buildings, which can be used to perform all kinds of simulation in the early design stage. Figure 1. 14 Solar panels with parameters in BIM (Ning et al. 2018) Starting to build the project model in an object-oriented way can save time and effort for architects and engineers since they don’t need to spend much time on the 2D documentation like plan and elevation, especially when there are changes of design because it is relatively straightforward to generate these views from the BIM (Yan 2017) (Fig. 1.15). Not only have architects and engineers benefit from BIM, but the object-oriented method also allows clash detection in tools like Navisworks to check and correct the clash between components in the pre-construction phase. It will largely reduce the chance of rework for the construction team. 20 Figure 1. 15 Example of BIM (STW Architects) BIM is not a single software program, but a process supported by various BIM software and technologies (Yan 2017). The high interoperability, which indicates the data exchange, between different BIM tools is one of the main characteristics of BIM. The Industry Foundation Class (IFC) and Green Building XML (gbXML) format has been developed to transfer data from the BIM model to the applications like energy simulation software, sequencing software, operations and maintenance (O&M ) software more smoothly without losing necessary information (Fig. 1.16). It also saves a lot of time and ensures accuracy by avoiding remodeling in other applications (Eastman 2008). Although theoretically, the exchange of information is possible, practically there are still many problems involved in the exchange of BIM data between software programs (Yan 2017). 21 Figure 1. 16 BIM and IFC workflow (Redmond and Smith 2012) BIM is a process that involves all the stakeholders from design and construction to facility management through the project life cycle. It does not just foster the sharing of data and knowledge, but also the responsibility, risk, and reward (Kensek 2014b). Unlike the traditional project delivery process, BIM aims to be applied from the early design stage to the demolition of the facility (Fig. 1.17). After the project completion, the complete and data-rich digital model will largely benefit the facility management and also the renovation if the management team keeps updating all the repairing and changes to the model. Besides all the benefit to the architecture, engineering, construction, maintenance and operation (AECO) industries, it also fosters the implementation of new technologies like 4D/5D construction, Virtual Reality (VR), Augmented Reality (AR) and Internet of Thing (IoT) by providing a data-rich platform (Kensek 2014). 22 Figure 1. 17 BIM lifecycle (Autodesk) The integration of BIM into the PV design can help to access the performance of the solar PV system through the building design and construction process. Accessing the PV system in the early design phase will help to maximize the performance of the system by optimizing the building’s orientation, roof shape, structure and so on (Gupta et al. 2014). During the design development phase, detailed design of the PV system and analysis of structural load, power generation, and electrical flow can be performed simultaneously with other stakeholders to ensure the performance of the PV system and the building. After the project is completed, the rich data platform and possible real-time management system will be helpful to maintain the performance and function of the system when operating. Given the growing adoption of BIM in new projects, it will not only improve the performance of the PV system comparing to the traditional process but also foster the development of it. 1.6. Revit programming Revit is a design and documentation BIM-based platform supporting the design, drawing, and schedules (Autodesk.com). Revit has been widely used in the AEC industry to support all phases and disciplines involved in a building project (Autodesk.com). Revit has rich and well-established functions for MEP, structure and some other disciplines, which provides a reliable basis for PV system design and 23 management. Revit allows the user to add new features to the existing functions and to customize their building information workflow. This new feature and customization can be done by building plug-in through coding in Revit API and SDK, or by coding graphically in Dynamo. 1.6.1. Revit API and SDK The Revit Application Programming Interface (API) is a set of tools that allows users to customize command functions, add new features to the software, and create custom plugins (Kensek 2014). Revit API integrates the parametric modeling and programming function allowing users to manipulate and customize Revit elements using the algorithm and computational logic (Yang, Koehl, and Grussenmeyer 2017). Revit API allows users to program with compliant languages like C#, C++, Python. The most popular language used in API is C# and most of the code samples are wrote in Visual Studio (Fig 1.18). Figure 1. 18 Revit API programming using Visual Studio for mechanical design (Autodesk) Revit Software Development Kit (SDK) is an important helpful file provided by Autodesk that contains an extensive description of the syntax of namespaces, class, methods, and sample of codes (Fig 1.19). Every Revit element is represented as a class in the Revit API. The sample code in the SDK is mostly written in C# (Huang 2018). API developers should have a clear understanding of hierarchy and 24 the syntax of statements so that the proper code can be translated into certain function in Revit (Su 2019). Figure 1. 19 Revit SDK interface When developing a plugin in Visual Studio, one of the steps is to add references to declare Revit API-related namespace and to ensure that all the classes and methods under these namespaces can be used in Revit (Su 2019). The most common reference for Revit is “RevitAPI.dll” and “RevitAPIUI.dll”. Dynamic link library (dll) contains information to link and run the code in Revit (Fig 1.20). Figure 1. 20 Adding references (left), namespaces (right) in Visual Studio The benefit of Revit API is to reduce the time on repetitive manual operation with an automated process or integrating all relative elements in one interface. There are probably thousands of plug-ins that have been developed for sale and just use in an office using the Revit API. Examples include Lumion, Enscape, FBX Review, Flux, Coins Auto-Section Box, Palladio X BIM Windows Layout, CTC Express Tools, and BIM Track. 25 For example, CTC Express Tools by CTC Software is one of the popular paid plugins used by companies in AEC industries. One of the featured functions of this tool is to change all the sheets names and numbers, and the drawings names and numbers inside the sheets in a single Excel sheet (Fig 1.21). Generally, if users want to change all the sheets or drawing names, they need to click on each sheet and then change it. There are usually hundreds of sheets and thousands of drawings in a large project. This function of CTC Tools can save users a large amount of time and effort. Figure 1. 21 Changing sheet names, view names in CTC tools 1.6.2. Dynamo Dynamo is an open-sourced visual programming tool in Revit. It is a built-in visual programming tool using Revit API in a graphical way. Users interact with the elements in Dynamo is called “nodes.” Each node has several “ports” acts as inputs and outputs (Fig. 1.22). The ports enable interaction within different nodes along “connector”. In order to connect two ports, the types of outputs ports should match with the type of input ports in the node needed to connect (Kensek 2014). There are many built-in nodes and customized packages online. Users can also create their own nodes by programming in Python script. 26 Figure 1. 22 Dynamo workflow Compared to Revit API, Dynamo is more user-friendly and easier for users who have no experience in programming. However, Dynamo is a subset of the Revit API and on some difficult or complicated tasks, it will crash more frequently. Dynamo has been used frequently parametric design. For example, there is a case of constructing a parametric bridge within Dynamo. The shape of the bridge is controlled by several parameters like the curvature of the beam and bridge slab, the height and length of the bridge and the cable spacing (Fig. 1.23). Figure 1. 23 Creating parametric bridge using Dynamo 1.7. Summary This chapter provides an overview of some basic concepts of BIM and the PV system, and what is the benefit of integrating these two concepts through the whole life cycle of the building. The factors and current conditions of solar PV system design, construction, and management in the AECO industries have 27 also been introduced. As building projects become large in scale and the use of the PV system becomes more popular, the PV system, construction and management should be moving toward the integrated BIM process. All the factors of the PV system can be considered in an earlier stage of design to reduce the cost and maximize efficiency. A building information model can be used both in creating the virtual PV system before construction and can later benefit its operation and maintenance. The next chapter will discuss past research projects on those aspects. 28 Chapter 2 2. BIM-based PV System Design and Management PV system design and management in BIM requires a deep understanding of PV system design and management, data analysis, and BIM tools. This chapter introduces background information and past research projects, including influencing factors in PV system design and management, the characteristics of PV system analysis data, BIM tools to fulfill the process, and application of Revit programming in the field of building science. 2.1. Understanding the PV system design factors and variables To realize the goal of PV system design, construction and management, it is important to learn about the strategies used in this process. The factors in those strategies and how they influence the process are important to maximize the system performance through the BIM process. Generally, three main categories of factors will be considered and analyzed in the pre-design and design phase: design, system, and financial. 2.1.1. PV design factors PV design factors are those variables that heavily influence the amount of energy that can be harvested and are needed to estimate the PV system performance. Those factors are common in the site assessment, including the site location, weather (solar irradiation level and seasonal snow cover rain pattern), existing and expected shading, expected soiling, existing roof structure and load, existing electrical load, roof orientation, condition, available space (U.S. Department of Energy 2014). Currently, there is no standard for estimating PV system performance. Therefore, the factors discussed are selected largely based on popular software, handouts, algorithms for the PV system (Gregg, Parker, and Swenson 2005). 29 2.1.1.1. Weather (Solar insolation level, rain pattern, seasonal snow cover) Local weather has a large impact on the PV system performance, and solar insolation level is one of the most important factors in the whole PV system design process. Solar insolation is “the amount of solar energy that falls on a given area over a certain period of time, which is termed kilowatt-hours (kWh) of energy per square meter per day” (U.S. Department of Energy 2014). The EPA recommended the insolation level is above 3.5 kWh per square meter per day. Besides solar insolation level, the sky cover rate, snow cover rate also influences the annual solar radiation level. To obtain the information for the local weather, the most common way is to use the typical meteorological year (TMY) weather data from National Solar Radiation Data Base (NSRDB). TMY data contains long-term data about “extraterrestrial and terrestrial hourly insolation (direct normal insolation, diffuse horizontal insolation, and global horizontal insolation)” (U.S. Department of Energy 2014). However, TMY data doesn’t include extreme or unusual weather events, which may have a 20% yearly difference from the actual solar insolation (Renné 2016). 2.1.1.2. Existing and expected shading and soiling Shading is also one of the most important factors in PV system design (Salimzadeh, Vahdatikhaki, and Hammad n.d.) (Ning et al. 2017) (U.S. Department of Energy 2014). In a system, the worst- performing module can largely reduce or even affect the performance of the entire string, which includes multiple solar panels connected in series with the same tilted angle and orientation. The maximum power of a system can drop by 7% for every 100w/m 2 , if 20% of the PV array that gets shading (Teo et al. 2018). The common shadings include trees, mast, dormer, cooling tower, rooftop equipment, roof edge, soiling and neighbor buildings (Fig. 2.1). 30 Figure 2. 1 Types of shadings (U.S. Department of Energy 2014) Partial shading happens when some of the connected PV panels are under shading. During the partial shading, the maximum power output of the PV system can drop drastically. However, the influence of partial shading is not constant and it can be varied due to different shading patterns and how the PV panels are connected (Teo et al. 2018). In particular cases, the partial shading can actually shut off a line, if one of the collectors is shaded. That collector turns into a normal semi-conductor and impedes the electricity generated in the other collectors (Mellit, Tina, and Kalogirou 2018) (Schiler 2020). Typically, simple shading analysis can be done by using a sun chart to find out and calculate the hours of the day in each month the PV getting shade (Fig. 2.2). Then, users can calculate the ratio of the shading and take into account the estimation. However, this approach is not suitable to calculate large- scale PV arrays because then the sun chart needs to be used on each panel to determine the shading. If considering partial shading on the PV module, different points on one panel should be analyzed. Glare from the PV system is another concern, both for air traffic and discomfort in the nearby environment (Rose and Wollert 2015). 31 Figure 2. 2 Typical shading analysis by sun chart (NREL) The computer-aided shading analysis enables an efficient and detail analysis. Most of the computer- aided shading analysis are using ray projection methods. Before using this method, the hourly sun position data is needed to construct the solar motion model (Fig. 2.3). Each position projects ray to the analyzed surfaces. All the objects between the sun's positions and surface points will be returned. If the returned object is empty, the surface is not shaded and vice versa. Figure 2. 3 Sunlight and shading analysis using Ladybug 32 2.1.1.3. Structure (structural load) Structure load of a PV array and mounting structures, such as dead loads (static load) to the buildings, wind load, seismic load, snow load is critical in assessment and design (Lisell, Tetreault, and Watson 2009) (Wills et al. 2015). The structure loads directly influence the feasibility of the PV system, the amount and types of PV module, and the types of the mounting structure (Fig. 2.4). Typical PV solar panel and racking will add around 3 lbs/sq ft to the roof and, if adding the mounting structure, it will be around 4 to 6 lbs/sq ft (Lisell, Tetreault, and Watson 2009). The weight that the roof can support highly impacted by the roof types and their structures. ASCE building code and local code have specific requirement of the wind load, snow load, and the seismic load (U.S. Department of Energy 2014). Figure 2. 4 PV system structural loads (NREL) The option for structure and load calculation is not very common in PV design tools in the market. EasyPV is one of few programs that have a simple calculation of the dead load and wind load based on the roof structure types, the weight of the solar modules and support structure, covered roof area and weight of roof cover. However, the tool only roughly checks if the load is too much based on UK standard, but not the load capacity of the roof (Wijeratne et al. 2019a). Therefore, it is not providing the necessary information to determine the amount of PV module and the layout. 33 2.1.1.4. Roof and building condition (orientation, condition, available space) The roof condition is also important to determine the amount of energy that can be harvested, the number, and the layout of the PV module. Roof slope and orientation are critical to the later design of PV tilt angle and azimuth because the panel orientation, in many cases, is parallel to the roof orientation for the layout efficiency purpose and the structural purpose. In general, the south-facing roof can harvest more sunlight than the other orientation (Lisell, Tetreault, and Watson 2009). The available roof space for PV systems depends on the design programing of the space including walkable space, cooling towers, and equipment. Currently, those building design factors are considered to be fixed since PV system design usually started at the later design stage. If pushing and integrating PV system design into an earlier stage, the overall efficiency and electricity production may have a considerable increase. The benefits of using BIM on the PV factors are listed in Table 2.1. Table 2. 1 Using BIM on PV factors Factors Using BIM Weather BIM foster the participation of all stakeholder in the early design stage. The analysis of the weather in this stage will be helpful to optimize the building orientation to maximize the performance of the solar system. Some BIM software like Revit has linked to the online database to provide some weather data based on the project location. Shading BIM foster the analysis of shading in the early design stage. Because of its object-oriented characteristic, the shading analysis will be more accurate rather than simple geometry. Revit has built-in shading and the sun setting, which can be used on shading analysis. Structural load BIM allows the early examination of the balanced firmness and hardness of design for structural engineering. Therefore, it is beneficial for PV designer to know how much structural load of the roof available for PV system or allows the structural engineering knows how much load you needed to maximize the performance of the PV system Electrical load BIM allows the early examination of the balanced electrical system and the size of the electrical load. It is beneficial for the project to know how much is the electrical load of the PV system and choose the right size of components like inverter and wire in advance Roof and building condition Accessing the PV system in the early design phase will help to maximize the performance of the system by optimizing the building’s orientation, roof shape, structure and so on 34 2.1.2. PV system factors PV system factors are those system variables that will influence the performance of the PV system. Some of the factors of the PV module, like the tilt angle, azimuth are considered in the pre-design phase. Other system factors usually will be designed in the design phase. During the design phase, works are divided into three parts: PV array and system design, electrical design, and structural design. The PV array and system design are mainly in charge of the array design, layout of the array, and layout of systems. The electrical design focuses on the sizing of components and balance of the current and the structural design works on the wind and seismic load and structural load. During the construction phase, the installation will be based on the construction document and checking that the installation is in compliance with the relative codes like building code, structural code and electrical code (Dodson, Doyle, and Lockhart n.d.). 2.1.2.1. PV module (tilt angle, azimuth, module spacing) Typically, panels with shallow tilt produce more energy in summer and steeper angles produce more energy in the winter. The best-fixed angle is the one between the two extremes, which produce the largest amount of annual output (Gregg, Parker, and Swenson 2005). Tilt angle (β) is the angle between the panel and the horizontal plane (Fig 2.5). The rule of thumb for maximum annual production is (Schiler 2020): β = Lat − 10 (2-1) Where: β = Maximum energy received tilt angle for South facing collector Lat = Latitude of panel location Solar azimuth angle (φ) is the angle between the direction of the panel and true south. solar elevation angle (α) is the angular height of the sun from horizontal (Fig 2.5). The calculation of solar azimuth angle and solar elevation angle can be calculated from equation 2, 3 (Ning et al. 2018). 35 α = 𝑠𝑠 𝑠𝑠𝑠𝑠 − 1 (𝑠𝑠 𝑠𝑠𝑠𝑠𝑠𝑠 𝑠𝑠 𝑠𝑠𝑠𝑠𝑠𝑠 + 𝑐𝑐𝑐𝑐 𝑠𝑠 𝑠𝑠 𝑐𝑐𝑐𝑐 𝑠𝑠 𝑠𝑠 𝑐𝑐𝑐𝑐 𝑠𝑠 𝑐𝑐 ) (2-2) φ = 𝑐𝑐𝑐𝑐 𝑠𝑠 − 1 ( sin 𝑎𝑎 co s 𝜑𝜑 − co s 𝛼𝛼 sin 𝜑𝜑 co s 𝜏𝜏 co s 𝛼𝛼 ) (2-3) Module spacing plays an important role in the energy harvest. In PV arrays, there is a high chance of row to row shading which will reduce the efficiency of the system (Fig 2.5). The distance (d) between two PV array can be calculated through the following equation 4. d = �sin β × L tan 𝛼𝛼 � × cos (φ 𝑝𝑝 − φ 𝑠𝑠 ) (2-4) where α, φ s , φ p , β, L are the solar altitude angle, the solar azimuth angle in the winter solstice, the azimuth angle of the solar panel the tilt angle, the height of the solar panel. Figure 2. 5 Diagram of Positioning factors 2.1.2.2. PV components and system (AC/DC voltage, component efficiency, mismatch) Factors of PV components and the system are important to determine the overall efficiency and energy produced by the PV system. These system factors are mainly for the purpose of improving the estimation of the PV system before getting into a detailed performance analysis by the specialist. The key system performance parameters are the following (Gregg, Parker, and Swenson 2005): • Cell Temperature: cell temperature is one of the important factors determining how much power it can produce. An increase in operating temperature due to heat transfer or strong sunshine will reduce the cell’s voltage and thereby reduce the output power (“PV Module Temperature | 36 PVEducation” n.d.). The power rating criteria for all PV panel is identical and the panel data is collected under standard test condition (STC), which is 1000 watts per square meter with an air density of 1.5 and cell temperature of 25 ºC (Gregg 2005). However, the environment is not always the same as STC in the real world. Therefore, many PV Module manufacturers also provide a temperature coefficient. The thermal coefficient for a typical mono-crystalline PV panel is -0.48%/ ºC, which means the output power decrease 0.48% for each 1 ºC drop under 25 ºC. • DC to AC size ratio is the rated size of inverter AC compared to the rated size of arrays DC. Usually, the DC to AC size will be 1.2, which means that a 6 kW DC arrays need a 5 kW AC sized inverter (PVWatts Calculator n.d.). Since the array output in the real-world is typically below to its rated size, reducing the AC size by a reasonable number can ensure the maximum energy production in lower-cost (Luoma, Kleissl, and Murray 2012). • Array mismatch may cause by various reasons like the imperfection of individual panels, partial shading, different aging and so on. Since all the panels in an array are connected to achieve operative voltage, the output is usually the average of each individual panels (Gregg, Parker, and Swenson 2005). • Device nominal rated efficiency includes inverter nominal efficiency and solar panel nominal efficiency. Inverter efficiency, which is the rated DC to AC conversion efficiency, has a significant impact on the system efficiency. Typically, the inverter has a 4% to 10% loss depending on the selection and cost of the inverters (Gregg, Parker, and Swenson 2005). Solar panel nominal efficiency is also significant to determine how much DC power can be produced by solar insolation, which is between 15% to 20% depending on the types and manufacturers. • Wiring loss is the resistant loss in the DC and AC line connected devices in the PV system. It is important to choosing the right size and length of wiring to meet the expected current in order to minimize the losses during the transferring. Typically, wiring losses should be controlled within 3% (Gregg, Parker, and Swenson 2005). 37 • Other losses including availability, soiling, snow, and aging also need to be considered when designing the system. Availability accounts for the scheduled and unexpected shutdown of the system, which generally counts for 3%. Soling, dust and snow in the module will reduce the solar energy harvesting and thus decrease the output of the PV system. The effect of snow is various from locations and the soiling and dust generally count for 2% of the losses (“PVWatts Calculator” n.d.). From these measurements and estimations, the following value can be calculated: • The energy conversion efficiency from solar insolation to electrical power • System efficiency from array’s DC to usable AC • PV Array performance under specific site conditions rather than STC 2.2. Understanding the PV system analysis and tools The PV system analysis is one of the main steps in the pre-design phase. Three main analysis play a role in determining the overall benefit of the PV system to the project: solar access, system, and financial analysis. Before getting into detailed design and analysis by the specialist, it is necessary to have estimations to define the scope of the PV systems (U.S. Department of Energy 2014). Tools are important in the PV system design process especially in the pre-design phase because it’s the architect, who usually doesn’t have professional knowledge and experience on PV systems, but is the main decision-maker about the scope of the PV system (Wijeratne et al. 2019a) (Horvat and Dubois 2012a). 2.2.1. Solar analysis and tools The solar analysis provides an estimation of the amount of energy that can be harvested by the PV array. Key parameters in the analysis include solar insolation, factors of shading, factors of snow and rain, and PV systems variables like title angle, azimuth, and spacing. The first step of solar analysis is to 38 analyze the global radiation. TMY format data is available from National Solar Radiation Data Base (NSRDB), which include the local solar insolation in three ways: beam solar insolation (I b ) sometimes called the direct normal (I DN ), diffused solar insolation (I d ), and reflected insolation (I r ) (Okoye, Taylan, and Baker 2015). The global insolation (I) is the sum of the three types of insolation. The following equations can calculate all three types of insolation on the receiving surface (Ning et al. 2018) (Ibrahim et al. 2013). 𝐼𝐼 𝑏𝑏 𝑏𝑏 = 𝐼𝐼 𝑏𝑏 [cos 𝛼𝛼 sin 𝛽𝛽 cos � 𝑠𝑠 𝑠𝑠 − 𝑠𝑠 𝑝𝑝 � + sin 𝛼𝛼 cos 𝛽𝛽 ] (2-5) Where I bc is the insolation on a specific surface and β is the tilt angle of panels. φ p , φ s and α are the module azimuth, solar azimuth angle and the solar elevation angle. 𝐼𝐼 𝑑𝑑𝑏𝑏 = 𝐼𝐼 𝑑𝑑 ( 1+co s 𝛽𝛽 2 ) (2-6) Where I dc is the diffused insolation on surfaces and β is the tilt angle. 𝐼𝐼 𝑟𝑟 𝑏𝑏 = 𝐼𝐼 𝑟𝑟 [ 1− co s 𝛽𝛽 2 ] (2-7) Where I rc is the reflected insolation from surrounding surfaces. The total insolation harvest by the system is the sum of the three types of insolation times the total area of the PV module. Currently, most of the PV tools such as SAM, RETscreen, Homer Pro, EasyPV, PV-GIS have solar analysis functions. They obtain solar insolation data by linking to the existing databases like NSRDB, PV, NASA. Some of the tools like Homer Pro, SAM has import option in order to get a more accurate local weather data. However, most of the tools don’t consider the rain pattern, which is important to estimate accurate solar radiation (Wijeratne et al. 2019a). Shading is also one of the critical factors in the solar analysis. Tools like SunEye, Solar ASSET, or the Solar Pathfinder can be used to determine the factor of shading (U.S. Department of Energy 2014) 39 (Fig. 2.5). For projects in the city with a complex surrounding environment, 3D based analysis will be more helpful. Users can integrate with City Geographic Markup Language (CityGML) to capture and analyze a more complex environment (Salimzadeh, Vahdatikhaki, and Hammad n.d.). Figure 2. 6 shading analysis in PV tools 2.2.2. System analysis and tools. System analysis provides the estimation of the DC/AC voltage that can be produced by the PV system. The sunlight harvested will trigger the PV cell to create currents and the PV panel efficiency heavily impacts the amount of current that can be produced. Simple system analysis will stop here, which only considers the PV panel efficiency. Simple system analysis is suitable for an early site assessment to have a rough idea of how much energy the site can generate. However, a more accurate estimation of the system should count the efficiency of the system’s components like inverter, the system operating voltage when PV connected in series and the loss during the process from DC to AC voltage (Gregg, Parker, and Swenson 2005). Different types of PV modules could have different parameters and operating conditions. Some types of PV modules may have different responses to weather conditions (beam insolation, diffused insolation), cost, conversion efficiency, degradation (Wijeratne et al. 2019a). The efficiency of the inverter significantly impacts the system efficiency, usually account for at least 6% of the system loss. Considering other components like wiring, batteries and charge controllers based on the power requirements and load types is also important to estimate the system loss, efficiency, and cost (Gregg, 40 Parker, and Swenson 2005). Most of the tools like SAM, PV Sol, PVsyst have a library database for different types of PV modules and inverter and relative loss like DC losses and AC losses. Table 2. 2 features of the mainstream Solar PV tools PV tools features RET Screen Rich meteorological and product database, strong financial analysis, Consider carbon emission Homer Pro Strong feasibility and economic analysis, consider carbon emission, can use hybrid renewable energy systems SAM Simulation of different financing models, Varieties of PV performance models, weather file imported PVsyst Comprehensive PV product databases, wide-ranging meteorological database, strong technical analysis PVwatts Easy use, quick site assessment Polysun Comprehensive PV product databases, electric grid data catalog, the electrical consumption profile PV sol Comprehensive module and inverter database, customize modules and inverter parameters, carbon emission, 3D environment 2.2.3. Financial analysis and tools Financial analysis directly influences the feasibility of the PV system. Clients and architects usually require lifecycle cost and benefit analysis of PV systems to make the decision on the scope of PV systems in the pre-design phase. The following metrics usually will be included in the financial analysis (U.S. Department of Energy 2014). • Payback Period • Levelized Cost of Electricity (LCOE) • Return on investment (ROI) The payback period is the amount of time the PV system takes to cover its cost. It determines the combination of costs and annual benefits from energy bill reduction. The typical payback period in the US is about 8 years (EnergySage 2014). LCOE “represents the average revenue per unit of electricity generated that would be required to 41 recover the costs of building and operating a generating plant during an assumed financial life and duty cycle” (EIA 2019). A reasonable number of LCOE for a PV system is between $5 to $15 cent/kWh (Kost et al. 2018). ROI is a performance measurement evaluating the efficiency of an investment or comparing the efficiency of a number of different investments (Investopedia.com). It is the ratio between net profit and the cost of investment. A reasonable number is between 10 to 30% in the first years. The cost of systems varies from the selection and amount of PV panels, inverters, and other Balance of Systems (BOS) and structural components like batteries, mounting structure. Other soft costs may include the design and installation fees, as well as the potential cost of operation and maintenance (Fig. 2.7) (Table 2.3). Available tools like SAM have a detailed analysis range from various hard cost, soft cost and indirect capital costs like permits, grid interconnection, tax and O&M costs (Wijeratne et al. 2019a). Figure 2. 7 Cost of solar panels break down (Sunmetrix.com) Table 2. 3 Typical residential PV panel cost (homeadvisor.com) Expense Percentage Example: 5kW @$3/kW Labor 15% $2,250 Permit/inspection fees 3% $450 Inverter 10% $1,500 Mount 5% $750 42 Other (Mktg, Overhead) 33% $4,950 Panel 34% $5,100 Total 100% $15,000 2.3. Understanding PV workflows The general workflow of the PV project lifecycle can be divided into five parts: Inception and Design, Construction, Commissioning and handovers, Operation and Maintenance, and Decommission (Fig. 2.8). Currently, the majority of PV projects are started in the design development phase for new buildings or management phase for existing buildings. Therefore, the PV system design is limited within a fixed building façade, structure, and rooftop and limited within a similar workflow. According to the Solar Energy and Architecture Initiatives 2009, the ultimate goal is to make architecture the major “driving force for the use of solar energy in buildings” in the project’s early design phase (EDP) (Wijeratne et al. 2019a) (Horvat and Dubois 2012a). The integration of the PV workflow with the project process will, somehow, change the current workflow, especially in the EDP. Figure 2. 8 Workflow of PV project 43 According to the international survey, most of the current PV tools have several common drawbacks that hinder their use in the EDP by architects (Horvat and Dubois 2012). Lack of advanced tools supporting work in EDP is one of the main problems. The early design stage is an iterative process with frequent changes in the design (volume, geometry, orientations, etc.). The tools need to be able to respond to those changes quickly and easily to use through these processes. Another big problem is the lack of CAAD tools to support the visualization and sizing of the PV system. Most of the simulation tools have the functions of the sizing and specification of the system. However, these tools usually have poor visualization and 3D interfaces (Horvat and Dubois 2012a). 2.4. Applying BIM for PV system design and management The majority of the existing PV design tools such as PVsyst needs like PV-designer to re-construct buildings in their interface, which wastes a lot of time and is usually hard to accurately model (Ning et al. 2017). Since BIM allows access to the information of different elements of the building, it is suitable for various types of simulation like energy performances (Salimzadeh, Vahdatikhaki, and Hammad n.d.). Given that BIM allows the integration of different parties’ components, it is beneficial to apply BIM for PV system design and management based on all these beneficial features of BIM. 2.4.1. Solar and energy analysis in BIM Simulation and analysis are two of the major steps in the BIM project’s lifecycle (Yan 2017). Currently, there are many Building Energy Modeling (BEM)-based performance analysis programs available in the market that is largely used in real projects for sustainable design, such as IES VE, eQUEST, and EnergyPlus. The interoperability of those BEM programs with BIM-based architectural model that has been examined to be not high (Attia and De Herde 2011). The BIM-based model is able to transform into the simulation tools via IFC or gbXML format. However, this method has two drawbacks. First, some geometries can’t be transformed successfully. Second, it is one direction simulation, which means the result in BEM cannot be transferred back easily to the BIM. 44 BIM-based modeling tools like Revit that have plugins like Insight have the ability to perform solar analysis directly in one interface and visualize the result (Fig. 2.9). It is one of the tools that will be used to validate these studies, especially on the solar insolation part. However, the estimated energy production is based on rough calculation and each simulated panel needs to be located and selected manually (Salimzadeh, Vahdatikhaki, and Hammad n.d.). Figure 2. 9 Solar analysis using Revit’s Insight (Autodesk) Cove.tool is another solar relative plugin for Revit. It is an automated building performance consulting tools and has functions on calculating the solar insolation level and PV system energy output (Fig 2.10) (Covetool.com). The user of BIM software like Revit would be able to link their model through Cove plug-in to the web-based analysis interface. It will be later used to validate the tool developed from this study. Figure 2. 10 analysis and visualization in Cove (Covetool.com) 45 For Revit based simulation, the shading effect on the solar insolation can be analyzed by modeling the nearby obstacles or using import through CityGML if the surrounding environment is large in scale (Salimzadeh, Vahdatikhaki, and Hammad n.d.). Ray projection methods supported by Revit can be used to analyze the shading (Ning et al. 2018). BIM-based solar analysis can be done by using Revit Dynamo. Customized packages like Honeybee and Ladybug are able to perform the solar analysis inside a Dynamo interface (Fig. 2.11). However, it is necessary to design the workflow through a complex process of programming if analyzing the solar insolation on each panel. Figure 2. 11 Solar analysis through Ladybug tools (Ladybug) 2.4.2. PV system design in BIM The main tasks of PV system design included configuration of PV panels, electrical design (Ning et al. 2018). Because of the object-oriented characteristic of BIM, it will require a certain level of development (LOD) PV object in the conceptual design and design development phase. The higher the object’s LOD means the higher completeness of the object with physical detail and various parameters, which is more time-consuming for architects and engineers comparing to the CAAD tools. However, some of the PV panel manufacturers started to have the digital model of their new product with rich information, such as Samsung, LG and ready for use in the BIM projects. Then, what architects and 46 engineers need to do is choosing the suitable products and testing on the tilt angle and modular spacing based on the solar and shading analysis. The electrical design for the PV system can benefit from BIM’s ability of information exchange between the object and its parameters (Fig 2.12). Many of the electrical components have been built and ready for use. The integration of the PV system model into the design and simulation of its components could be more feasible to achieve system optimization (Ning et al. 2017). Figure 2. 12 Electrical flow diagram for BIPV in Revit (Ning et al. 2018) 2.4.3. Revit application on PV system design and management With a well-developed building information model, architects and engineers can perform various simulations without spending too much time on data input, such as electrical flow analysis and energy use simulation in Revit. However, most of the current researches and plugins are focus on structural, mechanical and building energy simulation rather than PV system simulation. As for the integrated design of the PV system in BIM, there are no plugins and only a few research papers have been written about it. The feasibility of developing an integrated PV system design methods and plugin in BIM was demonstrated by Gui Ning and others in two case studies (Ning et al. 2018) (Ning et al. 2017). These two studies have attempted to develop an integrated workflow for PV design, simulation, and visualization by using the Revit API. 47 Environmental data including hourly solar radiation was needed in order to simulate the solar system in Revit. One method to get environmental data is to use series of formulas to build the solar motion model that includes declination angle, solar azimuth and others, and calculate the overall solar radiation on panels (Ning et al. 2018). Another method is to import environmental data such as energy plus data, TMY3 data, and read it in Revit. Energy Plus data, epw format, has been widely used in Ladybug and Honeybee in Dynamo for solar simulation. Shading analysis requires the vector of sun rays for each hour in a year period. Given the solar motion model, it is feasible to transform the number to XYZ vectors (Ning et al. 2017). Another way, which is more Revit-oriented, is to use the built-in sun and shading setting through Revit API. Finally, the ray projection method can be used to determine if the spot is shaded or not in the hour basis (Fig 2.13). Warnock algorithm is also feasible to determine whether the building is shaded. These methods create a plane in the reverse view from the sun’s viewpoints and cast the building geometry into the plane, changing shading analysis from 3D to 2D (Schiler 2020). Figure 2. 13 ray projection methods (Ning et al. 2018) For the layout strategies of PV panels, an algorithm is needed to find the strategy harvesting the highest amount of solar energy. Based on the layout constraint and variables, it is viable to use a simple algorithm to find the value of the variable with the highest solar insolation on panels and automatically 48 place the panel family based on those values (Ning et al. 2017). 2.5. Summary Key environmental factors include different types of solar insolation and factors of shading in the estimation of the energy production for the PV system. The key system factors like panel efficiency, inverter efficiency also have a large impact on the overall system efficiency and electricity production (Table 2.4). Table 2. 4 Summary of PV system factors (Wijeratne et al. 2019b) Categories Factors Building and site Roof shape and slope Available space Inner shading Surrounding shading Weather Solar motion Solar Insolation (direct, diffused and reflected) Sky cover rate PV module layout Tilt angle Azimuth Module spacing PV system Panel efficiency Inverter efficiency Wiring loss Finance Soft and hard costs Benefit and profit Return on Investment Payback Period The critical analysis based on those factors includes solar analysis, system analysis, and financial analysis. They are important to determine the feasibility and scope of the PV system. Currently, many PV related tools in the market allow users to perform the analysis. However, it is hard to find one which integrates all these key functions in one platform. There are no PV tools suitable for architects to use in the early design phase (EDP). The design in EDP is an iterative process with frequent design changes in the building’s volume, geometry, and orientation. Currently, available tools and workflows are not suitable for the purpose of 49 making the architect the main driving force to apply solar energy on building in EDP. The integration of PV system design and management with BIM has the potential to provide a single, easy-to-use, and EDP-friendly platform for architects to perform and visualize necessary analysis while designing the PV system based on various and reliable resources. 50 Chapter 3 3. Methodology This chapter introduces the overall workflow for the BIM-based PV system design including building and site context preparation, PV systems design, and feasibility studies. The main research process includes building geometry preparation, environment, PV module, system, and financial studies. The detailed step from input to output and the relationship between each process will also be explained. Chapter 4 contains the code that was written to create PV LINK. 3.1. Methodology overview In order to have a better understanding of the proposed methodology, it is important to understand the difference between the proposed and traditional methods (Fig. 3.1). A traditional BIM-based workflow for PV system design is based on a multi-platforms method. The architectural model with building geometry usually will be transferred to a simulation software through the Industry Foundation Classes (IFC) format or rebuilding the model in the simulation software. Then, the simulation result will be used to model the PV system in the architectural model. Different from the traditional workflow, the proposed workflow is based on a simple BIM platform, Revit. The architectural model can be used directly to simulate the solar insolation and electricity generation with synchronous visualization in a 3D environment. The data produced from each process of the simulation will be stored in the parameters of corresponding objects. Moreover, the model of the PV modules will be automatically placed in the architectural model based on the simulation. Figure 3. 1 Traditional methods vs proposed methods 51 The proposed workflow has three main categories: Building, PV system, and Feasibility (Fig. 3.2). It defines the process starting from the building level to the system level and ends in the information level and includes five parts: Building Geometry, Environment, PV Module, Systems and Components, and Finance (Fig. 3.2). Figure 3. 2 Overall workflow diagram 3.1.1. Building Geometry (see section 3.2 for further details) A completed 3D model of the building containing basic roof elements (architectural, structural, and mechanical contents) are created in the Revit in order to generate a deployable surface for the solar studies through roof surface analysis. Examples of basic roof elements may include cooling tower, structural roof edge, and stairwell, which will cause inner shading. The completed 3D model of the surrounding geometry, for example, buildings, trees, electrical poles, are also needed to generate shading surfaces for the use of shading analysis. The site context can be made either through direct modeling in Revit or importing the site from other software programs. 52 3.1.2. Environment (see section 3.3 for further details) The interface needs the import of weather data, such TMY files, including three types of solar insolation (direct or beam solar insolation, diffused solar insolation and reflected solar insolation), overcast pattern (cloud) and geometry data like site latitude. Then the shading analysis and solar analysis with shading can be simulated in the deployable area. Based on the insolation baseline standard, a solar map is shown in the 3D environment and the solar deployable area was generated to use in the next phase. 3.1.3. PV Module (see section 3.4 for further details) The user needs to select a PV module from a preset database of popular PV panels to determine the PV size. Other module factors like tilt angle and module spacing are calculated based on the site latitude and orientation. Based on those geometry factors, the optimized module layout and quantity and the solar analysis of those modules are simulated. A function of automated placement can place the PV module components in the deployable area. 3.1.4. Systems and components (see section 3.5 for further details) After the solar analysis of PV modules, a systematic analysis simulates how much DC current can be generated based on the module characteristics and how much AC current can be converted based on the inverter and other components’ performance factors. System data will be stored in the module type parameters, which enable users to modify the value and apply to all elements of the family type. 3.1.5. Finance (see section 3.6 for further details) The electricity generated from the system analysis and the financial factors of selected modules and systems is used in calculating the cost and benefits of the PV system. Through the analysis of the payback period and return on investment, the financial report is generated to support decision making. Several design options are also available to provide various schemes on PV design. 53 3.2. Building Geometry Autodesk Revit is a BIM tool for 3D modeling based on components. Users can build necessary elements of a project, including its site, topography, walls, roofs, structural columns, electrical conduits, etc. A detailed geometry is needed for the simulation and studies (Fig 3.3). Figure 3. 3 Workflow diagram for building geometry 3.2.1. Building Geometry Preparation The preparation of a roof model is important to accurate simulation. Different roof shapes and orientation determine the different strategies using in the PV module layout. Depending on the phase of the project, the roof preparation can be simply as a face in the predesign phase for some projects, or it could be a detailed roof for existing buildings projects. The mounting structure of PV modules is also determined by the slope and structure of the roof. The structural load of the roof will be an optional function for a more accurate simulation. As a user inputs the maximum structural load, the tool will reduce the amount of the PV modules to reduce the overall system load below the maximum roof load. Another important part of the geometry preparation is to generate surrounding obstacles, such as trees, mountains, nearby buildings, and inner roof obstacles, such as roof skylights, stairwells, and 54 mechanical equipment (Fig. 3.4). In general, all the surrounding geometry that can cast shadows on the rooftop should be modeled in order to create an accurate solar analysis. The inner obstacles also influence the layout design of the PV module. Figure 3. 4 Example of inner roof obstacles (https://www.rooftechconsultants.ca/resources/top-3-roofing-concerns-for- commercial-buildings/) 3.2.2. Roof surface and shading surface analysis The purpose of roof surface analysis is to identify the roof surfaces based on their shape and available spaces. For regular sloped gable roof surfaces, the deployable surface will consist of two roof surfaces with different orientations and will exclude the skyline parts (Fig. 3.5). Later, additional roof surfaces (e.g. 4 for a hip roof) may be added. The roof surfaces with different orientations and different slopes need to be separately analyzed in order to simplify the calculating process. The automated placement of PV modules will require a series of coordinates to place the family instances; in Revit, each kin of component is called a family, variations are types, and each placement of a family is called an instance. So, a PV module would be a family; types are 2’ and 3’ wide PV modules; instances are how many have been put on the roof. The coordinates with certain patterns will simplify the calculating process of optimizing the layout. For more complex roof surfaces, the roof needs to identify as multiple surfaces different surfaces in order to automatically placing the solar panel later. 55 Figure 3. 5 Roof surface identification If the surrounding environment is complex (especially in an urban context), extra steps are needed to import the surrounding objects as shading surfaces. CityGML is an open data model and allows users to download 3D city models. For example, it is possible to export surrounding buildings from the cityGML model and save it to the fbx format file. Then, it can be imported into Revit as a site family (Fig 3.6). The object in the cityGML file is surface-based, which can be easily used on shading analysis and solar analysis. Figure 3. 6 City GML example in Revit 3.2.3. Building Data and Visualization Through the building preparation process, a complete site model with the surrounding environment is visible in the 3D environment. The buildings also have a detailed roof model with project-specific architectural, structural and mechanical elements, which may include cooling towers, air exhaust, AHU 56 unit, stairwell, and skylight. Deployable surfaces and shading surfaces generated and identified through the process are used in the environment part (Fig 3.7). 3.3. Environment In order to create an environmental analysis visualization, geographic and weather data are used along with the geometrical data. The solar analysis with shading will determine the solar deployable areas as base and boundary for the later PV module analysis (Fig 3.8). Figure 3. 7 Workflow diagram for Environment Figure 3. 8 Deployable surfaces (left), Deployable area (right) N 57 3.3.1. Environmental preparation The preparation of the environmental analysis includes collecting the geographic and weather data, as well as setting the insolation baseline. The site latitude is important to later determine some factors of the PV module, such as tilt angle and spacing. Site latitude can be collected through the project information or manually input by the users. Collecting weather data is the most important step in environmental preparation. The TMY data is downloaded from the NSRDB website. It contains data like temperature, wind speed, and different types of solar insolation, which are direct normal insolation (DNI), diffused horizontal insolation (DHI) and global horizontal insolation (GHI) (Figure 3.9). The data needed is DHI, DNI, GHI and sky cover. One of the benefits of using TMY data is that it contains hourly data for one year, which is the average representation over a multi-year period. Besides weather data, the insolation baseline is set in order to distinguish the area that is not efficient for solar harvest. The baseline of the minimum harvestable amount is 200 W/m 2 . Only if the values of the analyzed grid is higher than the baseline, it will be counted into the solar deployable area. Figure 3. 9 TMY 3 data in Excel spreadsheet Another important setting before the simulation is the grid-distance setting. In order to distinguish 58 the solar efficient and inefficient area based on the insolation baseline and visualize the solar insolation in the 3D environment, it is necessary to define the analyzed surfaces into a small grid. The smaller the grids are, the more accurate are the results, while the computation workload is larger. Depending on the user's needs, the size of the grid can be customized. Otherwise, the default value would be 3.2 feet by 3.2 feet (Fig 3.10). Figure 3. 10 Default grid setting 3.3.2. Environmental analysis There are two simulations in the environmental analysis: solar analysis and shading analysis. The solar analysis simulates the solar insolation on given surfaces. In order to use the solar data in TMY file, the solar motion model is needed, including declination angle (δ), solar elevation angle ( α), and panel azimuth angle (φ s ). The calculation of these three factors can be done by equation 1,2,3 (Ning et al. 2018). δ = 23.45 sin[ 360 × ( 284+ 𝑛𝑛 ) 365 ] (3-1) α = 𝑠𝑠 𝑠𝑠𝑠𝑠 − 1 (𝑠𝑠 𝑠𝑠𝑠𝑠𝑠𝑠 𝑠𝑠 𝑠𝑠𝑠𝑠𝑠𝑠 + 𝑐𝑐𝑐𝑐 𝑠𝑠 𝑠𝑠 𝑐𝑐𝑐𝑐 𝑠𝑠 𝑠𝑠 𝑐𝑐𝑐𝑐 𝑠𝑠 𝑐𝑐 ) (3-2) φ 𝑠𝑠 = 𝑐𝑐𝑐𝑐 𝑠𝑠 − 1 ( sin 𝑎𝑎 co s 𝜑𝜑 − co s 𝛼𝛼 sin 𝜑𝜑 co s 𝜏𝜏 co s 𝛼𝛼 ) (3-3) Where φ, τ and n are the local latitudes, the sun hour angle, and the day of the year. These factors are important to calculate prior to analyzing the solar insolation on given surfaces. In order to get the sun hour angle (τ), a series of calculation is needed to get the local solar time (LST), Local Standard Time Meridian (LSTM), Equation of Time (EoT) and Time Correction Factor (TC) (PVeducation.org). N 59 LSTM = 15° × ∆T (3-4) EoT = 9.87 sin(2B) − 7.53 cos( 𝐵𝐵 ) − 1.5 sin (𝐵𝐵 ) (3-5) TC = 4(Longitude − LSTM) + EoT (3-6) LST = LT + TC/60 (3-7) τ = 15° (LST − 12) (3-8) Where: B = (d − 81) × 360/365 in degrees d = the number of days since the start of the year ΔT = the difference of the Local Time (LT) from Greenwich Mean Time (GMT) Shading analysis will be done by using ray projection methods by setting a ray from a point in a specific direction to find out if it hit the shading surfaces. The ray is the solar ray and the specific direction is the sunlight direction, which is defined by the solar motion model. Basically, it is the XYZ vector which is transformed from the declination angle, solar elevation angle, and solar azimuth angle. If the grid is shaded, it has shading factor equal to 0 and it only counts the diffused and reflected insolation in that certain time period. If the grid is not shaded, the shading factor will be 1. After getting the shading factors for the whole year, the program will multiple it with corresponding direct insolation from TMY data sources to obtain solar insolation with shading analysis. 3.3.3. Environmental data and visualization After analysis, the solar insolation will be shown on the 3D environment for visualizing the result as a solar map on the surfaces. In order to create a solar map, the surface needs to be a gradient color to show the difference between solar insolation and showing solar legend on the side (Fig 3.11). 60 Figure 3. 11 Solar maps by PV Link The solar deployable area must be generated from this section before starting the PV module section. Based on the solar insolation baseline setting, the area with solar insolation level higher than the baseline will be counted into the solar deployable area, which will be used on deploying PV modules in the next section. 3.4. PV Module PV module sections cover the automated generation of PV modules and analysis of the solar insolation on each panel based on the user’s selection (Fig 3.12). Optimized methods will be used on the layout of PV panels inside the solar deployable area to maximize the overall solar harvest. The solar insolation of each panel will store in its family parameters, which will use on system analysis with other technical parameters. N 61 3.4.1. PV Module Preparation PV module preparation includes PV types being set up in Revit, and the calculation of position factors like tilt angle and module azimuth. For the PV types, several popular brands of solar panels including SunPower, LG, REC, and its popular panel versions will be created in the Revit as different types. Many types of parameters including dimensions, positioning factors, technical factors, electrical factors, and materials will add to the types based on their technical description and use of the proposed methodology (Fig 3.13). Figure 3. 13 PV module model in Revit Figure 3. 12 Workflow diagram for PV Module 62 The position factors like module azimuth, tilt angle and module spacing will be calculated based on the data from the environmental analysis. The following formula can calculate the panel tilt angle (β). The rule of thumb for maximum annual production is β = Lat − 10 (3-9) Where: β = Maximum energy received tilt angle for South facing collector Lat = Latitude of panel location Other factors like solar panel distance (d) are the distance between the PV module array in order to avoid array shading. It can be calculated by equation (3-10). d = �sin( β) × L tan( α) � × cos (φ 𝑝𝑝 − φ 𝑠𝑠 ) (3-10) where α, φ s , φ p , β, L are the solar altitude angle, the solar azimuth angle in the winter solstice, the azimuth angle of the solar panel the tilt angle, the height of the solar panel. The module azimuth angle generally will be perpendicular to the roof as it usually allows the largest amounts of the panel and avoid array shading. In the layout optimization, module azimuth facing true south and module azimuth based on the roof direction will be tested. 3.4.2. PV array geometry and solar analysis All three positioning factors of the PV module (module spacing, azimuth, and tilt angle) will have a different weight of impact depending on the roof and environment conditions. Therefore, all these three factors need a series of calculations to test different values on those three parameters to find out the one with the highest total solar insolation. However, the limited baseline is that the panels in the same array should be faced in the same direction and in the same line of the array for array mounting efficiency and 63 electrical purposes. Then, the optimization of the layout will be how to position the PV arrays in the solar deployable area. For the tilt angle, the test will be based on the rule of thumb, which is the latitude minus 10. As for the module azimuth angle, the test condition will be facing true south, perpendicular, parallel or the layout direction allowing the highest amounts of solar panels. As for module spacing, if the modules are flush or flat on the surface or follow the slope of surfaces, then the spacing of modules can be minimized. Otherwise, the module spacing is defined by the equation 3-10. In order to compare the performance of each test condition, it needs to calculate the solar insolation on the PV panel. Basically, the year data of solar insolation for each point from the last section should go through extra calculations related to the tilt angle and module azimuth. The amount of direct solar insolation fall on the solar panel can be calculated by equation (3-11) (Ning et al. 2018). 𝐼𝐼 𝑏𝑏 𝑏𝑏 = 𝐼𝐼 𝑏𝑏 × (𝑐𝑐𝑐𝑐 𝑠𝑠 𝛼𝛼 𝑠𝑠 𝑠𝑠𝑠𝑠𝛽𝛽 cos( 𝑠𝑠 𝑚𝑚 − 𝑠𝑠 𝑠𝑠 ) + 𝑠𝑠 𝑠𝑠𝑠𝑠𝛼𝛼 𝑐𝑐𝑐𝑐 𝑠𝑠 𝛽𝛽 ) (3-11) Where I bc is the insolation on the horizontal surface. β is the tilt angle of panels. φ m is the module azimuth and α is the solar elevation angle. The diffused insolation on the solar panel can be calculated by the raw diffused insolation from TMY data and tilt angle. The amount of diffused insolation on the solar panel can be calculated by equation (3-12) ( PVEducation n.d.). 𝐼𝐼 𝑑𝑑𝑏𝑏 = 𝐼𝐼 𝑑𝑑 × ( 180 − 𝛽𝛽 180 ) (3-12) Where I dc is the diffused insolation on surfaces and β is the tilt angle. 3.4.3. Module Data and Visualization Each test condition will calculate the amount of solar insolation fall on every panel for a year. 64 Through all the test conditions, the PV array layout with the highest harvest on solar insolation can be used for the automated PV module placement in Revit (Fig 3.14). The auto-placement function will put the family instance of selected PV panel on the points of grids that defined by the calculated module spacing. The calculated optimal tilt angle will be also automatically used to change the tilt parameter of the family instance. Figure 3. 14 Auto-placement of PV panels The outcome of the solar analysis on panels will be the solution that can harvest the highest amount of solar insolation over the course of the year. The solar insolation collected by each panel will be stored into its parameters for the use of electricity estimation in the next section. 3.5. System and Components The PV system converts the solar energy harvesting by PV module to electricity by other components includes the inverter, wiring, transformer and so on. A significant amount of energy may lose during the converting process. Therefore, it is important to choose the right size of components and analyze the losses in order to estimate the power output from the PV system. N 65 3.5.1. System and components preparation Based on the selection of PV panel from the last section, a nominal rated panel efficiency, ranged between 15% to 20%, for the product will be used. Given the solar insolation estimation from the last section and the panel efficiency, the DC power generated by the PV panel under STC can be calculated. Besides the solar panel, the user also needs to select the size and efficiency of the inverter. The default value of the size of an inverter will be 5/6 of the DC power size and the efficiency of the inverter will be 96% based on the researches in Chapter 2. Other system losses also have default value based on the typical systems (Table 3.1). Users are able to modify the value of those parameters based on their own needs. Table 3. 1 System losses categories and the default value System Losses Factors Default Value Soiling 2% Snow 0% Mismatch 2% Wiring & Connection 2.5% Availability 3% Aging 0% Nameplate rating 1% others 0% Figure 3. 15 Workflow diagram for System and Components 66 3.5.2. System analysis System analysis is based on three main models, which is the thermal model, the DC model, and the AC model. The thermal module is used to calculate the cell temperature based on the air temperature and the solar insolation fall on the solar panel. Cell temperature can be calculated from Equation (3-9) (Riffonneau et al. 2011). 𝑇𝑇 𝑏𝑏 = 𝑇𝑇 𝑎𝑎 𝑎𝑎 𝑟𝑟 + 𝐺𝐺 𝑇𝑇 800 ×( 𝑁𝑁 𝑁𝑁 𝑁𝑁 𝑁𝑁 − 20) (3-9) Where T c , T air , G T, are cell temperature, air temperature extracted from TMY data file on hour base, and solar insolation. The Nominal Operating Cell Temperature (NOCT) coming with the chosen PV module is the operating temperature of the cell under the specific test condition, which is 800 W/m 2 of irradiance, 20ºC of air temperature, and 1m/s of wind velocity. An hour-based cell temperature data for one year will be generated after the thermal module. DC model calculates the DC power generated by the PV module under the operating cell temperature and solar insolation. The output power of all the modules at the maximum power point (MPP) can be obtained from (3-10) (Riffonneau et al. 2011). 𝑃𝑃 𝑑𝑑𝑏𝑏 ℎ = 𝑃𝑃 𝑠𝑠 𝑡𝑡 𝑏𝑏 × 𝐺𝐺 𝑁𝑁 1000 ⁄ × [1 − 𝛾𝛾 ( 𝑇𝑇 𝑏𝑏 − 25)] (3-10) Where P dch , P stc, and G T are PV output power, the rated PV power at STC and solar insolation. γ and T c are the temperature coefficient, cell temperature. The temperature coefficient depends on the type of solar panel selected. As for the AC model, it calculates the amount of AC power that was inverted by the inverter. Not only the inverter efficiency is used in this model, but also the system losses like wiring losses, mismatch. The system losses are calculated by the product of each loss from the system input by (3-11) (Dobos 67 2014). 𝐿𝐿 𝑡𝑡 𝑡𝑡 𝑡𝑡 𝑎𝑎 𝑡𝑡 = 100 [1 − (1 − 𝐿𝐿 𝑠𝑠 𝑡𝑡 𝑎𝑎 𝑡𝑡 ) × (1 − 𝐿𝐿 𝑠𝑠 𝑛𝑛𝑡𝑡 𝑠𝑠 ) × (1 − 𝐿𝐿 𝑚𝑚 𝑎𝑎 𝑠𝑠 ) × (1 − 𝐿𝐿 𝑠𝑠𝑎𝑎 𝑟𝑟 ) × (1 − 𝐿𝐿 𝑎𝑎𝑎𝑎𝑎𝑎 ) × �1 − 𝐿𝐿 𝑎𝑎 𝑎𝑎 𝑎𝑎 � × (1 − 𝐿𝐿 𝑛𝑛 𝑎𝑎 𝑚𝑚 ) × (1 − 𝐿𝐿 𝑡𝑡 𝑡𝑡 ℎ 𝑎𝑎𝑟𝑟 )] (3-11) Where L total is the result of the loss from all categories. The default value of total system losses is 10% not including loss from shading, which has been counted in the Environment section. After getting the data of the system losses, inverter sizing and efficiency are also needed to be calculated in order to obtain the result of AC power output by (3-12)(Dobos 2014). 𝑃𝑃 𝑎𝑎 𝑏𝑏 = 𝑃𝑃 𝑑𝑑𝑏𝑏 × (1 − 𝐿𝐿 𝑡𝑡 𝑡𝑡 𝑡𝑡 𝑎𝑎 𝑡𝑡 100 ⁄ ) × 𝐸𝐸 𝑎𝑎 𝑛𝑛 𝑎𝑎 (3-12) Where P ac , P dc , and E inv are the total AC power output of the PV system, the sum of DC power for all the modules, and inverter efficiency, which default value is 0.96. 3.5.3. System data and user control System analysis estimates the final AC power output of the PV system from the solar insolation data and PV module data in the previous section. All the system data including cell temperature, individual DC power generation, AC power output will be stored in corresponding parameters of family instances such as PV module and inverter. Before moving to the next section of financial analysis, Optional control can allow the program to minimize the system size to meet the specific load requirement. It is useful for cases that the amount of power output needed is clear, or the users think the output power is too much for their project. By inputting a reasonable AC output power, the program will start to calculate back how much DC power needed, then how many modules needed. Finally, extra modules with lower DC output will be automatically deleted, but under layout constraints. In other words, it will delete the PV module with low output within one array first, which will keep the integrity of other arrays. 68 3.6. Financial Feasibility Financial feasibility analyzes the cost and benefit of the PV system based on the component selection and amount of the output power from previous sections (Fig 3.16). Before the financial analysis, some of the default financial factors like tax benefit, local electricity rate can be modified based on the user’s need. Finally, a financial report including key indicators including Levelized Cost of Electricity (LOCE) and payback period will be exported and visualized in Excel. 3.6.1. Financial preparation The cost and benefit of the PV system are two main factors for financial analysis. Part of the cost of the system is derived from the previous sections, including the number of PV panels and the cost of them. For other component’s hard cost and soft cost will be calculated based on the DC wattage generated or the size of the systems (Table 3.2). Table 3. 2 Estimated cost breakdown for the PV system (Fu, Feldman, and Margolis 2018) Category Modeled Value ($ / W dc ) Inverter price $0.19 Structural BOS $0.11 Figure 3. 16 Workflow diagram for Financial Feasibility 69 Electrical BOS $0.24 Direct Installation cost $0.30 Permitting, inspection and connection $0.10 Overhead $0.31 Customer acquisition $0.34 Supply chain cost $0.42 Sale tax $0.09 Profit $0.34 Total $2.45 The default value of inverter, structural and electrical Balance of Systems (BOS) is able to modify by the users based on their own needs. Operation and Maintenance (O&M) of the PV system is the main future cost of the PV system. The default value is $22/kW/year based on the system size and a 2% annual growth rate. The inflation rate and discount rate are advanced optional parameters, which account for inflation and net present value. If the users consider paying the system as a loan, advanced optional parameters such as debt interest rate and debt fraction rate allow accounting those parameters into the financial analysis. The benefit of the PV system includes the offset of electricity cost, tax credit, local incentive, and solar renewable energy certificates (SRECs), which allows owners to sell extra electricity to the grid. The tax credit will be ended in 2022 and all incentives and SRECs are dependent on the location of the project. Therefore, they are optional input for the financial analysis. Electricity rate varies with locations and types of the building. Based on the EIA’s Short Term Energy Outlook 2020, the latest average electricity rates are 13.09 cents per kilowatt-hour for residential buildings, 10.62 for commercial buildings and 6.93 for industrial buildings in the US (EIA 2019). Several common types of buildings will be defined, and the corresponding electricity rates will be the default value, which the users are also able to modify. Electricity usage also varies from locations and specific types of the building. Based on the EIA’s Commercial Buildings Energy Consumption Survey (CBECS), the default value for different types of the building will be used in the financial analysis based on the user 70 selection of types of buildings (Table 3.3). The estimation of electricity usage will be the product of electricity use and square footage or the number of households. Table 3. 3 Default electricity usage based on types of buildings (EIA 2016) Types of buildings Default electricity use Residential 10972 kWh/household Education 11 kWh/SF Food 45.5 kWh/SF Healthcare 25.8 kWh/SF Lodging 15.3 kWh/SF Office 15.9 kWh/SF Public assembly 14.5 kWh/SF Services 8.3 kWh/SF Warehouse 6.6 kWh/SF 3.6.2. Financial analysis A detailed cost and benefit analysis and two financial indicators will be calculated based on the financial inputs and preparation. The detailed cost-benefit analysis is year-based, which allows users to understand the profit and cost pattern. The total installed cost of the PV system is calculated by the sum of the cost per square foot from Table 3.2 times the output of the DC power, then plus the total PV module cost. The annual O&M cost will increase each year by the default value of 2% or user-defined numbers. If the users need to purchase by loan, the interest payment will be also counted into the cost for each year. Profit from energy generation and possible federal or state incentives will also be documented and export to Excel (Fig 3.17). Figure 3. 17 Financial costs and benefits analysis in Excel 71 The payback period of the PV system is obtained from the cash flow analysis (Fig 3.18). Based on the information on cost and benefit analysis for each year, the cash flow and cumulative cash flow can be calculated. Excel’s lookup function can find the year with positive cash flow, which will be the payback year. The more accurate value of the payback period can be obtained from equation (3-13). X = (N × a − M × b)/(N − M) (3-13) Where X, N, M, a, b are payback period in years, cash flow in payback year +1, cash flow in payback year, payback year, and payback year +1. Figure 3. 18 Cash flow for payback calculation in Excel LOCE is another financial indicator for financial analysis. It can be calculated from the total life cycle cost divided by the total electricity production over the lifecycle since the future value should be discounted to become its present value. An optional discount rate (r) can be included to more accurately calculate the value of energy production and costs in the future. A degradation factor of the PV system can be also included in the calculation of LOCE. The LOCE can be calculated by equation (3-12) (Branker, Pathak, and Pearce 2011). LCOE = ∑ ( 𝐼𝐼 𝑡𝑡 + 𝑁𝑁 𝑡𝑡 + 𝐹𝐹 𝑡𝑡 − 𝐵𝐵 𝑡𝑡 )/( 1+ 𝑟𝑟 ) 𝑡𝑡 _ 𝑇𝑇 𝑡𝑡 = 0 ∑ 𝑆𝑆 𝑡𝑡 ( 1− 𝑑𝑑 ) 𝑡𝑡 /( 1+ 𝑟𝑟 ) 𝑡𝑡 _ 𝑇𝑇 𝑡𝑡 = 0 (3-12) T and t are the lifecycle of the PV system and the specific year. I t , O t , F t , B t are the initial investment for t, O&M cost, interest payment and potential incentives in the cost side. On the benefit side, S t , d are yearly rated energy output and degradation factor. 72 3.6.3. Financial data and visualization After the financial analysis, indicators like the LCOE and payback period will be shown in the Revit interface. Detailed Financial report can be made by exporting those data into Excel. A detailed year by year data of cost and benefit and detailed cash flow will be calculated and presented in Excel. The Excel API will be used to automatically generate charts for the financial report (Fig 3.19). Figure 3. 19 Charts of financial analysis 3.7. Tool Preparation Different types of tools used in the studies can be divided into tools for development, performance, assistance, and validation (Fig 3.20). Several models are needed to be created or obtained for PV LINK and also validating the key concepts of the studies. Figure 3. 20 tools used 3.7.1. Tool selection Revit is the platform selected for performing the solar PV design and management tool since Revit is one of the most popular BIM software. Visual Studio is one of the powerful coding and debugging tools. It has the ability to import Revit dll file, which includes all the namespace and functions of Revit API, 73 and helps users to code easier. Also, Visual Studio allows users to debug by running Revit inside it, which helps users to quickly find problems (Fig 3.21). Figure 3. 21 Debugging in Visual Studio with Revit running Since many source data like solar insolation data form NREL are in CSV format, Excel will be used in transferring the data into Revit. Also, much data and information like energy output and financial reports will be eventually exported to Excel for visualization and further analysis. Solar Insight is a popular solar analysis tool that has plugins for Revit. Even though they have a limitation on system analysis and financial analysis, they could be also used to validate the result from PV LINK. 3.7.2. Model preparation PV LINK is used on three case study buildings for checking the performance of the plug-in. A detailed description of this is in Chapter 5. The results will be validated by comparing the solution with Insight and substitute algorithms. The building for case 1 is a simple single-floor building with a flat roof. This 22 by 20 feet building is good enough to test most of the basic functions of the developed tool including auto-placement of PV panel, solar insolation, energy output and so on. It is also simple so that it can be easily used to test each code segment while developing the tools. 74 The building for case 2 is the same building of case 1 but with an extra object, a chimney on the roof, and with a neighboring building. Case 2 will be used on testing the sun shading analysis, which is one of the difficult parts of developing the tool. It is also helpful to test the layout strategies and auto-placement of the PV panel because of the object in the middle of the roof (Fig 3.22). Figure 3. 22 Case study 1 building (left), case study 2 buildings (right) The building for Case 3 is Watt Hall, the headquarter of USC School of Architecture (Fig 3.23). It is five-story buildings covering an area of 67,855 square feet, with three floors above ground. Because it is a real building and with large inner shadings created by the stairwell and mechanical room, it is very important for validating the tool and the result (Fig 3.24). Watt Hall also has much information on the energy use pattern, so it helps for the financial part of the tools. Figure 3. 23 Watt Hall N N 75 Figure 3. 24 the Revit model of Watt Hall 3.8. Summary This chapter introduced the overall methodology based on the five main modules - building geometry, environment, PV panels, system and component, and financial feasibility. Each section has its own workflow from preparation, analysis to result and visualization (Fig 3.25). Information, the key concepts of this study, is obtained, transferred, analyzed, visualized and stored through the whole workflow and connecting each module. 76 Figure 3. 25 Overall workflow diagram Appropriate software programs (Revit, Excel, Visual Studio, Solar Insight) were selected for developing, performing, assisting and validating PV LINK. Several models for case studies were introduced to test the PV LINK and the result of them will be validated through multiple approaches. 77 Chapter 4 4. Program Development With tool features and workflow defined in Chapter 3, this chapter provides explanations on how PV Link is developed with source codes. First, setting up the programming environment is summarized. The program development is made up of five main categories based on the methodology, building geometry, environment, PV module, PV system, and financial feasibility. These six parts are programmed in Visual Studio and explained separately in this chapter. Each of the five main categories also has its own function button in the Revit Add-ins interfaces (Fig 4.1). The entire version of the source code is available in Appendix A. This chapter explains the most important parts of the source code. Chapter 5 shows how to run the software. Figure 4. 1 Tool Development Diagram 78 4.1. Setting Up In this section, the coding environment included the Visual Studio environment set up and the Revit Plugin Addin file will be explained. Also, the User Interfaces (UI) for PV LINK are created using Window Form, A graphical class library widely used on UI design. They take the user inputs value and provide certain user controls, which makes the program and workflow complete. Three UI forms have been designed and will be used in the Environment, PV System, and Financial Feasibility sections. 4.1.1 Coding Environment As mentioned in Chapter 1, in order to set up the environment for Revit plug-ins in Visual Studio, it is necessary to add RevitAPI and RevitAPIUI references, which contain the information to access and modify the Revit application. Based on the Revit elements that the program intended to use, it is important to declare them by “using” keyword before started coding (Fig 4.2). By declaring the class implements “IExternalCommand,” Revit will be able to use it to execute a command. Then, execute () method will be used to execute the function in Revit and return a “Result” to tell Revit whether the command execution has succeeded (Fig 4.2) (Autdesk.com). “CommandData” provides API access to the Revit application. Those processes are common in setting up the environment for Revit plugin in Visual Studio. 79 Figure 4. 2 setting up the programming environment in Visual Studio In addition to coding in Visual Studio, it is also important to write an AddIn manifest to actually made the plug-in work in Revit. External commands and applications written in Visual Studio need to be registered via a “.addin” manifest file (Fig 4.3). This file needs to include the information on the name and path of the plugin, which allows Revit to access it when it initiated the plugin. Figure 4. 3 Code for the addin file 80 4.1.2 UI Design Window Form is one of the popular UI design platforms, which is developed by Microsoft. Visual Studio provides a graphic design toolbox, which even makes the UI design easier (Fig 4.4). Program developers can drag the functions in the toolbox, such as label, text box and button, and put them in the desired locations on the base form (Fig 4.4). Some functions like button click may need extra codes to tell the program what to do next. For example, the Browse button has extra code for opening file dialog, which then allows users to browse and select files from local disk (Fig 4.5). Figure 4. 4 Visual Studio window form toolbox and example of PV Link UI design After designing the UI, PV Link needs to implement it into the main programs. When the user launches the program, the UI will show up on the Revit Interface (Fig 4.5). If the main program needs to extract information from user input on the UI, variables need to be created in the UI to store the input value (Fig 4.5). 81 Figure 4. 5 PV Link UI in Revit interface and Plugin program The user interface helps PV Link to collect the necessary inputs such as TMY 3 data files of their project locations in order to perform the analysis in the later sections. It also provides certain control functions, such as the size of the grid to display the solar map, which allows user to customize their analysis. 4.2. Building Geometry User selections, filters, and bounding boxes are three important features in the Building Geometry sections of the code. The information of the selected roof and its top face stored in objects can be used on further analysis. User selections are prompted up functions for Revit API that allows users to select elements from the Revit interface. PV Link uses this function to allow a user to select a roof for performing solar analysis in that face. Filters are another Revit API function that takes a user-defined selection set and takes a subset of it by eliminating elements that are not useful. Filter helps PV Link to avoid invalid selection of elements, which may cause errors in the program. In this case, the filter has been set only to allow roof elements to be selected. A bounding box is an invisible 3D rectangular space that contains all the model elements, annotation elements, and datum elements defined in a family-based 82 element (Autodesk 2019) (Fig 4.6). By extracting two of the four corner points of the bounding box (the maximum and minimum), PV Link can determine the center point of the solar panel family and place it based on this center point. Figure 4. 6 bounding box for PV panel instance PVs are added to the roof of the building. The most important step in this section is to allow and ask the user to select a roof surface to analyze. First, a reference object is defined to accept and store the chosen result. “UI. Selection” keywords should be also declared in the very beginning. To access the current user selection from the user interface, PV Link needs to access the selection property of the active document in Revit. The Revit API Selection class has a Pick Object method, which takes inputs of object type of selection, a selection filter and showed note. After the selection has made, PV Link can use the reference’s element property to access the reference’s relative element and its data (Fig 4.7). Figure 4. 7 User selection of surface to analyze 83 Filters are used several times in this program to avoid unwanted user behaviors, which will cause the program to fail. In this section, a selection filter is set only to allow the user to select the roof element in Revit for further analysis. More specifically, the AllowElement () method allows the user only to click on the elements defined within this method. In this case, the roof element has been defined as the only element that can be selected by the user (Fig 4.8). Figure 4. 8 selection filter class To perform shading analysis, solar insolation analysis, and PV layout on the selected surfaces, the information of the top face of the roofs has to be obtained. PV Link uses the reference object to store the top face from the host object and cast it into face type by “As” operator, which converts an object (type) into another object (type). In this case, the Bounding Box class requires input variables as a face type so that PV Link will convert the reference type into face type. The bounding box is a very important property used throughout the program. Many Revit objects and classes have a bounding box property. BoundingBoxXYZ and BoundingBoxUV objects contain information of minimum and maximum points of the geometry, in this case, the top face. Based on the maximum and minimum points, the center point of the object can be calculated. Also, the maximum and minimum UV value can be also used to divide the surface into grids and these grids can be used on solar maps and placement of PV module in later sections (Fig 4.9). 84 Figure 4. 9 obtaining information from the selected roof Based on the maximum and minimum UV points of the bounding box, PV Link can then evenly distribute the points on the surfaces based on the user-selected width of the gird (Fig 4.10). Note that the smaller the value of the distance of width, the more calculation is needed and thus the running time. These points will be used on solar and shading analysis and the solar map visualization. Figure 4. 10 distributing points on the face by max and min UV value 4.3. Environment The main tasks in the Environment section are solar insolation analysis, shading analysis, solar data, and visualization. Based on the selected roof passed from the Building Geometry section, PV Link needs to perform the solar and shading analysis on this object. The result of that analysis, then, will be visualized in the Revit interface and passed to the PV Module section. 4.3.1. Environmental Preparation The first step of environmental preparation is to ask users to download TMY 3 data from the NREL website based on the project locations. A user interface will pop up to provide the instruction of the download and input requirement asked the full file path of the downloaded document (Fig 4.11). Chapter 85 5 details the entire user process. After user input, PV Link will extract the data, including latitude, UTC time zone, longitude, direct normal insolation (DNI) and diffuse horizontal insolation (DHI) from the downloaded .csv file (Fig 4.12). Figure 4. 11 UI for Environment section Figure 4. 12 Example of TMY3 data and its format A “Readexcel” method is created, and it returns an indexing list of string based on the file path. Since not all the data from the TMY3 file is needed, the functions of line skipping and adding value based on the column number are used to store the specific number and group of numbers into the corresponding variable. For example, the time zone can be obtained from the first item of a list using skipping no line and in column #3 (Fig 4.13). 86 Figure 4. 13 Reading .csv file and extracting the data Since all the TMY3 .csv files for all the weather stations have the same data structure, this method can be for all project locations by simply downloading and inputting the corresponding file. 4.3.2. Solar Motion Model The first step of solar insolation analysis is to construct the solar motion model based on the project location. In order to do that, PV Link needs to calculate the solar hour angle based on the local solar time (LST). First, the equation of time (EOT) for the entire year can be derived by running values from 1 to 365 into the corresponding formula, Then, using the list of EOT to calculate the Time Correction Factor (TC). Since LST needs to be on an hourly basis, a list of values from 1 to 24 repeating 365 times is created. Finally, the solar hour angle can be calculated based on the LST (Fig 4.14). 87 Figure 4. 14 calculation of the hour angle After obtaining the solar hour angle, the declination angle, the solar azimuth angle, and the solar elevation angle can be calculated to construct the solar motion model. Since part of the data such as the declination angle is a day-based value and the other data like solar elevation angle is hourly, the solar azimuth angle needs extra processing to calculate. Day-based data is extracted once a time, and then, gone through the formula with the corresponding 24 hour-based data. In order to adjust the solar azimuth angle to facing south, if the data is a positive number, 360 has to be subtracted from it (Fig 4.15). Figure 4. 15 Calculation of solar azimuth angle 88 4.3.3. Shading Analysis Shading analysis is one of the challenging parts of the coding perspective. In order to determine the shading rate for a year, PV Link needs to get the sunlight vectors for 8760 hours for a given year. Since Revit has a built-in function of sun and shadows, PV Link sets an automatic process to extract the information for every 8760 hours. Revit API sun and shadow settings class represent the sun control and solar study based on the position, dates, and time intervals. Since the sun and shadow settings are view-based in sun and shadow settings, PV Link needs to access the active view from the active Revit document (Fig 4.16). Before actually extracting the sun setting information, a list of dates and times for a year needs to be created because PV Link needs it to modify the date and time for each hour automatically. Figure 4. 16 Sun and shadow setting based on date and times For each date and time in the list, PV Link modifies the setting of sun settings based on it (Fig 4.17). An error handler is also needed to prevent the program to fail. 89 Figure 4. 17 Modifying dates and time in Revit In order to obtain the sunlight vectors, solar altitude and azimuth need to be obtained from the currently active frame of specific date and time. Then, PV Link creates a serious of transform along the X-axis and Z-axis based on altitude and azimuth to calculate the direction of the sun in vectors (Fig 4.18). Figure 4. 18 Transforming and extracting information of sunlight vectors (left), diagram of altitude and azimuth (right)(timeanddate.com) After obtaining the sun vectors for the entire year, PV Link can determine whether a point is shaded in a specific time period. Using ReferenceIntersector class is able to find and return elements that intersect a ray created from a point and direction vectors (Fig 4.19). A 3D view for elevation is required in order to use these classes (Fig 4.20). 90 Figure 4. 19 Diagram of ray projection method for determining shading rate Figure 4. 20 shading factor class setting up and obtaining the 3D view The Reference Intersector class can filter the result by using the element filter to specify the reference type. Then, based on the test point, a sun vector for the specific one-hour period, and the filter, RefInersector.Find () method can determine whether or not the ray hits objects (Fig 4.21). If the ray hits something, the program returns 0. If not, it returns 1. By running through the vectors for the whole year, PV Link can create a list of shading factors for a year (Fig 4.22). Figure 4. 21 Reference Intersector and shading factors N 91 Figure 4. 22 Example of shading list in the spreadsheet 4.3.4. Solar Insolation Analysis The solar insolation on the testing points can be calculated based on the solar elevation angle, shading rate, and the raw insolation data from TMY3. Using the same method of extracting data from .csv file, PV Link can extract the raw solar insolation for a year. Then, the list of raw solar insolation is multiplied with the corresponding shading rate; if the shading rate is 0, it means the point is shaded in that time, so the direct insolation for that time is also 0. Finally, a list of direct insolation for a year is generated (Fig 4.23). For the diffused insolation, the process is much easier. The diffused insolation for a horizontal surface can directly use the information on TMY3 data. Therefore, using extracting methods, PV Link can create a list of diffused insolation for a year (Fig 4.24). Figure 4. 23 Direct normal insolation analysis 92 Figure 4. 24 Example of lists of the beam and diffuse insolation in the spreadsheet 4.3.5. Solar Data and Visualization The solar insolation data obtained from the analysis is ready for uses in the PV Module sections. The solar data is also able to be exported to Excel based on a user option. Using the system string builder, PV Link can write those data into rows and columns (Fig 4.25). Then, using system IO, all the data can be written into the .csv file in the local folder (Fig 4.26). Figure 4. 25 Export data to Excel Figure 4. 26 Hour angle, declination, elevation angle and azimuth data exporting to the spreadsheet 93 The solar map is the data visualization for solar insolation on the selected roof. The first step of creating a solar map through Revit API is to set the analysis display style through Analysis Display Style class. PV Link will look for the analysis display style type of elements, and if no style exists in the document, the program will create one. The first style setting, part 2 and part 3 in Fig 4.27, is used to create the color surface and assign two colors for the maximum and minimum value by red, green, and Blue (RGB) color model. Then, PV Link will set a new legend and its text style. By using CreateAnalysisDisplayStyle function, which takes style name, color surface setting, color setting, and legend setting variables, PV Link can generate a new display style for solar analysis and assign it to the current 3D view (Fig 4.27). Figure 4. 27 setting analysis display style After creating the analysis display style, PV Link needs to assign those display style to the analysis result, in this case, the solar insolation level on the selected roof element (solar map). By doing that, the distributed points on the roof surface and its corresponding accumulated insolation value are paired up and then linked to the color value in the display style (Fig 4.28). In other words, the area near the points with higher insolation levels will display as the color representing higher value, which is orange in this 94 case. Spatial Field Manager class, which is responsible for the creation, deletion and modification of the spatial field element, will be used to manage the analysis result of the solar insolation level on the surface (Fig 4.29). Figure 4. 28 Linking solar analysis of the roof with the display style and displaying the result on view Figure 4. 29 solar map 4.4. PV Module The main tasks of the PV Module section are calculating the solar insolation on the PV panel, finding the PV layout that harvests the high amount of solar insolation, and doing the auto-placement of the PV N 95 module based on the positioning factors (Fig 4.30). Then, based on the result of solar insolation analysis and shading analysis, PV Link can process those data to calculate the solar insolation on the panel. Figure 4. 30 Diagram of positioning factors 4.4.1. PV module preparation The default solar panel family instance is the one from the default Revit library. Users will be asked to load the Revit family into the project. Users are also able to load the solar panel from other sources, but that family has to include information about the panel size and a modifiable parameter of the tilt angle. The information of the solar panel can be extracted by getparametervalue () method (Fig 4.31). PV Link is able to extract the solar panel type from the active document and the based on the string name to look up the corresponding parameter and its value (Fig 4.32). Figure 4. 31 extracting information of parameters for family instance N 96 Figure 4. 32 Sample of PV family and the corresponding parameters Based on the rule of thumb and formula of tilt angle and module spacing (see Chapter 3, Section 3), PV Link can calculate the tilt angle and module spacing that will generally harvest the highest amount of solar insolation. The information needs to be obtained from preparation in order to perform the layout and solar analysis (Fig 4.33). Figure 4. 33 Example of data from preparation 4.4.2. PV Array Layout and Solar Analysis The layout and solar analysis for the PV array are based on the analysis for the middle point of the PV array. It is important to notice that this assumes micro-inverters, such that half coverage produces half current, instead of the typical zero-current when a portion of an array with a single inverter gets shaded. In a south-facing house with a rectangular roof shape, the layout of points can be done by dividing the edges of the roof based on PV size and module spacing (Fig 4.34). In the rows, the distance between each point is the panel width. In the columns, the distance is the module spacing. The distance from points to the edges is half of the distance between points, which makes the PV module efficiently occupy the space. 97 Users will be able to change it based on their requirements. All the girds are divided based on the UV value of the selected roof and its face. After the grids, using the cartesian product of UV values, PV Link can get the UV value of all the points on the intersections of the grids (Fig 4.35). Figure 4. 34 divided the surface into grids Figure 4. 35 Points on the grids Givens the points to analyze, PV Link can perform solar insolation analysis based on the data from Environment sections. The solar isolation for each of the points is calculated from the data lists of solar elevation angle, raw solar insolation from TMY3, shading rate, and azimuth (Fig 4.36) (Fig 4.37). Figure 4. 36 Direct normal insolation on tilted solar panel N N 98 Figure 4. 37 Example of the data list and calculated values 4.4.3. Module Data and Visualization The Auto-placement of the PV panel family instance can be achieved based on the UV points from the layout and solar analysis. Using the Create.NewFamilyInstance () method, PV Link automatically creates family instances. In order to use this method, the UV points need to be transformed into XYZ coordinates. The reference directions of new family instances are also needed and can be obtained from the analyzed face (Fig 4.38). Figure 4. 38 Auto-placement of the solar panels After auto-placement, the parameter of the tilt angle is updated to the family instance by the Settypeparameter () method, which is developed using the same logic of extracting information from parameter (Fig 4.39) (Fig 4.40). This method is also used to write data, included total solar insolation and average solar insolation, into corresponding parameters for each family instance. The data can be also N 99 export to Excel based on the user option. Figure 4. 39 Setting parameter value of the family instance Figure 4. 40 Solar panels with a new tilt angle 4.5. System and Components The main tasks of the system and components section are calculating the DC energy output from PV panel, DC power output after system loss and AC power output from the inverter, based on series of default value or user inputs on system parameters like inverter efficiency, estimated wiring loss and PV panel thermal coefficient. Furthermore, the functions included user interfaces (UI) input, adding and writing parameters to the family instance and placing family instances are important to assist the system analysis and the flow of information in Revit. 4.5.1. System Preparation There are two major preparations needed before implementing the system analysis: inverter family preparation and defining system factors. An inverter Revit family needs to import into the project. Since there is no built-in inverter family in Revit family library. It is necessary to download one from outside sources or create a simple one in Revit (Fig 4.41). The inverter object will be used to store the N 100 information from system analysis. Figure 4. 41 Example of inverter family (ABB.com) After the inverter family has been loaded into the project, PV Link will add certain type parameters into it including the inverter efficiency, DC Input, system loss, and AC output. In order to add parameters to a family through the Revit API, the Family Manager class needs to be used to modify the family file (Fig 4.42). First, PV Link finds the inverter family based on the user input keyword of the inverter and opens the family file in the backstage in order to use the Family Manager class. In part 2 of figure 4.42, PV Link adds parameters based on the specifying parameter group (e.g. Data), parameter type (e.g. number), instance or type parameter, and parameter name. After adding the parameter, PV Link will save the modification for the family file and close it. Finally, it will load the family into the project if the users haven’t done so already. 101 Figure 4. 42 Adding parameters into family Several types of data needed on system analysis include components factors like inverter efficiency, system loss factors such as soiling loss and wiring loss, and the information of solar insolation collected by each PV panel from the PV Module section (Fig 4.43). Each factor has a default value based on the data from common PV system components and loss estimation widely used in other PV tools, such as PVwatts. The user can always change those default numbers through the PV Link user interface. Figure 4. 43 Data Preparation for system analysis and UI 102 4.5.2. System Analysis System analysis will calculate the PV panel output based on the solar insolation in the panel on an hourly base. Given the air temperature hour database from TMY 3, PV Link can construct 8760 hours cell thermal model for a year in order to calculate the influence of cell temperature on PV panel efficiency. Then, based on the solar insolation and PV panel rated power, PV Link can obtain the DC output from each panel through calculation (Fig 4.44). There are also many possible losses in the other components of the PV system besides PV panel, like inverter efficiency, and the specific environmental and physical conditions such as snow and aging can also influence the system production. Those factors will be calculated to finally get the estimation on the AC output from the inverter. The user is also able to obtain the system analysis data by exporting it to a csv file for further analysis (Fig 4.45). Figure 4. 44 System analysis of PV panel DC output calculation (left), Inverter AC output calculation (right) 103 Figure 4. 45 The insolation collected and DC output of the PV panel 4.5.3. System Data and Visualization After the system analysis, PV Link will ask the user to place the inverter near the building. Depending on the family type of the inverter family, it can be placed on the wall or on the ground. Rather than using auto-placement like PV panel, the location of the inverter varies among projects, since it is largely depended on the physical conditions of the house like the locations of windows and door. Also, it can also install inside and outside. Therefore, user placement is more suitable for locating the inverter in these cases than doing this automatically in PV Link. The prompt function of family instance placement is based on the family symbol of the inverter family and will be called when running the system analysis (Fig 4. 46). 104 Figure 4. 46 Function asking the user to place the inverter objects The data included DC power input to the inverter, AC power output from inverter and system losses is stored in the placed inverter object. PV Link reads through all the parameters for the inverter family and finds out the three parameters created at the beginning of this section. Using Parameter.Set function, PV Link can add corresponding values to those parameters (Fig 4.47). Figure 4. 47 Writing and storing data into inverter family parameters 4.6. Financial Feasibility The Financial feasibility section analyzes the feasibility of installing the PV system from three main N 105 indicators, Payback period, Levelized Cost of Electricity (LCOE), and cost and benefit. A series of estimated costs per unit and the factor of cash flow analysis has a default value and can be modified based on user inputs. Those factors are used on the cost and benefit analysis, cash flow analysis and LCOE analysis through the defined project lifecycle on a year base. Finally, the results of different indicators and a detailed financial report is created to support the decision making for the PV system on the project. 4.6.1. Financial Preparation Three types of parameters have to be defined before the financial analysis: cost factors, electricity use factors, and cash flow factors. The cost factors for the PV system are defined based on the per DC wattage for the system size, such as a 6kw system. The cost factors include the manufacturing cost for components, the cost of installation, the cost of sale and supply, as well as tax (Fig 4.48). Those cost factors are US average cost in 2018 collecting from NREL. Users always can change those default values through UI. The estimated total cost of the PV system can be obtained by multiplying the sum of the unit costs with system size. Figure 4. 48 The cost of a PV system Electricity use factors help with estimating how much electricity consumption of the buildings can be covered by the PV system. Two inputs included building type and either the number of households for residential or the floor area for other building types is needed from users. Based on these two inputs, PV Link can estimate the electricity consumption of the buildings by multiplying them with pre-defined electricity use per unit (Fig 4.49). 106 Figure 4. 49 Estimating electricity consumption for the project Cash flow factors can be divided into tax and tax credit factors, operation factors, and production factors. Three main incentives are common in the US PV industry including Investment Based Incentive (IBI), Capacity Based Incentive (CBI), and Performance-Based Incentive (PBI). This can be varied between different locations of the project. IBI and CBI will usually count into the beginning of the cash flow with the total cost of the PV system, and PBI is based on electricity production, which will be usually counted into the cash flow of the first ten years. Another major financial benefit is the Investment Tax Credit, which covers 26% of the total cost of the PV system but will be ended in 2022. On the tax side, state tax and federal tax will be charged mainly on the three incentives through effective tax rate (Fig 4.50). The operation factors include future operation and maintenance (O&M) cost and its growth rate over the lifecycle assuming the problems like aging and weathering will increase. As for the production factors, the electricity price, electricity discount rate and the production degradation rate are used to estimate the electricity production and its value over the project lifecycle (Fig 4.50). 107 Figure 4. 50 Defining cash flow factors 4.6.2. Financial Analysis In order to obtain the critical financial indicators included payback period and LCOE, it is necessary to calculate the cost and benefit for each year and prepare a detailed cash flow analysis over the project lifecycle. Lists of cost and benefit factors are defined first to later store the values for each year; lists for income and expense are used for calculation of LCOE (Fig 4.51). Figure 4. 51 defining lists to store costs and benefits over the lifecycle The calculation for the cash flow is a little different in the year 0 and year 1 since the IBI, CBI, cost and investment tax credit only happen in these two cash flow periods. For the remainder of the years, PV Link can calculate the detailed cash flow more effectively by using the Foreach loop (Fig 4.52a). When calculating the electricity production and its value, the degradation rate and electricity price discount rate will be used. After calculation for one year, the value will be updated to the variables outside the loop (before the for loop in Fig 4.52a), so that it can be used on the calculation for next year. Since the PBI incentive is effective in the first 10 years, the BPI and its relative federal and state tax will be only counted into the first ten-year cash flow (Fig 4.52b). 108 Figure 4. 52 Cash flow calculation (a) electricity production and its values (left), (b) PBI incentive and relative taxes (right) Based on the operating cost, electricity value, incentives and taxes, PV Link calculates the cash flow for the corresponding year and the accumulated cash flow by adding through the previous years (Fig 4.53a). The Payback period is obtained by finding the last negative and first positive value through the list of accumulated cash flow. The discount rate (or inflation rate) is needed by adding each year for the LCOE calculation (Fig 4.53b). Then, the result of LCOE is obtained through the sum of expenses divided by the sum of electricity generation over the project life cycle. Figure 4. 53 Cash flow calculation (a) operating cost, cash flow, and accumulated cash flow, (b) expense and income for LCOE calculation Through PV Link, the user can also choose using a loan for cash flow analysis by defining the loan interest and the years for the loan term. The repayment of the loan for each year can be obtained through Equation (4-1). The actual payment for each year can be obtained by the difference between cash flow and calculated repayment. 109 𝑃𝑃 = 𝐴𝐴 × 𝑠𝑠 /(1 − (1 + 𝑠𝑠 ) − 𝑁𝑁 ) (4-1) Where: P= repayment for the loan for each year A= total expense for the PV system i = loan interest rate N= loan term 4.6.3. Financial Data and Visualization After system analysis, all the main financial indicators will be shown in the UI. A detailed financial report will be available in csv format. By using System.DataTable class, PV Link can create a data table through the lists of cash flow variables. The predefined name of the variables will be added into the columns of the data table (Fig 4.54). Then, the value stored in those variables will be added into the corresponding cell in rows by using a For loop (Fig 4.54). Using a similar function of exporting data to a csv file in Section 4.3.5, The detailed financial report will be available for viewing and further analysis in Excel (4.55). Figure 4. 54 Creating data table and exporting to csv file 110 Figure 4. 55 Financial reports and payback period 4.7. Summary The steps of developing the PV Link follows the same logic of methodology in Chapter 3 (Fig 4.56) from building geometry, environment, PV module, to PV system and financial feasibility. Information is the key to connect each section and within those sections from preparation, to analysis and visualization. An extra set up section explained the basic coding environment for Revit API. Chapter 4 described important parts of the code, Appendix A contains the entire code, and Chapter 5 explains how to use PV Link. 111 Figure 4. 56 Tool Development Diagram The Revit API classes including filter, user selection, bounding box, sun and shadow setting, reference intersection, family manager and spatial field manager have been explained in the corresponding sections. They are crucial to implementing PV Link’s functions in Revit, such as shading analysis, solar insolation analysis, and auto-placement. In summary, the user starts with three Revit files: Revit project with building, PV panel family, and Revit inverter family. The user then inputs the selection of the face, the TMY file path, and the placement of the inverter family in corresponding sections, and optional components factors (loss, cost electrical use, and cash flow factors) to modify the default value. The final outputs from the software are solar maps, PV panels and inverter placed in the proper location, solar and energy data spreadsheet, and a financial report. 112 Chapter 5 5. Case Studies This chapter starts with an introduction of the plug-in package PV Link developed in Chapter 4 and then explains the process of using PV Link in Revit (Fig 5.1). Three case studies of projects are examined to test whether the program’s main features work properly and generate the expected results, serving to validate the tool’s feasibility and accuracy under different conditions (Fig 5.2). Detailed instruction of how to use PV Link is also provided in Case Study 1. Figure 5. 1 Tool used in Case Studies Figure 5. 2 Projects for Case Study 1,2 and Case Study 3 from (USC FMS) N N N 113 5.1. Plug-in Package and Preparation This section provides a general explanation and guidelines for the ready-to-use plug-in package, and how to load and install necessary files in order to run PV Link in Revit. The PV Link’s interface and its functions will be also introduced in this section. 5.1.1. PV Link Package and Installation The PV Link package can be downloaded online as a zip file. Users need to unzip the file into local D drive since the addin file can only find the Dynamic Link Library (dll) files in this specified location, “C: \PV Link”. There are five types of files inside the package, a Readme file, an example Revit project, a Revit family file, the dll packages, and addin files (Fig 5.3). The Readme file provides detailed instructions on how to install and use PV Link. The Example Revit project file allows the users to test and to get familiar with PV Link, and the Revit Family file provides necessary ready-to-use Revit families including a solar panel and an inverter for use in PV Link projects. Figure 5. 3 PV Link Packages PV Link is composed of four main plug-ins: Environmental Analysis, PV Module, System Analysis, and Financial Feasibility (Fig 5.3). Each of the plugins has its own program documentation and dll file, which enable the addin file to run certain linked programs. For example, there are the main program cs file, the window form file (UI file), and the dll file in the documentation of Environmental Analysis plug- in (Fig 5.4). 114 Figure 5. 4 Program documentation for Environmental Analysis and its dll files The user must place the four addin files inside the Addin folder into the Revit’s Addin folder in order to launch them in Revit. Those files must be placed in an exact location (Fig 5.5). If using Revit 2020, the users have to place it in the 2020 folder rather than 2019. When placing the addin file, it is important to click on “show hidden files” in order to see the program data file in C drive (Fig 5.5). Figure 5. 5 Adding addin file into Revit folder 5.1.2. Revit Interface After placing the addin files into the specified locations, the user can then launch Revit to use PV Link. When initiating Revit, several warning windows will pop up to ask for the user’s permission to load PV Link plug-ins into Revit (Fig 5.6). Clicking on “Always Load” will enable Revit to load PV Link every time when opening Revit. 115 Figure 5. 6 Warning windows in Revit After launching Revit successfully, users need first to change the location of the project in the Manage categories. By clicking on the search button with the project address key words, Revit will identify several matching locations and users need to choose the correct one (Fig 5.7). Figure 5. 7 Changing project locations When finished with the project location setting, users will have to open their Revit projects or open the example project provided in the plug-in package. If opening their own projects rather than the sample Revit project file supplied, the user has to load in the two Revit families in the Revit project file by clicking on the “Load Families” button in the “Insert” menu tab (Fig 5.8). 116 Figure 5. 8 Loading Revit families into the projects The plug-ins can be launched in Revit by clicking on the “External Tools” button in the “Add-Ins” Categories (Fig 5.9). It is important to note that the “External Tools” button only appears when there are plug-ins loaded into Revit. In the dropdown menus of External Tool, users can initiate the four plug-ins for PV Link (Fig 5.9). Figure 5. 9 External Tools ribbon to launch plug-ins 5.1.3. Interfaces of PV Link The order of launching plug-ins for PV Link is important. The correct order is EnvironmentalAnalysis, PVModule, SystemAnalysis, and FinancialFeasibility because there are important variables and data carried from one to the next. Without these data and variables, the corresponding plug-ins will fail to run and then create an error message. After finished running one plug- 117 in, users are always able to modify elements before running the next one except when closing the project file. After clicking on the first plug-in, EnvironmentalAnalysis, a UI will pop up for taking the user's inputs (Fig 5.10). The hyperlink will direct the user to the TMY 3 database at the NREL website. By searching the state where the project is located, users can choose the stations near the located city. A csv file containing TMY3 data can be downloaded and loaded into the plug-in by clicking on the Browse button (Fig 5.10). Raster size represents the size of grids divided the selected surface and will be used on displaying the solar map. The smaller the size of the grids is, the more accurate the result will be and the more running time the program will take. The default value for raster size is 3 feet (Fig 5.10). Figure 5. 10 Environmental Analysis UI, TMY3 website and downloaded csv file There is no UI window for PVModule plug-in, since all the information required, such as the length and width of the PV panel, will be extracted from the solar panel family loaded into the project. With the System analysis plug-in, there are two categories of factors in System analysis UI: PV System factors and system loss factors. The default values for those factors have been built in the program (Fig 5.11). Users can always manually change those values based on their assumptions on these factors. 118 Figure 5. 11 System Analysis UI The UI for Financial Feasibility plug-in includes two main categories of financial factors, cost factors, and cash flow factors (Fig 5.12). The cost factors are based on US dollar per system size wattage and the default value are also based on the US average in 2018, as are the cash flow factors. An extra function allows users to calculate the cash flow with purchasing by loan (Fig 5.12). 119 Figure 5. 12 Financial Analysis UI 5.2. Case Study 1 In Case Study 1, a simple project is tested. Detailed instructions for using PV Link are also provided in this section. The building for case 1 is a simple single-floor building with a flat roof located in Los Angeles, CA. This 22 by 20 feet building is complex enough to test most of the basic functions of the developed tool including auto-placement of PV panel, solar insolation, shading analysis, energy output, and financial analysis. It is also simple so that it can be used to test each code segment while developing the tools. A taller surrounding building is in the southwest direction of the test building in order to test the shading analysis (Fig 5.13). 120 Figure 5. 13 Buildings for Case Study 1 5.2.1. Building Geometry and Environment When launching the Environmental Analysis plug-in, the UI will pop up to ask for input from the users. The TMY3 data is downloaded from the NREL website and is loaded into the UI. Raster size is set to 3 feet, which is also the default value (Fig 5.14). Figure 5. 14 Los Angeles TMY 3 data After clicking the OK button, the user selection function will be called to ask the user to select a roof to analyze. The notification will be in the bottom left corner to remind the users, and users can only click on the roof elements (Fig 5.15). N 121 Figure 5. 15 Selecting roof surfaces When finished clicking, the roof analysis and solar analysis will start. First, the Environmental plug- in divides the selected surfaces into grids based on the raster size. Then, PV Link will construct the solar motion model based on information from the TMY3 data and the sun direction for shading analysis based on the solar motion model (Fig 5.16) (Fig 5.17). The database of solar motion model and sun direction can be viewed from the csv file located in a new folder, “APIdata,” that PV Link will create on the C drive Desktop (Fig 5. 17). Figure 5. 16 Dialog showing the process of the plug-in Figure 5. 17 Database of solar motion model, shading analysis and solar insolation analysis N 122 The last part of the environmental analysis is to calculate the solar insolation on the center point of each grid and then using this data to display the solar map on the selected surface (Fig 5.18). In figure 5.18, the purple color represents lower accumulated solar insolation. The southwest corner is shaded by the surrounding building part of the year and is shaded a more purplish color. The difference in accumulated solar insolation between grid cells is easily seen on the corresponding insolation Excel sheet available in the APIdata folder. The solar motion model and shading data have been stored in their corresponding global variables and ready to use in the next plug-ins, PV Module. Figure 5. 18 Solar Map and corresponding insolation data 5.2.2. PV Module There is no UI for the PV Module plug-in since all the information necessary can be extracted from the solar panel family and from running the Environmental Analysis plug-in. First, the PV Module plug- in starts with calculating the positioning factors of PV panel, including tilt angle and module spacing based on the information from the Environmental section (Fig 5.19). Figure 5. 19 Dialog showing the process of the PV Module plug-in N 123 Based on these positioning factors, PV Link distributes points for placing PV panels on the selected surface and performing solar insolation analysis. Finally, PV Link will automatically place the panel family on the positioning points and modified its positioning parameters (Fig 5.20). All the data writing into the family parameters can be checked on the Excel sheet available in the APIdata folder (Fig 5.21). Figure 5. 20 Automated placement of PV panel and update on its parameters Figure 5. 21 Data for solar insolation on Panels 5.2.3. PV System The next step after the PV Module section is to launch the System Analysis plug-ins to analyze the system output. First, the UI for the system analysis plug-ins will pop up and ask for the user's input on PV system factors and system loss factors (Fig 5.22). System Factors has two types of variables for PV Panel and Inverter. Except for using the default value, as shown in Fig 5.22, the user can also input values based on the product specification sheet from their desired PV Panel. For example, in the specification sheet for Jinko Solar’s PV Panel, the PV rated power, Nominal Operating Cell Temperature (NOCT), and N 124 temperature coeffcient can be found as the highlighted part shown in Fig 5.22. Figure 5. 22 PV system UI and PV panel specifications sheet (Jinkosolar.com) Based on the user inputs in PV system factors and the data of solar insolation on the panel from the last plug-in, PV Link can calculate the DC output from PV Panels (Fig 5.23). The corresponding average DC outputs and accumulated DC outputs are then written into the parameters of PV Panels. This data are also available in the APIdata folder to validate (Fig 5.24). Figure 5. 23 Dialog showing the process of the System Analysis plug-in Figure 5. 24 Solar panel DC power output With the sum of the output from all the PV Panel and system loss factors, PV Link can calculate the N 125 total DC input to the inverter and the final AC output. After finishing all the system analysis, the plug-in will ask the user to place the inverter family based on the users’ desired locations by clicking the object in place (Fig 5.25). It is important to notice that after placement users may need to click on the “Esc” button on the computer keyboard to finish and close this function. The data of final system output are stored in the parameters of the inverter placed by the users (Fig 5.26). Figure 5. 25 Plug-in asking the user to place inverter family Figure 5. 26 Writing final system output data into the parameters of Inverter 5.2.4. Financial Feasibility The Financial Feasibility plug-in enables the user to perform financial analysis on the PV system based on data produced in System Analysis plug-in. When launching this plug-in, the financial feasibility UI will ask the user to input on two main financial factors including cost factors and cash flow factors. All the default values shown in the UI are based on the US average or general assumption (Fig 5.27). Factors like investment incentive, capital incentive, and performance incentive could vary between states. The federal tax credit that will end in 2022 should be carefully defined based on their projects. N N 126 Figure 5. 27 The UI for Financial Feasibility plug-in After the factors input, PV Link will be able to calculate the cash flow for different financial factors each year and obtain the result for three main financial indicators (Fig 5.28). A detailed financial report will be available in the APIdata folder after running the Financial Feasibility plug-in (Fig 5.29). Figure 5. 28 Dialog showing financial indicators Figure 5. 29 Financial Report 127 5.2.5. Result and Validation The results obtained from PV Link are validated by three types of sources: Revit tools - Solar Insight, new algorithms, and outside tools. Solar Insight is a Revit plug-in for solar analysis (Table 5.1). However, since it is built mainly for the solar analysis for the pre-design phase, Solar Insight only has simple outputs on PV panel analysis and system analysis. Thus, the value can be different between the two plug-ins and it may be necessary to use calculations by other methods to validate the results. Table 5. 1 Validation methods Parts of plug-ins Validation Shading Analysis Substitute Algorithms Solar Insolation and Solar Map Solar Insight / Substitute Algorithms (Ning et al. 2018) System Power Output Solar Insight Financial Analysis System Advisor Model (SAM) Validation of shading analysis has been made by comparing the sun direction calculated from the solar motion model and the sun direction extracted from Revit’s built-in sun and shadow setting. The substitute method transforms the solar elevation angle, solar azimuth angle, and declination angle from the solar motion model into XYZ vectors. Comparing these two datasets, the difference between the two methods in the sunrise time is minor (Fig 5.30). It can be explained by the raw data used in the calculation, in which the solar motion model method is using historical average data, and the Revit method only allows historical data from a specific year. 128 Figure 5. 30 Validation on sun direction Validation of the solar analysis on a selected surface from Environmental plug-in can be done by comparing it with the same type of analysis done with Solar Insight. The solar map shows the same pattern and a similar difference, around 100 kWh, between shaded and unshaded areas, which validated the shading analysis in PV Link. However, the accumulated insolation between the two plug-ins has a 300 KWh/m 2 difference (Fig 5.31). This could be caused by using different raw climate datasets. In PV Link, the raw climate data is coming from TMY3, which is the average number from 30 years of historical data sets and excludes the extreme condition. However, Solar Insight is using specific climate data for a year; in this case, the data from 2010, which is not a leap year. 129 Figure 5. 31 Validation of Environmental Analysis plug-in by Solar Insight Due to the large difference between the results from two plug-ins, it is necessary to use a different algorithm for solar insolation calculation from outside sources (Fig 5.32). The new algorithm added to PV Link uses a pure formula calculation method (Ning et al. 2018). In the beam insolation algorithm, A, k, m, I B represent the apparent extraterrestrial flux, optical depth, air mass ratio and beam insolation. This algorithm takes inputs for the day in a year (n) and solar elevation angle ( 𝛼𝛼 ) (Ning et al. 2018). In the diffused insolation algorithm, C and I DC stand for sky diffuse factor and diffused insolation, which takes inputs for the day in a year (n) and beam insolation (I B ). The result from the new algorithm is very close to the result from Solar Insight based on climate data from the specific year (Fig 5.32). Figure 5. 32 Validation of Environmental Analysis plug-in by outside sources (left), insolation calculation without using TMY 3 Data The result of the PV system output from the System Analysis plug-in is also validated by Solar N N 130 Insight. First, the solar Insight setting has been set to similar panel efficiency. As for the PV panel, Solar Insight doesn’t provide any option for PV panel placement. However, it provides the coverage area to estimate the area for the solar panel roughly. By setting the coverage area to 65% (16 19-square-feet solar panels divided by the roof area 458 square feet), the difference between test conditions for two cases can be minimized (Fig 5.33). The result shows the PV module power outputs from two plug-ins are close in this case, around 4% difference (Fig 5.34). Figure 5. 33 Setting on Solar Insight Figure 5. 34 Validation of PV energy output 5.3. Case Study 2 The building for case study 2 is a three-story office building located in Phoenix, Arizona. This 63 by 38 feet building has a flat roof with 1 feet curb around the edge and two 8 by 8 stairwells extending 6 feet above the roof (Fig 5.35) (Fig 5.36). Case 2 will be used for testing the inner shading by the stairwell, which will influence the solar insolation. The stairwells also serve to test the algorithm for automatically 131 placing the solar panel family, since they are obstacles for placing the PV Revit families. Figure 5. 35 Case Study 2 perspective and site plan Figure 5. 36 Case Study 2 section views 5.3.1. Running PV Link The TMY3 data file is downloaded from the NREL website and loaded into PV Link. The raster size is set to 5 feet since the building is larger in scale than the Case Study 1 and will take longer running time (Fig 5.37). The result shows a high variation from 2001 kW to 564kW in accumulated solar insolation, caused by the inner shading from the two stairwells. The solar map shows the area behind the stairwell on the north side and beside the stairwell on the east and west side have low solar insolation available (Fig 5.38). The testing on environmental analysis plug-in under the inner shading condition has returned the desired results on the solar map and the solar insolation data available in the APIdata folder. N 132 Figure 5. 37 Environmental Analysis inputs for Case Study The challenge here is the two stairwells on the roof because all the analytic points for solar insolation are evenly distributed in the selected face (Fig 5.38). By using face.inside() function, PV Link can remove the points that are not inside the face, which make the result displayed in a solar map more accurate. Overall, the accumulated solar insolation per m 2 is higher in Phoenix than Los Angeles, which also tests the feasibility of PV Link at different locations. Figure 5. 38 Solar map for Case Study 2 The next step is to run the PV Module plug-in to perform auto-placement of PV panels based on displacement strategies and solar analysis on them. The challenges for PV placement in Case Study 2 are the two stairwells and roof curb and their shading effect on the panels. PV Link uses ElementIntersectsElement() class to determine whether the placed PV panels intersect with the walls of stairwells and the curbs. Also, a baseline of average solar insolation has been set to 200 W/m 2 to filter out 133 the PV panels, which is heavily shaded. The result of the automated placement of PV panels shows PV Link avoids placing in the area with low solar insolation and placing clashing with any walls (Fig 5.39) (Fig 5.40). Arizona has generally higher solar insolation. The accumulated solar insolation on the same PV panel product is 400 kW higher than Los Angeles. Figure 5. 39 PV panel placement and its parameters for Case Study 2 Figure 5. 40 Spreadsheet for the result of PV Module plug-in After the PV Module section, System Analysis plug-in can be run to perform the analysis for PV panel DC power output and system final AC output. Case Study 2 uses the same PV system components N 134 and assume the same system loss factors as Case Study 1 in the system factors inputs (Fig 5.41). The result of system analysis shows the total AC output for a year is 27005 kWh, which is stored in the inverter family instance, and also the spreadsheet of system analysis available in the APIdata folder (Fig 5.42). Figure 5. 41 PV system input for Case Study 2 Figure 5. 42 Inverter placement and the information of system output for Case Study 2 The final step is to perform financial analysis by running the Financial Feasibility plug-in. Based on the information on solar incentives for Arizona, there is no performance-based incentive (PBI) available anymore (Solarpowerrocks.com). The PBI in financial feasibility inputs is changed to zero (Fig 5.43). N 135 Figure 5. 43 Financial Feasibility inputs for Case Study 2 The comparison of the financial indicators with PBI and without PBI tests the feasibility of financial plug-ins under different site conditions (Fig 5.44) (Fig 5.45). 2% of PBI can reduce the payback periods around a year. The financial report also shows the payback period for the project, which is available in the APIdata folder (Fig 5.46). Figure 5. 44 Result of financial indicators with 2% PBI Figure 5. 45 Results of financial Indicators without PBI 136 Figure 5. 46 Spread Sheet of Financial Report 5.3.2. Result and Validation The Validation of Case Study 2 will be the same as Case Study 1. First, the validation of shading analysis has been made on comparing the sun direction calculated from the solar motion model and sun direction extracting from Revit’s built-in sun and shadow setting. Comparing these two datasets, the difference between the two methods in the sunrise time is minor (Fig 5.47). It can be explained by the raw data using in the calculation, in which the solar motion model method is using historical average data and the Revit method only allows to use of historical data in a specific year. Figure 5. 47 Validation on sun direction Validation of solar analysis from Environment plug-in can be done by comparing it with the same 137 type of analysis on Solar Insight. The solar map shows the same pattern of the level of the solar insolation on surfaces which is low around the east, west, and north side of the stairwell (Fig 5.48). However, the accumulated solar insolation has an even larger difference of about 600 kWh/m2 compared with the difference in Case Study 1. This is because of the difference in raw climate data used in the study, which are TMY3 for PV Link and annual climate data in 2010 for Solar Insight. Figure 5. 48 Validation on Environmental Analysis plug-in by Solar Insight Since two cities have been used in PV Link, it is also helpful to compare the raw data used for these two case studies. Comparing the TMY3 data, it is obvious that Arizona has a higher solar insolation level than Los Angeles. The sum of Direct Normal Insolation (DNI), also referred to beam insolation, for a year in Arizona is 30% higher than in Los Angeles (Fig 5.49). The result of PV Link also shows a big difference about 10% between Arizona and Los Angeles but not in Solar Insight, about 1%. Figure 5. 49 Comparison of TMY3 data between Phoenix and Los Angeles N N 138 Due to the large difference between the results from two plug-ins, it is also necessary to use the new algorithm for solar insolation calculation same as Case Study 1. The result from the new algorithm is very close to the result from Solar Insight based on climate data from a specific year, around 1% (Fig 5.50). Figure 5. 50 Result from the new algorithm The result of the PV system output was validated by Solar Insight. First, the Solar Insight setting was set to the 15% efficiency and 62% coverage area (70 19-square-feet solar panels divided by the roof area of 2150 square feet). The result of PV Link shows the system output is around 2% lower than the Solar Insight. It may cause by the difference in the definition of system loss factors and system components factors since Solar Insight doesn’t provide any information on it we cannot accurately verify the cause of the difference (Fig 5.51). Figure 5. 51 Setting on Solar Insight 139 Figure 5. 52 Validation on PV energy output counting cell temperature and its loss(left), counting simply the efficiency 5.4. Case Study 3 The building for Case 3 is Watt Hall, the headquarters of the USC School of Architecture. It is a four-story building covering an area of 67,855 square feet, with three floors above ground. The 150 by 120 feet roof of Watt Hall has an area of about 16,000 square feet. A central 87 by 31 feet stairwell is composed of curtain walls and capped by a sloping roof and a 51 by 13 by 12 feet mechanical room (Fig 5.53) (Fig 5.54). The most important condition of Watt Hall for this test is its orientation; Watt Hall is not oriented on the cardinal directions; it is 28.06 degrees away from true north. This will test the solar and shading analysis and the layout strategies of PV modules. Case 3 also serves to test the azimuth of solar panels validating one of the positioning constraints, panels always facing true south. Because Watt hall is a real and large-scale building, it makes a good test case study for validating the tool and the results. 140 Figure 5. 53 Case Study 3 perspective and site plan (USC FMS) Figure 5. 54 Case Study 3 section views 5.4.1. Running PV Link Because of some limitations of PV Link on complex geometry, the roof condition needs to simplifying before running PV Link. All the curtain walls for the central stairwell are simplified into solid walls (Fig 5.55). Since the curtain wall has many mullions and glass panels, it largely increases the time in the shading analysis and sometimes causes the program to fail. The beam solar radiation through the transparent glass is outside the scope of this research and, because of the extended roof with overhang, it N N 141 may only happen in the early morning and later afternoon, when the beam solar radiation is relatively low. Therefore, Case study 3 is assumed the influence between the curtain wall and solid wall, in this case, is low. Figure 5. 55 Model simplification for Case Study 3 The TMY3 data file in Case Study 3 uses the data for Los Angeles, and the raster size is set to 6 feet on the user interface. The sun vector algorithm for shading analysis is updated to take into account the project true north angle, 28.06 degrees away from true north. The result of Environmental plug-in has a similar result for the highest accumulated solar insolation with Case Study 1 using the same weather data file. The solar map successfully shows the influence of inner shading caused by the stairwell and mechanical room. Figure 5. 56 Solar map for Case Study 3 N N N N 142 The next step is to run the PV Module plug-in to perform auto-placement and solar analysis for the solar panels. Two conditions have been set and tested to analyze the difference between panel facing true south and panels following the direction of the roof. For the strategies of following the roof direction, the algorithm to calculate the solar insolation on the panel is updated to takes into account the project's true north angle. As for the strategies of facing true south, it updates the placement algorithm to place the points following the true south not the roof direction. Furthermore, an additional function to determine if the PV panel is partially outside the roof edge is added into the program to filter out the undesired PV panels. For strategy 1 with panel following the direction of the roof, the result shows 459 PV panels placed in the roof above the baseline (Fig 5.57). The highest accumulated insolation on the PV panel reaches to 2993 kWh per year with no influence from inner shading (Fig 5.57). Figure 5. 57 PV panel placement and its parameters for Case Study 3 strategy 1 The other strategy with the panel facing true south, the result shows 444 PV panels placed in the roof above the baseline (Fig 5.58). The highest accumulated insolation on the PV panel reaches to 3122 kWh per year with no influence from inner shading (Fig 5.58). Comparing between two strategies, the PV 143 panel facing true south can get a generally higher accumulated insolation than PV panel following the roof direction, about 4%. However, strategy 1 allows more PV panels to be placed in the selected roof than strategy 2, about 3.5%. Figure 5. 58 PV panel placement and its parameter for Case Study 3 strategy 2 By running the System plug-in, the total electricity generation can be used to compare the final performance of these two strategies. The result shows strategy 1 has a higher total power output than strategy 2 around 1800kW (1%) (Fig 5.59). The difference is minor and less than a single PV panel output for a year. In terms of total system output, strategy 1 with panel following the roof direction is higher than strategy 2 about one panel’s yearly output, but with extra 15 panels. From a financial perspective, it is an extra $3000 costs more than strategy 2. Figure 5. 59 System output for Case study 3 Strategy 1 and 2 144 The final step is to perform financial analysis by running the Financial Feasibility plug-in. There is no large difference in the result from two placement strategies since the system output is close. The payback period for Case study 3 is 12.1 years (Fig 5.57). Figure 5. 60 Financial reports and payback period for Case Study 3 5.4.2. Result and Validation For Case Study 3, the validation of shading analysis has been made on comparing the sun direction calculated from the solar motion model and sun direction extracting from Revit’s built-in sun and shadow setting. Comparing these two datasets, the difference between the two methods in the sunrise time is around 10% (Fig 5.57). The difference between sun vector with project location facing true south and following the roof direction can be analyzed by comparing the sun vector dataset between Case Study 3 and Case Study 1. The result shows the difference between the X and Y axis regarding the change in project north (Fig 5.57). 145 Figure 5. 61 Validation on sun direction Validation of solar analysis can be done by comparing it with the same type of analysis on Solar Insight. The difference between the two datasets is similar to Case Study 1, around 30%, which is caused by the use of different raw climate datasets (Fi 5.58). The result shows the same pattern of solar insolation level in the solar map between these two tools. The result from the new algorithm is close to the result from Solar Insight, which is similar to Case Study 1 and 2 (Fig 5.59). Figure 5. 62 Validation on Environmental Analysis plug-in by Solar Insight 146 Figure 5. 63 Result from the new algorithm for Case Study 3 The result of the PV system output is validated by Solar Insight. In the study settings of Solar Insight, the panel efficiency is set to 15% and the coverage area is set to 54% coverage area (444 19- square-feet solar panels divided by the roof area of 15356-square-feet. The result of PV Link is 44,000 kWh less than Solar Insight about 20 % (Fig 5.65). Figure 5. 64 Setting on Solar Insight for Case Study 3 Figure 5. 65 Validation of PV energy output for Case Study 3 147 5.5. Summary The Chapter of Case Studies introduced the ready-to-use PV Link package and the main UIs of PV Link. A detailed explanation and instruction on how to load and use it in Revit were provided in Case Study 1. Through three case studies of projects, this chapter has examined whether the program’s main features work properly and generate expected results. Those studies also successfully showed the tool’s feasibility and accuracy under different conditions of project locations, inner shading, surrounding shading, and building roof size and layout. Three main methods of validation included new algorithms, Revit tools - Solar Insight and outside tools-SAM, have been used on Case Study 1 and 2 to validate the result from PV Link. The main difference from the validation is related to the different raw climate datasets use for PV Link (TMY3 data) and Solar Insight (annual data from 2010). Table 5. 2 Validation methods & Results Parts of plug-ins Validation Case 1 Difference Case 2 Difference Case 3 Difference Shading Analysis Substitute Algorithms 2% 2% 10% Solar Insolation and Solar Map Solar Insight / Substitute Algorithms (Ning et al. 2018) Solar Insight: 30% Insight vs new: 2% Solar Insight: 35% Insight vs new: 2% Solar Insight: 35% Insight vs new: 2% System Power Output Solar Insight 2% 2% 20% Financial Analysis System Advisor Model (SAM) 1% 1% 2% 148 Chapter 6 6. Discussion and Future Work This chapter discusses how the current workflow performed during the development of PV Link, together with the examination of the main tool’s feature. The discussion of some limitations within the current workflow and PV Link is also provided and evaluated. Then, the chapter proposes improvements to deal with existing limitations and shows the future potential of further developing PV Link into a more advanced product for assisting sustainable design and decision making through the BIM lifecycle. 6.1. Discussion This section summarizes the examination and evaluation of the performance of PV Link and its backbone workflow. The limitations of the methodology, the features, and software are also explained and examined to provide guides and ideas on improving and further developing PV Link in the future. 6.1.1. Evaluation of current workflow The proposed BIM-based workflow for PV system design and management tried to bring the traditional multi-platform methods into one BIM platform through PV Link. The process starts from the building level to the system level and ends at the information level. The methodology of BIM-based solar tools includes five parts: Building, Environment, PV Module, System and Components, and Finance (Fig 6.1). Each of the sections has its own input and preparation, analysis, and output and visualization (Fig 6.1). These five parts of workflow also divide the main functions of PV Link into five different plug-ins to fit into different project phases needed. For example, Environment sections can be used only in the early site assessment phase. 149 Figure 6. 1 Methodology diagram However, the modularization of the workflow is not only about lines of writing C# code for generating the functions and interfaces for each section. It also requires the connection between each section and the interaction with contents stored in the platform, local external file, and Revit family parameters to exchange data and information. That is also reinforcing the proposed single-platform approach for PV design and management. Through implementing PV Link in the projects of three case studies, it proved the feasibility of the BIM-based workflow from environmental assessment, PV placement strategies, to the system and financial analysis. Data is obtained, transferred, analyzed, visualized and stored through the whole workflow and connecting each module. 150 6.1.2. Examination of tool With the tool features and workflow defined in the Methodology, the source code of PV Link can be developed through Visual Studio. The workflow of tool development is made up of five main sections based on the methodology with an extra set up section (Fig 6.2). Information is the key to connect each section and within those sections from preparation, to analysis and visualization. Each cell represents an important customized (green and yellow color) or Revit built-in (orange color) function or class that ensures the program and features performing successfully in the corresponding sections (Fig 6.2). Figure 6. 2 Tool development Diagram The user starts with three Revit files: Revit project with building, PV panel family, and Revit inverter family. The user then inputs the selection of the face, the TMY file path, and the placement of the inverter family in corresponding sections, and optional components factors (loss, cost electrical use, and cash flow factors) to modify the default value (Fig 6.3). The final outputs from the software are solar maps, PV 151 panels and inverter placed in the proper location, solar and energy data spreadsheet, and a financial report (Fig 6.3). Figure 6. 3 PV Link’s inputs and outputs Running PV Link in the three case studies of projects has examined whether the program’s main features work properly and generate expected results. The tool’s feasibility and accuracy under different conditions of project locations, roof size, and layout, inner and surrounding shading have also been tested through these three cases. The main issues in validation stated in Chapter 5 are mostly related to the different raw climate datasets used between TMY3 data and single-year data. This is also one of the limitations will be explained in the Limitations section. 6.1.3. Limitations of the current version of PV Link Although all important features in PV Link worked properly in the three case studies, limitations still exist in and there is still plenty of room for improvement for the tool. The lack of a comprehensive climate raw database to use is one of the major limitations in PV Link. The original climate database used is TMY3 data from the National Renewable Energy Laboratory (NREL), which summarizes the 152 “average” of the long-term data from 1991 to 2005 into one typical year. That means the TMY3 data also excludes all the extreme or unusual weather events, which may have a large difference from the actual solar insolation. In Chapter 5, Solar insight, used single year climate data in 2010, has been used to validate the result and the large difference in accumulated solar insolation exists between two software (Fig 6.4). It is not a comprehensive way to only use raw weather data from a specific year to predict solar insolation in the future since the weather data in that year may have a large anomaly than it supposes to be. Therefore, the lack of available well-defined weather data in the market may cause inaccuracy in predicting the solar insolation available for the PV system in the future. The difference between the use of raw weather data, in this case, TMY data and specific year data, could potentially produce largely different predictions on the solar insolation analysis. This is also one of the key findings of this research. Figure 6. 4 Validation on solar insolation level The current layout strategies of placing PV panels in PV Link are mainly based on the three constraints: all panels facing true south, maximizing the amounts of panels in one array, and the same inner spacing between arrays. When there are inner obstacles, like stairwells and HVAC equipment, on the roof, PV Link, then, checks if the distributed panels clash with and stand in the low insolation area generated by the shadow of the obstacles. If it is true, then PV Link will delete that panels. However, when the clash is minor, moving the solar panel a little bit away from the obstacle can also avoid the clash while produced extra electricity. Therefore, this isn’t the best layout strategy when talking about the 153 layout with the highest solar insolation collected or the highest output. Furthermore, in the distance of inner spacing, PV Link calculates the minimum inner spacing to avoid the front solar panel cast any shadow on the panel in the back for any time, since it may reduce the overall efficiency by partial shading effect. This is true when talking without micro-inverter. It raises another limitation that PV Link doesn’t have options to determine whether to use micro-inverters. Even though PV Link assumes micro-inverters are installed on each panel to avoid the partial shading effect, the detail of micro-inverter and its relative factors are not included in the studies and tools. Although PV Link has a cell thermal model to estimate the effect of cell temperature and system loss factors, detailed system factors like short and open circuit current and voltage, apparent load in different phases have not been factored in. Therefore, it is a simple version of system output compared with the professional system analysis tools in MATLAB. System components like controller and batteries are also not in the scope of PV Link, which influences the system efficiency and output too. It is also crucial for a complete PV system model in BIM. Another limitation of PV Link is that the feasibility of placement strategies has been tested on the sloped roof and complex roof shapes. Currently, PV Link works properly on the flat roof. However, the current displacement strategies may not suitable to the sloped roof and more complex roof shapes due to the methods of distributing the points. 6.2. Future Work This section introduces possible directions and methods for addressing existing limitations and expand the functionalities of PV Link. This section is divided into two major parts: improvements that can be done within a short period, and future work that may need a longer period of work to accomplish. 154 6.2.1. Improvements Currently, the calculation speed for each section can be varied from 10 seconds to 4min depending on the size of the projects. The responding time of the software is quite long compared with other plug-ins in Revit, which is not very user-friendly. The major cause of the long responding time is performing solar and shading analysis on each point of the grids and each panel. Also, the responding time increases when the amount of calculation points increases in larger projects. It can be addressed by changing the sources code in a more efficient way. Currently, the source code of PV Link can be run without any compiler errors, but there are many opportunities for upgrades. The improvement in source code can address the limitations such as the tool feasibility on different roof shapes. For example, the displacement strategies of the analytic points are based on the UV value based on a face, and PV Link works fine with flat roofs. As for the sloped roof, the displacement strategies can change to use the XYZ value rather than UV value. For irregular and complex roof shapes, the point. Isinside() method can solve most of the problems. Several features can be added into PV Link to further develop it into a more advanced product in a short period: • Providing various types of PV panel and inverter families and/or creating a PV panel and inverter type database that users can select from. • Adding factors and families of other important components of the PV system such as batteries and controllers. • Providing options for micro-inverter and related functions and calculations. • Adding additional backward workflow – if the users know how much the electricity they need exactly, PV Link can calculate back to determine how many panels are needed and then auto- placement. 155 • Creating better user-friendly UIs, which can assist users throughout, not just for taking inputs but also showing the results and the data in spreadsheets such as the financial report. • Allowing the user to use various types of weather data to calculate the solar insolation level. • Improving the layout strategies for PV modules – a new algorithm that takes into account the minor clash that does not just delete it but try to move the panel away from the hit objects first. • Creating a new algorithm to run different layout strategies and then informing the users of those options and its solar insolation level. • Scripting from the web or manually inputting the local solar incentives, policies and prices for the PV system into the PV Link database and provide users access to the database. 6.2.2. Future Work The climate database is important for PV Link to predict and evaluate the performance of the PV system in the projects. As mentioned in the limitations section, it is not suitable to use the weather data from a specific year to predict the weather condition in the future. TMY3 database also has its drawback of excluding extreme weather events and it is not presenting the average (Schiler 2020). Some of the databases derived from TMY3 such as the weather data in EnergyPlus have their own algorithms to improve the raw dataset for better use on estimation (EnergyPlus.net). The future work of PV Link may include scripting and using the EnergyPlus data rather than the TMY3 raw dataset. Even though PV Link has a cell thermal model to calculate the effect of cell temperature on the system efficiency and system loss factors, it still considers as a relatively simple version of system analysis. Creating an advanced system analysis for PV Link will improve the tool’s functionalities. Instead of spending a lot of time creating it from scratch, connecting PV Link with the professional system analysis tool in MATLAB such as Simulink PV can be a possible alternative approach. 156 PV Link is mainly useful for early design planning and financial analysis. There are other major features that could be useful for other phases of a building’s lifecycle including electrical engineering integration, construction documentation, installation, and facilities management (Fig 6.5): • Electrical Engineering integration could be included providing detailed electrical diagrams for electrical engineers. The integration of the PV system model into the design and simulation of its components could be more feasible to achieve system optimization (Ning et al. 2017). In other words, the size of the inverter, the capacity of batteries bank and the number of PV modules as well as other components like controllers should be optimistically selected and designed to achieve the balance of system and maintain high efficiency during operation under various conditions (Fig 6.5). Figure 6. 5 Detailed electrical diagram for system designing and testing (MATLAB Simulink PV) • For the construction documentation of PV projects, it is necessary to have detailed drawings of PV systems and making sure it is compliant to the specific code. Adding functions for creating detailed drawing sheets and code checking can expand the functionalities of PV Link better to assist users on their projects (Fig 6.6). 157 Figure 6. 6 Construction Documentation (solarpartscomponents.com) • PV installation accounts for around 10-15% of the total cost of the PV system. The correct and efficient installation can reduce the cost of installation fees and change orders while ensuring the completeness and safety of the PV system. With providing detailed construction documentation, additional functions of automatic installation scheduling can be added to assist users in the installation or construction phase (Fig 6.7). Figure 6. 7 Detailed drawings (left) (Solarpv.com), PV system Installation schedule (right) (Pinterest.com) • Facility Management is concerned with the operation of the building. It can benefit from BIM and the model developed in PV Link. It is critical to have ongoing monitoring and maintenance of the PV system in order to secure the PV system’s safety and performance. Connecting PV system sensors with PV Link platform, it can allow the user to access the detailed real-time data for monitoring and inspection (Fig 6.8). 158 Figure 6. 8 PV system real-time management (right) (El-Leathey 2018). 6.3. Conclusion The integration of BIM and sustainable design leverage a building-based system optimization on PV system design and management. PV Link serves to bridge the design for the PV system, an important active sustainable design strategy, from the traditional multi-platforms approach into a single and information-driven BIM platform. Data is the key to connect each section from environmental analysis, panel layout optimization, to the system and financial analysis, and also within those sections from preparation to analysis and visualization. Besides the intellectual merit in the methodology of PV Link, innovative workflows, including the algorithm of shading analysis and solar analysis under the BIM environment is crucial to accomplish the main features of the tool. Given that BIM is increasingly adopted by many AEC firms, PV Link has the potential to assist them in sustainable design and analysis. According to the California Building Standard Commission (CBSC), the update on Title 24, AB178, mandate all new homes built in California to include solar PV system starting in 2020 (CBSC 2019). This new requirement on the state’s building code and the potential of the similar laws on other types of buildings or even in other states in the future leverage the practical merit of PV Link in the AEC industry. With further development of the software into a more advanced product, PV Link will be able to better assist the sustainable design and decision making through the BIM lifecycle. 159 References Arduin, Laffer & Moore Econometrics. 2016. “The High Cost of Rooftop Solar Subsidies.” https://www.technologyreview.com/s/544981/tax-credit-extension-gives-solar-industry-a-new-boom/. Atmaram, H. n.d. “TYPICAL PHOTOVOLTAIC SYSTEM FOR A COMMERCIAL BUILDING.” Accessed September 5, 2019. http://www.fsec.ucf.edu/en/publications/pdf/FSEC-CR-1294-01.pdf. Attia, Shady, and André De Herde. 2011. “Early Design Simulation Tools for Net Zero Energy Buildings: A Comparison of Ten Tools.” In . International Building Performance Simulation Association. https://orbi.uliege.be/handle/2268/167476. Branker, K., M. J.M. Pathak, and J. M. Pearce. 2011. “A Review of Solar Photovoltaic Levelized Cost of Electricity.” Renewable and Sustainable Energy Reviews. https://doi.org/10.1016/j.rser.2011.07.104. “Calculate Your Solar Panel Payback Period | EnergySage.” n.d. Accessed January 15, 2020. https://news.energysage.com/understanding-your-solar-panel-payback-period/. CBSC. 2019. AB-178 Energy: building standards: photovoltaic requirements. Dobos, Aron P. 2014. “PVWatts Version 5 Manual.” www.nrel.gov/publications. Dodson, Emily, Christopher Doyle, and Robert Lockhart. n.d. “Guide To Implementing Solar PV For Local Governments.” Accessed September 6, 2019. https://www.solsmart.org/media/ICMA_GuidetoImplementingSolarPVforLocalGovernments.pdf. Eastman, Charles M. 2008. BIM Handbook : A Guide to Building Information Modeling for Owners, Managers, Designers, Engineers, and Contractors. Hoboken, N.J: Wiley. EIA. 2018. “Annual Energy Outlook 2018 with Projections to 2050.” www.eia.gov/aeo. EIA. 2019. “Levelized Cost and Levelized Avoided Cost of New Generation Resources in the Annual Energy Outlook 2019.” http://www.eia.gov/outlooks/aeo/assumptions/. El-Leathey, Lucia-Andreea. 2018. “Energy Management System Designed for the Interconnected or Islanded Operation of a Microgrid Using LabVIEW Software.” In Smart Microgrids. InTech. https://doi.org/10.5772/intechopen.74856. Ellabban, Omar, Haitham Abu-Rub, and Frede Blaabjerg. 2014. “Renewable Energy Resources: Current Status, Future Prospects and Their Enabling Technology.” https://doi.org/10.1016/j.rser.2014.07.113. “Energy Patterns of Use.” n.d. Accessed September 2, 2019. http://css.umich.edu/sites/default/files/U.S._Renewable_Energy_Factsheet_CSS03-12_e2018.pdf. Faraz, Tahsin. 2012. “Benefits of Concentrating Solar Power over Solar Photovoltaic for Power Generation in Bangladesh .” https://ieeexplore.ieee.org/abstract/document/6153444. Frontini, Francesco, Pierluigi Bonomo, Anatoli Chatzipanagi, Guus Verberne, Menno Van Den Donker, and Wiep Folkerts. 2015. “BIPV PRODUCT OVERVIEW FOR SOLAR FAÇADES AND ROOFS.” www.bipv.ch. Fu, Ran, David Feldman, and Robert Margolis. 2018. “U.S. Solar Photovoltaic System Cost Benchmark: Q1 2018.” www.nrel.gov/publications. Gonçalves, Priscila, Vasconcelos Sampaio, Mario Orestes, and Aguirre González. 2017. “Photovoltaic Solar Energy: Conceptual Framework.” https://doi.org/10.1016/j.rser.2017.02.081. 160 Gregg, A., T. Parker, and R. Swenson. 2005. “A "Real World" Examination of PV System Design and Performance.” In Conference Record of the Thirty-First IEEE Photovoltaic Specialists Conference, 2005., 1587–92. IEEE. https://doi.org/10.1109/PVSC.2005.1488448. Gupta, Apeksha, Alexandra Cemesova, Christina J. Hopfe, Yacine Rezgui, and Tracy Sweet. 2014. “A Conceptual Framework to Support Solar PV Simulation Using an Open-BIM Data Exchange Standard.” Automation in Construction 37 (January): 166–81. https://doi.org/10.1016/J.AUTCON.2013.10.005. Hasan, Rasedul, Saad Mekhilef, Mehdi Seyedmahmoudian, and Ben Horan. 2017. “Grid-Connected Isolated PV Microinverters: A Review.” Renewable and Sustainable Energy Reviews. Elsevier Ltd. https://doi.org/10.1016/j.rser.2016.09.082. Horvat, Miljana, and Marie-Claude Dubois. 2012a. “Tools and Methods for Solar Design-an Overview of IEA SHC Task 41, Subtask B Peer-Review under Responsibility of PSE AG.” Energy Procedia 30: 1120–30. https://doi.org/10.1016/j.egypro.2012.11.125. Hosenuzzaman, M., N.A. Rahim, J. Selvaraj, M. Hasanuzzaman, A.B.M.A. Malek, and A. Nahar. 2015. “Global Prospects, Progress, Policies, and Environmental Impact of Solar Photovoltaic Power Generation.” Renewable and Sustainable Energy Reviews 41 (January): 284–97. https://doi.org/10.1016/J.RSER.2014.08.046. Huang, Lu. 2018. “Revit Plugins for Electrical Engineering Improvements in Buildings: Lighting Power Density and Electrical Equipment Placement.” https://search-proquest-com.libproxy2.usc.edu/docview/2184229941/?pq- origsite=primo. Ibrahim, A, A. A El-Sebaii, M. R.I Ramadan, and S. M El-Broullesy. 2013. “Estimation of Solar Irradiance on Tilted Surfaces Facing South for Tanta, Egypt.” International Journal of Sustainable Energy 32 (2): 111–20. https://uosc.primo.exlibrisgroup.com/discovery/fulldisplay?docid=informaworld_s10_1080_14786451_2011_ 601814&context=PC&vid=01USC_INST:01USC&lang=en&search_scope=MyInst_and_CI&adaptor=Primo Central&tab=Everything&query=any,contains,Estimation of Sola. Jali, M H, H Sarkawi, T B A Izzuddin, M F Sulaima, and M N M Nasir. 2014. “Solar PV Project Implementation Feasibility Study Based on Feed-in Tariff in Malaysia.” International Journal of Applied Engineering Research. Vol. 9. http://www.ripublication.com. James, Ted, Alan Goodrich, Michael Woodhouse, Robert Margolis, and Sean Ong. 2011. “Building-Integrated Photovoltaics (BIPV) in the Residential Sector: An Analysis of Installed Rooftop System Prices.” http://www.osti.gov/bridge. Kabir, Ehsanul, Pawan Kumar, Sandeep Kumar, Adedeji A Adelodun, and Ki-Hyun Kim. 2017. “Solar Energy: Potential and Future Prospects.” https://doi.org/10.1016/j.rser.2017.09.094. Kensek, K. M. 2014a. “Integration of Environmental Sensors with BIM: Case Studies Using Arduino, Dynamo, and the Revit API.” Informes de La Construcción 66 (536): e044. https://doi.org/10.3989/ic.13.151. Kensek, K.M. 2014b. Building Information Modeling. Routledge. Kost, Christoph, Shivenes Shammugam, Verena Jülch, Huyen-Tran Nguyen, and Thomas Schlegl. 2018. “LEVELIZED COST OF ELECTRICITY RENEWABLE ENERGY TECHNOLOGIES.” www.ise.fraunhofer.de. Lisell, L, T Tetreault, and A Watson. 2009. “Solar Ready Buildings Planning Guide Repository Citation.” https://digitalscholarship.unlv.edu/renew_pubs. 161 Loghmani, Ciavash. 2008. “Optimal Zoning Configurations For Solar Access in High Rise Developments.” University of Southern California. https://mail.google.com/mail/u/0/#search/marc/FMfcgxwGDDpcbtmPcTsxQRpfMMBCzDnC?projector=1& messagePartId=0.1. Luoma, Jennifer, Jan Kleissl, and Keenan Murray. 2012. “Optimal Inverter Sizing Considering Cloud Enhancement.” Solar Energy 86 (1): 421–29. https://doi.org/10.1016/j.solener.2011.10.012. Mellit, A., G. M. Tina, and S. A. Kalogirou. 2018. “Fault Detection and Diagnosis Methods for Photovoltaic Systems: A Review.” Renewable and Sustainable Energy Reviews. Elsevier Ltd. https://doi.org/10.1016/j.rser.2018.03.062. “National BIM Standard-United States.” 2013. http://mddb.apec.org/Documents/2013/SCSC/WKSP5/13_scsc_wksp5_007.pdf. Ning, Gui, Li Junnan, Dong Yansong, Qiu Zhifeng, Jia Qingshan, Gui Weihua, and Deconinck Geert. 2017. “BIM- Based PV System Optimization and Deployment.” Energy and Buildings 150 (September): 13–22. https://doi.org/10.1016/J.ENBUILD.2017.05.082. Ning, Gui, He Kan, Qiu Zhifeng, Gui Weihua, and Deconinck Geert. 2018. “E-BIM: A BIM-Centric Design and Analysis Software for Building Integrated Photovoltaics.” Automation in Construction 87 (March): 127–37. https://doi.org/10.1016/J.AUTCON.2017.10.020. Nrel. n.d. “Energy Payback: Clean Energy from PV: National Center for Photovoltaics PV FAQs (Fact Sheet).” Obeidat, Firas. 2018. “A Comprehensive Review of Future Photovoltaic Systems.” Solar Energy 163 (March): 545– 51. https://doi.org/10.1016/J.SOLENER.2018.01.050. Okoye, Chiemeka Onyeka, Onur Taylan, and Derek K Baker. 2015. “Solar Energy Potentials in Strategically Located Cities in Nigeria: Review, Resource Assessment and PV System Design.” https://doi.org/10.1016/j.rser.2015.10.154. Parida, Bhubaneswari, S Iniyan, and Ranko Goic. 2011. “A Review of Solar Photovoltaic Technologies.” Renewable and Sustainable Energy Reviews 15: 1625–36. https://doi.org/10.1016/j.rser.2010.11.032. “PV Module Temperature | PVEducation.” n.d. Accessed January 9, 2020. https://www.pveducation.org/pvcdrom/modules-and-arrays/pv-module-temperature. “PVWatts Calculator.” n.d. Accessed January 9, 2020. https://pvwatts.nrel.gov/pvwatts.php. Redmond, Alan, and B Smith. 2012. “Designing a Cloud BIM Business Process Model Case Study.” https://www.researchgate.net/publication/287062382_Designing_a_cloud_BIM_business_process_model_cas e_study. Renné, D. S. 2016. “Resource Assessment and Site Selection for Solar Heating and Cooling Systems.” In Advances in Solar Heating and Cooling, 13–39. Elsevier Inc. https://doi.org/10.1016/B978-0-08-100301-5.00002-3. Riffonneau, Yann, Seddik Bacha, Franck Barruel, and Stephane Ploix. 2011. “Optimal Power Flow Management for Grid Connected PV Systems With Batteries.” https://ieeexplore-ieee- org.libproxy2.usc.edu/stamp/stamp.jsp?tp=&arnumber=5713847&tag=1. Rose, Thomas, and Alexander Wollert. 2015. “The Dark Side of Photovoltaic - 3D Simulation of Glare Assessing Risk and Discomfort.” Environmental Impact Assessment Review 52 (April): 24–30. https://doi.org/10.1016/j.eiar.2014.08.005. 162 Ryan, Greer. 2016. “Shade Throwing 10 Sunny States Blocking Distributed Solar Development.” https://www.biologicaldiversity.org/programs/population_and_sustainability/energy/pdfs/ThrowingShade.pdf. Salimzadeh, N, F Vahdatikhaki, and A Hammad. n.d. “BIM-Based Surface-Specific Solar Simulation of Buildings.” Accessed August 28, 2019. http://www.iaarc.org/publications/fulltext/ISARC2018-Paper188.pdf. Sark, Wgjhm Van. 2012. “Design and Components of Photovoltaic Systems.” https://doi.org/10.1016/B978-0-08- 087872-0.00136-0. SEIA. 2018. “The 2018 State Solar Policy Changes You Need to Know | SEIA.” Solar Energy Industries Association (SEIA). 2018. https://www.seia.org/news/2018-state-solar-policy-changes-you-need-know. SEIA. 2019. “U.S. Solar Market Insight Report.” https://www.seia.org/research-resources/solar-market-insight- report-2018-year-review. “Solar Energy & Solar Power in Nevada | Solar Energy Local.” n.d. Accessed September 29, 2019. https://www.solarenergylocal.com/states/nevada/. Su, Gelin. 2019. “A BIM-Based Visualization Tool for Facilities Management - .” Teo, J., Rodney Tan, V. Mok, Vigna Ramachandaramurthy, and ChiaKwang Tan. 2018. “Impact of Partial Shading on the P-V Characteristics and the Maximum Power of a Photovoltaic String.” Energies 11 (7): 1860. https://doi.org/10.3390/en11071860. Trenberth, Kevin E., John T. Fasullo, and Jeffrey Kiehl. 2009. “Earth’s Global Energy Budget.” Bulletin of the American Meteorological Society 90 (3): 311–24. https://doi.org/10.1175/2008BAMS2634.1. U.S. Department of Energy. 2014. “On-Site Commercial Solar PV Decision Guide.” https://betterbuildingssolutioncenter.energy.gov/sites/default/files/attachments/On_Site_Solar_Decision_Guid e.pdf. Wholesale Solar. n.d. “Off-Grid Battery Bank Sizing.” Accessed September 30, 2019. https://www.wholesalesolar.com/solar-information/battery-bank-sizing. Wijeratne, W.M. Pabasara U., Rebecca J. Yang, Eric Too, and Ron Wakefield. 2019a. “Design and Development of Distributed Solar PV Systems: Do the Current Tools Work?” Sustainable Cities and Society 45 (February): 553–78. https://doi.org/10.1016/j.scs.2018.11.035. Wills, Rosalie, James Milke, Sara Royle, and Kristin Steranka. 2015. Best Practices for Commercial Roof-Mounted Photovoltaic System Installation. Springer. Wu, Xing. 2011. “Fault Detection and Diagnosis of Photovoltaic Systems - University of Southern California.” https://uosc.primo.exlibrisgroup.com/discovery/fulldisplay?docid=alma991043206070903731&context=L&vi d=01USC_INST:01USC&lang=en&search_scope=MyInst_and_CI&adaptor=Local Search Engine&tab=Everything&query=any,contains,Fault Detection and Diagnosis of Photovoltaic Systems. Yan, Jiayi. 2017. “CFD Visualization: A Case Study for Using a Building Information Modeling with Virtual Reality.” University of Southern California. Yang, X, M Koehl, and P Grussenmeyer. 2017. “PARAMETRIC MODELLING OF AS-BUILT BEAM FRAMED STRUCTURE IN BIM ENVIRONMENT.” https://doi.org/10.5194/isprs-archives-XLII-2-W3-651-2017. 163 Appendix A A.1 Building and Environment Plug-in using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data; using System.Data.OleDb; using System.IO; using System.Windows.Forms; using Autodesk.Revit.ApplicationServices; using Autodesk.Revit.Attributes; using Autodesk.Revit.DB; using Autodesk.Revit.UI; using Autodesk.Revit.UI.Selection; using Autodesk.Revit.DB.Architecture; using Autodesk.Revit.DB.Analysis; using Autodesk.Revit.Creation; using WindowsForms_Environmental; namespace EnvironmentalAnalysis { [Transaction(TransactionMode.Manual)] [Regeneration(RegenerationOption.Manual)] public class EnvironmentalAnalysis : IExternalCommand { public static RoofBase selectedroof { get; set; } public static double selectlatitude { get; set; } public IList<double> declination { get; set; } public static IList<double> elevationangle { get; set; } public static IList<double> azimuthangle { get; set; } public static IList<XYZ> Revitsundirection { get; set; } public static IList<XYZ> Solarmodeldirection { get; set; } public static string tmyFile { get; set; } public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication uiapp = commandData.Application; Autodesk.Revit.DB.Document doc = uiapp.ActiveUIDocument.Document; DockablePaneProviderData dpdata = new DockablePaneProviderData(); string files = null; string spacings = null; WindowsForms_Environmental.Form1 solarform = new WindowsForms_Environmental.Form1(); if (solarform.ShowDialog() == DialogResult.OK) { //TaskDialog.Show("test", solarform.inputStr); files = solarform.inputStr; spacings = solarform.inputspacing; } else if (solarform.ShowDialog()==DialogResult.Cancel) { return Autodesk.Revit.UI.Result.Cancelled; } Transaction trans = new Transaction(doc); trans.Start("lab1"); //define pick roof surfaces Reference PickRoof = null; //select roof surfaces Selection SelRoof = uiapp.ActiveUIDocument.Selection; //fiter to only roof acceptable RoofFilter Selfilter = new RoofFilter(); PickRoof = SelRoof.PickObject(ObjectType.Element, Selfilter, "please select a roof surfaces"); //get selected element Element elem = doc.GetElement(PickRoof); //cast element to roofbase roof RoofBase roof = elem as RoofBase; //store it for the use in next section selectedroof = roof; // Get outface of the roof IList<Reference> roofFaces = HostObjectUtils.GetTopFaces(roof); //TaskDialog.Show("roof face count", roofFaces.Count().ToString()); Reference interiorFaceRef = null; Face face = null; Element projectInfoElements = new FilteredElementCollector(doc) .OfCategory(BuiltInCategory.OST_ProjectBasePoint) .FirstElement(); BuiltInParameter bipAtns = BuiltInParameter.BASEPOINT_ANGLETON_PARAM; 164 Parameter patns = projectInfoElements.get_Parameter( bipAtns); double trueNorthAngles = patns.AsDouble(); double trueNorth = Radiantodegree(trueNorthAngles); // Add the true north angle to the azimuth for (int i =0;i<roofFaces.Count();i++) { Reference interiorFace = roofFaces[i]; Face faces = roof.GetGeometryObjectFromReference(interiorFace) as Face; if (faces!=null) { XYZ top = faces.Evaluate(new UV(1,1)); interiorFaceRef = interiorFace; face = faces; break; } } TaskDialog.Show("roof face", face.Area.ToString()); BoundingBoxUV bbx = face.GetBoundingBox(); trans.Commit(); string filepath = @files; tmyFile = filepath; //read excel file IList<string> itemlist = Readexcel(filepath, 0, 4); string listnumber = itemlist.Count.ToString(); //read the latitude string variablename = itemlist.First(); double latitude = double.Parse(variablename); selectlatitude=latitude; // read UTC timezone IList<string> itemlist2 = Readexcel(filepath, 0, 3); string Utc = itemlist2.First(); double Utctime = double.Parse(Utc); //read Longitude IList<string> itemlist3 = Readexcel(filepath, 0, 5); string Longitudevalue = itemlist3.First(); double Longitude = Math.Abs(double.Parse(Longitudevalue)); //have a list of 365 day in 1,2,3.... IList<double> day = test3.EnumerableUtilities.RangePython(1, 366, 1).ToList(); //solar hour angle IList<double> Solarhourangle = Hourangle(Longitude, Utctime, day); //to excel System.Text.StringBuilder bbb = new System.Text.StringBuilder(); bbb.AppendLine("ID,Name,Marks"); foreach (var item in Solarhourangle) { bbb.AppendLine(item.ToString()); } Console.WriteLine(bbb.ToString()); System.IO.File.WriteAllText(@"C: \Users\ASUS\Desktop\apidata2\Environment\hourangle.csv", bbb.ToString()); // declination angle IList<double> declinationangle = Declinationangle(day); IList<double> declinationYear = new List<double>(); System.Text.StringBuilder sdg = new System.Text.StringBuilder(); sdg.AppendLine("ID,Name,Marks"); foreach (var item in declinationangle) { double word = item; for (int i = 0; i < 24; i++) { sdg.AppendLine(word.ToString()); declinationYear.Add(word); } } Console.WriteLine(sdg.ToString()); System.IO.File.WriteAllText(@"C: \Users\ASUS\Desktop\apidata2\environment\declination.csv", sdg.ToString()); // get solar elevation angle IList<double> solarelevationangle = Solarelevationangle(declinationYear, Solarhourangle, latitude); elevationangle = solarelevationangle; //get solar azimuth angle // Azimuth = cos-1 [(sin ¦Ä * cos ¦Õ - cos ¦Ä * sin ¦Õ * cos HRA) / cos ¦Á] IList<double> solarazimuthangle = Azimuthangle(declinationYear, solarelevationangle, Solarhourangle, latitude); azimuthangle = solarazimuthangle; String D1 = "Constructing solar motion model"; 165 TaskDialog.Show(" Solar Motion Model", D1); //z = sin(altitude) //hyp = cos(altitude) //y = hyp * cos(azimuth) //x = hyp * sin(azimuth) //vector = (x, y, z) // getting vector works of the sun IList<XYZ> sundirection = Sundirection(solarazimuthangle, solarelevationangle,trueNorth); Solarmodeldirection = sundirection; System.Text.StringBuilder see = new System.Text.StringBuilder(); see.AppendLine("ID,Name,Marks"); foreach (var item in sundirection) { see.AppendLine(item.ToString()); } Console.WriteLine(see.ToString()); System.IO.File.WriteAllText(@"C: \Users\ASUS\Desktop\apidata2\environment\sundirection transformed.csv", see.ToString()); Autodesk.Revit.DB.Document docs = uiapp.ActiveUIDocument.Document; Transaction transun = new Transaction(docs); transun.Start("sun1"); Autodesk.Revit.DB.View view = docs.ActiveView; SunAndShadowSettings sunsetting = view.SunAndShadowSettings; DateTime StartDate = new DateTime(2018, 1, 1); DateTime EndDate = new DateTime(2018, 12, 31); IList<DateTime> datetime = new List<DateTime>(); IList<DateTime> activeframe = new List<DateTime>(); foreach (DateTime days in EachDay(StartDate, EndDate)) { datetime.Add(days); } IList<double> timesss = test3.EnumerableUtilities.RangePython(0, 24, 1).ToList(); IList<XYZ> revitsun = new List<XYZ>(); foreach (var dat in datetime) { DateTime datee = dat; int year = dat.Year; int month = dat.Month; int date = dat.Day; foreach (var da in timesss) { double ti = da; DateTime sunstart = DateTime.SpecifyKind(new DateTime(year, month, date), DateTimeKind.Local); //DateTime sunrise = sunsetting.GetSunrise(DateTime.SpecifyKind(new DateTime(2018, 1, 1),DateTimeKind.Local)); // sunrise on April 20, 2011 //DateTime sunset = sunsetting.GetSunset(DateTime.SpecifyKind(new DateTime(2018, 1, 1), DateTimeKind.Local)); // sunset on April 22, 2011 sunsetting.SunAndShadowType = SunAndShadowType.StillImage; //sunsetting.StartDateAndTime = sunstart.AddHours(10); // start 2 hours after sunrise on April 20, 2011 sunsetting.StartDateAndTime = sunstart.AddHours(ti); //sunsetting.EndDateAndTime = sunstart.AddHours(1); // end 2 hours before sunset on April 22, 2011 if (sunsetting.IsTimeIntervalValid(SunStudyTimeInterval.Hour)) // check that this interval is valid for this SunAndShadowType sunsetting.TimeInterval = SunStudyTimeInterval.Hour; // check for validity of start and end times if (!(sunsetting.IsAfterStartDateAndTime(sunsetting.EndDateAndTime) && sunsetting.IsBeforeEndDateAndTime(sunsetting.StartDateAndTime))) TaskDialog.Show("Error", "Start and End dates are invalid"); // Set the initial direction of the sun at ground level (like sunrise level) XYZ initialDirection = XYZ.BasisY; DateTime time = sunsetting.GetFrameTime(sunsetting.ActiveFrame); activeframe.Add(time); // Get the altitude of the sun from the sun settings double altitude = sunsetting.GetFrameAltitude( sunsetting.ActiveFrame); // Create a transform along the X axis based on the altitude of the sun Transform altitudeRotation = Transform .CreateRotation(XYZ.BasisX, altitude); // Create a rotation vector for the direction of the altitude of the sun XYZ altitudeDirection = altitudeRotation .OfVector(initialDirection); // Get the azimuth from the sun settings of the scene double azimuth = sunsetting.GetFrameAzimuth( sunsetting.ActiveFrame); 166 // Correct the value of the actual azimuth with true north // Get the true north angle of the project Element projectInfoElement = new FilteredElementCollector(docs) .OfCategory(BuiltInCategory.OST_ProjectBasePoint) .FirstElement(); BuiltInParameter bipAtn = BuiltInParameter.BASEPOINT_ANGLETON_PARAM; Parameter patn = projectInfoElement.get_Parameter( bipAtn); double trueNorthAngle = patn.AsDouble(); // Add the true north angle to the azimuth double actualAzimuth = 2 * Math.PI - azimuth + trueNorthAngle; // Create a rotation vector around the Z axis Transform azimuthRotation = Transform .CreateRotation(XYZ.BasisZ, actualAzimuth); // Finally, calculate the direction of the sun XYZ sunDirection = azimuthRotation.OfVector( altitudeDirection); if (Math.Abs(sunDirection.Z) <= 0.01 ) { XYZ newsun = new XYZ(sunDirection.X, sunDirection.Y, 0); revitsun.Add(newsun); } else { revitsun.Add(sunDirection); } } } String D2 = "Processing Shading analysis"; TaskDialog.Show(" Shading analysis", D2); System.Text.StringBuilder dtime = new System.Text.StringBuilder(); dtime.AppendLine("RevitSun"); foreach (var item in revitsun) { dtime.AppendLine(item.ToString()); } Console.WriteLine(dtime.ToString()); System.IO.File.WriteAllText(@"C: \Users\ASUS\Desktop\apidata2\environment\revitsun.csv", dtime.ToString()); revitsun.RemoveAt(0); revitsun.Add(new XYZ(0,0,0)); Revitsundirection = revitsun; System.Text.StringBuilder bbbb = new System.Text.StringBuilder(); bbbb.AppendLine("Solarhourangle,solarelevationangle,solarazimuthangle"); for (int i = 0; i < Solarhourangle.Count(); i++) { bbbb.AppendLine(Solarhourangle[i].ToString() + "," + solarelevationangle[i].ToString() + "," + solarazimuthangle[i].ToString()); } Console.WriteLine(bbbb.ToString()); System.IO.File.WriteAllText(@"C: \Users\ASUS\Desktop\apidata2\environment\solar motion.csv", bbbb.ToString()); int spacing = Int32.Parse(spacings); IList<UV> uvPts = UVpoint(face, spacing, spacing); IList<XYZ> xyzPts = new List<XYZ>(); IList<int> deleteIndex = new List<int>(); int countIndex = 0; foreach (var pt in uvPts) { if (face.IsInside(pt)) { XYZ point = face.Evaluate(pt); xyzPts.Add(point); } else { deleteIndex.Add(countIndex); } countIndex++; } int delete_count = 0; foreach (var ind in deleteIndex) { uvPts.RemoveAt(ind - delete_count); delete_count++; } IList<double> averageradiations = new List<double>(); IList<double> accumulateradiations = new List<double>(); IList<IList<int>> shadingrates = new List<IList<int>>(); 167 foreach (var point in xyzPts) { XYZ points = point; //revit sun vector or solar motion vector //revitsun , sundirection IList<int> shadingrate = Shadingft(docs, points, revitsun); IList<double> beamflat = Beamradiationflat(solarelevationangle, shadingrate, filepath); IList<double> diffuseflat = Diffuseradiation(filepath, 0); IList<double> totalradiation = new List<double>(); for (int i = 0; i < beamflat.Count; i++) { double totalradi = beamflat[i] + diffuseflat[i]; totalradiation.Add(totalradi); } double averageradiation = totalradiation.Average(); double accumulateradiation = totalradiation.Sum(); averageradiations.Add(averageradiation); accumulateradiations.Add(accumulateradiation); //zip the points with radiation //should move the point to the center of the family and up with the tilt angle System.Text.StringBuilder ddtime = new System.Text.StringBuilder(); ddtime.AppendLine("shadingrate,beamflat,diffuseflat"); for (int i =0; i<shadingrate.Count;i++) { ddtime.AppendLine(shadingrate[i].ToString() + "," + beamflat[i].ToString() + "," + diffuseflat[i].ToString()); } Console.WriteLine(ddtime.ToString()); System.IO.File.WriteAllText(@"C: \Users\ASUS\Desktop\apidata2\environment\testpoint diffuse and beamflat.csv", ddtime.ToString()); } // new algortihm validating the result /*IList<double> averageradiationstest = new List<double>(); IList<double> accumulateradiationstest = new List<double>(); foreach (var point in xyzPts) { XYZ points = point; IList<int> shadingrate = Shadingft(docs, points, revitsun); IList<double> beam_inso = Inso_beam(day, solarelevationangle,shadingrate); IList<double> diff_inso = Inso_diff(day, beam_inso); IList<double> totalradiation = new List<double>(); for (int i = 0; i < beam_inso.Count; i++) { double totalradi = beam_inso[i] + diff_inso[i]; totalradiation.Add(totalradi); } double averageradiation = totalradiation.Average(); double accumulateradiation = totalradiation.Sum(); averageradiationstest.Add(averageradiation); accumulateradiationstest.Add(accumulateradiation); } System.Text.StringBuilder flatt = new System.Text.StringBuilder(); flatt.AppendLine("averageradiationstest,accumulateradiationstest"); for (int i = 0; i < averageradiationstest.Count; i++) { flatt.AppendLine(averageradiationstest[i].ToString() + "," + accumulateradiationstest[i].ToString()); } Console.WriteLine(flatt.ToString()); System.IO.File.WriteAllText(@"C: \Users\ASUS\Desktop\apidata2\environment\flatperformancetest.csv", flatt.ToString());*/ String D3 = "calculating solar insolation"; TaskDialog.Show(" solar insolation", D3); SetAnalysisDisplayStyle(doc,1); SpatialFieldManager sfm = SpatialFieldManager.GetSpatialFieldManager(doc.ActiveView); if (sfm == null) sfm = SpatialFieldManager.CreateSpatialFieldManager(doc.ActiveView, 1); List<double> doubleList = new List<double>(); IList<ValueAtPoint> valList = new List<ValueAtPoint>(); //assign insolation value to the corresonding points for (int i=0;i<uvPts.Count(); i++) { UV point = uvPts[i]; double insolation = accumulateradiations[i]; //doubleList.Add(v + DateTime.Now.Second); doubleList.Add(insolation); valList.Add(new ValueAtPoint(doubleList)); doubleList.Clear(); } // assign domain for the UV point based on the value and color surface setting FieldDomainPointsByUV pnts = new FieldDomainPointsByUV(uvPts); FieldValues vals = new FieldValues(valList); 168 //assign field maneger to face int idx = sfm.AddSpatialFieldPrimitive(interiorFaceRef); //create new analysis result schema AnalysisResultSchema resultSchema = new AnalysisResultSchema("Accumulated Solar Insolation", "Accumlated solar insolation for a TMY year"); //set the unit name and multiplier of the data IList<string> unitNames = new List<string>(); unitNames.Add("W/m2"); IList<double> multipliers = new List<double>(); multipliers.Add(1); //assign unit to schema resultSchema.SetUnits(unitNames, multipliers); //create solar map display sfm.UpdateSpatialFieldPrimitive(idx, pnts, vals, sfm.RegisterResult(resultSchema)); /*IList<double> averageTMY = new List<double>(); IList<double> accumulateTMY= new List<double>(); IList<double> declination = Declinationangless(day); string dec = declination.Count().ToString(); TaskDialog.Show("declination count", dec); foreach (var point in xyzPts) { XYZ points = point; IList<int> shadingrate = Shadingft(docs, points, revitsun); IList<double> beamflat = BeamflatTMY(latitude, declination, Solarhourangle, shadingrate, filepath) ; IList<double> diffuseflat = Diffuseradiation(filepath, 0); IList<double> alradiation = new List<double>(); for (int i = 0; i < beamflat.Count; i++) { double totalradi = beamflat[i] + diffuseflat[i]; alradiation.Add(totalradi); } System.Text.StringBuilder ddddtime = new System.Text.StringBuilder(); ddddtime.AppendLine("ID,Name,Marks"); foreach (var item in alradiation) { ddddtime.AppendLine(item.ToString()); } System.IO.File.WriteAllText(@"C: \Users\ASUS\Desktop\apidata1\TMYInsolation.csv", ddddtime.ToString()); double averageradiation = alradiation.Average(); double accumulateradiation = alradiation.Sum(); averageTMY.Add(averageradiation); accumulateTMY.Add(accumulateradiation); } System.Text.StringBuilder flata = new System.Text.StringBuilder(); flata.AppendLine("averageradiations,accumulateradiations"); for (int i = 0; i < averageTMY.Count; i++) { flata.AppendLine(averageTMY[i].ToString() + "," + accumulateTMY[i].ToString()); } Console.WriteLine(flata.ToString()); System.IO.File.WriteAllText(@"C: \Users\ASUS\Desktop\apidata2\flatperformanceTMY.csv", flata.ToString());*/ System.Text.StringBuilder flat = new System.Text.StringBuilder(); flat.AppendLine("averageradiations,accumulateradiations"); for (int i = 0; i < averageradiations.Count; i++) { flat.AppendLine(averageradiations[i].ToString() + "," + accumulateradiations[i].ToString()); } Console.WriteLine(flat.ToString()); System.IO.File.WriteAllText(@"C: \Users\ASUS\Desktop\apidata2\flatperformance.csv", flat.ToString()); transun.Commit(); return Result.Succeeded; } public IList<UV> UVpoint(Face face, double panellength, double width) { BoundingBoxUV bbx = face.GetBoundingBox(); double lowpointu = bbx.Min.U; double lowpointv = bbx.Min.V; double highpointu = bbx.Max.U; double highpointv = bbx.Max.V; List<double> Upts = new List<double>(); foreach (var i in EnumerableUtilities.RangePython((lowpointu + panellength), bbx.Max.U -panellength, panellength)) { Upts.Add(i); } IList<double> Vpts = new List<double>(); foreach (var s in EnumerableUtilities.RangePython((lowpointv + width), (highpointv - width), width)) { Vpts.Add(s); } 169 var cartesianProduct = from Upt in Upts from Vpt in Vpts select new { Upt, Vpt }; IList<UV> newpoints = new List<UV>(); foreach (var points in cartesianProduct) { UV newpoint = new UV(points.Upt, points.Vpt); newpoints.Add(newpoint); } return newpoints; } void SetAnalysisDisplayStyle (Autodesk.Revit.DB.Document doc, int numberstep) { AnalysisDisplayStyle analysisDisplayStyle = null; // Look for an existing analysis display style with a specific name FilteredElementCollector collector1 = new FilteredElementCollector(doc); ICollection<Element> collection = collector1.OfClass(typeof(AnalysisDisplayStyle)).ToElements(); var displayStyle = from element in collection where element.Name == "Display Style 1" select element; // If display style does not already exist in the document, create it if (displayStyle.Count() == 0) { AnalysisDisplayColoredSurfaceSettings coloredSurfaceSettings = new AnalysisDisplayColoredSurfaceSettings(); coloredSurfaceSettings.ShowGridLines = true; AnalysisDisplayColorSettings colorSettings = new AnalysisDisplayColorSettings(); Color orange = new Color(255, 205, 0); Color purple = new Color(200, 0, 200); colorSettings.MaxColor = orange; colorSettings.MinColor = purple; AnalysisDisplayLegendSettings legendSettings = new AnalysisDisplayLegendSettings(); legendSettings.NumberOfSteps = numberstep; legendSettings.Rounding = 1; legendSettings.ShowDataDescription = false; legendSettings.ShowLegend = true; FilteredElementCollector collector2 = new FilteredElementCollector(doc); ICollection<Element> elementCollection = collector2.OfClass(typeof(TextNoteType)).ToElements(); var textElements = from element in collector2 where element.Name == "LegendText" select element; // if LegendText exists, use it for this Display Style if (textElements.Count() > 0) { TextNoteType textType = textElements.Cast<TextNoteType>().ElementAt<TextNoteType>(0); //legendSettings.SetTextTypeId(textType.Id, doc); } analysisDisplayStyle = AnalysisDisplayStyle.CreateAnalysisDisplayStyle(doc, "Display Style 1", coloredSurfaceSettings, colorSettings, legendSettings); } else { analysisDisplayStyle = displayStyle.Cast<AnalysisDisplayStyle>().ElementAt<AnalysisDisplayStyle>(0); } // now assign the display style to the view doc.ActiveView.AnalysisDisplayStyleId = analysisDisplayStyle.Id; } public IList<double> Declinationangle(IList<double> day) { IList<double> declinationangle = new List<double>(); foreach (var da in day) { // Declination angle, denoted as ¦Ä, is the angle between the planes // of the equator and a line drawn from center of the sun to the center of the earth. // declination angle = 23.45 * sin ( 360 * (day-81) / 365) double Bvalue = da - 81; double ovalue = Degreetoradian(360 * Bvalue / 365); double declination = 23.45 * Math.Sin(ovalue); declinationangle.Add(declination); } return declinationangle; } public IList<double> Solarelevationangle(IList<double> declinationangle, IList<double> Solarhourangle, double latitude) { IList<double> solarelevationangle = new List<double>(); double lati = Degreetoradian(latitude); for (int i=0;i<Solarhourangle.Count();i++) { // Solar elevation angle, expressed as ¦Á, is the angular height of the //sun in the sky measured from the horizontal 0¡ã at sunrise and 90¡ã when //the sun is right overhead. //¦Á = sin?1 (sin ¦Ä sin ¦Õ + cos ¦Ä cos ¦Õ cos ¦Ó) double elev = Degreetoradian(declinationangle[i]); double hras = Degreetoradian(Solarhourangle[i]); double elev1 = Math.Sin(elev) * Math.Sin(lati); double elev2 = Math.Cos(elev) * Math.Cos(lati) * Math.Cos(hras); double slav = Math.Asin(elev1 + elev2); double sla = Radiantodegree(slav); 170 if (sla < 0) { sla = 0; solarelevationangle.Add(sla); } else { solarelevationangle.Add(sla); } } return solarelevationangle; } public IList<double> Azimuthangle(IList<double> declinationangle, IList<double> solarelevationangle, IList<double> Solarhourangle, double latitude) { IList<double> solarazimuthangle = new List<double>(); double lati = Degreetoradian(latitude); for (int i = 0; i < solarelevationangle.Count(); i++) { double decl = Degreetoradian(declinationangle[i]); double solarelev = Degreetoradian(solarelevationangle[i]); double solarhour = Degreetoradian(Solarhourangle[i]); double azim1 = Math.Sin(decl) * Math.Cos(lati); double azim2 = Math.Cos(decl) * Math.Sin(lati) * Math.Cos(solarhour); double azim3 = (azim1 - azim2) / Math.Cos(solarelev); double azim4 = Math.Acos(azim3); double azim5 = Radiantodegree(azim4); if (solarhour < 0) { solarazimuthangle.Add(azim5); } else { solarazimuthangle.Add(360 - azim5); } } return solarazimuthangle; } public IList<XYZ>Sundirection(IList<double> solarazimuthangle, IList<double> solarelevationangle,double northangle) { IList<XYZ> sundirection = new List<XYZ>(); for (int i = 0; i < solarazimuthangle.Count; i++) { double azimu = solarazimuthangle[i] - northangle; double elev = Degreetoradian(solarelevationangle[i]); double azim = Degreetoradian(azimu); double z = Math.Sin(elev); double hyp = Math.Cos(elev); double y = hyp * Math.Cos(azim); double x = hyp * Math.Sin(azim); XYZ se = new XYZ(x, y, z); sundirection.Add(se); } return sundirection; } public IList<double> BeamflatTMY( double latitude,IList<double> declination, IList<double> hourangle, IList<int> shadingrate, string filepath) { IList<string> itemlist = Readexcel(filepath, 2, 7); IList<double> beam = new List<double>(); double sinlati = Math.Sin(Degreetoradian(latitude)); double coslati = Math.Cos(Degreetoradian(latitude)); foreach (var item in itemlist) { beam.Add(double.Parse(item)); } // sin (declination) * sin (latitude) + cos (declination) * cos (latitude) * cos (HRA) IList<double> beamradiation = new List<double>(); for (int i = 0; i < beam.Count; i++) { double soladec = declination[i]; double solarhourangle = hourangle[i]; double beamradia = beam[i]; int rate = shadingrate[i]; double sindec = Math.Sin(Degreetoradian(soladec)); double cosdec = Math.Cos(Degreetoradian(soladec)); double coshra = Math.Cos(Degreetoradian(solarhourangle)); double angle = sindec * sinlati; double angles = cosdec * coslati * coshra; double angless = angle + angles; double beamfinal = beamradia * angless * rate; 171 beamradiation.Add(beamfinal); } return beamradiation; } public IList<double> Beamradiationflat(IList<double> solarelevation, IList<int> shadingrate, string filepath) { IList<string> itemlist = Readexcel(filepath, 2, 7); IList<double> beam = new List<double>(); foreach (var item in itemlist) { beam.Add(double.Parse(item)); } IList<double> beamradiation = new List<double>(); for (int i = 0; i < beam.Count; i++) { double solarelev = solarelevation[i]; double beamradia = beam[i]; int rate = shadingrate[i]; double beamradiat = beamradia * Math.Sin(Degreetoradian(solarelev)); double beamfinal = beamradiat * rate; beamradiation.Add(beamfinal); } return beamradiation; } public IList<double> Beamradiationtilt(IList<double> solarelevation, IList<int> shadingrate, IList<double>azimuthangle, string filepath, double tiltangle, double panelazimuth) { IList<string> itemlist = Readexcel(filepath, 2, 7); IList<double> beam = new List<double>(); foreach (var item in itemlist) { beam.Add(double.Parse(item)); } //IBC = IB ?(cos ¦Á sin ¦Â cos (¦Õ ? ¦Õ ) + sin ¦Á cos ¦Â) // test : change azimuth from "azimu - panelazimuth" to "360 -azimuth+ panelazimuth" IList<double> beamradiations = new List<double>(); for (int i = 0; i < beam.Count; i++) { double solarelev = solarelevation[i]; double beams = beam[i]; int rate = shadingrate[i]; double azimu = azimuthangle[i]; double beamr = Math.Cos(Degreetoradian(solarelev)) * Math.Sin(Degreetoradian(tiltangle)) * Math.Cos(Degreetoradian(360 - azimu + panelazimuth)); double beamra = Math.Sin(Degreetoradian(solarelev)) * Math.Cos(Degreetoradian(tiltangle)); double beamrad = (beamr + beamra) * beams * rate; beamradiations.Add(beamrad); } return beamradiations; } //paper methods public IList<double> Diffuseradiationtilt (string filepath, double tiltangle) { IList<string> itemlist = Readexcel(filepath, 2, 10); IList<double> diffuse = new List<double>(); double tilt = Degreetoradian(tiltangle); foreach (var item in itemlist) { double diff = double.Parse(item); double diffu = (1 + Math.Cos(tilt)) / 2; double diffus = diff * diffu; diffuse.Add(diffus); } return diffuse; } //pveducation.com methods public IList<double> Diffuseradiation(string filepath, double tiltangle) { IList<string> itemlist = Readexcel(filepath, 2, 10); IList<double> diffuse = new List<double>(); foreach (var item in itemlist) { double diff = double.Parse(item); double diffu = (180 - tiltangle) / 180; double diffus = diff * diffu; diffuse.Add(diffus); } return diffuse; } //from paper public IList<double> Reflectedradiation(string filepath, IList<double> skydiffuse, IList<double> solarelev, double reflectance) 172 { IList<string> itemlist = Readexcel(filepath, 2, 7); IList<double> reflect= new List<double>(); int count = 0; foreach (var sky in skydiffuse) { double skyrate = sky; for (int i = count; i < (count + 24); i++) { double direct = double.Parse(itemlist[i]); double elev = Degreetoradian( solarelev[i]); double refl = Math.Sin(elev) + skyrate; double reflec = direct * refl * reflectance; reflect.Add(reflec); } count = count + 24; } return reflect; } public IList<double>Reflectedradiationtilt(IList<double> reflectedradiation,double tiltangle) { IList<double> reflectedtilt = new List<double>(); foreach(var reflect in reflectedradiation) { double refl = 1 - Math.Cos(Degreetoradian(tiltangle)); double refle = refl / 2 * reflect; reflectedtilt.Add(refle); } return reflectedtilt; } //get data from excel into list public static IList<string> Readexcel(string filepath, int lineskip, int columnnumber) { IList<string> itemlist = new List<string>(); //read file by line and skip the first line var lines = System.IO.File.ReadAllLines(filepath).Skip(lineskip); foreach (string item in lines) { // split each line by comma var values = item.Split(','); // add those value into list of string itemlist.Add(values[columnnumber].ToString()); } return itemlist; } public double Degreetoradian(double angle) { return Math.PI * angle / 180; } public double Radiantodegree(double radian) { return radian * 180 / Math.PI; } public IList<double> Hourangle(double Longitude, double Utctime, IList<double> day) { //LSTM Local Standard Time Meridian LSTM= 15degree*Utctime double LSTM = Math.Abs(Utctime) * 15; IList<double> TC = new List<double>(); foreach (var da in day) { double Bvalue = da - 81; double ovalue = Degreetoradian(360 * Bvalue / 365); double Eot1 = (Math.Sin(2 * ovalue)) * 9.87; double Eot2 = (Math.Cos(ovalue)) * 7.53; double Eot3 = (Math.Sin(ovalue)) * 1.5; double Eotvalue = Eot1 - Eot2 - Eot3; //Time Correction Factor (TC) TC=4(longitude - LSTM) +Eot double Tcfactor = 4 * (Longitude - LSTM) + Eotvalue; //Local Solar Time (LST) TC.Add(Tcfactor); } IList<double> time = test3.EnumerableUtilities.RangePython(1, 25, 1).ToList(); IList<double> LST = new List<double>(); foreach (var tc in TC) { double tcvalue = tc; foreach (var ti in time) { double Localsolartime = tcvalue / 60 + ti; LST.Add(Localsolartime); } } IList<double> HRA = new List<double>(); foreach (var lst in LST) { 173 double hourangle = 15 * (lst - 12); HRA.Add(hourangle); } return HRA; } public IEnumerable<DateTime> EachDay(DateTime from, DateTime thru) { for (var day = from.Date; day.Date <= thru.Date; day = day.AddDays(1)) yield return day; } public IList<int> Shadingft (Autodesk.Revit.DB.Document doc, XYZ testpoint,IList<XYZ>revitsun) { FilteredElementCollector collector = new FilteredElementCollector(doc); Func<View3D, bool> isNotTemplate = v3 => !(v3.IsTemplate); View3D view3D = collector.OfClass(typeof(View3D)).Cast<View3D>().First<View3D>(isNotTemplate); // Use the center of the skylight bounding box as the start point. IList<double> shadingratios = new List<double>(); XYZ points = testpoint; IList<ReferenceWithContext> ddd = new List<ReferenceWithContext>(); IList<int> dde = new List<int>(); foreach (var vec in revitsun) { //not sure it. ElementClassFilter filter = new ElementClassFilter(typeof(Wall)); ElementClassFilter fi = new ElementClassFilter(typeof(Floor)); IList<Type> all = new List<Type>(); all.Add(typeof(Wall)); all.Add(typeof(Floor)); ElementMulticlassFilter Allfi = new ElementMulticlassFilter(all); ReferenceIntersector refIntersector = new ReferenceIntersector(Allfi, FindReferenceTarget.All, view3D); ReferenceWithContext referenceWithContext = refIntersector.FindNearest(points, vec); if (referenceWithContext != null) { ddd.Add(referenceWithContext); dde.Add(0); } else { dde.Add(1); } } return dde; } public double feettometer (double feet) { double result = feet * 0.3048; return result; } public double metertofeet (double meter) { double result = meter * 3.28084; return result; } public class RadianandDegree { public double Degreetoradian(double angle) { return Math.PI * angle / 180; } public double Radiantodegree(double radian) { return radian * 180 / Math.PI; } } public class declinationangle { public IList<double> Declinationangle(IList<double> day) { IList<double> declinationangle = new List<double>(); RadianandDegree rad = new RadianandDegree(); foreach (var da in day) { // Declination angle, denoted as ¦Ä, is the angle between the planes // of the equator and a line drawn from center of the sun to the center of the earth. double Bvalue = da - 81; double ovalue = rad.Degreetoradian(360 * Bvalue / 365); double declination = 23.45 * Math.Sin(ovalue); declinationangle.Add(declination); } return declinationangle; } } 174 public class RoofFilter : ISelectionFilter { public bool AllowElement(Element e) { //return true; return (e.Category.Id.IntegerValue.Equals((int)BuiltInCategory.OST_Roofs)); } public bool AllowReference(Reference r, XYZ p) { return false; } } public static class EnumerableUtilities { public static IEnumerable<double> RangePython(double start, double stop, double step = 1) { if (step == 0) throw new ArgumentException("Parameter step cannot equal zero."); if (start < stop && step > 0) { for (var i = start; i < stop; i += step) { yield return i; } } else if (start > stop && step < 0) { for (var i = start; i > stop; i += step) { yield return i; } } } public static IEnumerable<double> RangePython(double stop) { return RangePython(0, stop); } } } } A.1.1 Window Form 1: Environment using System; using System.IO; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Diagnostics; namespace WindowsForms_Environmental { public partial class Form1 : Form { public Form1() { InitializeComponent(); textBox2.Text = "3"; } //Boolean first_time_click = true; private void Form1_Load(object sender, EventArgs e) { //textBox2.ForeColor = System.Drawing.Color.Gray; textBox2.Text = "3"; } private void label1_Click(object sender, EventArgs e) { } private void groupBox1_Enter(object sender, EventArgs e) { } private void label2_Click(object sender, EventArgs e) { } private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { 175 Process.Start("https://rredc.nrel.gov/solar/old_data/nsrdb/1991-2005/tmy3/by_state_and_city.html"); } private void label3_Click(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { int size = -1; DialogResult result = openFileDialog1.ShowDialog(); // Show the dialog. string files = null; if (result == DialogResult.OK) // Test result. { string file = openFileDialog1.FileName; try { string text = File.ReadAllText(file); size = text.Length; } catch (IOException) { } files = file; } textBox1.Text = files; Console.WriteLine(size); // <-- Shows file size in debugging mode. Console.WriteLine(result); // <-- For debugging use. } private void button2_Click(object sender, EventArgs e) { /*DialogResult res = MessageBox.Show("Would you like to run the command?", "Confirm", MessageBoxButtons.YesNo ); if (res == System.Windows.Forms.DialogResult.No) { return; }*/ this.DialogResult = DialogResult.Cancel; this.Close(); } private void button3_Click(object sender, EventArgs e) { //Set Dialog Result and manually close the form this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } private void textBox1_TextChanged(object sender, EventArgs e) { } public string inputStr { //Extract information on text box get { return this.DialogResult == DialogResult.OK ? textBox1.Text : ""; } } private void label4_Click(object sender, EventArgs e) { } private void textBox2_TextChanged(object sender, EventArgs e) { //For_First_Click(); } public string inputspacing { get { return this.DialogResult == DialogResult.OK ? textBox2.Text : ""; } } private void textBox3_TextChanged(object sender, EventArgs e) { } } } 176 A.2 PV Module Plug-in using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Windows.Forms; using System.Threading.Tasks; using Autodesk.Revit.ApplicationServices; using Autodesk.Revit.Attributes; using Autodesk.Revit.DB; using Autodesk.Revit.UI; using Autodesk.Revit.UI.Selection; using Autodesk.Revit.DB.Architecture; using Autodesk.Revit.Creation; using Autodesk.Revit.DB.Analysis; namespace test3 { [Transaction(TransactionMode.Manual)] [Regeneration(RegenerationOption.Manual)] public class PVModule : IExternalCommand { public static IList<double> AverageInso { get; set; } public static IList<double> AccumulatedInso { get; set; } public static IList<double> AveragePerm2 { get; set; } public static IList<FamilyInstance> Fminstances { get; set; } public static IList<IList<double>> panelInso { get; set; } public static string file { get; set; } public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { //Get application and document objects UIApplication uiapp = commandData.Application; Autodesk.Revit.DB.Document doc = uiapp.ActiveUIDocument.Document; //Get project base point Element projectInfoElements = new FilteredElementCollector(doc) .OfCategory(BuiltInCategory.OST_ProjectBasePoint) .FirstElement(); BuiltInParameter bipAtns = BuiltInParameter.BASEPOINT_ANGLETON_PARAM; Parameter patns = projectInfoElements.get_Parameter( bipAtns); double trueNorthAngles = patns.AsDouble(); IList<double> solarelevationangle = EnvironmentalAnalysis.EnvironmentalAnalysis.elevationangle; IList<double> solarazimuthangle = EnvironmentalAnalysis.EnvironmentalAnalysis.azimuthangle; IList<XYZ> revitsun = EnvironmentalAnalysis.EnvironmentalAnalysis.Revitsundirection; IList<XYZ> solarmodelsun = EnvironmentalAnalysis.EnvironmentalAnalysis.Solarmodeldirection; double panellength = 5.5; double panelwidth = 3.125; //double spacing = 4.3; double trueNorth = Radiantodegree(trueNorthAngles); double latitude = EnvironmentalAnalysis.EnvironmentalAnalysis.selectlatitude; double tiltangle = latitude - 10; double panelazimuth = 180- trueNorth; try { Transaction trans = new Transaction(doc); trans.Start("lab1"); // extract selected roof RoofBase roof = EnvironmentalAnalysis.EnvironmentalAnalysis.selectedroof; //filtered element of the solar panels FilteredElementCollector collector = new FilteredElementCollector(doc); collector.OfClass(typeof(FamilySymbol)).OfCategory(BuiltInCategory.OST_ElectricalEquipment); Element photo = null; foreach (var col in collector) { if (col.Name.Contains("SunModule")) { photo = col; } } string filepath = EnvironmentalAnalysis.EnvironmentalAnalysis.tmyFile; // calculating minimum module spacing file = filepath; double winterelev = solarelevationangle[8505]; double winterazim = solarazimuthangle[8505]; double modulespacing = spacingcal(tiltangle, winterelev, winterazim, panelwidth); string modul = "module spacing = " + modulespacing.ToString(); string d3 = "calculating positioning factors of PV panel"; TaskDialog.Show("positioning factors", d3 ); 177 FamilySymbol symbol = photo as FamilySymbol; if (!symbol.IsActive) { symbol.Activate(); doc.Regenerate(); } IList<Reference> roofFaces = HostObjectUtils.GetTopFaces(roof); // Get outface of the roof Reference interiorFaceRef = null; Face face = null; for (int i = 0; i < roofFaces.Count(); i++) { Reference interiorFace = roofFaces[i]; Face faces = roof.GetGeometryObjectFromReference(interiorFace) as Face; if (faces != null) { interiorFaceRef = interiorFace; face = faces; break; } } //get the footprint of tilt panel double panelwidths = panelwidth * Math.Cos(Degreetoradian(tiltangle)); //get the new points from divided surfaces into grids //case study 2 gap_u = 1.25; gap_v = 2; //case study 1 gapu = ; gapv = //case study 3 gapu = 2; gapv = 2; double gap_u = 1.25; double gap_v = 2; IList<UV> newpoints = UVpoint(face, panellength, panelwidths, modulespacing, gap_u, gap_v); IList<UV> panelpoints = new List<UV>(); IList<XYZ> xyzPts = new List<XYZ>(); IList<int> deleteIndex = new List<int>(); int countIndex = 0; foreach (var pt in newpoints) { //detection methods for roof not facing south IList<UV> po = new List<UV>(); double u1 = pt.U + panellength / 2; double u2 = pt.U - panellength / 2; double v2 = pt.V + panelwidth; double v1 = pt.V; po.Add( new UV(u1, v1)); po.Add( new UV(u1, v2)); po.Add( new UV(u2, v2)); po.Add( new UV(u2, v1)); int count = 0; if (face.IsInside(pt)) { foreach (var p in po) { if (!face.IsInside(p)) { count ++; } } if (count==0) { XYZ point = face.Evaluate(pt); xyzPts.Add(point); } else { deleteIndex.Add(countIndex); } } else { deleteIndex.Add(countIndex); } countIndex++; } int deletepoint_count = 0; foreach (var ind in deleteIndex) { newpoints.RemoveAt(ind - deletepoint_count); deletepoint_count++; } string d4 = "calculating points for placing solar panel. points count = " + newpoints.Count().ToString(); TaskDialog.Show("analysis points", d4); //performaning solar insolation analysis on pv panels IList<double> averageradiationstilt = new List<double>(); IList<double> accumulateradiationstilt = new List<double>(); IList<double> averageproduction = new List<double>(); IList<double> accumulateproduction = new List<double>(); 178 EnvironmentalAnalysis.EnvironmentalAnalysis w = new EnvironmentalAnalysis.EnvironmentalAnalysis(); List<IList<double>> insolation = new List<IList<double>>(); foreach (var point in xyzPts) { //transforming the points to middle of the solar panel double zvalue = panelwidth / 2 * Math.Cos(Degreetoradian(90 - tiltangle)); double zfinal = point.Z + zvalue; double yvalue = zvalue / Math.Tan(Degreetoradian(90 - tiltangle)); double yfinal = point.Y - yvalue; XYZ points = new XYZ(point.X, yfinal, zfinal); // perfomring shading analysis on the points //revitsun or solarmodelsun IList<int> shadingrate = w.Shadingft(doc, points, revitsun); // performing beamradiation on tilt panels IList<double> beamflat = w.Beamradiationtilt(solarelevationangle, shadingrate, solarazimuthangle, filepath, tiltangle, panelazimuth); //performing diffused radiation on tilt panels IList<double> diffuseflat = w.Diffuseradiationtilt(filepath, tiltangle); // calculating the total radiation IList<double> totalradiation = new List<double>(); IList<double> average = new List<double>(); for (int i = 0; i < beamflat.Count; i++) { double totalradi = beamflat[i] + diffuseflat[i]; totalradiation.Add(totalradi); if (totalradi!=0) { average.Add(totalradi); } } System.Text.StringBuilder daddd = new System.Text.StringBuilder(); daddd.AppendLine("ID,Name,Marks"); foreach (var item in totalradiation) { daddd.AppendLine(item.ToString()); } Console.WriteLine(daddd.ToString()); System.IO.File.WriteAllText(@"C: \Users\ASUS\Desktop\apidata2\pvmodule\paneltotalinsolation.csv", daddd.ToString()); insolation.Add(totalradiation); double averageradiation = average.Average(); double avarageproduct = averageradiation * w.feettometer(panellength) * w.feettometer(panelwidth); double accumulateradiation = totalradiation.Sum(); double accumulatepro = accumulateradiation * w.feettometer(panellength) * w.feettometer(panelwidth); averageradiationstilt.Add(averageradiation); averageproduction.Add(avarageproduct); accumulateradiationstilt.Add(accumulateradiation); accumulateproduction.Add(accumulatepro); } trans.Commit(); string d5 = "calculating solar insolation on panel"; TaskDialog.Show("Insolation on Panel", d5); string d6 = "auto-placement"; TaskDialog.Show("auto-placement", d6); Transaction transss = new Transaction(doc); transss.Start("lab1"); IList<FamilyInstance> instances = new List<FamilyInstance>(); foreach (var uvpoints in newpoints) { XYZ location = face.Evaluate(uvpoints); XYZ normal = face.ComputeNormal(uvpoints); XYZ refDir = normal.CrossProduct(XYZ.BasisZ); FamilyInstance instance = doc.Create.NewFamilyInstance(interiorFaceRef, location, refDir, symbol); instances.Add(instance); //instances.Add(instance); foreach (Parameter p in instance.Parameters) { if (p.Definition.Name == "Solar Panel Angle") { p.Set(Degreetoradian(tiltangle)); } if (p.Definition.Name == "Panel spacing") { p.Set(modulespacing); } } } transss.Commit(); Transaction transsss = new Transaction(doc); 179 transsss.Start("lab1"); for (int i = 0; i < instances.Count; i++) { //each instance FamilyInstance instance = instances[i]; //each instance' Accumulated Insolation double accumulatedInsolation = accumulateproduction[i]; //each instance's Average Insolation double averageInsolation = averageproduction[i]; //each instance's average insolation per m2 double averagePerm2 = averageradiationstilt[i]; foreach (Parameter p in instance.Parameters) { if (p.Definition.Name == "Accumulated Insolation (W)") { p.Set(Math.Round(accumulatedInsolation,1)); } if (p.Definition.Name == "Average Insolation (W)") { p.Set(Math.Round(averageInsolation,1)); } if (p.Definition.Name == "Average Insolation (W/m2)") { p.Set(Math.Round(averagePerm2,1)); } } } transsss.Commit(); double baseline = 200; IList<Element> panel_delete = new List<Element>(); IList<int> deletepanel_index = new List<int>(); int index = 0; Transaction transt = new Transaction(doc); transt.Start("lab1"); foreach (var ins in instances) { Element e = ins as Element; foreach (Parameter p in ins.Parameters) { if (p.Definition.Name == "Average Insolation (W/m2)") { //delete element if insolation too load if (p.AsDouble() <=baseline ) { deletepanel_index.Add(index); panel_delete.Add(e); } //delete element if insolation else { ElementIntersectsElementFilter solarpanel = new ElementIntersectsElementFilter(e); FilteredElementCollector panelcollector = new FilteredElementCollector(doc); IList<Element> panelIntersectWall =panelcollector.OfClass(typeof(Wall)).WherePasses(solarpanel).ToElements(); if (panelIntersectWall.Count != 0) { panel_delete.Add(e); deletepanel_index.Add(index); } } break; } } index++; } transt.Commit(); foreach (Element passed in panel_delete) { using (Transaction delete = new Transaction(doc, "Delete element")) { delete.Start(); doc.Delete(passed.Id); delete.Commit(); } } int delete_count = 0; foreach (var inde in deletepanel_index) { instances.RemoveAt(inde- delete_count); averageproduction.RemoveAt(inde- delete_count); averageradiationstilt.RemoveAt(inde- delete_count); accumulateproduction.RemoveAt(inde- delete_count); accumulateradiationstilt.RemoveAt(inde- delete_count); insolation.RemoveAt(inde- delete_count); 180 delete_count++; } TaskDialog.Show("panel count", instances.Count().ToString()); Fminstances = instances; System.Text.StringBuilder aver = new System.Text.StringBuilder(); aver.AppendLine("averageradiationstilt,averageproduction,accumulateradiationstilt,accumulateproduction"); for (int i = 0; i < accumulateproduction.Count; i++) { aver.AppendLine(Math.Round(averageradiationstilt[i],1).ToString() + "," + Math.Round(averageproduction[i],1).ToString() + "," + Math.Round(accumulateradiationstilt[i],1).ToString() + "," + Math.Round(accumulateproduction[i],1).ToString()); } Console.WriteLine(aver.ToString()); System.IO.File.WriteAllText(@"C: \Users\ASUS\Desktop\apidata2\pvmodule\tiltpanelperformance.csv", aver.ToString()); AverageInso = averageproduction; AccumulatedInso = accumulateproduction; AveragePerm2 = averageradiationstilt; panelInso = insolation; return Result.Succeeded; } catch (Autodesk.Revit.Exceptions.OperationCanceledException) { return Result.Cancelled; } catch (Exception ex) { message = ex.Message; TaskDialog.Show("ERROR MESSAGES", ex.Message); return Result.Failed; } } public double spacingcal(double tiltangle, double winterelev, double winterazim, double panelwidth) { double module = Math.Sin(Degreetoradian(tiltangle)); double modules = Math.Tan(Degreetoradian(winterelev)); double modulespa = module * panelwidth / modules; double modu =panelwidth * Math.Cos(Degreetoradian(tiltangle)); //d =[sin (β)×L / tan (α)]×cos (φ_p - φ_s) //will check later for calculation double modulesp = Degreetoradian(winterazim - 180); double modulespac = Math.Cos(modulesp); double modulespace = modulespa * modulespac; //add the distance of the own panel double spacing = modu + modulespace; return spacing; } public IList<XYZ> solarpoints (IList<UV> newpoints, Autodesk.Revit.DB.Document doc, Face face, Reference interiorFaceRef, FamilySymbol symbol, double solarangle ) { IList<XYZ> solarpoints = new List<XYZ>(); IList<FamilyInstance> instances = new List<FamilyInstance>(); foreach (var uvpoints in newpoints) { XYZ location = face.Evaluate(uvpoints); solarpoints.Add(location); XYZ normal = face.ComputeNormal(uvpoints); XYZ refDir = normal.CrossProduct(XYZ.BasisZ); FamilyInstance instance = doc.Create.NewFamilyInstance(interiorFaceRef, location, refDir, symbol); //instances.Add(instance); foreach (Parameter p in instance.Parameters) { if (p.Definition.Name == "Solar Panel Angle") { p.Set(Degreetoradian(solarangle)); break; } } } return solarpoints; } public void Addparameters(Autodesk.Revit.DB.Document doc, string parametername, string familynamefilter, bool ifInstance) { FilteredElementCollector coll = new FilteredElementCollector(doc); IList<Element> families = coll.OfClass(typeof(Family)).ToElements(); List<string> paramNames = new List<string>(new string[] { parametername }); // Edit each family->sort parameters order->save to a new file->load back to the document. int count = 0; foreach (Family fam in families) { if (!fam.Name.ToString().Contains(familynamefilter) == true) 181 continue; Autodesk.Revit.DB.Document famDoc = doc.EditFamily(fam); using (Transaction t = new Transaction(famDoc, "Sort parameters.")) { t.Start(); foreach (string paramName in paramNames) { FamilyParameter FamParam = famDoc.FamilyManager.AddParameter(paramName, BuiltInParameterGroup.PG_DATA, ParameterType.Number, ifInstance); } t.Commit(); } string tmpFile = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly. GetExecutingAssembly().Location), fam.Name + ".rfa"); if (File.Exists(tmpFile)) File.Delete(tmpFile); famDoc.SaveAs(tmpFile); famDoc.Close(false); using (Transaction trans2 = new Transaction(doc, "Load family.")) { trans2.Start(); IFamilyLoadOptions famLoadOptions = new FamilyLoadOptions(); Family newFam = null; doc.LoadFamily(tmpFile, new FamilyLoadOptions(), out newFam); trans2.Commit(); } File.Delete(tmpFile); count++; } } public class RoofFilter : ISelectionFilter { public bool AllowElement(Element e) { //return true; return (e.Category.Id.IntegerValue.Equals((int)BuiltInCategory.OST_Roofs)); } public bool AllowReference(Reference r, XYZ p) { return false; } } public double getparametervalue(Autodesk.Revit.DB.Document doc, Element e, string parameter1) { ElementType type = doc.GetElement(e.GetTypeId()) as ElementType; //to get height of section Parameter h = type.LookupParameter(parameter1); double parameter = h.AsDouble(); return parameter; } public double Settypeparameter(Autodesk.Revit.DB.Document doc, string name, string targetparameter) { Element e = FindElementbyname(doc, typeof(ElementType), name); ElementType type = doc.GetElement(e.GetTypeId()) as ElementType; Parameter rotation = type.LookupParameter("Solar Panel Angle"); double angle = rotation.AsDouble(); return angle; } public Element FindElementbyname(Autodesk.Revit.DB.Document doc, Type targetType, string Targetname) { return new FilteredElementCollector(doc).OfClass(targetType).FirstOrDefault<Element>(e => e.Name.Equals(Targetname)); } public double Degreetoradian(double angle) { return Math.PI * angle / 180; } public double Radiantodegree(double radian) { return radian * 180 / Math.PI; } public IList<UV> UVpoint(Face face, double panellength, double panelwidths, double modulespacing, double gap_u, double gap_v) { 182 BoundingBoxUV bbx = face.GetBoundingBox(); string uv = bbx.Max.ToString(); string minuv = bbx.Min.ToString(); double lowpointu = bbx.Min.U; double lowpointv = bbx.Min.V; double highpointu = bbx.Max.U; double highpointv = bbx.Max.V; //case 2 List<double> Upts = new List<double>(); foreach (var i in EnumerableUtilities.RangePython((lowpointu + panellength / 2) + gap_u, (highpointu - panellength / 2), panellength)) { Upts.Add(i); } //case 2 - module spacing -0.5 IList<double> Vpts = new List<double>(); foreach (var s in EnumerableUtilities.RangePython(lowpointv + gap_v, (highpointv - panelwidths) - gap_v, modulespacing- 0.5)) { Vpts.Add(s); } var cartesianProduct = from Upt in Upts from Vpt in Vpts select new { Upt, Vpt }; IList<UV> newpoints = new List<UV>(); foreach (var points in cartesianProduct) { UV newpoint = new UV(points.Upt, points.Vpt); newpoints.Add(newpoint); } return newpoints; } private class FamilyLoadOptions : IFamilyLoadOptions { public bool OnFamilyFound(bool familyInUse, out bool overwriteParameterValues) { overwriteParameterValues = true; return true; } public bool OnSharedFamilyFound(Family sharedFamily, bool familyInUse, out FamilySource source, out bool overwriteParameterValues) { source = FamilySource.Family; overwriteParameterValues = true; return true; } } } public class class2 : IExternalCommand { public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication uiapp = commandData.Application; Autodesk.Revit.DB.Document doc = uiapp.ActiveUIDocument.Document; return Result.Succeeded; } } } A.3 PV System Plug-in using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.IO; using System.Windows.Forms; using System.Threading.Tasks; using Autodesk.Revit.ApplicationServices; using Autodesk.Revit.Attributes; using Autodesk.Revit.DB; using Autodesk.Revit.DB.Events; using Autodesk.Revit.UI; using Autodesk.Revit.UI.Selection; using Autodesk.Revit.DB.Architecture; using Autodesk.Revit.DB.Analysis; namespace systemanalysis { [Transaction(TransactionMode.Manual)] [Regeneration(RegenerationOption.Manual)] 183 public class PVsystem : IExternalCommand { List<ElementId> _added_element_ids = new List<ElementId>(); public static IList<IList<double>> PVoutput { get; set; } public static double DCpower { get; set; } public static double ACpower { get; set; } public static double panelamount { get; set; } public static IList<double> PVouts { get; set; } public static double PVSum { get; set; } public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication uiapp = commandData.Application; UIDocument uidoc = uiapp.ActiveUIDocument; Autodesk.Revit.DB.Document doc = uidoc.Document; Autodesk.Revit.ApplicationServices.Application app = uiapp.Application; //define system double panelEfficiency = 0.15; double NOCT=0; double tempeCo = 0; double ratedPower = 0; double inverterEy = 0; //define system loss factors default value double soiling = 0; double snow = 0; double mismatch = 0; double wiring = 0; double availability = 0; double aging = 0; double nameplate = 0; double others = 0; string invertername = null; //DockablePaneProviderData dpdata = new DockablePaneProviderData(); Form1 solarform = new Form1(); DialogResult formshow = solarform.ShowDialog(); if (formshow == DialogResult.OK) { ratedPower = Int32.Parse(solarform.PVRated); NOCT = Int32.Parse(solarform.NOCT); tempeCo = Convert.ToDouble(solarform.TempCoefficient); invertername = solarform.InverterName; inverterEy = Convert.ToDouble(solarform.InverterEfficiency); soiling = Convert.ToDouble(solarform.Soiling); snow = Convert.ToDouble(solarform.Snow); mismatch = Convert.ToDouble(solarform.Mismatch); wiring= Convert.ToDouble(solarform.Wiring); availability= Convert.ToDouble(solarform.Availability); aging= Convert.ToDouble(solarform.Aging); nameplate = Convert.ToDouble(solarform.Nameplate); others = Convert.ToDouble(solarform.Others); } else if (formshow == DialogResult.Cancel) { return Autodesk.Revit.UI.Result.Cancelled; } //add parameter to Transaction trans = new Transaction(doc); string parametername = "System Losses"; string parametername1 = "DC Input"; string parametername2 = "AC Output"; string familyname = "TRIO"; bool ifInstance = false; test3.PVModule pvsection = new test3.PVModule(); string s1 = "adding new parameters to the inverter family"; TaskDialog.Show("adding new parameter", s1); pvsection.Addparameters(doc, parametername, familyname, ifInstance); pvsection.Addparameters(doc, parametername1, familyname, ifInstance); pvsection.Addparameters(doc, parametername2, familyname, ifInstance); //define the variable of PV panel, which will later as input IList<IList<double>> solarinsolation = test3.PVModule.panelInso; //extra information of accumlated insolation from PV module IList<double> totalinsolation = test3.PVModule.AccumulatedInso; string filepath = test3.PVModule.file ; //get the list of temperature from tmy3 IList<double> dryTemperature = dryBulb(filepath); //extra information of solar insolation from PV module section //Option 1 IList<double> easyOutput = new List<double>(); //easy way to calculate PV panel output foreach (var insolation in totalinsolation) { 184 double easyout = insolation * panelEfficiency; easyOutput.Add(easyout); } System.Text.StringBuilder dtime = new System.Text.StringBuilder(); dtime.AppendLine("easyOutput"); foreach (var item in easyOutput) { dtime.AppendLine(item.ToString()); } Console.WriteLine(dtime.ToString()); System.IO.File.WriteAllText(@"C: \Users\ASUS\Desktop\apidata2\pvsystem\easyoutput.csv", dtime.ToString()); string s2 = "calculating Solar Panel DC output"; TaskDialog.Show("solar panel output", s2); //Option 2 // define List collecting output IList<double> averageOutput = new List<double>(); IList<double> accumulatedOutput = new List<double>(); IList<IList<double>> outputlist = new List<IList<double>>(); //more accurate calculation fo the PV panel output foreach (var point in solarinsolation) { IList<double> yearinso = point; IList<double> PVout = new List<double>(); IList<double> average = new List<double>(); for (int i = 0; i < yearinso.Count; i++) { //cell temperature calculation //TC = Tair + GT / 800 x (NOCT – 20) double temperature = dryTemperature[i]; double insolation = yearinso[i]; double NOCTs = (NOCT - 20) / 800; double insolat = insolation * NOCTs; double cellTemp = temperature + insolat; //PV energy output //P_dch=P_stc×G_T⁄1000×[1-γ(T_c-25)] double insol = insolation / 1000; double inso = ratedPower * insol; double temperco = cellTemp - 25; double tempercoe = temperco * tempeCo; double tempercoef = 1 - tempercoe; double PVoutput = inso * tempercoef; PVout.Add(PVoutput); if (PVoutput != 0) { average.Add(PVoutput); } } //add list of list for hour data for every panel outputlist.Add(PVout); //sum and average output calculation and store in the lists double averageOut = average.Average(); double accumulOut = PVout.Sum(); averageOutput.Add(averageOut); accumulatedOutput.Add(accumulOut); } string s3 = "Calculating system output"; TaskDialog.Show("system output", s3); PVoutput = outputlist; PVouts = accumulatedOutput; PVSum = accumulatedOutput.Sum(); System.Text.StringBuilder daddd = new System.Text.StringBuilder(); daddd.AppendLine("accumulatedOutput,averageOutput"); for (int i =0; i< accumulatedOutput.Count();i++) { daddd.AppendLine(Math.Round(accumulatedOutput[i],1).ToString() + "," + Math.Round(averageOutput[i],1).ToString()); } Console.WriteLine(daddd.ToString()); System.IO.File.WriteAllText(@"C: \Users\ASUS\Desktop\apidata2\pvsystem\Panel output.csv", daddd.ToString()); // Monthly output IList<double> monthlyOutput = Monthlyouput(outputlist); System.Text.StringBuilder dadddd = new System.Text.StringBuilder(); dadddd.AppendLine("monthlyOutput"); foreach (var item in monthlyOutput) { dadddd.AppendLine(item.ToString()); } Console.WriteLine(dadddd.ToString()); System.IO.File.WriteAllText(@"C: \Users\ASUS\Desktop\apidata2\pvsystem\monthlyout.csv", dadddd.ToString()); //system loss factors 185 double lossFt = lossFactor(soiling, snow, mismatch, wiring, availability, aging, nameplate, others); //PV output power double PVEnergy = accumulatedOutput.Sum(); //DC power get into inverter double DCPower = (1 - lossFt) * PVEnergy; DCpower = DCPower; //AC power from inverter double ACPower = DCPower * inverterEy; ACpower = ACPower; //Recommended invetersizing double InverterSizing = DCPower / 1.2; IList<FamilyInstance> instances = test3.PVModule.Fminstances; double panelcount = instances.Count(); panelamount = panelcount; Transaction transsss = new Transaction(doc); transsss.Start("lab1"); for (int i = 0; i < instances.Count; i++) { //each instance FamilyInstance instance = instances[i]; //each instance' Accumulated DC Output double dcOutput = accumulatedOutput[i]; //each instance's Average DC Output double averagedc = averageOutput[i]; foreach (Parameter p in instance.Parameters) { if (p.Definition.Name == "Average DC Power Output") { string parmet = p.AsValueString(); p.Set(Math.Round(averagedc,1)); } if (p.Definition.Name == "DC Power Output") { p.Set(Math.Round(dcOutput,1)); } } } transsss.Commit(); //place inverter by user FilteredElementCollector collector = new FilteredElementCollector(doc); collector.OfCategory(BuiltInCategory.OST_ElectricalEquipment); collector.OfClass(typeof(FamilySymbol)); Element inverter = null; foreach (var col in collector) { if (col.Name.Contains("TRIO")) { inverter = col; } } FamilySymbol symbol = inverter as FamilySymbol; _added_element_ids.Clear(); app.DocumentChanged += new EventHandler<DocumentChangedEventArgs>( OnDocumentChanged); try { uidoc.PromptForFamilyInstancePlacement(symbol); } catch (Autodesk.Revit.Exceptions.OperationCanceledException ex) { Debug.Print(ex.Message); } app.DocumentChanged -= new EventHandler<DocumentChangedEventArgs>( OnDocumentChanged); int n = _added_element_ids.Count; TaskDialog.Show( "Place Family Instance", string.Format( "{0} element{1} added.", n, ((1 == n) ? "" : "s"))); //write parameter into inverter 186 writeparameter(doc, inverter, lossFt, DCPower, ACPower); return Result.Succeeded; } void OnDocumentChanged(object sender, DocumentChangedEventArgs e) { // this does not work, because the handler will // be called each time a new instance is added, // overwriting the previous ones recorded: // //_added_element_ids = e.GetAddedElementIds(); _added_element_ids.AddRange(e.GetAddedElementIds()); } public IList<double> dryBulb(string filepath) { IList<string> itemlist = Readexcel(filepath, 2, 31); IList<double> dryBulb = new List<double>(); foreach (var item in itemlist) { dryBulb.Add(double.Parse(item)); } return dryBulb; } public double lossFactor(double soiling, double snow, double mismatch, double wiring, double availability, double aging, double nameplate, double others) { double soil = 1 - soiling; double sno = 1 - snow; double mismat = 1 - mismatch; double wire = 1 - wiring; double available = 1 - availability; double age = 1 - aging; double name = 1 - nameplate; double other = 1 - others; double tota = soil * sno * mismat * wire * available * age * name * other; double total = 1 - tota; return total; } public IList<string> Readexcel(string filepath, int lineskip, int columnnumber) { IList<string> itemlist = new List<string>(); //read file by line and skip the first line var lines = System.IO.File.ReadAllLines(filepath).Skip(lineskip); foreach (string item in lines) { // split each line by comma var values = item.Split(','); // add those value into list of string itemlist.Add(values[columnnumber].ToString()); } return itemlist; } public void writeparameter(Document doc, Element item, double losses, double dcOut, double acOut) { Transaction transaction = new Transaction(doc); transaction.Start("fefeefefe"); //modify family type parameters ParameterSet parameters = item.Parameters; foreach (Parameter item1 in parameters) { if (item1.Definition.Name == "System Losses") { item1.Set(Math.Round(losses,3)); } if (item1.Definition.Name == "DC Input") { item1.Set(Math.Round(dcOut,1)); } if (item1.Definition.Name == "AC Output") { item1.Set(Math.Round(acOut,1)); } } transaction.Commit(); } public IList<double> Monthlyouput (IList<IList<double>> outputlist) { IList<double> monthly = new List<double>(); 187 int countelev = 0; foreach (var outp in outputlist) { // Solar elevation angle, expressed as α, is the angular height of the //sun in the sky measured from the horizontal 0° at sunrise and 90° when //the sun is right overhead. //α = sin−1 (sin δ sin φ + cos δ cos φ cos τ) IList<double> solu = new List<double>(); IList<double> output = outp; foreach (var hra in output.Skip(countelev).Take(730)) { solu.Add(hra); } double mont = solu.Sum(); monthly.Add(mont); countelev += 730; } return monthly; } } } A3.1 Window Form 2: PV System using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace systemanalysis { public partial class Form1 : Form { public Form1() { InitializeComponent(); textBox1.Text = "245"; textBox2.Text = "45"; textBox3.Text = "0.0045"; textBox4.Text = "TRIO"; textBox5.Text = "0.96"; textBox6.Text = "0.02"; textBox7.Text = "0"; textBox8.Text = "0.02"; textBox9.Text = "0.025"; textBox10.Text = "0.03"; textBox11.Text = "0"; textBox12.Text = "0.01"; textBox13.Text = "0"; } private void label1_Click(object sender, EventArgs e) { } private void label2_Click(object sender, EventArgs e) { } private void label13_Click(object sender, EventArgs e) { } private void textBox1_TextChanged(object sender, EventArgs e) { } private void textBox2_TextChanged(object sender, EventArgs e) { } private void label15_Click(object sender, EventArgs e) { } private void textBox9_TextChanged(object sender, EventArgs e) 188 { } private void textBox8_TextChanged(object sender, EventArgs e) { } private void textBox7_TextChanged(object sender, EventArgs e) { } private void textBox6_TextChanged(object sender, EventArgs e) { } private void textBox13_TextChanged(object sender, EventArgs e) { } private void textBox11_TextChanged(object sender, EventArgs e) { } private void button2_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; this.Close(); } private void button1_Click(object sender, EventArgs e) { this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } public string PVRated { get { return this.DialogResult == DialogResult.OK ? textBox1.Text : ""; } } public string NOCT { get { return this.DialogResult == DialogResult.OK ? textBox2.Text : ""; } } public string TempCoefficient { get { return this.DialogResult == DialogResult.OK ? textBox3.Text : ""; } } public string InverterName { get { return this.DialogResult == DialogResult.OK ? textBox4.Text : ""; } } public string InverterEfficiency { get { return this.DialogResult == DialogResult.OK ? textBox5.Text : ""; } } public string Soiling { get { return this.DialogResult == DialogResult.OK ? textBox6.Text : ""; } } public string Snow { get { return this.DialogResult == DialogResult.OK ? textBox7.Text : ""; } } public string Mismatch { get { return this.DialogResult == DialogResult.OK ? textBox8.Text : ""; } } public string Wiring { get { return this.DialogResult == DialogResult.OK ? textBox9.Text : ""; } } public string Availability { get { return this.DialogResult == DialogResult.OK ? textBox10.Text : ""; } } public string Aging { get { return this.DialogResult == DialogResult.OK ? textBox11.Text : ""; } } public string Nameplate { get { return this.DialogResult == DialogResult.OK ? textBox12.Text : ""; } } public string Others { get { return this.DialogResult == DialogResult.OK ? textBox13.Text : ""; } } 189 private void label5_Click(object sender, EventArgs e) { } } } A.4 Financial Feasibility Plug-in using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.IO; using System.Threading.Tasks; using Autodesk.Revit.ApplicationServices; using Autodesk.Revit.Attributes; using Autodesk.Revit.DB; using Autodesk.Revit.DB.Events; using Autodesk.Revit.UI; using Autodesk.Revit.UI.Selection; using Autodesk.Revit.DB.Architecture; using Autodesk.Revit.DB.Analysis; using System.Data; using System.Windows.Forms; namespace financialfeasibility { [Transaction(TransactionMode.Manual)] [Regeneration(RegenerationOption.Manual)] public class financialanalysis : IExternalCommand { public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication uiapp = commandData.Application; UIDocument uidoc = uiapp.ActiveUIDocument; Autodesk.Revit.DB.Document doc = uidoc.Document; Autodesk.Revit.ApplicationServices.Application app = uiapp.Application; //define cost double inverter = 0; double structural = 0; double electrical = 0; double installation = 0; double connection = 0; double overhead = 0; double customer = 0; double supplychain = 0; double sale = 0; double profit = 0; //define cash flow double OandM = 0; double OMgrowthrate = 0; double Taxcreidt = 0; double statetax = 0; double federaltax = 0; double investmentIncentive = 0; double captialincentive = 0; double degregationRate = 0; double discountRate = 0; double performanceIncentive = 0; double eprice = 0; double lifecycle = 0; double loanYear = 0; double loanInterest = 0; DockablePaneProviderData dpdata = new DockablePaneProviderData(); Form1 solarform = new Form1(); if (solarform.ShowDialog() == DialogResult.OK) { inverter = Convert.ToDouble(solarform.Inverter); structural = Convert.ToDouble(solarform.Structural); electrical = Convert.ToDouble(solarform.Electrical); installation = Convert.ToDouble(solarform.Installation); connection = Convert.ToDouble(solarform.Connection); overhead = Convert.ToDouble(solarform.Overhead); customer = Convert.ToDouble(solarform.Customer); supplychain = Convert.ToDouble(solarform.Supplychain); sale = Convert.ToDouble(solarform.Sale); profit = Convert.ToDouble(solarform.Profit); OandM = Convert.ToDouble(solarform.oandm); OMgrowthrate = Convert.ToDouble(solarform.omgrowthrate)/100; Taxcreidt = Convert.ToDouble(solarform.taxcreidt) / 100; statetax = Convert.ToDouble(solarform.Statetax) / 100; federaltax = Convert.ToDouble(solarform.Federaltax) / 100; investmentIncentive = Convert.ToDouble(solarform.Investment) / 100; captialincentive = Convert.ToDouble(solarform.Capital) / 100; 190 degregationRate = Convert.ToDouble(solarform.Degregation) / 100; discountRate = Convert.ToDouble(solarform.Discount) / 100; performanceIncentive = Convert.ToDouble(solarform.Performance) / 100; eprice = Convert.ToDouble(solarform.Eprice); lifecycle = Convert.ToDouble(solarform.Life); loanYear = Convert.ToDouble(solarform.Loan); loanInterest = Convert.ToDouble(solarform.Loaninterest) / 100; } else if (solarform.ShowDialog() == DialogResult.Cancel) { return Autodesk.Revit.UI.Result.Cancelled; } //extra information from last sections double DCpower = systemanalysis.PVsystem.DCpower; double ACpower = systemanalysis.PVsystem.ACpower; double ACkw = ACpower / 1000; IList<double> PanelDC = systemanalysis.PVsystem.PVouts; double DCpanel = PanelDC.Sum(); double DCSum = systemanalysis.PVsystem.PVSum; double DCkw = DCSum / 1000; //sum of the cost per Wdc system double total = inverter + structural + electrical + installation + connection + overhead + customer + supplychain + sale + profit; // total cost of the system double totalcost = DCkw * total; string costString = "Total Cost = " + Math.Round(totalcost, 2).ToString() + " USD"; TaskDialog.Show("totalcost", costString); //define types of buildings and default electricity use //user definition on the building string buildingtype = "residential"; double household = 3; double floorarea = 3000; // price of electricity based on US average double erate_resid = 0.1309; double erate_commer = 0.1062; double erate_indus = 0.0693; //determine the electricity use of the system double electricityuse = 0; if (electricityuse == 0) { if (buildingtype == "Residential") { electricityuse = 10972 * household * erate_resid; } else if (buildingtype == "Education") { electricityuse = 11 * floorarea * erate_commer; } else if (buildingtype == "Food") { electricityuse = 45.5 * floorarea * erate_commer; } else if (buildingtype == "Healthcare") { electricityuse = 25.8 * floorarea * erate_commer; } else if (buildingtype == "Lodging") { electricityuse = 15.3 * floorarea * erate_commer; } else if (buildingtype == "Office") { electricityuse = 15.9 * floorarea * erate_commer; } else if (buildingtype == "Public assmebly") { electricityuse = 14.5 * floorarea * erate_commer; } else if (buildingtype == "Services") { electricityuse = 8.3 * floorarea * erate_commer; } else if (buildingtype == "Warehouse") { electricityuse = 6.6 * floorarea * erate_indus; } } //define input of finanical cash flow //effective tax rate double effective = (1 - federaltax) * statetax; double effectivetax = effective + federaltax; 191 //define list of receive number for cash flow and payback period IList<double> Energyvalue = new List<double>(); IList<double> StateTaxSaving = new List<double>(); IList<double> federaltaxSaving = new List<double>(); IList<double> totalPBI = new List<double>(); IList<double> operaitngcost = new List<double>(); IList<double> cashflow = new List<double>(); IList<double> Cumulativecashflow = new List<double>(); IList<double> cumulativecashflowNofirst = new List<double>(); IList<double> Energyproduced = new List<double>(); //list for LOCE calculation IList<double> income = new List<double>(); IList<double> expense = new List<double>(); //IBI and CBI incentive given in year 0 double IBI = totalcost * investmentIncentive; double CBI = totalcost * captialincentive; double taxcredit = totalcost * Taxcreidt; //cash flow in year 0 double year0 = IBI + CBI - totalcost; //Add value to specific lists cashflow.Add(year0); expense.Add(Math.Abs(year0)); income.Add(0); //year1 tax costed by IBI and CBI income double year1tax = (IBI + CBI) * effectivetax; double year1state = (IBI + CBI) * statetax; double year1federal = year1tax - year1state; //year 1 tax costed by PBI income double year1PBI = ACpower * performanceIncentive / 1000; totalPBI.Add(year1PBI); double year1PBI_tax = year1PBI * effectivetax; //year1 state IBI, CBI and PBI taxs double year1PBI_state = year1PBI * statetax; double year1states = year1PBI_state + year1federal; StateTaxSaving.Add(year1states); //year1 federal all double year1PBI_federal = year1PBI_tax - year1PBI_state; double year1federals = taxcredit - year1PBI_federal - year1federal; federaltaxSaving.Add(year1federals); //year 1 operation cost double year1operate = ACkw / 1000 * OandM; operaitngcost.Add(year1operate); //year 1 energy value double year1energy = ACpower / 1000 * eprice; Energyvalue.Add(year1energy); //year 1 income double year1inc = ACpower/1000 * (1 + discountRate); income.Add(year1inc); //year 1 cash flow double year1cashflow = year1energy - year1states + year1federals + year1PBI - year1operate; cashflow.Add(year1cashflow); cumulativecashflowNofirst.Add(year1cashflow); Cumulativecashflow.Add(year0 + year1cashflow); //year 1 expense double year1exp = year1states + year1operate-year1federals - year1PBI ; double year1dep = 1 + discountRate; double year1expense = year1exp / year1dep; expense.Add(year1expense); //year 1 factors double electricity_produced = ACpower / 1000; double electricity_price = eprice; double operating_cost = year1operate; double cumulative_Nofirst = year1cashflow; double cumulative_first = year0 + year1cashflow; for (int i = 2; i < lifecycle + 1; i++) { //electricity production and stored double electricityproduced = electricity_produced * (1 + degregationRate); Energyproduced.Add(electricityproduced); //update electricity produced electricity_produced = electricityproduced; //electricity value double electricityprice = electricity_price * (1 + discountRate); 192 double electricityvalue = electricityproduced * electricityprice; //update electricity price and value stored electricity_price = electricityprice; Energyvalue.Add(electricityvalue); double totBPI = 0; double taxState = 0; double taxFederal = 0; //update PBI incentive if (i < 11) { totBPI = electricityproduced * performanceIncentive; totalPBI.Add(totBPI); //total tax for BPI double taxTOT = totBPI * effectivetax; //state tax for BPI taxState = totBPI * statetax; StateTaxSaving.Add(taxState); //federal tax for BPI taxFederal = taxTOT - taxState; federaltaxSaving.Add(taxFederal); } // operating cost double operatingCost = operating_cost * (1 + OMgrowthrate); operating_cost = operatingCost; operaitngcost.Add(operatingCost); //calculating cash flow double Cash_flow = electricityvalue - taxState - taxFederal + totBPI - operatingCost; cashflow.Add(Cash_flow); //cumulative cash flow without year 0 double cumulativeNo = cumulative_Nofirst + Cash_flow; cumulative_Nofirst = cumulativeNo; cumulativecashflowNofirst.Add(cumulativeNo); //cumulative cash flow with year 0 double cumulativeWith = cumulative_first + Cash_flow; cumulative_first = cumulativeWith; Cumulativecashflow.Add(cumulativeWith); //expense double yearexp = operatingCost + taxState + taxFederal - totBPI; double yeardiscount = Math.Pow(1 + discountRate, i); double yearexpense = yearexp / yeardiscount; expense.Add(yearexpense); //income double yearincome = electricityproduced / yeardiscount; income.Add(yearincome); } IList<double> negative = Cumulativecashflow.Where(i => i <= 0).ToList(); // X=(N×a-M×b)/(N-M) int paybackone = negative.Count(); int payback = paybackone - 1; double payback_cash = negative.Last(); double paybackone_cash = Cumulativecashflow[paybackone]; double paybackP = paybackone_cash * payback; double paybackPe = payback_cash * paybackone; double paybackPer = paybackone_cash - payback_cash; double paybackPeriod = (paybackP - paybackPe) / paybackPer; string paybackString = "Payback Period = " + Math.Round(paybackPeriod, 2).ToString() + " Years"; TaskDialog.Show("payback period", paybackString); //P = A*i / (1 – (1 + i)^-N) for repayment //if using a loan the repayment IList<double> cashflow_afterloan = new List<double>(); //A*I double loan = Math.Abs(year0) * loanInterest; //(1 – (1 + i)^-N) double loanin = 1 + loanInterest; double loanini = Math.Pow(loanin, -loanYear); double Repayloan = loan / (1 - loanini); // actual pay for after tax cash flow for loan IList<double> repay = Enumerable.Repeat(Repayloan, 30).ToList(); foreach (var cash in cashflow.Skip(1)) { double afterloan = cash - Repayloan; cashflow_afterloan.Add(afterloan); 193 } //LOCE calculation //costside/benefitside double expensesum = expense.Sum(); double incomesum = income.Sum(); double LCOE = expensesum / incomesum; string LCOEString = " LCOE = " + Math.Round(LCOE, 3).ToString() + " $/kWh"; TaskDialog.Show("Levelized Cost of Electricity", LCOEString); System.Text.StringBuilder aver = new System.Text.StringBuilder(); aver.AppendLine("income, expense cost"); for (int i = 0; i < income.Count; i++) { aver.AppendLine(income[i].ToString() + "," + expense[i].ToString() ); } Console.WriteLine(aver.ToString()); System.IO.File.WriteAllText(@"C: \Users\ASUS\Desktop\apidata2\feasibility\LOCE.csv", aver.ToString()); IList<double> lifeyear = EnumerableUtilities.RangePython(0, 30,1).ToList(); DataTable dt = new DataTable(); dt.Columns.AddRange(new DataColumn[17] { new DataColumn("Year"), new DataColumn ("Total IBI"), new DataColumn ("Total CBI"), new DataColumn ("Total Installed Cost"), new DataColumn ("Energy Value"), new DataColumn ("State Tax Savings"), new DataColumn ("Federal Tax Saving"), new DataColumn ("Total PBI"), new DataColumn ("Operating Costs"), new DataColumn ("Years"), new DataColumn ("Cash Flow"), new DataColumn ("Cumulative Cash Flow Without Year 0"), new DataColumn ("Cumulative Cash Flow with Year 0"), new DataColumn ("Loan Years"), new DataColumn ("After Tax Cash Flow"), new DataColumn ("Total Debt Payment"), new DataColumn ("Cash Flow for Payback Calculation")}); // year 0 data adding to table dt.Rows.Add(0, IBI, CBI, totalcost, DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value, 0, year0, DBNull.Value, DBNull.Value, 0, DBNull.Value, DBNull.Value, DBNull.Value); // the rest of the year for (int i = 0; i < lifeyear.Count-2; i++) { if (i<10) { dt.Rows.Add(lifeyear[i+1], DBNull.Value, DBNull.Value, DBNull.Value, Energyvalue[i], StateTaxSaving[i], federaltaxSaving[i], totalPBI[i], operaitngcost[i], lifeyear[i], cashflow[i + 1], cumulativecashflowNofirst[i] , Cumulativecashflow[i], lifeyear[i + 1], cashflow_afterloan[i],repay[i],cashflow[i+1] ); } else { dt.Rows.Add(lifeyear[i], DBNull.Value, DBNull.Value, DBNull.Value, Energyvalue[i], DBNull.Value, DBNull.Value, DBNull.Value, operaitngcost[i], lifeyear[i], cashflow[i + 1], cumulativecashflowNofirst[i], Cumulativecashflow[i], lifeyear[i + 1], cashflow_afterloan[i], repay[i], cashflow[i + 1]); } } /*DataTable dt2 = new DataTable(); for (int i = 0; i < dt.Rows.Count; i++) { dt2.Columns.Add(); } for (int i = 0; i < dt.Columns.Count; i++) { dt2.Rows.Add(); dt2.Rows[i][0] = dt.Columns[i].ColumnName; } for (int i = 0; i < dt.Columns.Count; i++) { for (int j = 0; j < dt.Rows.Count; j++) { dt2.Rows[i][j + 1] = dt.Rows[j][i]; } }*/ StringBuilder sb = new StringBuilder(); IEnumerable<string> columnNames = dt.Columns.Cast<DataColumn>(). Select(column => column.ColumnName); sb.AppendLine(string.Join(",", columnNames)); foreach (DataRow row in dt.Rows) 194 { IEnumerable<string> fields = row.ItemArray.Select(field => string.Concat("\"", field.ToString().Replace("\"", "\"\""), "\"")); sb.AppendLine(string.Join(",", fields)); } File.WriteAllText(@"C: \Users\ASUS\Desktop\apidata2\feasibility\financialreport.csv", sb.ToString()); return Result.Succeeded; } public static class EnumerableUtilities { public static IEnumerable<double> RangePython(double start, double stop, double step = 1) { if (step == 0) throw new ArgumentException("Parameter step cannot equal zero."); if (start < stop && step > 0) { for (var i = start; i < stop; i += step) { yield return i; } } else if (start > stop && step < 0) { for (var i = start; i > stop; i += step) { yield return i; } } } } } }
Abstract (if available)
Abstract
Replacing the traditional source of electricity in buildings, which accounts for 28% of total greenhouse gas emission, is critical to achieving environmental sustainability. Among sustainable strategies, PV systems are becoming more widely adopted in buildings as their cost comes down and their efficiency of converting solar energy to electricity goes up. A PV system and its efficiency are highly impacted by environmental factors like weather and location including surrounding obstacles. Different types of systems and types of panels are also important factors to be considered. Therefore, if the project teams can consider those factors in the early stage of design, the electricity produced and return on investment can be largely improved. ❧ The current BIM-based PV system design process largely depends on transferring the architectural model to the PV special simulation software. However, some critical geometric information is lost during this process, and it is a one-way process with no information flow back. Furthermore, the current process takes time and effort on remodeling and transforming data between two platforms, which is not very suitable for the early design phase which is characterized by quick and iterative processes. An automatic PV system design and management tool was developed, which fully integrates the existing and future information of PV systems in a building information modeling (BIM) platform. The proposed tool, PV for Early Design Phase (PV Link) first analyzes the solar radiation on a selected building façade. Then, it automatically selects the PV panel based on the solar analysis and user options with variables like PV size, roof geometry, and rooftop equipment. Finally, the solar radiation on each panel and the electricity produced are calculated, and results shown in a building information model (BIM). The proposed tool has been applied and examined through several case studies. The result shows the tool can help to design systems efficiently while maintaining a high solar harvesting and electricity production of the PV system. With modifying various financial inputs, users can also test different financial strategies to achieve the desired cost and payback period.
Linked assets
University of Southern California Dissertations and Theses
Conceptually similar
PDF
Building bridges: filling gaps between BIM and other tools in mechanical design
PDF
Automating fire code compliance using BIM and Revit plug-ins
PDF
MM Electrical Tool: a tool for generating electrical single line diagrams in BIM
PDF
Using building information modeling with augmented reality: visualizing and editing MEP systems with a mobile augmented reality application
PDF
An investigation on using BIM for sustainability analysis using the LEED rating system
PDF
A BIM-based tool for accessible design standard plan check: an automated plan review plug-in for Revit focusing on accessible design
PDF
Streamlining precast back-frame design: automated design using Revit plugin
PDF
Revit plugins for electrical engineering improvements in buildings: Lighting power density and electrical equipment placement
PDF
BIM+AR in architecture: a building maintenance application for a smart phone
PDF
Building information modeling based design review and facility management: Virtual reality workflows and augmented reality experiment for healthcare project
PDF
A BIM-based visualization tool for facilities management: fault detection through integrating real-time sensor data into BIM
PDF
Visualizing thermal data in a building information model
PDF
Building information modeling: guidelines for project execution plan (PxP) for India
PDF
Net zero energy building: the integration of design strategies and PVs for zero-energy consumption
PDF
Office floor plans generation based on Generative Adversarial Network
PDF
Lateral design with mass timber: examination of structural wood in high-rise timber construction
PDF
Interoperability between building information models (BIM) and energy analysis programs
PDF
Carbon accounting tool (CAT) in BIM: an embodied carbon plug-in for revit
PDF
Guidelines to airport design: accounting for glare from buildings during takeoff and landing – an LAX case study
PDF
Energy use intensity estimation method based on building façade features by using regression models
Asset Metadata
Creator
Lin, Qihang
(author)
Core Title
Streamlining sustainable design in building information modeling: BIM-based PV design and analysis tools
School
School of Architecture
Degree
Master of Building Science
Degree Program
Building Science
Publication Date
04/26/2020
Defense Date
03/23/2020
Publisher
University of Southern California
(original),
University of Southern California. Libraries
(digital)
Tag
BIM,building information modeling,OAI-PMH Harvest,photovoltaic system,PV,Revit API,Sustainable Design
Language
English
Contributor
Electronically uploaded by the author
(provenance)
Advisor
Kensek, Karen (
committee chair
), Choi, Joon-Ho (
committee member
), Schiler, Marc (
committee member
)
Creator Email
linqihang1994@gmail.com,qlin@usc.edu
Permanent Link (DOI)
https://doi.org/10.25549/usctheses-c89-288958
Unique identifier
UC11664324
Identifier
etd-LinQihang-8349.pdf (filename),usctheses-c89-288958 (legacy record id)
Legacy Identifier
etd-LinQihang-8349.pdf
Dmrecord
288958
Document Type
Thesis
Rights
Lin, Qihang
Type
texts
Source
University of Southern California
(contributing entity),
University of Southern California Dissertations and Theses
(collection)
Access Conditions
The author retains rights to his/her dissertation, thesis or other graduate work according to U.S. copyright law. Electronic access is being provided by the USC Libraries in agreement with the a...
Repository Name
University of Southern California Digital Library
Repository Location
USC Digital Library, University of Southern California, University Park Campus MC 2810, 3434 South Grand Avenue, 2nd Floor, Los Angeles, California 90089-2810, USA
Tags
BIM
building information modeling
photovoltaic system
PV
Revit API