This R Markdown script is for reproducing the analysis and graphs from the journal paper:
Alghamdi, A.; Blunden, L.S.; Alam, M.; Bahaj, A.S.; James, P.A.B. “Evaluating the Opportunities and Challenges of Domestic PV Installation in Saudi Arabia Based on Field Deployment in Jeddah”. Energies 2025, 18, x. https://doi.org/10.3390/xxxxx
Included along with this file are the data files and a compiled html version of this script.
library(readxl)
library(dplyr)
library(magrittr)
library(ggplot2)
library(purrr)
library(lubridate)
library(tidyr)
library(plotly)
library(paletteer)
library(stargazer)
library(htmltools)
library(scales)
library(FinancialMath)
library(sjPlot)
library(kableExtra)
# change filepath as appropriate
path_to_data <- ""
top_string <- as_labeller(c(`1` = "Villa 1", `2` = "Villa 2"))
TFA_1st <- 300 # first floor area, sq. m.
PV_area <- 70.6 # sq.m PV array
base_temp <- 18.0 # degC, for calculating CDDs
| Dependent variable: | |
| avta.cp | |
| avta.fr | 0.923*** |
| (0.921, 0.925) | |
| Observations | 221 |
| R2 | 1.000 |
| Adjusted R2 | 1.000 |
| Residual Std. Error | 0.596 (df = 220) |
| F Statistic | 626,731.000*** (df = 1; 220) |
| Note: | *p<0.1; **p<0.05; ***p<0.01 |
## Warning: Removed 130 rows containing missing values or values outside the scale range
## (`geom_col()`).
| Dependent variable: | ||
| cons2 | ||
| (1) | (2) | |
| cdd.adj | 0.019*** | 0.016*** |
| (0.015, 0.024) | (0.011, 0.021) | |
| Constant | 0.485 | 5.392*** |
| (-1.674, 2.643) | (2.906, 7.878) | |
| Observations | 65 | 65 |
| R2 | 0.529 | 0.359 |
| Adjusted R2 | 0.521 | 0.349 |
| Residual Std. Error (df = 63) | 2.231 | 2.570 |
| F Statistic (df = 1; 63) | 70.703*** | 35.246*** |
| Note: | *p<0.1; **p<0.05; ***p<0.01 | |
##
## Wilcoxon signed rank test with continuity correction
##
## data: p1 and p2
## V = 30580, p-value = 0.1626
## alternative hypothesis: true location shift is not equal to 0
discount_rate <- 0.15 # decimal
usd <- 3.75 # usd sar exchange rate 22 Nov 2024 (pegged to dollar)
tariff_exp <- 0.07/usd # current export tariff where applicable
tariff_low <- 0.18/usd # low rate import tariff (<6000kWh/month)
tariff_hi <- 0.30/usd # high rate import tariff (>6000kWh/month)
tariff_eco <- 1.00/usd # theoretical 'economic' export tariff
tariff_vhi <- 1.50/usd # theoretical economic export tariff without other changes
oandm <- 150 # annual maintenance cost usd
cost_kWp <- 1250 # installed
capacity <- 15 # kWp
initial_capital <- cost_kWp * capacity
econ_scale <- 0.8 # 20% reduction in cost
tariff_increase <- 1.0 # i.e. NO increase
n_years <- 7 #
## [1] "2022-07-27 +03"
## [1] 0.172952
## New names:
## • `mon` -> `mon...1`
## • `mon` -> `mon...4`
## • `mon` -> `mon...8`
| Case | NPV | IRR |
|---|---|---|
| BAU | -16285.69 | NA |
| I | -15525.55 | NA |
| II | -10581.03 | NA |
| III | -9277.93 | NA |
| IV | -1676.48 | 11.19 |
| V | -811.12 | 13.18 |
| VI | 767.57 | 16.69 |