Fulltext01 PDF
Fulltext01 PDF
Simon Wakter
Fredrik Wikerman
Simon Wakter
Fredrik Wikerman
Approved Examiner Supervisor
Nelson Sommerfeldt
Commissioner Contact person
Abstract
Solar power is a rapidly growing energy source. As efficiency increases and costs decrease, solar
photovoltaic (PV) systems are becoming increasingly attractive for small and medium scale
consumers to invest in. Despite advancements in photovoltaic technology, minor shading will
still drastically reduce the performance of a solar cell module. Therefore, shade analysis should be
performed before installation in order to assess the financial viability of an investment as well as
to optimize the location and orientation of a photovoltaic module. The process of accurate shade
analysis however, is something that is currently only carried out by professionals using expensive
equipment.
This bachelor’s thesis aims to develop the concept of a smartphone based shade analysis
technique, which by using MATLAB’s predefined image processing should produce a shading
diagram together with data ready for use as input in PV simulation software. The results should
be comparable to those of professional shading analysis products.
As a result, the concept of a shading analysis technique based on panoramic image capturing
using a smartphone and MATLAB image processing has been shown to work. The final analysis
technique uses a smartphone captured panoramic image as input and provides two forms of
output:
1. A shading diagram for easy and quick overview, providing information about which
obstacles may cause shading at a specific time of day and year
2. An excel file that can be used as input in the PV simulation software System Advisor
Model (SAM)
-2-
Sammanfattning
Solenergi är en snabbt växande energikälla. Allteftersom effektiviteten ökar och kostnaden
minskar, blir solcellssystem allt mer attraktivt för små och medelstora konsumenter att investera i.
Trots framsteg inom solcellsteknik, fortsätter även mindre skuggning att ge upphov till stora
effektbortfall i solcellsmoduler. Därför utförs ofta skugganalys före installation, för att bedöma
investeringens ekonomiska lönsamhet, likväl som för att optimera placeringen av
solcellsmodulen. För närvarande är dock precis skugganalys något som endast utförs av
yrkesverksamma med hjälp av dyr specialutrustning.
Detta kandidatexamensarbete syftar till att utveckla ett koncept kring en smartphone-baserad
skugganalysteknik som med MATLABs fördefinierade digitala bildbehandling ska producera ett
skuggdiagram tillsammans med data som kan användas i PV-simuleringsverktyg. Resultaten ska
vara jämförbara med resultat från professionella produkter för skugganalys
Efter projektets genomförande kan det konstateras att konceptet med en skugganalysteknik
baserad på MATLABs bildbehandling och en panoramabild som tagits med en smartphone
fungerar. Den slutliga analystekniken använder sig av en panorama bild som indata och ger utdata
i två former
1. Ett skuggdiagram för enkel och snabb överblick, vilket ger information om vilka hinder
som skulle kunna orsaka skugga vid specifik tid
2. En excel-fil som kan användas som indata i PV-simuleringsprogrammet System Advisor
Model (SAM)
-3-
Table of Contents
Abstract .......................................................................................................................................................... 2
Sammanfattning ............................................................................................................................................ 3
1 Introduction .......................................................................................................................................... 5
1.1 Background ................................................................................................................................... 5
1.2 PV cells and the effects of shading ........................................................................................... 7
1.3 The sun path diagram and shading diagrams .......................................................................... 8
1.4 PV simulation software ............................................................................................................... 9
1.5 Current methods and products for shade analysis .................................................................. 9
1.6 Digital image processing and MATLAB ................................................................................ 13
1.6.1 Current use of image processing in shade analysis ....................................................... 13
1.6.2 Digital images ..................................................................................................................... 13
1.6.3 Digital image processing................................................................................................... 14
1.6.4 MATLAB and the Image Processing Toolbox ............................................................. 14
2 Problem description and objective .................................................................................................. 15
3 Method ................................................................................................................................................ 16
3.1 Model design .............................................................................................................................. 16
3.1.1 Image acquisition ............................................................................................................... 16
3.1.2 Image processing ............................................................................................................... 17
3.1.3 Sun path diagram superimposition ................................................................................. 17
3.1.4 Data manipulation ............................................................................................................. 18
3.1.5 Restrictions ......................................................................................................................... 18
3.2 Sensitivity analysis ...................................................................................................................... 19
4 Results .................................................................................................................................................. 20
5 Conclusion .......................................................................................................................................... 21
6 Discussion, comparisons and recommendations .......................................................................... 22
6.1 Discussion ................................................................................................................................... 22
6.2 Comparisons............................................................................................................................... 23
6.3 Recommendations ..................................................................................................................... 24
7 References ........................................................................................................................................... 25
7.1 Software references ................................................................................................................... 25
8 Appendix ............................................................................................................................................. 26
8.1 Methods for mitigating loss/damage caused by shading ..................................................... 26
8.2 Obstruction matrix .................................................................................................................... 27
8.3 MATLAB code .......................................................................................................................... 28
-4-
1 Introduction
Solar energy can be converted into electricity using photovoltaic cells, offering social, economic
and environmental benefits over fossil fuel generated electricity. Solar photovoltaic (PV) systems
are continuously increasing in efficiency and recent advancements in manufacturing have
decreased the initial cost of investing in a solar PV system, thus making it economical for many
regions. Despite these recent advancements, shading still constitutes a major problem since even
partial shading (Figure 1) drastically reduces the performance of a solar cell array (Zheng et al.,
2013). To assess the financial viability of an investment in a PV system, it is important to estimate
the generation losses caused by shading.
Figure 1. A solar PV system on a residential building with several solar cell arrays affected by shading.1
1.1 Background
Increasing environmental consciousness and recent advancements in PV technology is making
solar power an increasingly attractive investment opportunity for small and medium scale
consumers. A solar PV system provides several attractive benefits (Chakraborty et al., 2013);
Highly reliable energy source that can match well with daytime loads, especially for
people in warm/sunny regions, thus providing a chance of self-sustainability
Modular and easy to install
No moving parts and no noise
Pollution-free
Low maintenance
Possibility of making money by selling electricity back to the grid
1
Image source: http://ecoaltenergy.files.wordpress.com/2013/07/solar-system-installed-by-eco-alternative-energy.jpg
-5-
Although the initial cost of investing has decreased in recent years, it is still critical to be able to
make precise return on investment (ROI) estimations to assess the viability of an investment.
Solar PV systems, unlike solar thermal panels, are sensitive to partial shading and highly
dependent on receiving uniform sunlight across the entire array to reliably generate electricity
(Lorenzo et al., 1994; Gao et al., 2009). Thus, in order to perform precise ROI estimations, it is
critical to approximate the generation losses caused by shading. Many different sources of
shading can affect the effectiveness of a particular installation. Such sources are:
The earth’s axis of rotation relative to the plane of the earth’s solar orbit causes a 46.9°
maximum solar altitude angle difference, known as declination (Duffie and Beckman, 2006)
(Figure 2 a))
Latitude-specific differences between seasons caused by earth’s roundness (Figure 2 b))
Far-object shading, e.g. mountains and/or clouds that depend on the geography and
weather conditions of a location (Figure 2 c))
Near-object shading, e.g. trees and/or buildings (Figure 2 d))
a) b)
c) d)
Figure 2. a) Solar declination at both maxima, ± 23.45° from the equator2. b) Difference in spread of incoming solar rays
depending on latitude.3 c) Far-object shading, caused by clouds.4 d) Near-object shading caused primarily by trees.5
Under normal conditions, when each cell in a solar module receive the same amount of sunlight
they generate roughly the same amount electricity (there is always some difference in output due
to variation in cell quality, as is expected from the manufacturing process). Under conditions with
uneven shading, a shaded cell will allow current from other unshaded cells to pass through its
parallel resistance, resulting in a reverse voltage and potentially a major drop in power output
(Chakraborty, 2013). The unshaded cells are still generating power, but the shaded cell(s) will now
absorb power instead (Figure 4). The shaded cell will receive a (high) current from the
accumulated generation of all unshaded cells, leading to a high reversed terminal voltage, and
thus a high absorbing power, on the shaded cell. This can lead to damage to the shaded PV cell,
causing permanent generation loss to the system (Chakraborty, 2013; Zheng et al., 2013).
6
Image source: Zheng et al., 2013
-7-
Figure 4. PV module where one out of 36 cells is shaded at 0% shade (blue), 50% shade (green) and 100% shade (red). Image a)
shows output current against input voltage, image b) output power against input voltage, image c) unshaded cells output voltage against
input voltage, image d) unshaded cells output power against input voltage, image e) shaded cell input voltage against input voltage,
image f) shaded cell output power against input voltage.7
Figure 5. Shading diagram showing solar eleveation and azimuth of the sun together with the horizon outline of an object.8
7
Figure credit: Zheng et al., 2013
8
Image source: https://lh4.ggpht.com/pPWA2Nx0LYfu73poJucnvSOE-
zrenyQ9MhBJ7hNIa0DD9AF6fvMHCW8t4wVX0Tk__Hxu=h900-rw
-8-
1.4 PV simulation software
PV simulation software uses weather data and specifications of a PV system to perform power
generation estimates, usually over a one year period. Shading diagrams can also be input, which
reduces available solar radiation at specified times. The software can then estimate generation
potential and predict if the system will have a net-positive return on investment.
There are a number of alternatives in terms of professional PV simulation software available on
the market. Some of the most commonly used are
TRNSYS is a graphically based software with powerful tools for simulation of the
behaviour of many transient systems, among them biological processes or traffic flow in
addition to energy and PV related systems (TRNSYS, 2014)
System Advisor Model (SAM) uses the PV model from TRNSYS. It is developed by the US
National Renewable Energy Laboratory (NREL) and provides a free alternative with a lot of
functionality (SAM, 2014)
PV*SOL from Valentin Software that comes in a basic, advanced and expert version, each
adding more capabilities (PV*SOL, 2014)
PV Designer Software from Solmetric offers energy calculations accounting for partial
shading based on user created 3D environments. (Solmetric, 2014)
PV Syst offers powerful tools for quick analysis of a system's behaviour and allows
comparisons between different configurations given the same site. (PV Syst, 2014)
Figure 6. A professional using the Solmetric SunEye 210 and the resulting picture of the analysis showing the surrounding area
combined with sun path data for the location and an estimation of solar access.9
Figure 7. A picture of the Solar Pathfinder equipment box and the resulting picture after use.10
There are also a number of smartphone apps that provide more or less accurate shade analysis.
Two examples are the Sun Shades app for android and the Solmetric iSV app for iPhone. Both use
vastly different approaches for mapping the horizon and also differ greatly in other aspects. The
Sun Shades app requires the user to map the horizon, either by using a set of crosshairs overlain in
camera view or by simply pointing the phone at the horizon and then tracing it around 360°. The
app uses the phones accelerometer, GPS, and compass to then calculate the outline of the
horizon following the user’s movements.
One, potentially large, weakness of this method is that all of these instruments have a
considerable margin of error, especially when used together. This often results in a horizon
outline that is jagged or chopped as a result from fluctuating readings or simply the user’s
inability to perform the measurement with sufficiently stable hands. The app then combines the
traced outline of the horizon with sun path data to, among other things, calculate a rough
estimate of the percentage of lost sun hours per day.
The Solmetric iSV app instead uses the camera of the smartphone together with compass and tilt
sensors of the iPhone to provide an “augmented reality” view on the phones screen (Figure 8).
The app does not map the horizon but simply provides this augmented reality view with sun path
data overlain directly to give quick estimates of the timing and impact of near-object shading.
While the Sun Shades app does provide the possibility of rough estimations and the option to
collect and save the data in many ways, the Solmetric iSV does not provide any way to save or
collect data.
10
Image source: http://www.solarpathfinder.com/PF
-10-
Figure 8. The horizon mapping mode in Sun Shades (left) and Solmetric iSV (right).11
There are also some ways of performing shade analysis with only a computer. A rough shade
analysis can be done simply with Google Sketchup. By measuring distances either in reality or
with Google Earth, a rough 3D-sketch of the site and the surrounding environment can be
created. Google Sketchup then supports sun and shadow effects that can be easily and
dynamically changed or even animated within the program to see the timing and effect of any
near-object shading.
There are also other methods, Solar Site Selector and PanoramaMaster (Figure 9). Solar Site Selector
basically provides a small round stand where transparent acetate foils can be placed. The
transparent foils have sun path diagrams printed onto them and by using an included compass
for direction it provides the same capabilities, although analogue, as the SolMetric iSV app. The
PanoramaMaster on the other hand provides a special bracket mount for tripods, which helps the
user to take a perfect panoramic image with their own camera by rotating the camera a fixed
number of degrees between each picture. The pictures must then be loaded into a computer,
where the images are stitched together into a panoramic picture using included software. The
panoramic image can then be used in PV simulation software.
Figure 9. The Solar Site Selector from a user’s point-of-view (left) and the PanoramaMaster mounting bracket (right).12
Finally, although it is not the object of this thesis, it is worth mentioning that a number of
different techniques for mitigating the losses/damage caused by shaded or damaged solar cells
exist. Some of these are covered in the Appendix, Section 8.1.
11
Image sources:
https://lh6.ggpht.com/Gs8_tOuX76S1bmYgN9oIE-TFGT9y8TZ1rSfv_zsyC9XMDY9eHrKVRTY0voAUQSCHaIA=h900-rw (left)
and http://ep.yimg.com/ca/I/yhst-77580361692593_2263_3022602 (right)
12
Image sources: http://www.solardesign.co.uk/images/shading2-2.jpg (left)
and http://www.solardesign.co.uk/images/panoramamaster.jpg (right)
-11-
Table 1. An overview of current shade analysis products and their respective strengths and weaknesses.
SunEye 210 Solar Pathfinder Solar shade app ISV iPhone solar Solar site PanoramaMaster
app selector
Image capturing Digital camera None, requires 360° panoramic Single (non- None, meant for Creates a 360°
method equipped with external digital image captured panoramic) image direct manual panoramic picture
fisheye lens. camera with the captured with analysis by using a special
Potential live video smartphone iPhone camera tripod mount
feed camera together with
software. Requires
a separate camera
Sun path Digital. Analogue Digital Digital Analogue for the actual
Digital
diagram overlay Automatically, Comes with Automatic with Automatically, Sun path diagram Automatically by
method instantaneously several paper sun sun path diagram instantaneously printed on plastic software
and continuously path diagrams for overlaid with and continuously foil is manually afterwards
overlying sun path different locations shaded parts and overlying sun path superimposed
diagram horizon diagram over the users
vision
Cost 2,195.00€ 215.77€ 13.00€ 4.49€ 64.71€ 294.14€
Generation Direct, more exact No direct Direct, more exact None None No direct
losses estimation estimation possible estimation, later estimation possible estimation, later
with further loss estimation with further loss estimation
analysis using possible with analysis using possible with
additional further analysis additional further analysis
software using additional software using additional
software software
Advanteges • Fast overview • Fast overview • No need for • No need for • Fast overview • Good site
• Quick • Easy to use external equipment external equipment overview
estimations • Cheap • Fast overview
• Accurate • Quick • Cheap
• Easy to use estimations
Disadvantages • Very expensive • Expensive • Accuracy • No estimations • Expensive • Expensive
• Need seperate • Bulky depends on the • Does not save • No estimations • No estimations
unit user data • Analog • Bulky
Sources www.solmetric.co www.solarpathfin http://comoving http://www.solm http://www.solar http://www.solar
m/buy210 der.com/PF magnetics.com/w etric.com/solmetri design.co.uk/sss.p design.co.uk/pano
p/?app=solar- c-isv-iphone- hp ramamaster.php
shades app.html
All inforamtion relating to cost is taken from the respective developers. All prices not in € were converted using
www.xe.com currency converter on 2014-03-13 19:31 UTC
-12-
1.6 Digital image processing and MATLAB
Digital image processing is the automatic manipulation of a digital image using predefined
algorithms. It is important to make this definition to separate it from digital image manipulation,
which is the process of manually manipulating an image using image editing software like Adobe
Photoshop, Google Picasa etc. using brushes or similar tools. It is also useful to differentiate
between image synthesis and analysis. Image synthesis is the process of synthesising/creating an
image from numerical values, whereas image analysis is the inverse process, extracting numerical
data relevant to the context from image data.
-13-
1.6.3 Digital image processing
Digital image processing is often divided into three different categories to differentiate between
different levels of image processing. The three categories are; low level, medium level and high
level of image processing. Low level processing involves primitive operations, usually primitive
operations with one function applied to each pixel only based on its location. Such operations
could include contrast or brightness alterations. Medium level processing entails attribute
extraction, i.e. recognition of patterns, edges or contours in an image. The breakdown and/or
classification of an image or image elements into meaningful numerical data constitute high level
processing.
Furthermore, digital image processing usually involves several steps in a specific order to obtain a
desired solution (Figure 10). The steps are (Marques, 2011);
1. Image Acquisition – the acquisition of the actual digital image
2. Preprocessing – improvement of image quality might be needed before further
processing is possible or to simplify it. May include improvements to contrast and
brightness or noise reduction
3. Segmentation – separating the main or relevant components from an image, e.g.
foreground/background
4. Extraction – identifying specific features within an image, e.g. letters or patterns
5. Classification – if several relevant features have been extracted during step 4, classifying
and sorting/ordering these might be necessary or desirable
In modern applications of image processing, a knowledge base is often implemented to help or
speed up the process at each step. For example, the knowledge base could contain information
about the colour of the sky, something that could speed up or be necessary during the
segmentation process if the sky was to be separated from the rest of the image.
13
Image source: Marques, 2011
-14-
The IPT offers powerful predefined functions for working with images. Functions like imread,
imsave and imwrite provide easy import/export capabilities which allow the user to work
with images of many different file formats without ever worrying about things like rasterizing or
decompression, no matter the file format in question.
There are also functions for image enhancement (e.g. imadjust, imcontrast or histeq) and
powerful region of interest based (roi-based) functions that allow selection of regions of interest
based on color (or other parameters) as well as powerful segmentation functions such as
activecontour.
-15-
3 Method
This section will outline and discuss the method and model design used in this project to create
shading diagram using MATLAB-based image processing.
•Import image
Image •Preprocessing
Processing •Segmentation
•Extraction
Sun Path
•Import sun path data
Superimposition •data format and image size
adjustment
•PV tool
Data import format
Manipulation
•Data addition
Results,
conclusions &
comparisons
-16-
To minimize the risk of any problems being introduced during the image acquisition process and
in order to ensure that the sun path data is correctly superimposed it is of paramount importance
to follow these three steps.
The image should cover a full 360°, no more and no less.
The image should have magnetic south in the centre of the image. It is therefore easiest
to use the smartphone’s compass to find a landmark that is directly north. The image can
then be captured with this landmark just in the left corner of the smartphone’s screen and
the smartphone is then rotated clock-wise until the same landmark is just visible in the
right corner of the smartphone’s screen.
The true horizon (sea level horizon) should be at the bottom of the image and no part of
the horizon may exceed the height of the image. This is easier if the phone is held
vertically (as normal) instead of horizontally.
14
Sun position data available from http://www.sunearthtools.com/dp/tools/pos_sun.php?lang=en
-17-
3.1.4 Data manipulation
In order to output the final shading diagram to PV simulation software, the format of the data
must fit the import format of the simulation software. Using the shading diagram image, data is
extracted into a 91-by-361 matrix, covering the full azimuth range from 0 to 360 degrees and the
full elevation range from 0 to 90 degrees. Each element in the matrix is either assigned a value of
zero or one, depending on if that specific part if part of the sky (background) or the horizon
outline (foreground), see section 8.2 – Obstruction Matrix. A zero now represents background
and a one now represents foreground, a necessary change from before (see section 3.1.2) to
match the input format of SAM. Unfortunately, limitations in Microsoft Excel won’t allow
MATLAB to write data matrices that exceed 256 columns or strings longer than 1024 characters
(otherwise the following error code is displayed: 0x800A03EC. To work around this, only every
second azimuth degree is exported to the excel file.
3.1.5 Restrictions
Since the goal of this thesis is not to provide a finished smartphone app but rather prove the
concept of a smartphone based shade analysis method that uses image processing, a number of
restrictions will be introduced. The restrictions introduced are:
The panorama image will be captured using a smartphone
The smartphone used will be a Samsung Galaxy S4
MATLAB and the IPT will be used for all computations and all image processing
No actual estimations of generation loss or ROI projections will be made
-18-
3.2 Sensitivity analysis
Since the method in this project is based on image processing, it is mainly sensitive to changes or
variations in the input panoramic image. The method is also sensitive in regards to the direction
of the centre of the panoramic image and it is therefore important to follow the three steps
explained in Section 3.1.1, Image acquisition. Except for these orientation related problems, there
are also a number of factors of the surrounding environment that could affect the quality of the
output shading diagram.
Dark clouds could potentially trick the software into masking it as foreground and incorrectly
making it part of the horizon outline. In the same way, brightly painted building, lakes/rivers,
snow and other reflective surfaces may after image analysis be subtracted from the horizon
outline.
Pictures taken in mountains pose two different challenges. First, there may be snow covering part
or all of the mountains. Snow covered mountain tops are easily recognized as background (or
sky) by the program because they are “connected” to the rest of the sky and the program uses
contours in greyscale images to differentiate between background and foreground. Secondly,
images taken at a height that is well above the true horizon (i.e., sea level horizon) may incorrectly
show the height of the sun’s path and the elevation of obstructions after analysis if the image is
not captured correctly, with the horizon at the bottom of the screen.
The figure below (Figure 12) shows a small section of a larger panoramic image. As can be seen in
the first picture (a) the mountain tops are snow-covered. As the image is processed, the snow and
the sky gradually look more and more the same and finally both become part of the background
after segmentation is complete.
Figure 12. a) Original image with snow-covered mountains. b) Grayscale image. Clouds and snow part of mountains still visible.
c) Contrast-adjusted image. d) Final image after contour processing.
-19-
4 Results
The concept of a shading analysis technique based on MATLAB image processing and a
panoramic image captured using a smartphone has been shown to work. The final analysis
technique uses a panoramic image as input and provides two forms of output:
1. A shading diagram for easy and quick overview, providing information about which
obstacles may cause shading at a specific time of day and year
2. An excel file that can be used as input in the PV simulation software SAM
Below is an example of a panoramic image fully processed in the MATLAB program
Shading_Analysis.m (see the Appendix, section 8.3) to provide a shading diagram (Figure
13) together with an excel file as final output. The panoramic image was taken in Turin, Italy
(coordinates 45.065547, 7.698714) the 16th of March 2014.
a)
b)
c)
d)
Figure 13. a) Panoramic image of Turin, b) Image turned into grayscale, c) Grayscale image after contour enhancement d)
Processed image with superimposed sun path data. A red mark shows each full hour on the sun’s path. Azimuth 180° marks south.
-20-
5 Conclusion
The concept of using a smartphone based image acquisition method and MATLAB image
processing to produce an input for PV simulation has been proved to work.
With the completion of this project it can be concluded that although the MATLAB programme
and image acquisition method do not provide a viable alternative to current methods and
products at this point, it does provide a very powerful platform for the development of a new
and better alternative product. The MATLAB image processing proved to be a powerful tool for
prototyping; new ideas could quickly be tested and/or modified to enhance the final product
(shading diagram and obstruction matrix) and it should prove easy to develop the prototype into
a future final product ready for end-consumer use.
-21-
6 Discussion, comparisons and recommendations
In this section, conclusions and comparisons relevant to the results will be presented together
with some recommendations for future reference.
6.1 Discussion
MATLAB’s image processing capabilities are many and powerful. So powerful that proving that
the concept itself worked proved easier than expected, although the speed of the program suffers
greatly if image size is increased. Balancing the right image size and right amount of image
enhancement turned out to be the biggest challenge. If the image was too heavily enhanced
before segmentation, too much detail was lost while if the image was not enhanced enough,
segmentation couldn’t be performed reliably and background and foreground were mixed
together completely.
After the amount of enhancement had been balanced, another challenge became trying to make
the program run faster, as it was very slow at first (taking a little over 40 minutes to run). A lot of
improvements were made and the average run time of the final program is roughly 6 minutes.
There are still things that could be done to speed up the process (see section 6.3 below).
Processing time also varies greatly from image to image, partly because of different image sizes
and partly, it seems, because some of MATLAB’s predefined functions seem to struggle with
certain images.
It is also clear that the analysis technique is highly dependent on the quality of the input image.
Using an image where the true horizon not properly aligned and/or the centre of the image not
aligned toward the south will cause the sun path diagram to be superimposed at a position offset
to its correct position. This in turn will lead to inaccurate estimations of the effects of any
shading.
There is also an inherent weakness to the whole process (mentioned earlier in section 3.1.1)
which is based on the smartphone captured panoramic image. Although part of the problem
could be resolved (and section 3.1.2), the main part remains unsolved. Any obstructions that are
too high to fit into the smartphone camera’s vertical field of view will simply be “cut off” at the
top (Figure 14).
Figure 14. Final output shading diagram. Input panoramic image was captured with the phone held horizontally to illustrate the
effect of tall obstructions on the output.
-22-
6.2 Comparisons
Unfortunately, it was not possible to compare the results of this analysis technique with any
results obtained using the only image processing based shading analysis product on the market,
the SunEye 210.
It was however possible to compare the results with the only shading analysis app on the market,
Solar Shades. Both shading diagrams (Figure 15 & Figure 16) were created based on the same site in
Turin, Italy (coordinates 45.065547, 7.698714). The Solar Shades app required several tries to get a
horizon outline that looked acceptable. Two panoramic images had to be captured because the
first one was not captured properly (too far below horizon). The horizon outline created with the
Solar Shades app, which is based on readings from accelerometers in the smartphone, is far too
jagged and uneven to make any estimation. It has one advantage though; since it is not based on
image processing there is no risk of any part of the horizon being cut off.
Figure 15. Shading diagram created with the Solar Shades app.
Figure 16. Shading diagram created with the MATLAB program Shading_Analysis.m
-23-
6.3 Recommendations
Because the concept could be proved to work and the program produced satisfactory results, the
main recommendations will regard the speed of the program.
Any MATLAB code can be written in a number of ways. The focus of this project has been to
create a working program to develop a proof of concept and see if that concept would work.
This concept could however be further developed and improved upon in a number of ways:
By rewriting the code using vectorization, the speed of the program could probably be
increased. The program contains a lot of for-loops, some of which could probably be
rewritten in a more efficient way.
By utilizing MATLABs parallel computing toolbox, the program might be rewritten in a
more efficient way. Using functions in the toolbox would, for example, allow MATLAB
to process multiple steps in a for-loop simultaneously. We were not able to try this due
to not having access to MATLABs parallel computing toolbox.
Since MATLAB is based on interpreting commands, and thus eliminating the need for
compilation, it’s an excellent development tool to prototype new ideas or techniques.
Unfortunately, it also makes it rather slow. If the technique was implemented using
another programming language or if the MATLAB code was compiled into C++ code it
could greatly increase the speed.
In order to avoid the problem with tall obstructions being “cut off”, a future smartphone
application based on this concept should make sure to either use multiple panoramic
images together, captured at different heights or use some lens attachment to widen the
field of view of the smartphone camera. Both should solve the problem with “cut off”
obstructions but both come with some drawbacks. Using several panoramic images will
increase the image size and therefore increase processing time and using any lens
attachment will introduce distortion that must be accounted for during image processing.
Lens attachments could in a worst case scenario cause the smartphone’s built in
panorama-generation to fail partially or completely to render a good panorama.
-24-
7 References
Chakraborty et al. (2013), Power Electronics for Renewable and Distributed Energy Systems. United
Kingdom, London: Springer-Verlag 2013
Duffie and Beckman, (2006), Solar engineering of thermal processes. United States, New Jersey,
Hoboken: John Wiley & Sons, Inc. 2006 3rd edition.
Lorenzo et al., (1994), Solar Electricity: Engineering of Photovoltaic Systems. Spain, Sevilla:
PROGENSA 1994
Marques (2011), Practical image and video processing using MATLAB. United States, New Jersey,
Hoboken: John Wiley & Sons, Inc. 2011
SolarPathFinder (2014), How the Pathfinder works, available at http://www.solarpathfinder.com
Retrieved: March 14, 2014.
Solomon and Breckon (2011), Fundamentals of digital image processing: a practical approach using
MATLAB. United States, New Jersey, Hoboken: John Wiley & Sons, Inc. 2011
UO Solar Radiation Monitoring Laboratory (2008), About Sun Path Charts. Available at
http://solardat.uoregon.edu Last revised: October 22, 2008. Retrieved: March 13, 2014.
Zheng et al. (2013), Impact of uneven shading and bypass diodes on energy extraction characteristics of solar
photovoltaic modules and arrays. International Journal of Sustainable Energy, Volume 32,
Issue 5, p 351-365.
Gao et al., (2009), Parallel-connected Solar PV System to Address Partial and Rapidly Fluctuating Shadow
Conditions. IEEE Transactions on Industrial Electronics Volume 56, Issue 5, p 1548–56
-25-
8 Appendix
8.1 Methods for mitigating loss/damage caused by shading
The most commonly used and researched technique uses bypass diodes to keep the current from
unshaded cells from passing through the parallel resistance of shaded and/or damaged cells.
When a cell is shaded, the bypass diode is activated by the current from unshaded cells and
“shuts off” the shaded cell. While this does drastically mitigate the generation loss and can
prevent damage to the shaded cell, the shaded cell will still not produce any electricity. This
technique is also expensive to use because it is very situation-dependent, meaning that the solar
module needs to be designed knowing exactly what cells will be shaded, thus requiring lots of
simulation/designing work using expensive professional software. However, if shading cannot be
avoided, it can be used to avoid heat damage to one or more cells that might keep it/them from
working at all (Zheng et al., 2013).
-26-
8.2 Obstruction matrix
A section of the obstruction matrix, with zeros coloured in blue and ones coloured in green for
better distinction between the two.
-27-
8.3 MATLAB code
%% Shading_Analysis.m
% Created by Simon Wakter & Fredrik Wikerman on 2014-04-02
% Last changed on 2014-05-05
%% DESCRIPTION
% This program uses a 360° panoramic colour image as input together with
% sun path data from http://www.sunearthtools.com/ in .xlsx file format.
% The program's final output is:
% 1) A shading diagram showing the horizon profile as a black
% foreground with the sky as an all white background with sun path data
% superimposed for each month of the year.
% 2) An .xls-file with a (rounded) obstruction matrix, using either a
% "1" (no obstruction) or "0" (obstruction) to indicate if there is an
% obstruction that may cause shading depending on the sun's position.
% The file will indicate this for every second azimuth value ranging
% from -180° to 180° and elevation values ranging from 0° to 90°.
clear all
close all
clc
tic
warning on verbose
% Turns on extra line to display MSGID of any displayed warning messages
warning off images:initSize:adjustingMag
% Turn of warning for image display when image resolution exceeds
% screen resolution
-28-
%% Load the image and manipulate it to bring out the foreground.
I = imread('Panorama_Turin_5.jpg');
I = imresize(I,0.1);
I_gray = rgb2gray(I);
I_a = imadjust(I_gray, [0.45 0.8],[],1);
I_a(end-10:end,:) = 0;
figure(10)
imshow(I)
title('Orginal image')
figure(11)
imshow(I_gray)
title('Gray image')
figure(12)
imshow(I_a)
title('Adjusted image')
step = round(length(I_a)/10);
bw = [];
for l = 1:step:length(I_a)
if zeros(size(temp_bw(end,:))) == temp_bw(end,:)
bw = [bw temp_bw];
else
temp_bw = imcomplement(temp_bw);
bw = [bw temp_bw];
end
else
mask = ones(size(I_a(:,l:l+step)));
temp_bw = activecontour(I_a(:,l:l+step), mask, 2000,...
'Chan-Vese', 0.15);
if zeros(size(temp_bw(end,:))) == temp_bw(end,:);
bw = [bw temp_bw];
else
temp_bw = imcomplement(temp_bw);
bw = [bw temp_bw];
end
end
end
figure(13)
imshow(bw)
title('Manipulated image')
-29-
%% Importing and formatting sun path data
Elevation = RAW(:,1:2:end);
Azimuth = RAW(:,2:2:end);
TEST = Elevation(1,1);
for n = 1:365
for k = 1:24
TF_ele = strcmp(Elevation(n,k), TEST);
TF_azi = strcmp(Azimuth(n,k), TEST);
if TF_ele == 1
Elevation(n,k) = {0};
end
if TF_azi == 1
Azimuth(n,k) = {0};
end
end
end
Elevation = str2double(Elevation);
Azimuth = str2double(Azimuth);
Max_Azi = max(max(Azimuth));
Min_Azi = min(min(Azimuth));
Max_Ele = max(max(Elevation));
Min_Ele = min(min(Elevation));
Div_Azi = Max_Azi-Min_Azi;
Div_Ele = Max_Ele-Min_Ele;
%% Plot sun path data and manipulate plot image to match image size.
figure(1000)
hold on
axis([Min_Azi Max_Azi 0 Max_Ele]);
for j = 15:30:365 % Every 30th day, rougly in the middle of each month
plot(Azimuth(j,:), Elevation(j,:), 'r', 'LineWidth', 0.2)
end
hold off
scale_width = round(size(bw,2)/360);
Total_width = Div_Azi*scale_width;
Reversed = flipud(Resize_BWC(:,:,1));
figure(14)
imshow(Reversed)
hold on, axis on, grid on
x_mark = linspace(0,size(Resize_BWC,2),19);
y_mark = linspace(0,size(Resize_BWC,1),9);
x_label = linspace(0,360,19);
y_label = linspace(0,Max_Ele,9);
set(gca, 'XTickLabel', x_label)
set(gca, 'YTickLabel', y_label)
for j = 15:30:365 % Every 30th day, rougly in the middle of each month
plot(Resize_Azi(j,end:-1:1), Resize_Ele(j,end:-
1:1),'color',rand(1,3)...
,'LineWidth', 0.5)
end
legend('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep',...
'okt', 'nov', 'dec')
title('Shading diagram')
xlabel('Azimuth (Degrees)'), ylabel('Elevation (Degrees)');
for j = 15:30:365
plot(Resize_Azi(j,end:-12:1), Resize_Ele(j,end:-12:1),'r+')
end
hold off
-31-
%% Find pixel values of horizon outline, convert to azimuth and elevation
% degrees to export to Excel
Obstruct_pixel = [];
H_step = round(size(Resize_BWC,2)/360);
temp_h = 0;
for h = 1:H_step:size(Resize_BWC,2)
for v = 1:1:size(Resize_BWC,1)
if Resize_BWC(v,h)==0 && size(Obstruct_pixel,2)~=h && h~=temp_h
temp_pixel = [v;h];
Obstruct_pixel = [Obstruct_pixel temp_pixel];
temp_h = h;
end
end
end
Ele_pixel = size(Resize_BWC,1)/90;
Azi_pixel = size(Resize_BWC,2)/360;
Elevation_obstruct = Obstruct_pixel(1,:)/Ele_pixel;
Azimuth_obstruct = Obstruct_pixel(2,:)/Azi_pixel;
Obstruction = [Elevation_obstruct; Azimuth_obstruct];
Obstruction_round = round(Obstruction);
Obstruction_matrix = zeros(91,361);
for l = 1:360
Obstruction_matrix(end:-1:end-(Obstruction_round(1,l) -1),l) = 1;
end
y_Ele = (90:-1:0)';
x_Azi = -180:2:180;
toc
-32-