Code Monkey home page Code Monkey logo

processcontrollersimulator's Introduction

Process Controller Simulator

A simulation framework, on which models, processes and controllers can be easily, flexibly and concurrently simulated. Includes automatic real-time visualization of process variables and an interactive CLI. Intended for educational use, for people interested in learning about modelling, simulation, control and optimization.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Running the example

This example will run a Continuous Stirred Tank Reactor (CSTR) model. A MPC Controller will aim to steer the manipulated variables in order to reach the control objectives (maximizing product yield). The example model is available here, the controller is defined here.


#Clone the project
git clone https://github.com/marianaipmonteiro/ProcessControllerSimulator

#Change into project directory
cd ProcessControllerSimulator

#Create a virtual environment
python3 -m venv venv

#Activate the virtual environment
source ./venv/bin/activate

#Install Dependencies
pip install -r requirements.txt

#Run Main, providing a simulation class as an argument
python3 Main.py examples.simulations.cstr_control_simulation.CSTRControlSimulation

Visualization

Connecting to localhost:8050 should present the automatic real-time visualization of process variables:

data-viz

CLI Interaction

A CLI is provided which allows several interactions with the running simulation:

# Help message
Commands:
            print world - Prints the state of the world.
            perturb <var> <value> - Perturbs variable <var> by the decimal amount <value>, positive or negative.
            help - Prints this message.
            exit - Exits the program.

Computational Model

The main abstractions in the framework are that of a WorldState, which contains the current state of the world (constants and variables). A Simulation owns a list of WorldStates, and will use a WorldInitializer to create the initial world, providing definitions for constants and variables. A Simulation is initialized by providing it with a number of SimulatedSystems.

Each SimulatedSystem is instantiated by the Simulation, and runs a simulation loop on a separate thread. This loop will periodically poll the WorldState list, obtaining the most recent WorldState, which is used by the SimulatedSystem to compute a new WorldState, and appending it to the WorldState list, thus progressing the state of the world. A simple lock is used to provide exclusive acess during accesses to the world state list, but users are abstracted from that.

Both Models and Controllers are SimulatedSystems, with specific simulation loops. To create a model, users may extend either Model.py or SelfInitializingModel.py (which is both a Model and a WorldInitializer). An example Controller is provided in the form of an MPC Controller.

Visualization is achieved by periodically rendering the values of a variable in all the WorldStates over time.

TO-DO

  • Flexible Simulation Framework
  • Initial Examples
  • Visualization
  • Logging
  • Figure out why Data Visualizer takes so long
  • GUI for Simulation Customization
  • Reinforcement Learning Controller Framework
  • Surrogate Model Framework
  • Benchmarks
  • Documentation
  • Testing

Authors

Mariana Monteiro - @marianaipmonteiro - Modelling the CSTR, implementing MPC strategy, computational model.

Pedro Silvestre - @PSilvestre - Computational model.

processcontrollersimulator's People

Contributors

marianaipmonteiro avatar

Stargazers

Pedro Silvestre avatar Afrânio Melo avatar Konstantinos Flevaris avatar Yoel avatar  avatar Julio Dutra avatar

Watchers

Pedro Silvestre avatar  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.