ChemCAD 5 services to visual basic applications: User Manual, страница 11

Methods          The methods defined in this interface are devised around flash calculations. The correct calling sequence should be that 1) define feed streams; 2) execute a proper flash calculation; 3) retrieve calculation results. The user can redefine feed stream if multiple streams need to be flashed. For a defined feed stream, the user can also call different flash calculations. After each flash calculation is converged, the calculated data (liquid and vapor stream, etc.) can only be retrieved once.

Before calling the methods, user need to declare component array in VBA macro. The lower bound of a component array has to be one, and the upper bound should be no less than the actual number of components. All the units of the arguments on the methods of this interface are CHEMCAD internal units.

Method             GetNoOfComponents                           

Returns            count of components in current job

Method             DefineFeedStream                   

Returns            number of flowrates received from  compFlowLbmol_Hr

Argument

Type

Description

tempR

presPsia

enthBtu_Hr

compFlowLbmol_Hr

float

float

float

float[]

Temperature (R) [in]

Pressure (psia) [in]

Enthalpy (Btu/hr) [in]

Component flowrates (lbmol/hr) [in]

HP flash at given enthalpy and pressure is carried out through the following method.

                        Method             CalculateHPFlash

Return              convergence of the flash routine (0 – converge, 1 – diverge)

Argument

Type

Description

presPsia

enthBtu_Hr

float

float

Pressure (psia) [in]

Enthalpy (Btu/hr) [in]

TP flash at specified temperature and pressure is carried out by the next method.

Method             CalculateTPFlash

Return              convergence of the flash routine (0 – converge, 1 – diverge)

Argument

Type

Description

tempR

presPsia

float

float

Temperature (R) [in]

Pressure (psia) [in]

VP flash at specified mole vapor fraction and pressure is called through CalculateVPFlash. This method can also calculate bubble point temperature if mole vapor fraction is 0, and dew point temperature if mole vapor fraction if 1.

Method             CalculateVPFlash

Returns            convergence of the flash routine (0 – converge, 1 – diverge)

Argument

Type

Description

presPsia

moleVapFrac

float

float

Pressure (psia) [in]

Mole vapor fraction [in]

VT flash at specified mole vapor fraction and temperature is called in CalculateVTFlash. This method can also calculate bubble point pressure if mole vapor fraction is 0, and dew point pressure if mole vapor fraction if 1.

Method             CalculateVTFlash

Returns            convergence of the flash routine (0 – converge, 1 – diverge)

Argument

Type

Description

tempR

moleVapFrac

float

float

Temperature (R) [in]

Mole vapor fraction [in]

After a flash calculation has converged, the following methods can be called to retrieve calculation data.

Method             GetVaporStream / GetLiquidStream

Returns            number of data items returned in array compFlowLbmol_Hr

Argument

Type

Description

tempR

presPsia

enthBtu_Hr

rateLbmol_Hr

compFlowLbmol_Hr

float

float

float

float

float[]

Temperature (R) [out]

Pressure (psia) [out]

Enthalpy (Btu/hr) [out]

Total mole rate (lbmol/hr) [out}

Component flowrates (lbmol/hr) [out]

Method             GetKValues

Returns            number of data items returned in array kValues

Argument

Type

Description

kValues

float[]

Calculated k-values [out]

Method             GetIonRates

Returns            number of data items returned in array ionFlowLbmol_Hr