Code Monkey home page Code Monkey logo

pv_simulator's Introduction

PV Simulator

Generates simulated photovoltaic (PV) power production and household consumption values and writes the results (in Kilowatts kW) to the disk.

Stack

  • Docker
  • RabbitMQ
  • Pika
  • Python 3.8

How to use

Using Docker Compose

  • To create and run the image use the following command, Make sure that docker is already installed in your system.
docker-compose up --build
  • Copy storage file from docker container to the local system. Make sure that your docker containers are up and running.
docker cp simulator:/simulator/output.csv ./

About the system

The configuration will create a cluster with 3 containers:

  • Meter container
  • Simulator container
  • RabbitMQ container

The Meter container will continuously generates a random consumption value between 0 to 9.0 KW and publishes meter data to RabbitMQ.

The Simulator container will read message from the RabbitMQ and parses the message. Then calculates the PV values using the PV Simulator.

The simlilation values are looks like this,

+------+-------+
| Hour | BasePV|
+------+-------+
|  4   |  0.1  |
|  5   | 0.15  |
|  6   |  0.2  |
|  7   |  0.3  |
|  8   |  0.5  |
|  9   |  1.0  |
| 10   |  2.0  |
| 11   |  2.5  |
| 12   |  3.0  |
| 13   |  3.5  |
| 14   |  3.5  |
| 15   |  3.2  |
| 16   |  3.0  |
| 17   |  2.5  |
| 18   |  2.0  |
| 19   |  1.0  |
| 20   |  0.2  |
| 21   |  0.1  |
+------+-------+

Calcultion of PV values

If hour less than 14:00

    Final PV value = BasePV + (0.01 * Minutes)

If hour greater than 14:00

    Final PV value = BasePV - (0.01 * Minutes)

Examples:

11:30 => 2.5 + (0.01 * 30) => 2.8
18:13 => 2.0 - (0.01 * 13) => 1.87

Calcultion of Sum up value

Sum up value = PV value - meter consumption value

Created sum up value with PV values and meter consumption values. Finally all values (timestamp, PV values, meter consumption value, sum up value) stored into a CSV file.

Format for CSV file

timestamp, pv_value, meter_consumption_value, sumup_value

RabbitMQ container is where messages flow through RabbitMQ and applications, stored inside a queue. A web browser access to the Dashboard is also provided for RabbitMQ message management and monitoring which can be accessed at http://localhost:15672.

Project Structure

Below is a project structure created:

.
├── README.md
├── docker-compose.yml
├── meter
│   ├── Dockerfile
│   ├── module
│   │   ├── __init__.py
│   │   ├── __main__.py
│   │   ├── config.py
│   │   ├── gateway
│   │   │   ├── __init__.py
│   │   │   └── rabbitmq.py
│   │   ├── handler.py
│   │   └── meter.py
│   ├── requirements.txt
│   └── tests
│       ├── __init__.py
│       └── test_meter.py
└── simulator
    ├── Dockerfile
    ├── module
    │   ├── __init__.py
    │   ├── __main__.py
    │   ├── config.py
    │   ├── gateway
    │   │   ├── __init__.py
    │   │   └── rabbitmq.py
    │   ├── handler.py
    │   ├── simulator.py
    │   └── storage.py
    ├── requirements.txt
    └── tests
        ├── __init__.py
        └── test_simulator.py

Help and Resources

You can read more about the tools documentation:

pv_simulator's People

Watchers

Rahul KP avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.