Fluid Prop Syntax
Fluid Prop Syntax
Option Explicit
'MsgBox FP
'Sub Auto_Open()
'ThisWorkbook.Path
'End Sub
'----------------------------------------------------------------------------------'
'----------------------------------------------------------------------------------'
error = False
error = True
End If
End If
Num_Comps = 0
ReDim Comp(1 To 1)
ReDim Conc(1 To 1)
Else
If Not IsArray(Concentrations) Then
Num_Comps = 1
Num_Comps = Concentrations.Count
Else
Num_Comps = UBound(Concentrations)
End If
End If
'Store composition.
If Num_Comps = 1 Then
Comp(1) = Components
' For TPSI Moist. Air concentration is used for mass fraction H2O
Conc(1) = Concentrations
Else
Conc(1) = 1
End If
Else
Comp(Counter) = ""
Else
Comp(Counter) = Components
End If
Else
Comp(Counter) = Components(Counter)
End If
Conc(Counter) = Concentrations(Counter)
Next Counter
End If
SetFluid = ModelName
'Store components.
Else
Next Counter
End If
Next Counter
End If
End If
End If
'Process units
End If
Else
End If
If Len(SetFluid) > 255 Then
End If
End If
End Function
'----------------------------------------------------------------------------------'
'----------------------------------------------------------------------------------'
ErrorMsg = Excel_SetFluid(FluidData)
Solve = "Invalid cell reference. There is not a valid working fluid definition in that cell."
Else
Call FP.Solve(FuncSpec, FuncValue, InputSpec, Target, FixedValue, _
Solve = output
Else
Solve = ErrorMsg
End If
End If
End Function
'----------------------------------------------------------------------------------'
'----------------------------------------------------------------------------------'
'----------------------------------------------------------------------------------'
'----------------------------------------------------------------------------------'
'Function Pressure(FluidData As String, InputSpec As String, _
End Function
End Function
End Function
End Function
'MsgBox FP
'MsgBox Luca
'End Function
'End Function
End Function
End Function
End Function
End Function
End Function
End Function
End Function
End Function
End Function
Function psi(FluidData As String, InputSpec As String, _
End Function
End Function
End Function
Function kappa(FluidData As String, InputSpec As String, _
End Function
End Function
End Function
End Function
End Function
' It calculates the logarithm of the fugacity coefficients of the components in a mixtures [-]
End Function
'----------------------------------------------------------------------------------'
'----------------------------------------------------------------------------------'
Function AllProps(FluidData As String, InputSpec As String, _
Dim P As Double
Dim T As Double
Dim v As Double
Dim d As Double
Dim H As Double
Dim s As Double
Dim u As Double
Dim q As Double
Dim cv As Double
Dim cp As Double
Dim c As Double
Dim fi As Double
ErrorMsg = Excel_SetFluid(FluidData)
ItemCount = 1
ItemCount = ItemCount + 1
Else
End If
Next Counter
Else
ReDim x(1 To 1)
ReDim y(1 To 1)
End If
AllProps = "Invalid cell reference. There is not a valid working fluid definition in that cell."
Else
cp, c, alpha, beta, chi, fi, ksi, psi, zeta, theta, kappa, _
OutputArray(1) = P
OutputArray(2) = T
OutputArray(3) = v
OutputArray(4) = d
OutputArray(5) = H
OutputArray(6) = s
OutputArray(7) = u
OutputArray(8) = q
OutputArray(9) = cv
OutputArray(10) = cp
OutputArray(11) = c
OutputArray(12) = alpha
OutputArray(13) = beta
OutputArray(14) = chi
OutputArray(15) = fi
OutputArray(16) = ksi
OutputArray(17) = psi
OutputArray(18) = zeta
OutputArray(19) = theta
OutputArray(20) = kappa
OutputArray(21) = gamma
OutputArray(22) = eta
OutputArray(23) = lambda
AllProps = OutputArray
Else
AllProps = ErrorMsg
End If
End If
End Function
'----------------------------------------------------------------------------------'
'----------------------------------------------------------------------------------'
Dim P As Double
Dim T As Double
Dim v As Double
Dim d As Double
Dim H As Double
Dim s As Double
Dim u As Double
Dim q As Double
Dim cv As Double
Dim cp As Double
Dim c As Double
Dim fi As Double
ErrorMsg = Excel_SetFluid(FluidData)
ItemCount = 1
ItemCount = ItemCount + 1
Else
End If
Next Counter
Else
ReDim x(1 To 1)
ReDim y(1 To 1)
End If
AllPropsSat = "Invalid cell reference. There is not a valid working fluid definition in that cell."
Else
cp, c, alpha, beta, chi, fi, ksi, psi, zeta, theta, kappa, _
OutputArray(1) = P
OutputArray(2) = T
OutputArray(3) = v
OutputArray(4) = d
OutputArray(5) = H
OutputArray(6) = s
OutputArray(7) = u
OutputArray(8) = q
OutputArray(9) = cv
OutputArray(10) = cp
OutputArray(11) = c
OutputArray(12) = alpha
OutputArray(13) = beta
OutputArray(14) = chi
OutputArray(15) = fi
OutputArray(16) = ksi
OutputArray(17) = psi
OutputArray(18) = zeta
OutputArray(19) = theta
OutputArray(20) = kappa
OutputArray(21) = gamma
OutputArray(22) = eta
OutputArray(23) = lambda
OutputArray(24) = d_liq
OutputArray(25) = d_vap
OutputArray(26) = h_liq
OutputArray(27) = h_vap
OutputArray(28) = T_sat
OutputArray(29) = dd_liq_dP
OutputArray(30) = dd_vap_dP
OutputArray(31) = dh_liq_dP
OutputArray(32) = dh_vap_dP
OutputArray(33) = dT_sat_dP
AllPropsSat = OutputArray
Else
AllPropsSat = ErrorMsg
End If
End If
End Function
'----------------------------------------------------------------------------------'
'----------------------------------------------------------------------------------'
Dim P As Double
Dim T As Double
Dim H As Double
Dim s As Double
ErrorMsg = Excel_SetFluid(FluidData)
ItemCount = 1
ItemCount = ItemCount + 1
Else
End If
Next Counter
zFlow_vu = "Invalid cell reference. There is not a valid working fluid definition in that cell."
Else
OutputArray(1) = P
OutputArray(2) = T
OutputArray(3) = H
OutputArray(4) = s
OutputArray(5) = alpha
OutputArray(6) = beta
OutputArray(7) = chi
OutputArray(8) = fi
OutputArray(9) = zeta
OutputArray(10) = gamma
zFlow_vu = OutputArray
Else
zFlow_vu = ErrorMsg
End If
End If
End Function
'----------------------------------------------------------------------------------'
'----------------------------------------------------------------------------------'
ErrorMsg = Excel_SetFluid(FluidData)
Psat_k1 = "Invalid cell reference. There is not a valid working fluid definition in that cell."
Else
Psat_k1 = Psat
Else
Psat_k1 = ErrorMsg
End If
End If
End Function
'----------------------------------------------------------------------------------'
'----------------------------------------------------------------------------------'
ErrorMsg = Excel_SetFluid(FluidData)
GetInfo = "Invalid cell reference. There is not a valid working fluid definition in that cell."
Else
Case "Mmol"
Case "Tcrit"
Case "Pcrit"
Case "Tmin"
Case "Tmax"
End Select
GetInfo = output
Else
GetInfo = ErrorMsg
End If
End If
End Function
End Function
End Function
End Function
End Function
ErrorMsg = Excel_SetFluid(FluidData)
AllInfo = "Invalid cell reference. There is not a valid working fluid definition in that cell."
Else
OutputArray(1) = Mmol
OutputArray(2) = Tcrit
OutputArray(3) = Pcrit
OutputArray(4) = Tmin
OutputArray(5) = Tmax
AllInfo = OutputArray
Else
AllInfo = ErrorMsg
End If
End If
End Function
'----------------------------------------------------------------------------------'
'----------------------------------------------------------------------------------'
SetUnits = UnitSet
End If
End If
End If
'Application.CalculateFull
Else
SetUnits = ErrorMsg
End If
End Function
' the units set from the cell that specifies the units set. It is
ItemCount = 1
Else
End If
Next Counter
NumUnits = (ItemCount - 2) / 2
UnitSet = Trim(Items(1))
MassOrMole = Trim(Items(2))
PropSymbol = ""
PropUnit = ""
If Counter = 1 Then
Else
End If
If Counter = 1 Then
Else
End If
Next Counter
Excel_SetUnits = ErrorMsg
End Function
SetRefState = "Reference state: T_ref = " + CStr(T_ref) + ", P_ref = " + CStr(P_ref)
Else
SetRefState = ErrorMsg
End If
End Function
Dim i As Integer
ErrorMsg = Excel_SetFluid(FluidData)
SaturationLine = "Invalid cell reference. There is not a valid working fluid definition in that cell."
Else
For i = 1 To nPnts
OutputArray(i, 1) = T(i)
OutputArray(i, 2) = P(i)
Next i
SaturationLine = OutputArray
Else
SaturationLine = ErrorMsg
End If
End If
End Function
Dim i As Integer
ErrorMsg = Excel_SetFluid(FluidData)
IsoLine = "Invalid cell reference. There is not a valid working fluid definition in that cell."
Else
Call FP.IsoLine(PropSpec, PropVal, RunSpec, CalcSpec, MinVal, MaxVal, nPnts, RunVal, Calcval, _
ErrorMsg)
For i = 1 To nPnts
OutputArray(i, 1) = RunVal(i)
OutputArray(i, 2) = Calcval(i)
Next i
IsoLine = OutputArray
Else
IsoLine = ErrorMsg
End If
End If
End Function
'------------------------------------------------------------------------------------------'
' Function to calculate x,y as function of Aij,Aji,alfa and P,T for StanMix mixures '
'------------------------------------------------------------------------------------------'
P As Double, T As Double)
ErrorMsg = Excel_SetFluid(FluidData)
xy_A_alfa = "Invalid cell reference. There is not a valid working fluid definition in that cell."
Else
xy(1) = x(1)
xy(2) = y(1)
xy_A_alfa = xy
Else
xy_A_alfa = ErrorMsg
End If
End If
End Function
'------------------------------------------------------------------------------------------'
' Function to calculate x,y as function of kij and P,T for PCP-SAFT mixures '
'------------------------------------------------------------------------------------------'
ErrorMsg = Excel_SetFluid(FluidData)
xy_kij = "Invalid cell reference. There is not a valid working fluid definition in that cell."
Else
xy(1) = x(1)
xy(2) = y(1)
xy_kij = xy
Else
xy_kij = ErrorMsg
End If
End If
End Function
'----------------------------------------------------------------------------------'
'----------------------------------------------------------------------------------'
ItemCount = 1
ItemCount = ItemCount + 1
Else
End If
Next Counter
AllTransProps = "Invalid cell reference. There is not a valid working fluid definition in that cell."
Else
Call FP.AllTransProps(T, rho, eta, eta_T, eta_rho, lambda, lambda_T, lambda_rho, ErrorMsg)
OutputArray(1) = eta
OutputArray(2) = lambda
AllTransProps = OutputArray
Else
AllTransProps = ErrorMsg
End If
End If
End Function
'Dim H As Double
'lc1 = 40
'lc2 = 400
'MsgBox "parto"
'Range("O2") = H
'End Sub