COCO - CAPE-OPEN to CAPE-OPEN simulation environment
 Help

ICOFEDocument interface

The ICOFEDocument is exposed by the COFE Flowsheet document object. See Creating a COFE document by automation for how to obtain an object of the COFE document type.

The following methods are exposed by the ICOFEDocument interface:

GetCompoundConstantDimensionality
declared as: BSTR GetCompoundConstantDimensionality(BSTR propName);
arguments: propName: the name of the property for which to get the dimensionality descriptor
return value: dimensionality descriptor
description: textual description of the dimensionality of the specified compound constant. Compound constants can be obtained from any material object, using GetComponentConstant (CAPE-OPEN version 1.0 thermodynamic interface) or GetCompoundConstant (CAPE-OPEN version 1.1 thermodynamic interface)

GetError
declared as: BSTR GetError(IDispatch* CO_Object, long errorCode);
arguments: CO_Object: reference to the object that threw the error
errorCode: the error code that was returned by the object
return value: textual error descriptor
description: returns a textual error descriptor as last thrown by the object that was passed to it. Should only be used directly after the object threw the error

GetPropertyDimensionality
declared as: BSTR GetPropertyDimensionality(BSTR propName, BSTR basis);
arguments: propName: the name of the property for which to get the dimensionality descriptor
basis: the basis that is passed to the function that obtains the property value
return value: dimensionality descriptor
description: textual description of the dimensionality of the specified property. Properties can be obtained from any material object, using GetProp (CAPE-OPEN version 1.0 thermodynamic interface), GetSinglePhaseProp, GetTwoPhaseProp, GetPDependentProperty, GetTDependentProperty, GetOverallProp, GetTPFraction and CalcAndGetLnPhi (CAPE-OPEN version 1.1 thermodynamic interface)

GetReactionObject
declared as: IDispatch* GetReactionObject(VARIANT reactionPackageID);
arguments: reactionPackageID: name of reaction package loaded into the document, or 1-based index into the array returned by GetReactionPackageNames
return value: reaction object
description: returns a reference to a reaction object interfaces. Interfaces exposed by the reaction object are ICapeReactionChemistry, ICapeReactionProperties, ICapeReactionsRoutine, ICapeThermoMaterialContext (see CAPE-OPEN Chemical Reactions Interface specification) and ICapeIdentification (see CAPE-OPEN Identification Common Interface).

GetReactionPackageCount
declared as: LONG GetReactionPackageCount();
return value: number of reaction packages loaded into the document
description: returns the count of reaction packages loaded into the document. See also: GetReactionPackageNames and GetReactionObject

GetReactionPackageNames
declared as: VARIANT GetReactionPackageNames();
return value: array containing names of reaction packages loaded into the document
description: returns the names of reaction packages loaded into the document. See also: GetReactionPackageCount and GetReactionObject

GetSimulationContext
declared as: IDispatch* GetSimulationContext();
return value: reference to the simulation context interface
description: returns the simulation context (can be used to obtain a list of material templates, and create material objects of choice for use of property or equilibrium calculations, see CAPE-OPEN Simulation Context COSE interface). Implemented interfaces: ICapeMaterialTemplateSystem, ICapeSimulationContext, ICapeDiagnostic, ICapeCOSEUtilities and ICapeIdentification (see CAPE-OPEN Identification Common Interface)

GetStream
declared as: IDispatch* GetStream(VARIANT streamID);
arguments: streamID: name of stream in the document, or 1-based index into the array returned by GetStreamNames
return value: reference to a stream object
description: returns a stream object. Implemented interfaces: ICOFEStream and ICapeIdentification (see CAPE-OPEN Identification Common Interface).

For material streams, additional interfaces are ICOFEMaterial and ICapeThermoMaterialObject (CAPE-OPEN version 1.0 thermodynamic interface), and ICapeThermoCompounds, ICapeThermoEquilibriumRoutine, ICapeThermoMaterial, ICapeThermoPhases, ICapeThermoPropertyRoutine, ICapeThermoUniversalConstant (CAPE-OPEN version 1.1 thermodynamic interface).

For energy and information streams, an additional interface is ICapeCollection (see CAPE-OPEN Collection Common Interface) exposing the parameters that are present on the stream (see CAPE-OPEN Parameter Common Interface).

GetStreamCount
declared as: LONG GetStreamCount();
return value: number of streams in the document
description: returns the count of streams in the document. See also: GetStreamNames and GetStream

GetStreamNames
declared as: VARIANT GetStreamNames();
return value: array containing names of the streams in the document
description: returns the names of streams in the document. The names of the streams may not be unique; it is up to the user to ensure unique stream names. See also: GetStreamCount and GetStream

GetUnit
declared as: IDispatch* GetUnit(VARIANT unitID);
arguments: unitID: name of unit operation in the document, or 1-based index into the array returned by GetUnitNames
return value: reference to a unit operation object
description: returns a unit operation object. The unit operation objects are passed on as they are imported into the document, and are therefore not implemented by COFE. If a unit operation is not imported into the document using the CAPE-OPEN COM interfaces, it cannot be passed on via this function.

Implemented interfaces: ICapeUnitOperation (see CAPE-OPEN Unit Operations Interface Specification), ICapeIdentification (see CAPE-OPEN Identification Common Interface).

Via the ICapeUnitOperation interface one can get access to a collection of the unit operation's ports and the streams attached to it.

Also, a unit operation typically exposes an ICapeUtilities (see CAPE-OPEN Utilities Common Interface) that in turn exposes an ICapeCollection interface via GetParameters, from which one can access the unit operation's parameters (see CAPE-OPEN Parameter Common Interface).

GetUnitCount
declared as: LONG GetUnitCount();
return value: number of unit operations in the document
description: returns the count of unit operations in the document. See also: GetUnitNames and GetUnit

GetUnitNames
declared as: VARIANT GetUnitNames();
return value: array containing names of the unit operations in the document
description: returns the names of unit operations in the document. The names of the unit operations may not be unique; it is up to the user to ensure unique stream names. See also: GetUnitCount and GetUnit

LoadFromString
declared as: void LoadFromString(BSTR* string);
arguments: string: string representing the content of a document, created by SaveToString
description: This function reloads a document from a string-encoding that was previously created using SaveToString. The mechanism of loading and saving to strings is a way to provide persistence for automation environments in which saving the embedded object is not supported for some reason. This function should be called only for new, empty flowsheet document objects.

SaveCopy
declared as: VARIANT_BOOL SaveCopy(BSTR path);
arguments: path: path to fsd file
return value: TRUE if saving the copy has succeeded
description: Save a copy of the embedded Flowsheet document object to the fsd file specified by path. Most active document containers do not support storing the embedded object separately.

SaveToString
declared as: void SaveToString(BSTR* string);
arguments: string: pointer to string variable that will receive a string representing the content of a document.
description: This function produces a string representing the content of the current flowsheet document, that can be used to restore the content of a new, empty document by LoadFromString. The mechanism of loading and saving to strings is a way to provide persistence for automation environments in which saving the embedded object is not supported for some reason.

ShowMainConfiguration
declared as: void ShowMainConfiguration();
description: Shows the configuration dialog for the document object. Allows the user to change and inspect loaded property packages, reaction packages and material types. Also allows inspection of supported compounds, properties and phases.

SolveFlowsheet
declared as: VARIANT_BOOL SolveFlowsheet(BSTR* message);
arguments: message: string receiving the message describing cause of failure.
return value: TRUE if the flowsheet is solved
description: Solve the flowsheet. Returns True if the flowsheet was solved successfully, or False in case of failure. The reason for failure is indicated in the returned message.

ValidateFlowsheet
declared as: VARIANT_BOOL ValidateFlowsheet(VARIANT* messages);
arguments: messages: list of strings with descriptions of invalid items.
return value: TRUE if the flowsheet is valid
description: Validates the flowsheet. Returns True if the flowsheet can be solved, or False if one or more items are invalid. The invalid items are returned as array of string messages.

Import
declared as: void Import(BSTR fileName);
arguments: fileName: path to COFE flowsheet file
description: This function loads a document from file. This function should be called only for new, empty flowsheet document objects. Since COFE 3.3.0.16.

Solve
declared as: void Solve();
description: Solve the flowsheet. Similar to SolveFlowsheet, except raises an error in case of failure. Since COFE 3.3.0.16.