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

    Dim inCount As Integer

    Dim outCount As Integer

    Dim idArray(1 To SIZE_STREAM_ARRAY * 2) As Integer

    curID = unitOpIDs(curUnitIndex)

    check = -1

    check = flowsheet.GetStreamCountsToUnitOp(curID, inCount, outCount)

    check = -1

    check = flowsheet.GetStreamIDsToUnitOp(curID, idArray)

    curRow = curRow + 1

    flowSht.Cells(curRow, 1).value = curID

    curCol = 2

    For curStreamIndex = 1 To (inCount + outCount) Step 1

        curCol = curCol + 1

        id = idArray(curStreamIndex)

        flowSht.Cells(curRow, curCol).value = id

    Next curStreamIndex       

Next curUnitIndex

End Sub

STREAM DATA

Stream data define the thermodynamic state and the rates of transportation of processing materials on a flowsheet. The data may be used in making operational decisions or satisfying computational needs. CHEMCAD 5 allows access of the data from Excel macros through interface IStreamInfo and IStreamProperty.

Description      With a known stream ID, IStreamInfo allows to retrieve and update stream data, including stream label, temperature, pressure, mole fraction, enthalpy, and component flowrates. All the engineering quantities are given in CHEMCAD 5 internal units. The component names and their IDs are also provided through the methods on this interface.

Definition

dispinterface IStreamInfo

        {

        methods:

               short GetNoOfComponents();

short PutStreamByID(short streamID, float tempR, float presPsia,     float moleVapFrac, float enthBtu_Hr, VARIANT compFlowLbmol_Hr);

short GetStreamByID(short streamID, float* tempR, float* presPsia, float* moleVapFrac, float* enthBtu_Hr, VARIANT compFlowLbmol_Hr);

               short GetIDsOfComponents(VARIANT compIDs);

               BSTR GetComponentNameByPosBaseOne(short compPos);

               short GetComponentIDByPosBaseOne(short compPos);

               BSTR GetStreamLabelByID(short streamID);    

        };

Methods          Two key method, GetStreamByID and PutStreamByID, are for retrieving and updating stream data.  

            Method             GetStreamByID

            Returns                        count of returned component data items in compFlowLbmol_Hr

Argument

Type

Description

streamID

tempR

presPsia

moleVapFrac

enthBtu_Hr

compFlowLbmol_Hr

short

float

float

float

float

float[]

ID of a stream [in]

Temperature (R) [out]

Pressure (psia) [out]

Mole vapor fraction [out]

Enthalpy (Btu/hr) [out]

Component flowrates (lbmol/hr) [out]

Method             PutStreamByID

            Returns                        count of received data items from compFlowLbmol_Hr

Argument

Type

Description

streamID

tempR

presPsia

moleVapFrac

enthBtu_Hr

compFlowLbmol_Hr

short

float

float

float

float

float[]

ID of a stream [in]

Temperature (R) [in]

Pressure (psia) [in]

Mole vapor fraction [in]

Enthalpy (Btu/hr) [in]

Component flowrates (lbmol/hr) [in]

Other methods on the interface are for convenience.

            Method             GetStreamLabelByID

            Returns                        user label string of the stream

Argument

Type

Description

streamID

short[]

stream ID for which the label is retrieved [in]

            Method             GetIDsOfComponents

            Returns                        count of component IDs returned in compIDs

Argument

Type

Description

compIDs

short[]

component IDs

            Method             GetComponentIDByPosBaseOne(short compPos);

            Returns                        ID of the component at position compPos on the component list

Method             GetComponentNameByPosBaseOne (short compPos);

            Returns                        name string of the component