Coder Social home page Coder Social logo

projet-ppc's Introduction

Projet-PPC

The goal of this programming project is to design and implement a multi-process and multithread simulation in Python with multiple ways of communication between them. The program simulates an energy market where energy-producing and consuming homes, weather conditions, and random events contribute to the evolution of energy price over time.

Requirements

To run the application, you will need to have Python3 and the following libraries installed:

  • matplotlib
  • sysv-ipc

Installation

Download all the files of this project in the same repository. Install matplotlib and sysv-ipc libraries using the following commands in the terminal:

  • python3 -m pip install matplotlib --user
  • pip install sysv-ipc

Open a terminal in the directory of the files and type the following command to start the simulation:

python3 Main.py

Classes

Home: Each home process has a unique ID and randomly takes a trade policy (0: Always sell, 1: Always give, 2: Sell if no takers). At the time of their creation and each day, the homes are assigned two random ints that define their production and consumption of energy, which vary according to the temperature of the day. The offer represents the difference between these two values. If it's negative, the home will look for a way to gain energy, and if it's positive, the home will get rid of it according to its trade policy.

Weather: This process is the first to start each day, it fills a shared memory with today's temperature.

External: This process is started by the Market. It sends signals to its parent (the Market) if an event occurs.

Market: The energy price varies according to events, and energy asks and sells from the Home classes. The energy price starts at 17 cents/kWatt. This process starts threads that take care of transactions from the Homes to the Market.

Main: This process starts the other processes. In this class, you can change all the values of the variables and constants used in the program.

Communication

Homes communicate with each other using message queues and exchange their energy freely before selling it to or buying it from the Market using sockets. Weather updates a shared memory with the temperature, and the Homes read it. External process, a child of the Market process, sends signal events to its parent, each signal corresponding to an event.

Take a look at our report Projet PPC.pdf for more informations about our work and reflexions about this project.

Functionality

The user can try to modify the variables in the Main.py to show how each number can influence the price of the energy over time (number of houses, number of days of the simulation, initial price of the energy...)

projet-ppc's People

Contributors

julie-mg avatar ran190 avatar

Watchers

 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.