---
title: "Photovoltaic Module JSON-LD"
author: "William C. Oltjen, Laura S. Bruckman, Roger H. French"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Photovoltaic Module JSON-LD}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

Photovoltaic Module JSON-LD Description
-----------------------------------
This json-ld template is used to store metadata information commonly used to describe photovoltaic (PV) Modules. There is information included on the cells, encapsulant, backsheet, electrical properties, and module dimensions. Note that a lot of the material included in this json pulls from the OrangeButton Taxonomy. 

Creating JSON-LD for PV Modules in R
------------------------------------------
```{r, message=FALSE, eval=FALSE}
library(FAIRmaterials)

# An example data frame for PV Modules
module_example <- data.frame('CellTechnologyType' = c('PERC', 'Al-BSF'),
                            'CellMaterial' = c('mono-crystalline', 'poly-crystalline'),
                            'EncapsulantMaterial' = c('EVA', 'POE'),
                            'BacksheetMaterial' = c('PVF', 'PET'),
                            'BacksheetColor' = c('White', 'Black'),
                            'ProdMfr' = c('CSI', 'FirstSolar'),
                            'ProdCode' = c('BiHiKu7', 'BiHiKu7255'),
                            'CellCount' = c(60, 72),
                            'ModuleEfficiency' = c(20.1, 22),
                            'GlassThickness' = c(2, 1.5),  # GT and J_Box are not included in the
                            'J_Box' = c('IP68', 'IP70')) # base template, but they still have a spot!

# This will generate JSON-LD file for the example data
output <- fairify_data(module_example, domain = 'PVModule', saveLocal = TRUE)
```

Creating JSON-LD for PV Modules in Python
------------------------------------------
```{python, eval = FALSE, python.reticulate = FALSE}
from fairmaterials.fairify_data import *
import pandas as pd

# An example data frame for PV Modules
module_example = {'CellTechnologyType' : ['PERC', 'Al-BSF'],
                  'CellMaterial' : ['mono-crystalline', 'poly-crystalline'],
                  'EncapsulantMaterial' : ['EVA', 'POE'],
                  'BacksheetMaterial' : ['PVF', 'PET'],
                  'BacksheetColor' : ['White', 'Black'],
                  'ProdMfr' : ['CSI', 'FirstSolar'],
                  'ProdCode' : ['BiHiKu7', 'BiHiKu7255'],
                  'CellCount' : [60, 72],
                  'ModuleEfficiency' : [20.1, 22]}

module_example = pd.DataFrame(module_example)
                            
# This will generate JSON-LD file for the example data
output <- fairify_data(module_example, domain = 'PVModule')
```


PV Module schema diagram
--------------------------

```{r, out.width="800px", echo=FALSE, fig.cap="PV Module schema diagram"}
knitr::include_graphics("pv-module.png")
```

Acknowledgment
--------------------------
This material is based upon work supported by the U.S. Department of Energy’s Office of Energy Efficiency and Renewable Energy (EERE) under Solar Energy Technologies Office (SETO) Agreement Number DE-EE0009347.
