Download Equilibrium Calculations User Manual

Transcript
HSC 8 – Equilibrium Module
November 25, 2014
Research Center, Pori / Petri Kobylin, Lena
Furta, Danil Vilaev
14009-ORC-J
45 (53)
data As ICalculationData) As
Double() _
Implements IActivityCoefficientModel.CalculateActivityCoefficients
Throw New NotImplementedException()
End Function
End Class
Below is a detailed description of the implementation.
The AddIn attribute has to include the add-in name and version.
<AddIn("AddinTest", Version:="1.0.0.0")>
The name property should return the string that will be shown as the model name in the
HSC Gibbs interface.
Public ReadOnly Property Name As String _
Implements IActivityCoefficientModel.Name
Get
Return "Addin Test"
End Get
End Property
The Init method is called by HSC Gibbs before the calculation of the phase, and an array of
ISpecies objects is passed into it. It is expected that the method keeps the species names
from this array somewhere.
Private _species As IEnumerable(Of ISpecies)
Public Sub Init(ByVal species As ISpecies()) _
Implements IActivityCoefficientModel.Init
_species = species
End Sub
The CalculateActivityCoefficients method is called by HSC Gibbs during the phase
calculations. The parameters passed are the amounts of species in mol (species order and
number correspond to the species passed into the Init method) and the ICalculationData
object that provides the temperature in Kelvins and pressure in bars. The method should
return a double-array with the same size as the species and amounts of arrays.
Public Function CalculateActivityCoefficients(amounts As Double(),
data As ICalculationData) As Double() _
Implements IActivityCoefficientModel.CalculateActivityCoefficients
Dim result() As Double
ReDim result(_species.Count - 1)
For i As Integer = 0 To _species.Count - 1
result(i) = 1.0
Next
Return result
End Function
The values returned by the CalculateActivityCoefficients method are treated by HSC Gibbs
as species activity coefficients, with 1 meaning an ideal system. During the Gibbs energy
calculations, the natural logarithm of the activity coefficient is used. So, if your activity
coefficient model provides the logarithm of the activity coefficient, you need to exponentiate
it in the CalculateActivityCoefficients method, so that the correct logarithm is achieved in
the Gibbs energy calculations.
Copyright © Outotec Oyj 2014