Skip to content
Open

v1.2 #65

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ _site
.jekyll-cache
.jekyll-metadata
vendor
.Rhistory
1 change: 1 addition & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
info.R
1,315 changes: 0 additions & 1,315 deletions arbinimport.R

This file was deleted.

59 changes: 59 additions & 0 deletions global.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# ######
#
# Welcome to the Battery Analyzer Utility!
#
# This script aims to make it quick and efficient to analyze data exported by an Arbin battery cycler
#
# ######

# ######
#
# These are all the required packages to aid in several of the processes, ranging from data analysis to plotting
#
# ######

# options(warn = 0)

list.of.packages <- c("readxl", "dplyr", "shiny", "tcltk", "DT", "shinyjs", "shinyalert", "pracma", "purrr", "zoo", "plotrix", "tools", "shinyWidgets", "gifski")
new.packages <- list.of.packages[!(list.of.packages %in% installed.packages()[, "Package"])]
if (length(new.packages)) install.packages(new.packages)
lapply(list.of.packages, require, character.only = TRUE)

source("ui.R", local = TRUE)
source("server.R")
source("info.R")

# This line tests if the current R environment is interactive, RStudio makes an interactive environment by default
if (interactive()) {

# ######
#
# All the global variables within the script, aka variables that need to be accessed by more than one
# function or session
#
# "Reactive Values" are ones that need to be readily changed, such as user inputs and variables to be displayed
#
# ######
data <- reactiveValues(data = data.frame())
final <- data.frame()
dirLocation <- vector()
numCycles <- data.frame()
dQdVData <- data.frame()
total <- data.frame()
cycle_facts <- data.frame()
tmp_data <- data.frame()
dirName <<- ""
tmp_cycles <- vector()
titleLabel <- ""
xlabel <- ""
ylabel <- ""
addParams <- FALSE
arbinCM <- FALSE
catMetric <<- vector()
legTitle <<- ""
sheetName <<- ""
bounds <<- vector()
compCycleFacts <<- data.frame()
}

shinyApp(ui, server)
86 changes: 86 additions & 0 deletions info.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@

graphInfoTable <- HTML('
<style type="text/css">
.tg {border-collapse: collapse;border-spacing: 0;}
.tg td{font-family: Arial, sans-serif;font-size: 14px;padding: 10px 5px;border-style: solid;border-width: 1px;overflow: hidden;word-break: normal;border-color: black;}
.tg th{font-family: Arial, sans-serif;font-size: 14px;font-weight: normal;padding: 10px 5px;border-style: solid;border-width: 1px;overflow: hidden;word-break: normal;border-color: black;}
.tg .tg-gfnm{background-color: #efefef;border-color: #000000;text-align: center;vertical-align: middle}
.tg .tg-i0p4{font-weight: bold;background-color: #ecf4ff;border-color: #000000;text-align: center;vertical-align: middle}
.tg .tg-3fas{background-color: #efefef;border-color: #000000;text-align: left;vertical-align: middle}
.tg .tg-o3hj{background-color: #ecf4ff;border-color: #000000;text-align: center;vertical-align: middle}
.tg .tg-xwyw{border-color: #000000;text-align: center;vertical-align: middle}
.tg .tg-0a7q{border-color: #000000;text-align: left;vertical-align: middle}
</style>
<table class="tg">
<tr>
<th class="tg-i0p4">Graph</th>
<th class="tg-i0p4">X Axis</th>
<th class="tg-i0p4">Y Axis</th>
<th class="tg-o3hj"><span style="font-weight: bold">Plot Frequency</span><br></th>
<th class="tg-i0p4">Description</th>
</tr>
<tr>
<td class="tg-xwyw">dQdV Graph</td>
<td class="tg-xwyw">Voltage (V)</td>
<td class="tg-xwyw">dQdV (Ah/V)</td>
<td class="tg-xwyw">per cycle</td>
<td class="tg-0a7q">The differential capacity plot for each cycle<br></td>
</tr>
<tr>
<td class="tg-gfnm">Voltage Profile</td>
<td class="tg-gfnm">Continuous Capacity (mAh/g or Ah)</td>
<td class="tg-gfnm">Voltage (V)</td>
<td class="tg-gfnm">per cycle</td>
<td class="tg-3fas">Voltage vs. capacity plot for each cycle. Units depend if the masses are specified.</td>
</tr>
<tr>
<td class="tg-xwyw">Voltage vs. Time</td>
<td class="tg-xwyw">Time (min)</td>
<td class="tg-xwyw">Voltage (V)</td>
<td class="tg-xwyw">per cycle</td>
<td class="tg-0a7q">The voltage as a function of time, including all steps</td>
</tr>
<tr>
<td class="tg-gfnm">Discharge Capacity</td>
<td class="tg-gfnm">Cycle</td>
<td class="tg-gfnm">Discharge Capacity (mAh/g or Ah)</td>
<td class="tg-gfnm">per cell</td>
<td class="tg-3fas">Discharge capacity for each <span style="font-weight: bold">individual cell </span>per cycle. Coulombic efficiency is also plotted on a secondary axis. Units depend if the masses are specified.</td>
</tr>
<tr>
<td class="tg-xwyw">Discharge Areal Capacity</td>
<td class="tg-xwyw">Cycle</td>
<td class="tg-xwyw">Discharge Capacity (Ah/cm<sup>2</sup>)</td>
<td class="tg-xwyw">per cell</td>
<td class="tg-0a7q">Discharge areal capacity for each <span style="font-weight: bold">individual cell </span>per cycle. Coulombic efficiency is also plotted on a secondary axis.</td>
</tr>
<tr>
<td class="tg-gfnm">Total Discharge Capacity</td>
<td class="tg-gfnm">Cycle</td>
<td class="tg-gfnm">Discharge Capacity (mAh/g or Ah)</td>
<td class="tg-gfnm">per analysis</td>
<td class="tg-3fas">Discharge capacity summarized for <span style="font-weight: bold">all cells</span> in the analysis. Coulombic efficiency is also plotted on a secondary axis. Mean is plotted as a point with error bars presenting the standard error between the cells. Units depend if the masses are specified.</td>
</tr>
<tr>
<td class="tg-xwyw">Average Voltage</td>
<td class="tg-xwyw">Cycle</td>
<td class="tg-xwyw">Voltage (V)</td>
<td class="tg-xwyw">per cell</td>
<td class="tg-0a7q">The average voltage vs capacity for each cycle. The charge voltage (V<sub>charge</sub>) and discharge voltage (V<sub>discharge</sub>) were calculated using the average value theorem. The average voltage is then (V<sub>charge</sub> + V<sub>discharge</sub>)/2. Charge and discharge voltages are plotted alongside the average.</td>
</tr>
<tr>
<td class="tg-gfnm">Delta Voltage</td>
<td class="tg-gfnm">Cycle</td>
<td class="tg-gfnm">Voltage (V)</td>
<td class="tg-gfnm">per cell</td>
<td class="tg-3fas">The delta voltage vs capacity for each cycle. The charge voltage (V<sub>charge</sub>) and discharge voltage (V<sub>discharge</sub>) were calculated using the average value theorem. The delta voltage is then V<sub>charge</sub> - V<sub>discharge</sub>). Charge and discharge voltages are plotted alongside the average.</td>
</tr>
<tr>
<td class="tg-xwyw">Capacity Loss</td>
<td class="tg-xwyw">Cycle</td>
<td class="tg-xwyw">Capacity (mAh/g or Ah)</td>
<td class="tg-xwyw">per cell</td>
<td class="tg-0a7q">The discharge capacity minus the charge capacity for each cycle. Units depend if the masses are specified.</td>
</tr>
</table>
')
97 changes: 97 additions & 0 deletions modal.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Defines the modal in which the cell masses can be exported from Excel
graphModal <- modalDialog(
{
fluidPage(
style = "font-size:15pt;",
tags$head(tags$style(".modal-dialog{min-width:60%}")),
fluidRow(align = "center", graphInfoTable),
)
},
title = "Graph Types",
easyClose = TRUE
)

graphbuilder <- modalDialog(
{
fluidPage(
useShinyjs(),
useShinyalert(),
tags$head(tags$style(".modal-dialog{width:80%}")),
tags$head(tags$style(".modal-body{ min-height:1000px}")),
sidebarLayout(
sidebarPanel(
fluidRow(
headerPanel("Graph Options"),
),
fluidRow(
style = "padding:5%; border: 1px solid black;",
strong("Basis for Plot Types"), tags$br(),
helpText("Between Analysis requires a second dataset to be imported"), tags$br(),
radioButtons("perType", NULL, choices = c("Within Analysis", "Between Analyses"), inline = TRUE),
hidden(fileInput("compAnalysis", "Data to Compare"))
),
fluidRow(
style = "padding:5%; margin:5%;",
radioButtons("typeGraph", "Graph Type:", choices = c(
"dQdV Graphs", "Voltage Profiles", "Voltage vs. Time",
"Charge Voltage", "Discharge Voltage",
"Average Voltage", "Delta Voltage", "Discharge Capacity", "Charge Capacity"
), inline = FALSE),
radioButtons("plotStyle", "Plot Style:", choiceNames = c("Point", "Line", "Both"), choiceValues = c("p", "l", "o"), inline = TRUE),
checkboxGroupInput("cells", "Cell to Analyze:", choices = 1, inline = FALSE),
selectInput("renderCycles", "Cycles of Interest:", choices = 1, multiple = TRUE),
),
fluidRow(
strong("Click to show coordinates:"), tags$br(), tags$br(),
"X: ",
textOutput("hoverCoordx", inline = TRUE), tags$br(),
"Y: ",
textOutput("hoverCoordy", inline = TRUE),
style = "border: 1px solid black; padding: 5%; margin: 5%;"
),
fluidRow(
textInput("fileName", "Name of graph file:"),
actionButton("saveGraph", "Save Graph", width = "100%", class = "btn-primary"),
style = "border: 4px double black; padding: 5%; margin: 5%;"
),
),
mainPanel(
fluidRow(
plotOutput("outputPlot", height = "800px", click = "plot_click"),
style = "padding: 5%;",
),
fluidRow(
h3("Graph Formatting"),
helpText("*If left blank, they will be calculated using the min and max of the data to be plotted."),
column(
2,
numericInput("xMin", "X Min", value = NULL),
sliderInput("textSize", "Text Size", min = 0.1, max = 5, value = 1, ticks = FALSE),
),
column(
2,
numericInput("xMax", "X Max", value = NULL),
sliderInput("pointSize", "Point/Line Size", min = 0.1, max = 5, value = 1, ticks = FALSE),
),
column(
2,
numericInput("yMin", "Y Min", value = NULL),
),
column(
2,
numericInput("yMax", "Y Max", value = NULL),
),
column(
4,
textInput("originalData", "Original Data Name", value = "Original Data"),
textInput("compareData", "Comparison Data Name", value = "Comparison Data"),
),
style = "border: 1px dashed black; padding: 2%;",
)
)
)
)
},
size = "l",
title = "Post-Processing Graph Builder"
)
Loading