The Designer library COM methods (functions and subroutines that are members of the Application and Document class) can be conceptually grouped in the following categories:
● Variable Data Exchange Methods
These methods are used for performing general application tasks such as activating the designer, application, opening and closing files, etc.
Application Related Methods:
● ShowApp( ) This subroutine is used to activate the Pro-Designer application and display it in its current size position.
● CloseApp( ) This subroutine is used to close the Pro-Designer application. If there are Pro-Designer case files still open it will close all the documents without saving them.
● OpenDoc(fileName As String) This function is used to open the Pro-Designer file with name fileName, makes this file the active Document object, and returns a reference to the caller.
● SetActiveDoc(fileName As String) This function is used to activate the Pro-Designer file with name fileName and also returns a reference to this file as a Document object.
● CloseAllDocs(bSaveIfNeeded As Boolean) This subroutine is used to close all open Pro-Designer file (Document objects) Use bSaveIfNeeded = True for saving the Designer case files and bSaveIfNeeded = False for just closing the documents.
a) For help on how to initiate the Application and Document objects, in order to access the above methods, please see Declaring and Initializing Pro-Designer Server Objects.
b) For VBA examples that use these methods see Application Related Scripts.
These methods are used for performing generic document tasks on specific Pro-Designer case files.
Document Related Methods:
● CloseDoc(bSaveIfNeeded As Boolean) This subroutine is used to close the active Pro-Designer file (Document object). Use bSaveIfNeeded = True for saving the Designer case file and bSaveIfNeeded = False for just closing the document.
● GetDocName(fileName As String, nMaxChar As Long) This function is used to return the name of the active Pro-Designer file (Document object). The function returns a Boolean which is True if it was successful in obtaining the file name and False if it was not. The filename argument is an output argument and returns the name of the Pro-Designer file. The nMaxChar is an input argument and specifies the number of characters that the file name will contain
● SaveDoc() This subroutine is used to save the the active Document object.
c) For help on how to initiate the Application and Document objects, in order to access the above methods, please see Declaring and Initializing Pro-Designer Server Objects.
d) For VBA examples that use these methods, see Application Related Scripts.
These methods are used for simulation tasks. They are all functions that return a Boolean value, which is True if the task was successful and False if the task failed. They include:
● DoMEBalances(val) This function is equivalent to clicking on the Solve button or to selecting Tasks / Do M&E Balances from the Pro-Designer application main menu. The value of variable (val) is currently of no importance.
● DoEconomicCalculations( ) This function is equivalent to selecting Tasks / Perform Economic Calculations from the Pro-Designer application main menu.
● ScaleUpThroughput(VarID As VarID, val) This function is used for scaling the process throughput (It is equivalent to selecting Tasks / Adjust Process Throughput from the Pro-Designer application main menu and selecting the Based on Scale Up / Down Factor option). Use VarID = scaleUpFactor_VID and the value of the scale up factor for val (val is a Variant, it’s type should be double and its value should be greater than zero).
|
Before the Do M&E Balances or the Economic Calculations are executed, the program checks whether all data entered using the COM functions is consistent. If there were inconsistencies in the data entered then the Do M&E Balances and/or Economic Calculations are not performed and the functions return False. The functions might also return False if there was another error during solve or economic calculations. (You can check for data inconsistencies using IsCOMSimDataComplete() as described in “Error Related Methods”. |
For VBA examples that implement these methods, see Simulation Related Scripts.
These methods are used for data exchange between a Pro-Designer processs file and external applications. They can be used to set/change input variables in a processs file, or simply to get the value of an input/output variable.
Please note that the COM functions used for variable data exchange were designed to mimic the Pro-Designer application interface dialogs, therefore experience with the SuprePro interface is important for using the COM functions. For example in many dialogs you have a choice for setting one variable or another, and the respective variables are enabled only if you select the corresponding option. The same applies in the COM functions. If you are setting an operation/equipment/ stream etc. variable through a COM function, make sure you have selected the option for this variable first. If for example you can set either the mass flow or the volume flow, before calling the COM function on setting the volume flow, make sure that the option for setting the volume flow is selected (you can check/set this with the COM function as well). In many cases when setting a value the corresponding option is also set/enabled.
All variable data exchange methods are Boolean type functions. All functions return True if the data access was successful and return False if an error occurred during data transfer. In order to find out how to retrieve error messages in the latter case look at Error Related Methods. The typical COM function for accessing an input/output variable has 2 arguments, the first one being of VarID type (the variable identifier that specifies the variable) and the other one being of Variant type (the actual value of the variable). Some functions require extra arguments in order to specify the variable being accessed. The variable data exchange methods are grouped in the following categories:
● Functions for Process (Flowsheet) Variables
● Functions for Section Variables
● Functions for Procedure Variables
● Functions for Equipment Variables
● Functions for Operation Variables
● Functions for Stream Variables
● Functions for Ingredient Variables
● Functions for Heat Transfer Agent Variables
● Functions for Power Variables
● Functions for Report Option Variables
● Functions for Excel Data Link Variables
● Functions for Excel Table Variables
One difference with the Pro-Designer application interface is that in the Designer library methods all variables (with some exceptions) are communicated in SI Units. To find more on the units of the COM Server Variables, see Units of Variables accessed by COM.