Functions for Ingredient Variables

The following functions can be used for setting or retrieving variables that refer to a specific ingredient (pure components / mixtures) that is already registered to the processs file:

Generic Set/Get Functions with three arguments:

      GetIngredientVarVal (ingredientName As String, VarID As VarID, val)   

      GetIngredientVarVal2 (ingredientName As String, VarID As VarID, val, val2)

which can be used to retrieve the value of input/output variables related to the specific ingredient

         SetIngredientVarVal (ingredientName As String, VarID As VarID, val) 

         SetIngredientVarVal2 (ingredientName As String, VarID As VarID, val, val2)

can be used for setting input variables related to the specific ingredient

The first argument is the ingredient’s local name, the second argument (varID) is the variable identifier that specifies the variable we want to access and the third argument (val) is the variables value. The Variable ID that needs to be used for each variable is listed inIngredient Variables. Please see Accessing Pro-Designer Variables with COM for general information on accessing the Pro-Designer variables with the COM Server.

For a sample script that illustrates the use of these functions, see Scripts For Ingredient Variables.

Other (Special-Purpose) Functions:

         BOOL IsIngredientBeingUsedAsRawMaterial (ingredientName As String) it can be used to find out if a given (registered) ingredient (pure component or stock mixture) as identified by its local name (argument) is used anywhere in the process as ‘raw material’. Please note that this function will return true if the specified ingredient is:
a) Part of an input stream’s top-level composition, and the input stream is classified as ‘Raw Material’. Note that if the supplied ingredient is part of another ingredient (e.g. a stock mixture) that is specified as the top-level stream’s ingredient, such use is ignored.
b) Specified in any operation’s consumption needs through its dialog (e.g. pressurize, gas sweep, etc.)
c) Specified as the composition material of any discrete entities (e.g. ‘plastic’ in bottles, or "aluminum" in cans etc.)

         Double IngredientAmtUsedAsRawMaterialPerBatch (ingredientName As String) will return (in kg/batch) the amount of ingredient (pure component or stock mixture) identified by its local name in the argument that is used by the recipe as raw material. Please note the comments under the IsIngredientBeingUsedAsRawMaterial() function above to find out the exact definition of “use as raw material” to see what will be included in the returned amount.

      Double IngredientAmtUsedAsRawMaterialPerYr (ingredientName As String)  will return (in kg/yr) the amount of ingredient (pure component or stock mixture) identified by its local name in the argument that is used by the recipe as raw material. Please note the comments under the IsIngredientBeingUsedAsRawMaterial() function above to find out the exact definition of "use as raw material" to see what will be included in the returned amount. This function is meaningful for processes that execute in batch mode and continuous mode.

         Double IngredientAmtUsedAsRawMaterialPerCampaign (ingredientName As String)  will return (in kg/campaign) the amount of ingredient (pure component or stock mixture) identified by its local name in the argument that is used by the recipe as raw material. Please note the comments under the IsIngredientBeingUsedAsRawMaterial() function above to find out the exact definition of "use as raw material" to see what will be included in the returned amount. This function is only meaningful for processes that execute in batch mode (when called on a process that is continuous it will return 0.0).

         Double IngredientAmtUsedAsRawMaterialPerMP (ingredientName As String)  will return (in kg/unit-of-MP) the amount of ingredient (pure component or stock mixture) identified by its local name in the argument that is used by the recipe as raw material. Please note the comments under the IsIngredientBeingUsedAsRawMaterial() function above to find out the exact definition of "use as raw material" to see what will be included in the returned amount. Also, for a meaningful value to be returned, the recipe must have a designated product unit cost reference rate. Otherwise, the returned value is 0.0.

         Double IngredientAmtUsedAsRawMaterialPerHr (ingredientName As String) will return (in kg/h) the amount of ingredient (pure component or stock mixture) identified by its local name in the argument that is used by the recipe as raw material. Please note the comments under the IsIngredientBeingUsedAsRawMaterial() function above to find out the exact definition of "use as raw material" to see what will be included in the returned amount. This function is meaningful for processes that execute in continuous mode and in Batch Mode.

      Double IngredientAmtUsedAsRawMaterial (ingredientName As String, timeRef As ResourceUseTimeRef) will return the amount of ingredient (pure component or stock mixture) identified by its local name in the argument that is used by the recipe as raw material, in the selected time reference units specified by the ResourceUseTimeRef argument.

      Double IngredientAmtConsumedByOperation (procedureName As String, operationName As String, ingredientName As String, timeRef As ResourceUseTimeRef) will return the amount of ingredient (pure component or stock mixture) identified by its local name in the argument that is consumed by specified operation as raw material, in the selected time reference units specified by the ResourceUseTimeRef argument.

 

To see the above functions in action, please consult the “ComEx8.xls” example spreadsheet with its VBA scripts.