Specifications
Extensibility 3-35
3-35
9. The other function that is required to implement a kinetic
reaction extension is the ReactionRate function.
Code Explanation
Public Function ReactionRate(ByVal Fluid As
Object, ByVal RxnTemperatureInC As Double,
ByVal RxnVolumeInKmolPerM3 As Double, rate As
Double) As Boolean
This function is called whenever the
extension is executed.
On Error GoTo ErrorTrap
Enable Error trapping.
Dim TotalPressure As Double
Dim RxnTemperatureinK As Double
Dim EthyleneIndex As Integer
Dim AceticAcidIndex As Integer
Dim OxygenIndex As Integer
Dim WaterIndex As Integer
Dim ComponentFracs As Variant
Dim EthylenePP As Double
Dim AceticAcidPP As Double
Dim OxygenPP As Double
Dim WaterPP As Double
Declare local variables.
If hyBulkDens.Value <= 0 Then
hyBulkDens.Value = 2700
Check to see if the value of hyBulkDens >
0. If not, then sets it to the default value
of 2700 kg catalyst/m
3
reactor volume.
TotalPressure =
Fluid.Pressure.GetValue("psia")
Gets the overall pressure of the reaction
in psia.
RxnTemperatureinK = RxnTemperatureInC +
273.15
Get the temperature of the reaction K.
EthyleneIndex =
Fluid.Components.Index("Ethylene")
AceticAcidIndex =
Fluid.Components.Index("AceticAcid")
OxygenIndex =
Fluid.Components.Index("Oxygen")
WaterIndex = Fluid.Components.Index("H2O")
Get component index numbers. These
index numbers are later used to
reference the components and their
properties.
ComponentFracs = Fluid.MolarFractionsValue
Set ComponentFracs equal to the
component molar fractions of the fluid.
EthylenePP = ComponentFracs(EthyleneIndex) *
TotalPressure
AceticAcidPP =
ComponentFracs(AceticAcidIndex) *
TotalPressure
OxygenPP = ComponentFracs(OxygenIndex) *
TotalPressure
WaterPP = ComponentFracs(WaterIndex) *
TotalPressure
Get partial pressure of components in
psia by multiplying component mole
fraction by total pressure (Smith and Van
Ness, p. 300).