1.1.3 • Published 8 years ago

neutriumjs.steam v1.1.3

Weekly downloads
2
License
CC-BY-4.0
Repository
github
Last release
8 years ago

NeutriumJS.Steam

Introduction

NeutriumJS Steam is a stand alone javascript implementation of the IAPWS formulations of the thermodynamic properties of water and steam. The IAPWS papers implemented in NeutriumJS.Steam are as follows:

For specific details on range of applicability for the IAPWS please refer to the Revised Release on the IAPWS Industrial Formulation 1997 for the Thermodynamic Properties of Water and Steam 2007.

Getting Started

Adding NeutriumJS.Steam

Bower.io

You can install NeutriumJS Steam using bower.

bower install neutriumjs-steam

npm

You can add NeutriumJS.Steam to your project using npm by:

npm install neutriumjs.steam --save

Standalone

If your project is not using bower you can use the compiled and minified source which is found at:

dist/neutriumJS.steam.min.js

Including the library

The NeutriumJS.Steam library should be included into your page using the following:

<script charset="utf-8" src="path-to-lib/neutriumJS.steam.min.js"></script>

Note the use of charset="utf-8" is important, particularly if using un-minified code as the codebase makes use of unicode character variable names.

Limiting Library Weight

NeutriumJS.Steam is divided into base, pressure-temperature (PT), pressure-entropy (PS), pressure-enthalpy (PH) and enthalpy-entropy (HS) modules. If you only require a subset of this functionality you can exclude modules to reduce the weight of the library. There are a number of builds in the ./dist folder that provide selected subsets of the functionality, however you can also create your own subset as follows:

At a bare minimum you must include the following files which will provide the functionality to calculate steam properties using pressure and temperature (these are the dependencies of all sub modules):

src/NeutriumJS.Steam.js
src/NeutriumJS.Steam_PT.js

To enable calculation of steam properties using pressure-entropy or pressure-enthalpy in addition to the base requirements above you need to include either/both of the following files as appropriate:

src/NeutriumJS.Steam_PS.js
src/NeutriumJS.Steam_PH.js

Lastly if you wanted to enable calculations based on enthalpy-entropy (HS) you need to include the following files in addition to the base requirements (note the dependency on the PH module):

src/NeutriumJS.Steam_PH.js src/NeutriumJS.Steam_HS.js

If you need further clarification of module dependencies just refer to the UMD definition at the start of each source file.

Calculating Steam Properties

IAPWS provides four methods to calculate the properties of steam and water using combinations of pressure (in MPa), temperature (K), enthalpy (kJ/kg.K) and entropy (kJ/K.kg). In NeutriumJS Steam these four functions are listed as follows:

NeutriumJS.Steam.PT.solve(P, T);	// Calculate properties from pressure and temperature
NeutriumJS.Steam.PH.solve(P, H);	// Calculate properties from pressure and enthalpy
NeutriumJS.Steam.PS.solve(P, S);	// Calculate properties from pressure and entropy
NeutriumJS.Steam.HS.solve(H, S);	// Calculate properties from enthalpy and entropy

Return Values

If your specified values lie within the applicable range for the IAWPS formulations you will be return an object containing the following properties:

{
	p, 		// Pressure, p, MPa
	t, 		// Temperature, t, K
	v, 		// Specific volume, v, m^3/kg
	rho,	// Density, rho, kg/m^3
	u,		// Specific internal energy, u, kJ/kg
	s,		// Specific entropy, s, kJ/kg
	h, 		// Specific enthalpy, h, kJ/kg.K
	cp,		// Specific isobaric heat capacity, Cp kJ/kg.K
	cv,		// Specific isochoric heat capacity, Cv
	w,		// Speed of Sound, w, m/s
	mu,		// Viscosity cP,
	k,		// Thermal Conductivity W/m.K
	sig,	// Surface Tension mN/m
	epsilon,// Dielectric constant
	ic		// Ionisation constant
}

If you try and calculate the properties outside the range of applicability as specified by IAWPS NeutriumJS Steam will return null.

Optional Neutrium Convert Support

NeutriumJS.steam has optional support for the NeutriumJS.convert module. Just include it before the steam modules:

<script charset="utf-8" src="path-to-lib/neutriumJS.convert.min.js"></script> 
<script charset="utf-8" src="path-to-lib/neutriumJS.steam.min.js"></script>

Then you can get NeutriumJS.steam to return results as Qty objects:

var result = NeutriumJS.steam.PT.solve(3, 300).asQty();

This will allow you to easily convert each property as required:

var psi = result.P.to('psi');

See the the NeutriumJS.convert readme for more info.

Testing

NeutriumJS Steam is currently tested using all applicable tests provided in the IAWPS papers listed above. To run the tests, after cloning the repo install all npm and bower dependencies then run the default gulp task.

Donations

NeutriumJS is free software, but you can support the developers by donating here.

Release Notes

VersionNotes
1.0.0Initial Release
1.0.5Add UMD definition
1.1.0Optional NeutriumJS.convert support
1.1.1Change P and T keys to lower case
1.1.2Added exception throwing for out of range case
1.1.3Bug fixes for exception throwing logic

License

Creative Commons Attribution 4.0 International

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.5

8 years ago