Skip to content
/ SRMS Public

Java desktop application for calculating and visualizing CO2/Carbon emissions before and after cloud adoption

Notifications You must be signed in to change notification settings

jin040907/SRMS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sustainable Resource Management System

Java desktop application for calculating and visualizing CO2/Carbon emissions before and after cloud adoption. Features emission calculations, data persistence, reporting, and interactive charts.

Features

  • Emission Calculation: Calculate CO2 and Carbon emissions based on energy consumption and emission factors
  • Cloud Impact Analysis: Compare emissions before and after cloud adoption with configurable power reduction percentages
  • Data Persistence: Save emission data with timestamps to a text file
  • Report Generation: Generate comprehensive reports from saved emission data
  • Visual Analytics: Create interactive line charts showing emission trends over time
  • User-Friendly GUI: Intuitive Swing-based graphical user interface

Requirements

  • Java: JDK 8 or higher
  • JFreeChart Library: Version 1.0.19 (included in the project)
  • JCommon Library: Version 1.0.23 (included in the project)

Project Structure

Sustainable-Resource-Management-System/
├── finalProject/
│   ├── src/
│   │   └── finalProject/
│   │       └── SustainableResourceManagementSystem.java
│   ├── bin/
│   │   └── finalProject/
│   │       └── SustainableResourceManagementSystem.class
│   ├── emission_data.txt          # Saved emission data
│   └── jfreechart-1.0.19/         # JFreeChart library
│       └── lib/
│           ├── jfreechart-1.0.19.jar
│           └── jcommon-1.0.23.jar
├── Proposal.docx
├── Presentation.pdf
└── README.md

Installation

  1. Clone or download the repository

    git clone <repository-url>
    cd Sustainable-Resource-Management-System
  2. Ensure Java is installed

    java -version

    Should show Java 8 or higher.

  3. Compile the project

    cd finalProject
    javac -cp "jfreechart-1.0.19/lib/jfreechart-1.0.19.jar:jfreechart-1.0.19/lib/jcommon-1.0.23.jar" src/finalProject/SustainableResourceManagementSystem.java -d bin

Usage

Running the Application

cd finalProject
java -cp "bin:jfreechart-1.0.19/lib/jfreechart-1.0.19.jar:jfreechart-1.0.19/lib/jcommon-1.0.23.jar" finalProject.SustainableResourceManagementSystem

Using the Application

  1. Enter Input Values:

    • Energy Consumption (kWh): Total energy consumption
    • CO2 Emission Factor (kg CO2/kWh): Emission factor for your energy source
    • CO2 Emission (kg): Additional CO2 emissions
    • Cloud Power Reduction (%): Percentage reduction in power consumption after cloud adoption
  2. Calculate Total Emission:

    • Click "Calculate Total Emission" to see emissions before and after cloud adoption
    • Results display both CO2 and Carbon emissions
  3. Save Data:

    • Click "Save Data" to persist the current calculation with a timestamp
    • Data is saved to emission_data.txt in the finalProject directory
  4. Generate Report:

    • Click "Generate Report" to view all saved emission data
    • The report appears in the Report text area
  5. Generate Emission Graphs:

    • Click "Generate Emission Graphs" to create visual charts
    • The graph displays four series:
      • Red: CO2 Emission Before Cloud
      • Yellow: CO2 Emission After Cloud
      • Green: Carbon Emission Before Cloud
      • Blue: Carbon Emission After Cloud

Calculation Methodology

CO2 Emissions

  • Before Cloud: (Energy Consumption × CO2 Emission Factor) + CO2 Emission
  • After Cloud: (Energy Consumption × (1 - Reduction%) × CO2 Emission Factor) + CO2 Emission

Carbon Emissions

  • Carbon Emission Factor: CO2 Emission Factor × 0.2727 (1 kg CO2 = 0.2727 kg Carbon)
  • Before Cloud: (Energy Consumption × Carbon Emission Factor) + (CO2 Emission × 0.2727)
  • After Cloud: (Energy Consumption × (1 - Reduction%) × Carbon Emission Factor) + (CO2 Emission × 0.2727)

Data Format

Saved data is stored in emission_data.txt with the following format:

Timestamp: YYYY-MM-DD HH:mm:ss, Energy Consumption: X kWh, CO2 Emission Factor: Y kg CO2/kWh, CO2 Emission: Z kg, Carbon Emission Factor: W kg C/kWh, Power Reduction: P%, Total CO2 Emission Before Cloud: A kg CO2, Total CO2 Emission After Cloud: B kg CO2, Total Carbon Emission Before Cloud: C kg C, Total Carbon Emission After Cloud: D kg C

Dependencies

  • JFreeChart 1.0.19: For chart generation and visualization
  • JCommon 1.0.23: Required dependency for JFreeChart

Both libraries are included in the jfreechart-1.0.19/lib/ directory.

Troubleshooting

Common Issues

  1. ClassNotFoundException: Ensure the JAR files are in the classpath

    java -cp "bin:jfreechart-1.0.19/lib/*" finalProject.SustainableResourceManagementSystem
  2. No data available for report: Make sure you've saved at least one data entry before generating a report

  3. Graph generation error: Ensure emission_data.txt exists and contains valid data entries

  4. Invalid input error: Make sure all input fields contain valid numeric values

Development

Building from Source

cd finalProject
javac -cp "jfreechart-1.0.19/lib/jfreechart-1.0.19.jar:jfreechart-1.0.19/lib/jcommon-1.0.23.jar" \
      src/finalProject/SustainableResourceManagementSystem.java \
      -d bin

Code Structure

  • Main Class: SustainableResourceManagementSystem.java
    • GUI initialization and layout
    • Event handlers for buttons
    • Calculation logic
    • File I/O operations
    • Chart generation

License

This project uses JFreeChart library which is licensed under LGPL. Please refer to jfreechart-1.0.19/licence-LGPL.txt for details.

Author

Developed as part of a final project for Sustainable Resource Management.

Future Enhancements

  • Export reports to PDF format
  • Database integration for data storage
  • Multiple chart types (bar, pie, etc.)
  • Data filtering and search capabilities
  • Multi-user support
  • API integration for real-time emission factors

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

Contact

For questions or support, please refer to the project documentation or contact the development team.

About

Java desktop application for calculating and visualizing CO2/Carbon emissions before and after cloud adoption

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages