'Open the Visual Basic Editor from Excel 'Create a module if one is not already opened, 'Copy this file to the VBA module 'AirPTWCvEng(Pressure (psia), Temperature (deg F), HUmidity Ratio) returns specific heat at constant volume (Btu/lbwet/deg F) 'AirPTWCvSIF(Pressure (MPa), Temperature (deg K), HUmidity Ratio) returns specific heat at constant volume (KJ/kgwet/deg K) Declare Function MyAirPTWV Lib "TAIR32.DLL" Alias "AirPTWV" (ByVal P As Double, ByVal T As Double, ByVal W As Double, ByVal U As Long) As Double Declare Function MyAirTVWP Lib "TAIR32.DLL" Alias "AirTVWP" (ByVal T As Double, ByVal V As Double, ByVal W As Double, ByVal U As Long) As Double Declare Function MyAirPTWC Lib "TAIR32.DLL" Alias "AirPTWC" (ByVal P As Double, ByVal T As Double, ByVal W As Double, ByVal U As Long) As Double Public Function AirPTWCvSIF(ByVal P As Double, ByVal T As Double, ByVal W As Double) As Double Dim V As Double Dim V1 As Double Dim P1 As Double Dim T1 As Double Dim dVdTp As Double Dim dPdTv As Double Dim Cp As Double V = MyAirPTWV(P, T, W, 19) T1 = T + 1 V1 = MyAirPTWV(P, T1, W, 19) dVdTp = (V1 - V) / (T1 - T) P1 = MyAirTVWP(T1, V, W, 19) dPdTv = (P1 - P) / (T1 - T) Cp = MyAirPTWC(P, T, W, 19) AirPTWCvSIF = Cp - T * dVdTp * dPdTv * 1000 End Function Public Function AirPTWCvEng(ByVal P As Double, ByVal T As Double, ByVal W As Double) As Double Dim V As Double Dim V1 As Double Dim P1 As Double Dim T1 As Double Dim dVdTp As Double Dim dPdTv As Double Dim Cp As Double Dim US As Integer US = 16 V = MyAirPTWV(P, T, W, US) T1 = T + 1.8 V1 = MyAirPTWV(P, T1, W, US) dVdTp = (V1 - V) / (T1 - T) P1 = MyAirTVWP(T1, V, W, US) dPdTv = (P1 - P) / (T1 - T) Cp = MyAirPTWC(P, T, W, US) AirPTWCvEng = Cp - (T + 459.67) * dVdTp * dPdTv * 144 / 778.169262 End Function