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

Description      IUnitOpInfo interface allows user to retrieve and update unit specification parameters. It also answers the query for user-supplied unit label string.

Definition        dispinterface IUnitOpInfo

        {

        methods:

               short GetUnitOpSpecArrayDimension();

               short GetUnitOpSpecByID(short unitOpID, VARIANT unitOpSpec);

               short PutUnitOpSpecByID(short unitOpID, VARIANT unitOpSpec);

               BSTR GetUnitOpLabelByID(short unitOpID);

               short GetUnitOpCategoryByID(short unitOpID, BSTR* unitOpCate);

        };

Methods          Each unit can store up to 250 parameters in an array of float type. With a known unit ID, user can retrieve or update unit specification parameters.

                        Method             GetUnitOpSpecByID

                        Returns                        number of parameters returned in unitOpSpec

Argument

Type

Description

unitOpID

unitOpSpec

short

float[]

Unit ID [in]

Unit specification parameters [out]

                        Method             PutUnitOpSpecByID

                        Returns                        number of parameters received from unitOpSpec

Argument

Type

Description

unitOpID

unitOpSpec

short

float[]

Unit ID [in]

Unit specification parameters [in]

Method             GetUnitOpLabelByID

                        Returns                        user-defined unit label

Argument

Type

Description

unitOpID

short

Unit ID [in]

                        Each unit has its own identity. This identify informs us the role of the unit on a flowsheet, such as mixer, flash, or kinetic reactor. In CHEMCAD 5, this identify is given by either a unique category ID or a four-character string.

Method             GetUnitOpCategoryByID

                        Returns                        unit category ID

Argument

Type

Description

UnitOpID

unitOpCate

short

BSTR

Unit ID [in]

4 character string of category name

Example

FLASH

Description      IFlash interface provides access to CHEMCAD 5 flash calculations. To use flash calculations, a user first defines a feed stream, including its temperature, pressure, enthalpy and its component flowrates. All quantities should be given in CHEMCAD 5 internal units. For a user-defined feed stream, TP (isothermal flash at given temperature and pressure), VP (flash at given mole vapor fraction and pressure), VT (flash at given mole vapor fraction and temperature), HP (adaiabatic flash at given pressure) flash calculations are available. After a flash calculation is converged, the calculated liquid and vapor stream can be retrieved. The k-values at equilibrium and ion flow rates (if electrolyte is chosen) may also be returned.

Definition        dispinterface IFlash

        {

        methods:

               long GetNoOfComponents();

short DefineFeedStream(float tempR, float presPsia, float enthBtu_Hr, VARIANT compFlowLbmol_Hr);

               short CalculateHPFlash(float enthBtu_Hr, float presPsia);

short GetVaporStream(float* tempR, float* presPsia, float* enthBtu_Hr, float* rateLbmol_Hr, VARIANT compFlowLbmol_Hr);

               float GetMoleVaporFraction();

               float GetCalculatedHeatDuty();

               short CalculateTPFlash(float tempR, float presPsia);

               short CalculateVPFlash(float moleVapFrac, float presPsia);

               short CalculateVTFlash(float moleVapFrac, float tempR);

               short GetKValues(VARIANT kValues);

               short GetIonRates(VARIANT ionFlowLbmol_Hr);

short GetLiquidStream(float* tempR, float* presPsia, float* enthBtu_Hr, float* rateLbmol_Hr, VARIANT compFlowLbmol_Hr);

        };