GithubHelp home page GithubHelp logo

danwbr / dtl Goto Github PK

View Code? Open in Web Editor NEW
19.0 8.0 7.0 9.96 MB

DWSIM Thermodynamics Library (legacy version - 3.x)

Home Page: http://dwsim.inforside.com.br/wiki/index.php?title=DTL

License: GNU Lesser General Public License v3.0

Visual Basic 78.34% C# 21.66%

dtl's Introduction

DWSIM Standalone Thermodynamics Library

Version 3.3.0.0

Copyright 2016 Daniel Medeiros

The DWSIM Standalone Thermodynamics Library is a .NET/Mono managed dynamic link library (DLL) that exposes DWSIM's thermodynamics engine to external applications using a simple programming interface, with no dependency on external components.

DWSIM Standalone Thermodynamics Library is free for commercial and non-commercial use. Read the license.txt file for more details.

Usage

To use the library in your .NET projects, add a reference to the DWSIM.Thermodynamics.dll file. All calculation functions will be available in the DTL.Thermodynamics namespace, inside the 'Calculator' class.

To use the library in other languages/ecosystems through its COM interface, you must register it with Administrator privileges using RegAsm, which can be found in your .NET 4.0 installation directory (usually C:\Windows\Microsoft.NET\Framework\v4.0.30319). After finding the tool, open a DOS console window and run the following command:

"RegAsm.exe /tlb:DWSIM.Thermodynamics.tlb DWSIM.Thermodynamics.dll"

This will create and register the type library automatically, making it callable through COM.

Methods

This library has methods to calculate:

  • Single Compound Properties
  • Single Phase Mixture Properties
  • PT, PH, PS, PVF and TVF Equilibrium Flashes, using an algorithm of your choice (two or three phases)

Property and Equilibrium calculation functions require parameters that must be one or more values returned by GetPropPackList, GetCompoundList, GetPropList, GetCompoundConstPropList, GetCompoundTDepPropList, GetCompoundPDepPropList and GetPhaseList. They are self-explanatory, and will return values in an array of strings.

For instance, the PTFlash function requires the name of the Property Package to use, the compound names and mole fractions, temperature in K, pressure in Pa and you may optionally provide new interaction parameters that will override the ones used internally by the library. The calculation results will be returned as a (n+2) x (3) string matrix, where n is the number of compounds. First row will contain the phase names, the second will contain the phase mole fractions and the other lines will contain the compound mole fractions in the corresponding phases.

For PH, PS, TVF and PVF flash calculation functions, an additional line is returned that will contain the temperature in K or pressure in Pa in the last matrix column.

dtl's People

Contributors

danwbr avatar ledragon avatar mauro-galbiati avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dtl's Issues

Error at build

Unable to open module file \DTL\DWSIM\Objects\PropertyPackages\Base\HYP.vb': The system cannot find the file specified.

Adding custom component

Hi Daniel,
First of all its a great library and many thanks for your efforts.

I have looked at the example provided and api, and as I understand the feed and mixtures you can create only from PropertyPackage.AvailableCompounds property.

Is there any way to add custom component? I come from petroleum engineering and fluid pvt characterization deals a lot with not pure but "pseudo" components and fractions. Here where I am at the moment.

var calc = new Calculator();
calc.Initialize();

double T = 283; //K
double P = 101325; //Pa

var pr = calc.GetPropPackList()[0];
PropertyPackage pp = calc.GetPropPackInstance(pr);

var ethane = calc.GetCompoundList()[50];

 /// trying to add new compound
var c7PlusName = "c7Plus"
var c7PlusProp = new ConstantProperties();
c7PlusProp.Molar_Weight = 96;
pp.AvailableCompounds.Add( c7PlusName , c7PlusProp);

object[,] result = calc.PTFlash(pp, 0, P, T, new[] { ethane, c7PlusName }, new[] { 0.5, 0.5 }); 

Its obviously fails, because more properties should be defined for the compound.
But ConstantProperties() has way too many fields and many of them is not used in this flash.

What should I define for this hydrocarbon like compound to make PTFlash work?

For pseudo component we usually have molecular weight, specific gravity, and boiling point.
Critical temperature, Tc; critical pressure, pc; and acentric factor of each component in a mixture are required by EOS and estimated from correlations. I am a bit lost with ConstantProperties class. Any advice would be much appreciated.

Anton.

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.