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

Argument

Type

Description

ionFlowLbmol_Hr

float[]

Ion rates in liquid phase [out]

Method             GetMoleVaporFraction

Returns                        calculated mole vapor fraction

Method             GetCalculatedHeatDuty

Returns                        calculated heat duty

Example          This subroutine shows the calling sequence of methods from IFlash interface

            Sub MixerInExcel(ByVal ChemCADEntry As Object)

        On Error Resume Next

        ' get all cc5 objects

        Dim curUnitOp As Object

        Dim strInfo As Object

        Dim uopInfo As Object

        Dim flash As Object

        Set curUnitOp = ChemCADEntry.GetCurUnitOp

        Set strInfo = ChemCADEntry.GetStreamInfo

        Set uopInfo = ChemCADEntry.GetUnitOpInfo

        Set flash = ChemCADEntry.GetFlash

Dim check As Integer

        Dim component(1 To SIZE_COMP_ARRAY) As Single

        Dim compSum(1 To SIZE_COMP_ARRAY) As Single

        …

        ' HP flash to determine vapor fraction and temperature

check = flash.DefineFeedStream(setTemperature, setPressure, setEnthalpy, compSum)

        check = flash.CalculateHPFlash(setEnthalpy, setPressure)

check = flash.GetVaporStream(temperature, pressure, enthalpy, flowRate,   component)

        mvf = flash.GetMoleVaporFraction

        heatDuty = flash.GetCalculatedHeatDuty

        …

        End Sub

ENTHALPY

Description      IEnthalpy calculates the liquid or vapor enthalpy of a user-supplied stream.

Definition           dispinterface IEnthalpy

        {      

        methods:

               short GetNoOfComponents();

short DefingStream(float tempR, float presPsia, VARIANT compFlowLbmol_Hr);

               short CalculateLiquidEnthalpy(float* enthBtu_Hr);

               short CalculateVaporEnthalpy(float* enthBtu_Hr);

        };

Methods          When stream enthalpy is needed, the user call the following function to specify the stream data.

                        Method             DefingStream

Returns                        number of data items received from compFlowLbmol_Hr

Argument

Type

Description

tempR

presPsia

compFlowLbmol_Hr

float

float

float[]

temperature [in]

pressure [in]

liquid/vapor component flowrates [in]

After the stream data is specified, the enthalpy of the stream can be calculated using one of the functions

Method             CalculateLiquidEnthalpy / CalculateVaporEnthalpy

            Returns                        1 – return value is valid; 0 – the return value is invalid

Argument

Type

Description

enthBtu_Hr

float

enthalpy [out]

Example

K-VALUES

Description      IKValues calculates k-values at given temperature, pressure and liquid-vapor compositions. It may also return ion rates if electrolyte is chosen.

Definition           dispinterface IKValues

        {      

        methods:

               short GetNoOfComponents();

short DefineLiquidStream(float tempR, float presPsia, VARIANT compFlowLbmol_Hr);

short DefineVaporStreamComponentRates(VARIANT compFlowLbmol_Hr);

               short GetKValues(VARIANT kValues);

               short GetIonRates(VARIANT ionFlowLbmol_Hr);

               short GetActivityCoefficients(VARIANT actCoef);

               short GetFugacityCoefficients(VARIANT fugCoef);

        };

Methods          The first step is to define the liquid-vapor two phase system, its temperature, pressure and compositions using the two methods given below

            Method             DefineLiquidStream / DefineVaporStreamComponentRates

            Returns            number of data items received from array compFlowLbmol_Hr

Argument

Type

Description

tempR

presPsia

compFlowLbmol_Hr

float

float

float[]

temperature [in]

pressure [in]

liquid/vapor component flowrates [in]