MATLAB – based software for modeling and studying grid – tied photovoltaic systems

On-grid photovoltaic systems are well known and established systems in countries where solar energy is considered for residential buildings. MATLAB – based interactive software was developed to perform a quick and reliable design of grid – tied photovoltaic systems. The software is one of a kind, since it was the first time to build such a user-friendly comprehensive tool using MATLAB. The reason behind choosing MATLAB as a programming environment was primarily because of its powerful capabilities in numerical computation, data analysis and visualization. MATLAB also offers impressive and easy-to-use tools in applications development using Graphical User Interfaces (GUIs). The software was originally developed to serve educational purposes in the university domain, keeping in mind that MATLAB is considered a standard tool for tackling engineering problems. In the first stage of this project, the software was created by using simple script programming in m-files, and then these m-files were used later on with Graphical User Interface programming. It’s an essential step before installing a PV system, whether it is stand alone or grid-tied systems, to perform a detailed study which showcases its technical and economical feasibility. The technical validity of the PV system can be achieved by insuring that the system is working with a sufficient overall light-to-electricity conversion efficiency. This can be insured by a good selection of the system components such as PV panels, inverters, and cables, connecting the system components in a permissible manner, and a proper installation of the PV arrays in order to increase the sun light exposure and reduce surface temperatures. The software was developed to perform a sequential task designing and planning procedure, which means that the design procedure consists of a number of dependent tasks that follow each other as shown in Figure.1. The software was equipped with a daily 13-year period meteorological database for number of cities in the United Arab Emirates (UAE) and PV system components database (i.e. PV modules, inverters, etc). MS Excel was used to build the databases, due to the simplicity of linking Excel to MATLAB routines and the ease of carrying out adjustments in the databases whenever necessary. The first task in the design procedure is to specify the site information and carry out the solar irradiance study. This is simply done by selecting the city of investigation, specifying the PV installation area orientation and inclination angle, and finally determining a proper reflectivity factor depending on the surrounding ground surfaces and structures (i.e. sand, grass, snow, etc). 6

In the next step, the designer is asked to give some details about the geometry of the installation area, such as the PV panels' alignment and dimensions.The designer will then move to do the building load profile study, in order to determine the building's annual energy requirements and decide how much the PV system will be responsible to cover.According to the aforementioned design steps, the software will suggest number of PV panels that would surely fit into the installation area.Upon the designer choice of the PV panel, the software will pick up number of DC/AC inverters according to their sizing factor.Fig. 1.The sequential design process used in the developed application Up to this stage of the design procedure, the user can analyze the systems electrical performance graphically.The final design step is to select appropriate wiring and protection devices in such a way the planned system will be efficient and as safe as possible.A partitioned grid-tied PV system can be modeled and designed using the developed software.The partitioning feature is available in both DC and AC circuits of the PV system.The user can save his design at any stage of the design procedure, with the ability to load the saved file and perform adjustments whenever needed.Simplicity and clearance of the software has been carefully preserved through creating the software in a one window multi panel fashion.Moreover, a user with minimum knowledge about PV systems can easily perform the designing procedure with the assistance provided by the guidance features of the software.These guidance means varies from providing quick and short explanation of some technical terminologies to providing the PV components datasheets.The book chapter will mainly focus on the software capabilities and features and how MATLAB tools were used to create a reliable, simple, and user friendly software, that can be utilized to design, model, and predict grid-tied PV systems.

Background
The amount of carbon dioxide and sulfur oxides has increased rapidly, putting the whole world in a real battle with the resulting environmental problems (Ohnishi et al., 1995).In the light of that and in order for a future society to be sustainable while operating at or above our current standard of living, a shift away from carbon based energy sources must occur.Active PV energy technology can outline a partial solution for the environmental problems caused by accelerating global energy expenditure.Solar cells, since they convert solar light directly into electrical energy, are the most prominent candidates for a new and clean energy source.The research works on solar cells are moving fast worldwide.The technical, social, and economic benefits and limitations of PV technologies to provide electricity in both off-grid and on-grid applications are critically analyzed and it has been demonstrated that PV electrical production is a technologically feasible, economically viable, environmentally green, sustainable, and socially equitable solution to the energy needs in the near future (Pearce, 2002).It is argued that in order to resolve the energy problems the world is facing today and to live comfortably in the 21st century, we must install photovoltaic power-generating systems in our homes, facilities, etc …, and then build a global system with solar cells (Ohnishi et al., 1995).Given this promising field of research all over the world, there is remarkably growing use of photovoltaic technologies in building design especially in housing.Unfortunately little research efforts have been devoted to the same sector in Arab countries in general and in the UAE in particular.According to the last general census in UAE for population, housing and establishments conducted by the Ministry of Economy on 6 December 2005, the total number of buildings in UAE reaches 336 thousand buildings and the number of residential buildings reaches about 60% of this number in Abu Dhabi and Dubai.With the advances and enhancements in the quality of PV technologies, the electricity produced through utilizing these technologies in buildings is witnessing a noticeable increase.The spread of the use of PV technologies has and is still leading to a continuous decrease in the initial cost of installing PV systems.The situation is getting better with the current production of photovoltaic panels in Abu Dhabi.Consequently, it is thought that through the incorporation of photovoltaic technology in housing designs and BIPVs of the UAE, significant saving of energy will be achieved.This will help in realizing environmental sustainability in the housing sector in which the domestic use of electricity represents a significant level.The integration of photovoltaic technologies into the design of typical housing might be generalized for the whole of the UAE.This may help the developed communities and the scattered ones in securing their electricity needs, or most of them, at a lower cost.Even with higher initial cost, PV systems are a good choice, considering the rising cost of fossil fuelbased electricity.This claim is supported by a recent research in the region (Egypt) which proved that providing electricity for a family house in a rural zone using PV systems is very beneficial and competitive with other types of conventional energy sources, especially considering the decreasing prices of PV systems and their increasing efficiency and reliability.PV systems also have the advantage of maintaining a clean environment.The first solar village project in Abou-Sorra, Syria (Zein et al., 1998) showed that the generated power has been supplied to six households.The PV plant in this project has proved to be technically feasible and efficient.In comparison with a system based on diesel generator set, this PV system turned out to be more economically efficient for rural electrification of scattered houses and villages in sunny countries like Syria.In addition, some research works have been conducted in the field of BIPV to tackle the issue of the practical and economic feasibility of adopting this system and how to overcome some inherited difficulties associated with its use.For example, in a study conducted by Omer et al. (2003) about a BIPV system installed on a detached house, using crystalline PV roof slates appropriate for domestic buildings, it has been found that the problems inherent in the design of roof slate integrated PVs result in elevated temperatures of cells.Therefore, the study suggested a modification to the way solar slates are built, and that is by providing airways and voids at the rear of the slates to allow air to pass between them, which would help to prevent any rise in cell temperature.In the same study, in terms of economic justification, it was suggested that for the systems to be economically competitive, the array and labor costs need to be reduced.The researchers claim that this appears to be possible, given volume production and standardization of PV system components, which would drive down production costs, and reduce labor costs as installation experience becomes greater.Solar energy is already economically viable in many applications, and will continue to expand as production continues to increase in scale (Omer et al., 2003).During recent years, interest in introducing the use of PV systems in the envelope of buildings (BIPV) has increased significantly.PV production has been doubling almost every 2 years, having increased by 48% since 2002 (Elgun & Shahrabi, 2008).The cumulative global PV power production was 12400 MW at the end of 2007 (Elgun & Shahrabi, 2008).UAE has strongly emerged in the PV market by launching its outstanding MASDAR initiative.This AED 15 billion initiative is expected to establish a strong renewable energy-dependent society in the country.This initiative is being directed to investments in a solution for the manufacture of future energy, as well as education and R&D, carbon management and sustainable development and planning.Photovoltaic systems can be connected to the public electricity grid via suitable inverters.Energy storage (i.e.batteries) is not necessary in this case.On sunny days, the PV system provides power for the electrical appliances in a house.Excess energy is injected in the public grid.During the night and overcast days, power is drawn from the grid.PV systems operating parallel to the grid have great technological potential.However, without subsidies from the government or utilities, they are not yet financially competitive (Román et al., 2006).Today, PV solutions form one of the basic concepts of smart homes, ensuring renewable, clean, and free-of-charge energy resource.Recently, the concept of a smart home has come to present this home not only as one that can provide a convenient and healthy life through the utilization of intelligent solutions mainly based on information and communication technologies, but also a home that can cover its energy requirements using renewable energy sources.In this work, a MATLAB -based modeling tool to design, predict, and analyze grid-tied PV systems is presented.This tool offers a simple, quick, and accurate means for designing grid -tied PV systems that can be used in smart homes.The simplicity of this modeling tool would probably make it a good tool for educational and research purposes.In comparison with the tools available in the market (i.e PVSol, PVSYST 4.37), this developed tool has some smart routines that classify and suggest suitable PV panels, while meeting both the power and installation area requirements, unlike other tools where either the output power or the installation area is considered.Besides, the user can easily design the cables and protection devices throughout all portions of the PV system.Such a feature is not available in other PV system design tools.In addition, the developed tool can be limited to records, such as weather records, of the UAE environment, or it may include weather records for tens of cities around the world.In section two all necessary background information is presented.The tool sections, the how-to-use and features of the proposed tool are discussed in section three.Section four presents the results and discussion of a case study, which was conducted to validate and show the features of the presented modeling tool.

Principle of Grid Tied Photovoltaic Systems
PV systems may be connected to the public grid.This requires an inverter for the transformation of the PV-generated DC voltage to the level of grid AC voltage.National and even regional regulations differ widely with respect to the policy of interconnection requirements and incentives for PV-generated electricity fed into the grid.In order to support the production of PV-generated power, some utilities offer a better price for the kWh fed into their grid than they charge for the kWh from the grid.In other locations a oneto-one ratio is applied which means the same kWh-price applies to both flow directions.The third option is to pay less for the generated PV power fed into the grid than for that sold to the consumer (Luque & Hudges, 2005).In comparing the rates, the fixed rates for the power connection also have to be considered.Depending on the kind of tariffs adopted, one or two electricity meters have to be used at the point of utility connection.Figure 2 shows a block diagram of a grid-connected PV system suitable for building integration.In grid-connected applications, photovoltaic systems must compete against the cost of the conventional energy source used to supply the grid.PV systems are particularly cost-effective when the utility load and solar resource profiles are well matched.This is, for example, the case in areas with high air-conditioning loads (such as the UAE) that have their peaks during the peak sunshine hours of the summer day.Fig. 2. Grid connected PV system schematic (source: www.homepower.com),

Conservation and Energy Efficiency
Renewable energy may seem to be a fascinating solution when you look at its benefits, but the main concern of someone willing to invest in renewable energy should be conservation and efficiency (Kerr, 2008).It is well known that renewable energy solutions are not yet economically competitive with exhaustible resources (i.e oil, coal and gas) especially for countries with low electricity tariffs like the UAE.Conservation involves changing your energy consumption behaviors from wasteful, inefficient habits (such as lighting places that should not be lighted) to energy-saving ones.Efficiency, on the other hand, is reducing energy consumption without changing your life-style by using efficient appliances (Livingston, 2007).Both conservation and efficiency work in parallel, because the more efficiency you have in your energy consumption the more money you will save when installing your renewable energy.

Principle of Building Load Assessment
Before designing a PV system for a building, whether it is a residential, commercial or public building, a full load assessment should be performed.The load assessment is described by a graph called the load profile.This graph shows the variation in the electrical load versus time (Woodfeden & Laforge, 2007).A load profile will vary according to the customer type (typical examples include residential, commercial and industrial), the temperature and the holiday seasons.Figure 3 shows a typical load profile for a residential building (i.e.Villa) in Al Ain.Load profiles could be hourly, daily, monthly, or annually, depending on the nature of the analysis carried out and the level of precision required.The load assessment shows the power consumption behavior of people occupying the building, which is a vital step for planning and designing PV systems (Woodfeden & Laforge, 2007).

Grid Tied Inverters
In grid-connected PV systems, grid-tied inverters are used to convert the DC power from the PV generator (PV arrays) to AC power.The AC power is then delivered first to the home loads (i.e.household appliances), with any excess power fed to the grid as described in Figure 4. Most of the grid-tied inverters have a set of features that make them interactive with both the DC side (PV arrays) and the AC side (utility grid).These features improve the safety and reliability of the overall system.The inverters are equipped with an anti-islanding protection.Islanding occurs when the grid gets down and the inverter power output becomes in resonance with the power demand of home appliances (Woodfeden, 2007).This phenomenon may lead to some unwanted consequences if it lasts for a long time.To avoid this islanding, the inverter automatically switches off once it senses a utility outage.Another feature inverters should have is the ground fault detection system, which turns off the inverter until the fault is manually cleared.Some inverters can provide a string over-current protection by fixing fuses inside the inverter enclosure (SMA Sunny Boy, 2007).The PV generator is connected to the grid via DC/AC inverters based on different technological concepts.There are three main topologies that can be followed in connecting the inverter to the PV generator.The first topology involves a number of modules connected in series (string), and a large number of parallel strings connected to one central inverter as shown in Figure 5 (Luque & Hedgus, 2005).

Fig. 5. Schematic of central inverter topology
Central inverter topology is mainly used for large PV systems (> 10kW), which is not the appropriate topology for residential building grid-tied PV system.Instead, the same central inverter topology is used but with a lower number of strings (< 4 strings); this topology is called multi-string inverter topology.The second topology is the string inverter topology, where each PV string is connected to one inverter, which is a good solution to minimize mismatch between strings and reduce losses due to shading as shown in Figure 6 (Luque & Hedgus, 2005).

Fig. 6. Schematic of string inverter topology
String inverter topology was the first standard topology for utility-interactive systems.The third topology is a less popular topology, and that is the module integrated inverter, where each module has its own inverter.Module integrated inverter topology is used in relatively small PV systems (50 -400 W), where a lower number of modules is involved.For large PV systems, module integrated inverter topology is avoided since it would make the system AC circuit drastically complex.These different types of inverters are all available in the market.The choice of the most appropriate inverter depends on the technical and economical feasibility (Luque & Hedgus, 2005).

PV System Sizing
The PV generator is designed in such a way that the output DC power, voltage and current match with the input DC ratings of the inverter used.This principle is very important from both technical and economical points of view, because if the PV system is optimally sized, the overall performance of the system would be improved.This means that the inverter is primarily picked according to the configuration of the PV generator.In other words, an oversized inverter will lead to a shorter inverter service life, which in turn may increase the maintenance cost of the system.On the other hand, an undersized inverter would cause an unjustified excess in the initial cost of the system (Luque & Hedgus, 2005).To determine the sizing status of the inverter, the inverter sizing factor is calculated, which is the ratio of the PV generator DC power output to the DC input power rating of the inverter.The inverter sizing factor ranges from 0 to 100%.The maximum and minimum sizing factors should be calculated to make sure that the inverter will remain optimally sized regardless of the DC power output of the PV generator throughout the year.

Balance of System
All components that make up the grid-tied PV system except the PV panels and the inverter are called Balance of the System (BOS).This includes wiring, protection devices (fuses and circuit breakers), enclosures, disconnects, installation equipment and power metering devices (Sick & Erge, 1996).Each of these components is designed and picked according to the system requirements and the code of the standard adopted in order to improve the system reliability, durability and safety.

Wiring and Cable Sizing
Every single conductor in the system is sized and picked to withstand the maximum possible operating currents and harsh weather conditions.The selection procedure is achieved through the corresponding standard code practices (IEEE P929, 1996).Cable sizing is the process of selecting the proper cable size (cross-sectional area) in a specific location of the system.The ampacity of the cable is calculated, which is the maximum current that a conductor can handle.Each cable has different ampacity values depending on the ambient temperature and cable insulation type (IEEE P929, 1996).Cable sizing includes the module interconnection cables, PV generator-inverter cables, inverter-utility grid cables and grounding cables.

Protection Devices
Like conductors, protection devices are sized according to their ampacity.The protection devices used in PV systems are mainly fuses and circuit breakers.The ratings of these devices are determined according to which part of the system these devices are protecting.The ampacity of a protection device should be smaller than that of the conductor it is directly connected to, while both should have the same insulation (National Electrical Code, 2005).Fuses and circuit breakers are encapsulated in enclosures that are usually equipped with a manual disconnect such as junction boxes.

DC and AC Disconnects
To improve the level of safety of the PV system, manual disconnects should be used in both DC and AC sides of the system, in such a way that it would be easy to isolate any portion of the system in case of a fault or for maintenance.At least one disconnect should be installed right between the PV generator and the inverter, while another disconnect should be placed between the inverter and the utility grid (IEEE P929, 1996).

Metering Devices
In grid-connected PV systems, power metering devices are an important part of the system.A wattmeter should be used to record the amount of energy the PV system is generating during the day, alongside the normal wattmeter that records the amount of energy bought from the utility company.Sometimes, one wattmeter could be used, in such a way that its needle spins in one direction when energy is bought and in the opposite direction when it is sold.

The Modeling Tool
This section presents all the methods, techniques and procedures applied to build a comprehensive PV tool that can be used to design, predict and analyze on-grid PV systems.

Site information & PV Array Installation
The first step in designing the grid-tied PV system is to specify the site information such as the city, the tilt angle and the reflectivity factor.These pieces of information are enough to calculate the daily average global irradiance, which is a very important parameter in the PV system as shown in Figure 7.The PV tool prompts the user to enter the dimensions of the array installation area (width and height) as shown in Figure 8.The tool will fit the module on the suggested area considering the space between modules in each string and between strings as well.The user will be able to control the accuracy of the installation area filling by adjusting the area mismatch variable, which is the allowed error margin between the suggested installation area and the actual PV array area as shown in Figure 8.The user can also specify whether the modules alignment is horizontal or vertical as shown in Figure 9.This feature has been added to make sure that the modules alignment matches with the shape of the installation area, hence ensuring a good appearance of the PV array as part of the building.

Load Profile Section
In the load profile section, the user will be able to select the load profile model from the popup menu shown in Figure 10.The menu includes three load profile models for residential buildings (villa).Each of these models represents a level of power demand behavior.For example, model A represents the average power consumption, while model B and C represent the maximum and minimum power consumption respectively.These three load profile models were developed by analyzing and studying a 13-year annual load profile for tens of villas in Al Ain.To develop a realistic and accurate power demand profile representing the environment and the life-style in Al Ain, a large number of load profiles were obtained from Al Ain Distribution Company (AADC).After selecting the proper load profile model, the user should specify the coverage factor as shown in Figure 10, which is the percentage the PV system is expected to cover from the annual home power demand.This way, the tool will give an indication message showing to what extent the designed PV system will cover the annual power demand.

Modules Sorting Procedure
The database built for this tool includes various types of modules, each with different electrical and mechanical characteristics.To make the design procedure simpler and faster, the PV tool has some routines that sort out the most appropriate modules in terms of fitting the installation area, so instead of going through all modules, only the modules that would fit the suggested installation area will be displayed for the user as shown in Figure11.

Fig. 11. load profile section
After confirming the installation area dimensions, the user can select from a group of modules based on the desired electrical behavior.Once the user selects one of the listed modules, the tool determines all possible PV array configurations: a number of parallel strings (group of modules in series) and a number of modules per string as shown in Figure 12.The tool is designed to show all possible configurations, where the number of strings is less than the number of modules per string as shown in Figure 11.This is to limit the number of choices in front of the user and because of the fact that if the number of strings is greater than number of modules per string, high overall current and low overall voltage will be obtained, which is not technically recommended (IEEE P929, 1996).

Inverter Selection Methodology
After the module and the PV generator configurations are selected, the tool searches the database of inverters for the inverters that would work properly with the designed PV array.The inverter searching procedure is performed by comparing the output voltage, current and power of the DC generator with the DC input ratings of the inverter.The tool lists all the inverters that can work properly from the technical point of view as shown in Figure 13.All selected inverters would probably work in all conditions such as maximum irradiance days (maximum current) and maximum ambient temperature days (minimum voltage).

Fig. 13. Inverter selection section
Based on the budget and the preferred level of system reliability, the user can select the suitable inverter.The tool offers a helpful clue for the designer to select the best inverter based on the inverter sizing factor range as explained above.The higher the sizing factor range, the better the design would be.Practically, an inverter sizing factor criterion that ranges from 45 to 100 could be considered optimal (Antonio Luque and Steven Hedgus, 2005).In general, the inverter sizing factor range is calculated as shown in equation 1. (1)

M in M ax A rray A rray M ax M ax In verter
In verter P P S izin g F actor R an ge to P P 

PV System Partitioning
The PV tool offers the opportunity of designing a partitioned grid-tied PV system.The partitioning feature is available for both DC and AC circuits of the PV system.For the DC side, if the system is composed of several PV generators located in different locations, while they all have the same design parameters and specifications, the user can design one PV generator and then specify a number of identical PV generators as shown in Figure 10.This feature duplicates the PV array and prevents the designer from going back and starting again from the beginning.The duplicated PV arrays are then connected to the same inverter, so the partitioning of the DC side is at the PV array level.For the AC side, the PV system can be divided into independent sub-systems, each subsystem with its own inverter.Then all the subsystems are combined together via a combiner enclosure to connect it to the home distribution panel as shown in Figure 14.

Cable and Protection Devices Sizing Procedure
Picking the appropriate components for the PV system is very important to ensure a high level of reliability and safety.The PV tool computes the cable sizes at every spot in the system.In electrical power systems, most conductors are restricted from operating on a continuous basis at more than 80% of their rated ampacity.This principle also applies for over-current protection devices.However, the current-carrying conductors used in PV systems are further de-rated by a factor of 80% due to the manner in which PV modules generate power in response to sunlight and because the intensity of sunlight at noon may exceed the standard test conditions (IEEE P929, 1996).The ampacity of conductors and the sizing of over-current devices is an area that requires careful attention.Temperatures and wiring methods must be addressed for each site.Calculations start with the 125% of Isc value to comply with the UL 1703 requirements, and an additional 125% must then be used for code compliance (UL 1703(UL , 2000)).Finally, the cable ampacity is adjusted for temperature using the cable de-rating table.The user is requested to specify the ambient temperature of operation and the cable insulation type at a specific part of the PV system, and then the tool will determine the adequate cable size and protection device rating for that part as shown in Figure 15.Regarding the cabling of the system, the tool is designed to determine the cable sizes at the following parts of the system:  Module interconnection cabling  DC combiner -Inverter cabling  Inverter -AC combiner cabling (if more than one inverter is used)  Equipment grounding cable  DC grounding electrode cable Grounding all PV system components is an important step to make the system immune to all kinds of hazards caused by electrical faults.After determining the cable size, the tool computes the proper protection device ratings to protect each cable and all attached equipment from any over-current that may occur.

Economical Assessment Procedure
The PV tool offers the opportunity to perform an economical assessment.The economical evaluation is based on two variables, the net present value (NPV) and the system payback period ( ) P (Jose L. Bernal-Agustn, Rodolfo Dufo-Lopez, 2005).Basically, both of these variables are strongly linked to one another because NPV shows whether the system will pay-off during its service life time or not, while the year in which the system pays-off will determine the payback period ( ) P .To calculate the net present value ( ) NPV , the system initial cost ( ) S should be calculated as shown in equation 2.
The investment cost includes the PV system cost, which in turn includes all PV components such as modules, inverters and BOS equipments.The annual maintenance cost is also included in the investment cost.The initial cost of grid-tied PV systems is unfortunately very high, so these renewable solutions can be made economically competitive by applying subsidy programs.The subsidy programs can be offered and controlled by the government, who can pay a percentage of the initial investment cost or increase the price of the energy sold to the utility (Bernal-Agustn & Dufo-Lopez, 2005).
The net cash flow ( ) Q i.e. the difference between the cash input generated by the investment and the payment or cash output the investment requires) can be calculated for each year (j) as described in equations 3 & 4: (3) are the annual costs attributed to the operation, maintenance and insurance.It should be taken into account that the income and expenditures may vary from year to year due to inflation.For PV systems connected to the grid, the maintenance costs and insurance increase with inflation.However, the income due to the sale of the energy does not necessarily have to increase.The effect of the inflation rate ( g ) is calculated as shown in equation 5.
In order to compare investments, it is necessary to consider the same period of time.If the cash flow is over various years, they should all be considered during the same period of time (normally at the start of the investment).This way, different investments can be compared using the Nominal Interest Rate and the Net Present Value.The Nominal Interest Rate ( ) is the monetary price or the interest rate that allows different economic quantities to be referred to each other, transferred periodically over time, to the initial year of investment.The net present value of the investment is defined as described in equation 6.
Where ( ) NPV is the duration of the investment (i.e. the service time of the PV system) and ( ) is the nominal interest rate.In order to say that the generated benefits from the system are greater than the cost, NPV should be as large as possible and always positive (Jose L. Bernal-Agustn, Rodolfo Dufo-Lopez, 2005).
The Pay-Back Time ( P ) is the number of years, up to the present moment, needed to make the NPV of the cash flow equal to the initial outlay of the investment.It can be expressed as shown in equation 7.
Based on this method of analysis, the shorter the Pay-Back time is, the better the investment.This is a criterion that values the availability more than the profitability and does not take into account the cash flow generated after the recuperation period (Bernal-Agustn & Dufo-Lopez, 2005).

Guidance and Documentation
The PV tool (Figure 16) is designed to be simple, clear and easy-to-use.To achieve these characteristics, guidance and help features were added so that the user will be able to understand all technical parameters and terminologies during the design process.All modules and inverters data sheets were added to help the user choose the most appropriate PV component.The tool also has the ability to provide a full and comprehensive summary of the designed system as final output documentation.

Design of a BIPV Villa in Al Ain -UAE
The developed PV software was used to design a grid-tied photovoltaic system for a residential building (villa) in Al Ain.Then the villa was prototyped to show how the PV array is integrated into the structure of the building.The system consists of three PV generators (subsystems).Each subsystem is oriented towards the south.The first subsystem is mounted on the southward-tilted parts of the building roof with an inclination angle of 30°.The second and third subsystems are located on the garage with an inclination angle of 15° as shown in Figure 17.Each subsystem was designed to be independent of both the DC and AC sides.

Roof Array (Subsystem 1)
The design of the PV system starts with the selection of a proper load profile.Model A load profile, which represents the average energy consumption of typical villas in Al Ain, was selected to be used in the design.Figure 18 shows the average monthly energy consumption for Model A.

Fig. 18. Average monthly energy consumption
The south-facing roof is tilted at an angle of 30°. Figure 19 shows the daily average global irradiance distribution with reflectivity factor set to 0.2.The installation area dedicated to subsystem 1 was approximately 41 m 2 (26.5 x 1.70 m).To have a good-looking PV array, the modules were aligned vertically in order to suit the shape of the installation area.Moreover, the aesthetical side was preserved by setting the area mismatch factor to 5%, so that the proposed installation area will be very close to the actual array area.The proper module was selected from a set of modules suggested by the tool, keeping in mind that all the suggested modules should fit into the installation area.BP SX 3200 was used as a module in subsystem 1 array with a rated maximum power of 200W.A total number of 29 modules were used with a configuration of 1 x 29, occupying an area of 44m2. Figure 20 demonstrates the daily DC analysis parameters of subsystem 1.After completing the design of the PV generator, a proper grid-tied inverter was selected.SB 5000TL HC is the proper inverter for this design, since it has a sizing factor range of 53% -86% (which is a permissible sizing factor range).The tool predicted the annual energy produced by subsystem 1 (approximately 12.3 MWh). Figure 21 shows the energy produced by subsystem 1.After designing both the PV array and the grid-tied inverter, the next step is to size the cables and protection devices for all parts of the PV system.The module interconnection cable size is found to be 2.5mm 2 and it is protected by a 12A fuse located at the DC combiner enclosure (ambient temperature of 70° C and insulation of 90°C).Since subsystem 1 has a single string array, the array-inverter part has the same cable and fuse sizes as the previous part (PV array).The inverter-AC combiner cable is sized to be 6mm 2 (ambient temperature 60°C and insulation 90°C). www.intechopen.com

Garage Array (Subsystem 2)
Subsystem 2 is located on the garage with dimensions of 6.25 x 3 and tilt angle of 15°.The selected module for this array was BP 175I with configuration of 2 x 7 and total gross PV array area of 10m 2 .The inverter SB 3300TL HC was selected as the most appropriate inverter with sizing factor range of 67 -95 %.The DC analysis results of subsystem 2 are shown in Figure 22.The total monthly energy yield produced by this subsystem is shown in Figure 23.The module interconnection cable was sized to be 2.5mm 2 and it is protected with a 9A fuse located in the DC combiner enclosure (ambient temperature 70°C and insulation 90°C).The array-inverter cable was sized to be 4mm 2 and it is protected with a 20A fuse located in the DC disconnect enclosure.The inverter-AC combiner cable size was designed to be 6mm 2 .

Overall PV System
The overall coverage factor of the whole PV system was determined to be approximately 27%. Figure 24 shows the overall output energy of the combined PV system.It is obvious that the monthly energy consumption values are much larger than the value of the energy produced by the PV system, which is an expected result.The PV system was basically designed to cover up to 25% -30%, while the actual PV system coverage factor is approximately 28%, keeping in mind that the overall wiring losses comprise around 5% (typical value).It is known that the total PV energy production is divided into autoconsumed energy and injected energy.Figure 26 shows the total auto-consumed energy versus the total injected power.The monthly total injected energy was equal to zero in all months, because all the generated PV power was consumed.So the green bars represent only the auto-consumed energy.The designed PV system has an overall system efficiency of 15%, which makes sense due to the large losses in the system, which are mainly due to the low light-electricity conversion efficiency of the crystalline-type panels used in this modeling tool and also the losses in the cables and wires used in the system.

Conclusion
This paper presents a MATLAB-based tool for the design of PV systems.The proposed modeling tool uses daily weather data and simple irradiance models that are as accurate as many other complex models.This tool is flexible enough to adapt quickly if other locations in the world are to be investigated.Besides, the tool offers a variety of PV products such as modules, inverters, cables, etc.The tool is still under development to include more features such as the prediction of the amount of CO 2 that can be reduced in case of replacing a traditional building by a BIPV.

Fig. 4 .
Fig. 4. Grid tied inverter connected between the PV generator and the utility grid

Fig. 14 .
Fig. 14.Schematic of an AC partitioned grid tied PV system

Fig. 15 .
Fig. 15.Cabling and protection section prices of the energy bought from and sold to the utility respectively.PV Aut E  is the annual energy generated by the PV system connected to the grid that is auto-consumed (i.e.not bought from the grid), and PV Inj E  is the generated energy injected into the grid annually(Bernal-Agustn & Dufo-Lopez, 2005).Furthermore, M C and Ins C

Fig. 19 .
Fig. 19.Daily average global irradiance on an inclined surface of 30° . (a) The average energy yield of sub-system 1 per month (b) The total energy output every month Fig. 23.Total energy yield per month of sub-system 2