Coder Social home page Coder Social logo

rankinelab's Introduction

RankineLab

Description

RankineLab is a MATLAB tool for the thermodynamic analysis and optimization of Rankine cycles. The code was developed aiming at simplicity and flexibility in terms of cycle configurations and operating conditions. Some of the notable features of the code are listed below:

  • Supports simple and recuperated Rankine cycle architectures.
  • Supports a wide range of cycle configurations, including: trilateral, partial-evaporation, saturated, superheated, transcritical, and supecritical cycles.
  • Supports a wide range of fluids, such as water, carbon dioxide, refrigerants, hydrocarbons and siloxanes.
  • Supports first law (energy) and second law (exergy) cycle analyses.
  • Uses the equations of state of the CoolProp or REFPROP fluid libraries to compute the thermodynamic properties of the fluids.
  • Uses the gradient-based algorithms of the MATLAB Optimization Toolbox to find the optimal cycle configuration in a systematic way. The usual execution time for one cycle optimization is less than 10 seconds on a single core.

Installation

In order to use RankineLab, you need a MATLAB installation and the MATLAB Optimization Toolbox. In addition you need to install CoolProp and interface it with MATLAB through Python. This may sound complicated, but it is not!

Check the step-by-step instructions below to learn how to interface MATLAB with CoolProp in a Windows operating system. The installation for Linux or Mac operating systems would be similar.

Step 1 - Download and install Miniconda

Download the Miniconda environment management system and follow the installation instructions.

Step 2 - Create a virtual environment and install CoolProp

Open a Miniconda terminal (look for "Anaconda Prompt" or "Miniconda3"). Once the terminal is open, type the following command to create a new virtual environment named coolprop_env:

conda create --name coolprop_env python=3.8

Don't worry if you are not familiar with the command window or with virtual environments, you only have to type two more commands before the installation is complete. Now that the environment is created, you can activate it. Just use the following command:

conda activate coolprop_env

Finally, type the following command to install CoolProp:

conda install CoolProp --channel conda-forge

That's it! Note that it was necessary to tell Miniconda that it should look for Coolprop in the conda-forge channel.

Step 3 - Interface MATLAB and Coolprop

Open MATLAB (or close and open it if it was already open) and type the following command to let MATLAB know where is the Python executable (python.exe) of the virtual environment that you have just created:

pyversion C:\Users\rober\.conda\envs\coolprop_env\python.exe

Note that, in my case, the executable was located at C:\Users\rober\.conda\envs\coolprop_env\. You should replace this part with the correct path in your computer.

Good! You have installed CoolProp and interfaced it with MATLAB. Let's do a simple test to check if the installation was successful. We are going to use CoolProp to compute the saturation temperature of water at atmospheric pressure. Just type the following command in MATLAB:

py.CoolProp.CoolProp.PropsSI('T','P',101325,'Q',0,'Water')

If it does not throw and error and returns 373.1243 K, the installation was successful.

Getting started

The best way to learn how to use RankineLab is to open one of the examples and start playing around with the different parameters and settings. The examples have plenty of comments to guide the users and help them understand how the code works. You can use the example scripts as a template to start your own projects.

Mathematical background

Check out the technical note if you want to learn more about the formulation of the optimization problem and the thermodynamic modeling behind RankOpt.

License

RankineLab is licensed under the terms of the MIT license. See the license file for more information.

Contact information

RankineLab was developed by Roberto Agromayor and of Lars O. Nord at the Norwegian University of Science and Technology (NTNU). Drop us an email to [email protected] if you have questions about the code or you have a bug to report!

rankinelab's People

Contributors

roberagro 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.