Skip to content

kkriti01/pvsimulator

Repository files navigation

PV Simulator

Running using docker-compose

  1. docker-compose build docker-compose up
  2. You'll see meter and pv_simulator service failing and restarting, this is fine, they are waiting for rabbitmq . Once rabbitmq is up, they'll start normally
  3. see logs in local /logs directory (host log is mapped to container)
  4. see graph plot by opening 'http://127.0.0.1:7005' on your local machine

if port 7005 , 5672 and 15672 are busy on the host, please either free them or change port mapping in the docker-compose.yml file

Running manually

  1. create virtual environment (python >= 3.7)
  2. install dependencies: pip install -r requirements.txt
  3. make sure rabbitmq is running
  4. update rabbitmq connection url by exporting it to environment variable RABBIT_MQ_HOST or directly updating in settings.py file
  5. start meter : python3 -m simulator.services.meter
  6. start pv_simulator : python3 -m simulator.services.pv_simulator
  7. start web : python3 -m simulator.services.web
  8. other variable can be controlled by os environment variable provided in settings.py

The solution

  1. meter.py: It simulates power consumption in home and generates random but continuous power and publish it to the broker.
  2. simulator.py: Reads message from broker and generates simulated power value, adds that simulated value in power meter reading and write it to the file.
  3. web.py: It shows a plot which plots power meter reading(KW) with time.

Tests:

Change the rabbitmq hostname to localhost in settings 'amqp://guest:guest@localhost:5672' before running the test. Test can be run as python3 -m pytest

Improvement:

  1. More test cases can be added.
  2. Power value plot can be improved further. Also currently plot shows data for current date, one parameter can be added to select date and show reading for that date.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published