Scripts For Equipment Contents Variables

Examples of VBA scripts used for accessing equipment contents related variables are given.

Example 1: Set and get the temperature of the initial contents of an equipment:

Function SetAndGetEquipContentsTemperature(equipName, temperature) As Double

Dim var1 As Variant

Dim var2 As Variant

Dim var3 As Variant

Dim var4 As Variant

Dim str As String

 

Set superProDoc = DocumentObject()

var1 = CDbl(temperature)

str = CStr(equipName)

var2 = Null

var3 = Null

var4 = Null

superProDoc.SetEquipContentsVarVal str, VarID.temperature_VID, var1, var2, var3, var4

var1 = 0.0 ' Reset to 0 so as for testing purposes

superProDoc.GetEquipContentsVarVal str, VarID.temperature_VID, var1, var2, var3, var4

 

SetAndGetEquipContentsTemperature = CDbl(var1)

End Function

Example 2: Set and get the mass flow of an ingredient from the intial contents of an equipment:

Function SetAndGetInitialComponentMassFlow(equipName, compName, massFlow) As Double

Dim var1 As Variant

Dim var2 As Variant

Dim var3 As Variant

Dim var4 As Variant

Dim str As String

 

Set superProDoc = DocumentObject()

var1 = CDbl(massFlow)

str = CStr(equipName)

var2 = CStr(compName)

var3 = Null

var4 = Null

superProDoc.SetEquipContentsAutoInitOptions str, VarID.autoInitMode_VID, byUser_Sim

superProDoc.SetEquipContentsVarVal str, VarID.bEditIngredientFracs_VID, False, var2, va3, var4

superProDoc.SetEquipContentsVarVal str, VarID.componentMassFlow_VID, var1, var2, var3, var4

var1 = 0.0 ' Reset to 0 so as for testing purposes

superProDoc.GetEquipContentsVarVal str, VarID.componentMassFlow_VID, var1, var2, var3, var4

 

SetAndGetInitialComponentMassFlow = CDbl(var1)

End Function

IconInfo00008.bmp 

 When no ingredient, procedure or operation name is specified you must pass the word “Null”. This will also mean that the variable of the initial contents is retrieved.

In the second example first we set the auto initialization option to set by user “byUser_SIM” then we set the ‘edit ingredient fracs’ flag to false and then we set the component mass flow.

Example 3: Get the mass fraction of a pure component after the execution of an operation

Function GetEquipContentsCompMassFrac(equipName, procName, opName, compName) As Double

Dim var1 As Variant

Dim var2 As Variant

Dim var3 As Variant

Dim var4 As Variant

Dim str As String

 

Set superProDoc = DocumentObject()

var1 = 0.0

str = CStr(equipName) ‘ equipment name

var2 = CStr(compName) ‘ pure component name

var3 = CStr(procName) ‘ procedure name

var4 = CStr(opName) ‘ operation name

 

superProDoc.GetEquipContentsVarVal str, VarID.compMassFrac_VID, var1, var2, var3, var4

 

GetEquipContentsCompMassFrac = CDbl(var1)

End Function