Skip to content

UM-Battery-Control-Group/UMBCL-InfluxDB

Repository files navigation

UMBCL_InfluxDB

This project seamlessly store the battery test record into the InfluxDataBase, offering an efficient solution for write and read data.

Table of Contents

  1. Prerequisites
  2. Setting up a Virtual Environment
  3. Installing Dependencies
  4. Docker
  5. Usage
  6. Usage by Docker
  7. ROSA
  8. License
  9. Questions

Prerequisites

Setting up a Virtual Environment

Virtual environments allow you to manage project-specific dependencies, which can prevent conflicts between versions.

  1. Install virtualenv (If not installed)

    pip install virtualenv
  2. Navigate to your project directory:

    cd /path/to/your/project
  3. Create a virtual environment:

    virtualenv venv
  4. Activate the virtual environment:

    • On macOS and Linux:

      source venv/bin/activate
    • On Windows:

      .\venv\Scripts\activate

    After activation, your command prompt should show the name of the virtual environment (venv in this case).

Installing Dependencies

Once the virtual environment is activated, you can install the project's dependencies.

pip install -r requirements.txt

Docker

Install docker: https://www.docker.com/products/docker-desktop/

  1. Connect our network drive to your PC.
  2. Navigate to 'docker-compose.yml'.
  3. Update the 'volumns' to the path of our network drive and map that.

To start the container:

docker-compose up

To stop the container:

docker-compose down

To access the InfluxDB dashboard, navigate to localhost:8086. Log in using the credentials specified in the 'docker-compose.yml' file. Once logged in, locate the 'Data' section and select 'Tokens'. Copy the displayed token and then replace the existing token in the 'influx.env' file with this new one.

Usage

To upload the file:

    from src.model improt DataManager
    data_manager = DataManager()
    file_path = "path/to/the/file"
    data_manager.write_data(file_path)

To make the query:

    from src.model improt DataManager
    data_manager = DataManager()
    measurement = "GMJuly2022_CELL004_EIS_3d_P25C_25P0PSI_20230324_R0_CH032"
    tags = {"ChannelNumber": "CH032", "Pressure": "25P0PSI"}
    data = data_manager.query_data(tags=tags) 
    # OR data = data_manager.query_data(measurement=measurement)

To learn more about the write and query API, hover your cursor over the respective function to view a tooltip or pop-up with detailed instructions and information.

Usage by Docker

Compose up the container:

sudo docker-compose up -d

Then get in the app container:

sudo docker-compose run --service-ports app

Inside the container, try upload like:

--write /data/PROJ_GMJULY2022/Cycler_Data_By_Cell/GMJuly2022_CELL002/GMJuly2022_CELL002_Test3_1_P0C_5P0PSI_20230505_R0_CH041.csv neware_vdf

Recursive write

--write /data/PROJ_GMJULY2022/Cycler_Data_By_Cell/GMJuly2022_CELL002/ -r
--write /data/PROJ_GMJULY2022/Cycler_Data_By_Cell/GMJuly2022_CELL002/ --recursive

Try query like:

--query GMJuly2022_CELL102_EIS_3d_P25C_5P0PSI_20230717_R0_CA8 Pressure=5P0PSI

ROSA

Find your oc login API token ,then login like:

oc login --token=bvna2asdasfeR3sdfeSASfnUW6snA2rDm23asd --server=https://api.containersprod.art2.p1.openshiftapps.com:6443

Adjust the YAML files in the 'deployment/kubernetes' folder to match your computing environment.

Apply all the yaml files like:

oc apply -f influxdb-pvc.yaml

License

This project is licensed under the MIT License.

Questions

If you have any questions or encounter any bugs, please raise an issue in our repository or send an email to [email protected]. We greatly appreciate your feedback.

About

The time series database for battery test data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published