Skip to content

🔋 USING R AND JAVA to Get and Analyzed your laptop battery health report. Compare the current with design capacity

Notifications You must be signed in to change notification settings

justinphan3110/Battery-Health-Report

Repository files navigation

Battery-Health-Report

USING R AND JAVA to Get and Analyzed your laptop battery health report. Compare the current with design capacity

The battery capacity will decrease over time. This application will help you to track the current capacity compared to the design capacity

▶️ Click here to got to Install and Download section

📓 Demo

click Scan

image

After scan successful you will received the information of your computer. Now you have to option, you can either choose the short result to get the percentage of design capacity or a details one which will thoroughly analyze the battery health since you bought the laptop.

image

Choose the Short Result Option:

image

Choose the Detail Result Option:

image

two windows of a point plot and a csv file will pop up give the the data how your battery capacity decrease over time

image

Prerequisites

I will use cmd commnad to generate a battery-report.html and using Jsoup.jar to parsing this file and read it into a csv file.

I will then use Renjin to intergrate R into JVM to clean and analyze this batter data base on each week since the laptop was bought.

image

The html file will give us the data as

image

I will then use BufferedReader to read this .html file image

After the data has been read. CSVWriter from the OpenCSV can be used to write these data into a .csv file .csv file can then be used by R language to clean and analyze. I use Renjin instead of JRI because Renjin will run on JVM and not require and JRI require installed R on the computer to implement. Renjin can be set up in Java IDE as

image

engine.eval command just simply pass the command into normal R Terminal to execute the data.frame

image

The data after been clean and analyze in BatteryReport.csv, I use JFreeChart to draw a scatter point plot analyze how the capacity of laptop battery decrease in terms of weeks since it was first used.

image

Most of the API is build based on javaFX

Installing

⏩Option 1: Download the BatteryHealthReport(forUser) folder and unzip the withJava.zip if your computer have Java (64-bit) installed OR unzip the NoJava.zip if your computer does not have java installed

(:heavy_exclamation_mark:note: keep the jar and the .exe file in the same folder).

image

Click on battery.exe to run

image

Note: If you run on the version of WithJava and the application stop working after you click scan, there may be a chance that your laptop is using Java 32-bit. Therefore, you can either change it back to 64 bits or use the NoJava.rar version. Check JVM 64-bit or 32-bit

Maven Setting(Pom.xml)

Dependencies

<dependencies>
	<!-- https://mvnrepository.com/artifact/org.jfree/jcommon -->
	<dependency>
		<groupId>org.jfree</groupId>
		<artifactId>jcommon</artifactId>
		<version>1.0.23</version>
	</dependency>

	<!-- https://mvnrepository.com/artifact/org.jfree/jfreechart -->
	<dependency>
		<groupId>org.jfree</groupId>
		<artifactId>jfreechart</artifactId>
		<version>1.0.19</version>
	</dependency>

	<!-- https://mvnrepository.com/artifact/org.nuiton.thirdparty/JRI -->
	<dependency>
		<groupId>org.nuiton.thirdparty</groupId>
		<artifactId>JRI</artifactId>
		<version>0.9-6</version>
	</dependency>
	<!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
	<dependency>
		<groupId>org.jsoup</groupId>
		<artifactId>jsoup</artifactId>
		<version>1.11.3</version>
	</dependency>
	<!-- https://mvnrepository.com/artifact/com.opencsv/opencsv -->
	<dependency>
		<groupId>com.opencsv</groupId>
		<artifactId>opencsv</artifactId>
		<version>4.5</version>
	</dependency>
	<!-- https://mvnrepository.com/artifact/org.renjin/renjin-script-engine -->
	<dependency>
		<groupId>org.renjin</groupId>
		<artifactId>renjin-script-engine</artifactId>
		<version>RELEASE</version>
	</dependency>
</dependencies>

Build

For more concise, the full build set up and the above repositories and dependencies can be access pom.xml

Note: Repositories section is requried for running Renjin

Download

⬇️ Code and ⬇️ Lib Folder

Or you can download each of the dependencies straight from the web for updated

image

1️⃣ jsoup: for the purpose of parsing and reading the html file.

2️⃣ opencsv: can be used to write and read csv file

3️⃣ Renjin: using JVM to intergrate Java and R for better data analysize (note: user does not need to have R installed on computer when using Renjin)

4️⃣ JRI: user can used JRI for the familiar if Renjin is still new

5️⃣ JCommon and 6️⃣ JFreeChart: for the purpose of drawing the plot

🔗 Built With

Author

Long Phan

About

🔋 USING R AND JAVA to Get and Analyzed your laptop battery health report. Compare the current with design capacity

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published