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

In certain modeling tasks, user designs specific algorithms, and intends to use CHEMCAD 5 to play a role in the algorithms. The user can implement in VBA environment and employ VB Server interface of CHEMCAD 5. Through this interface, the user can load a job, exchange data, run a job, and access many chemical engineering calculations.

Description      ICHEMCADVBServer interface is often created using its programmatic identifier “CHEMCAD.VBServer” in a VBA macro. It provides job related operations and also serves as an entry point to all other interfaces. In the following example, a handle to ICHEMCADVBServer of CHEMCAD 5 is passed to VB variable CC5.

Dim CC5 As Object

Sub LoadCC5()

    Set CC5 = CreateObject("CHEMCAD.VBServer")

End Sub

Definition:       dispinterface ICHEMCADVBServer



        boolean LoadJob(BSTR* bstrJobPath);

        boolean RunJob();

        VARIANT GetFlowsheet();

        VARIANT GetUnitOpInfo();

        VARIANT GetUnitOpSpecUnitConversion();

        VARIANT GetStreamInfo();

        VARIANT GetStreamUnitConversion();

        VARIANT GetStreamProperty();

        VARIANT GetKValues();

        VARIANT GetEnthalpy();

        VARIANT GetFlash();

        VARIANT GetEngUnitConversion();

        VARIANT GetCompPPData();

        BSTR GetWorkDir();

        boolean SwitchWorkDir(BSTR* bstrNewWorkDir);

        short GetNoOfJobsInWorkDir();

        BSTR GetJobAt(short jobIndex);

        short GetNoOfCasesInJob(BSTR* jobName);

        BSTR GetCaseAt(BSTR* jobName, short caseIndex);


Methods          Each of the following methods exposed by ICHEMCADVBServer takes a void argument and returns an IDispatch pointer of another interface to the calling subroutine.

Method             GetFlowsheet

Returns                        a handle to IFlowsheet

Method             GetUnitOpInfo

Returns                        a handle to IUnitOpInfo

Method             GetUnitOpSpecUnitConversion

Returns                        a handle to IunitOpSpecUnitConversion

Method             GetStreamInfo

Returns                        a handle to IStreamInfo

Method             GetStreamUnitConversion

Returns                        a handle to IStreamUnitConversion

Method             GetStreamProperty

Returns                        a handle to IStreamProperty

Method             GetEnthalpy

Returns                        a handle to IEnthalpy

Method             GetKValues

Returns                        a handle to IKValues

Method             GetFlash                     

Returns                        a handle to IFlash

Method             GetEngUnitConversion

Returns                        a handle to IEngUnitConversion

Method             GetCompPPData

Returns                        a handle to ICompPPData

The following methods can be used to manipulate jobs, loading a job, running a job, switching current work directory, and retrieving jobs and cases.

Method             LoadJob

Returns                        a boolean flag, TRUE if a job is loaded






Full job path

Method             RunJob

Returns                        a boolean flag, TRUE if recycle is converged.

Method             GetWorkDir

Returns                        a string of work directory

Method             SwitchWorkDir

Returns                        a boolean flag, TRUE if a job is loaded






a string of work directory

Method             GetNoOfJobsInWorkDir

Returns                        count of jobs in work directory

Method             GetJobAt

Returns                        a string of job name






job index in job array

Method             GetNoOfCasesInJob

Returns                        count of cases in job directory