I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com

gaslaw

Returns the pressure, volume, weight or temperature inside a gas given the other three parameters.
Controller: CodeCogs

Private project under development, to help contact the author: Contact Controller

Interface

C++
Excel

Gaslaw

 
doublegaslawinttarget
doublepressure
doublevolume
doubleweight
doublegas_constant
doubletemperature )[inline]
Given four of the five parameters in the ideal gas law: this function is able to deduce the fifth one, where \inline p is the pressure of gas, \inline V is the volume, \inline w is the weight, \inline R is the individual gas constant and \inline T is the absolute temperature in degrees Rankine.

In order to return the desired parameter, the function takes a target argument which can be PRESSURE, VOLUME, WEIGHT, GAS or TEMPERATURE correspondingly. The value of the desired parameter as argument in the function call is ingored, but a convenient way is to denote it by a null value.

You may notice that in the example code below we are considering carbon dioxide with gas constant \inline R = 1130.

Example 1

#include <stdio.h>
#include <codecogs/engineering/fluids/imperial/gaslaw.h>
 
int main()
{
  double 
  p = Engineering::Fluids::Imperial::gaslaw
  (PRESSURE, 0, 1000, 850.3, 1130, 10),
  V = Engineering::Fluids::Imperial::gaslaw
  (VOLUME, 9608.39, 0, 850.3, 1130, 10),
  w = Engineering::Fluids::Imperial::gaslaw
  (WEIGHT, 9608.39, 1000, 0, 1130, 10),
  R = Engineering::Fluids::Imperial::gaslaw
  (GAS, 9608.39, 1000, 850.3, 0, 10),
  T = Engineering::Fluids::Imperial::gaslaw
  (TEMPERATURE, 9608.39, 1000, 850.3, 1130, 0);
 
  printf("    Pressure = %.2lf lb/ft^3\n", p);
  printf("      Volume = %.2lf ft^3\n", V);
  printf("      Weight = %.2lf lb\n", w);
  printf("Gas constant = %.2lf ft lb/slug deg.R\n", R);
  printf(" Temperature = %.2lf deg.R\n", T);
 
  return 0;
}

Output

Pressure = 9608.39 lb/ft^3
      Volume = 1000.00 ft^3
      Weight = 850.30 lb
Gas constant = 1130.00 ft lb/slug deg.R
 Temperature = 10.00 deg.R

Note

To add table with gas constants on http://www.engineeringtoolbox.com/individual-universal-gas-constant-d_588.html

References

The Engineering Division, Crane Co., "Flow of fluids through valves, fittings, and pipe", Chicago, 1957

Parameters

targetPRESSURE, VOLUME, WEIGHT, GAS or TEMPERATURE
pressurepressure inside the gas (lb/ft absolute)
volumevolume of gas (ft)
weightweight of gas (lb)
gas_constantthe individual gas constant (ft lb/slug R)
temperatureabsolute temperature of gas (R)

Returns

The value of the desired parameter.

Authors

Lucian Bentea (July 2006)
Source Code

This module is private, for owner's use only.

Not a member, then Register with CodeCogs. Already a Member, then Login.