Three steps are needed to obtain the heat capacity coefficients for a cubic polynomial in temperature using the Prode Physical Properties (PPP) system and Mathcad.
1. Obtain the data
The heat capacity is determined at a number of temperatures using the Mathcad statements below.
The ccode argument in the second line is a vector of PPP component identification numbers obtained previously in the worksheet.
The temperature range must be within the limits given for each component, as shown in the PPP editor window. Requests for an enthalpy outside of those limits will result in an error. Due to the expression involving mc_CompHG, the low temperature, t1, needs to be at least one degree above the low limit in PPP.
The default origin index in Mathcad arrays is zero. Thus, k and i ranges end at npts-1 and NC-1, respectively.
The mc_CompHG PPP function returns the enthalpy change for a component in the gas state between two temperatures. Since the two temperatures specified are 1 degree apart, the result is a heat capacity per unit mass of the component. Multiplication by the molecular weight produces the molar heat capacity.
The data matrix, M, has npts rows and NC columns.
2. Regress the data
Conducting a least squares regression to obtain the polynomial coefficients is easy, once you have found the right Mathcad routine. Use the help file to explore the curve fitting options. The "regress" function was used as shown below. By using the range index, i, regressions for all components were performed using only one statement.
The arguments in the call for regress are divided by their default units to make them dimensionless. The second argument for regress selects the heat capacity vector for component i which is in column i, as indicated by the angle bracketed superscript.
The result of the regression is the cp_fit matrix. Each column of cp_fit contains the results for one component. This matrix can be used in another Mathcad function to obtain interpolated values of the heat capacity. However, I prefer to have just the coefficients of the polynomial instead so that I can use them in matrix calculations. The extraction of the coefficients from cp_fit is the final step.
3. Extract coefficients
The extracted submatrix has been transposed to produce the cp matrix. As will be shown in the next post, this form is convenient for matrix operations with the heat capacity. The submatrix is also multiplied by the default units for heat capacity. If desired, cp can then be displayed in other units by merely typing the desired units in the result units placeholder. Mathcad performs the conversion calculations.
The above procedure is a simple workaround for the slow enthalpy function in PPP. Note that the availability of the enthalpy information in PPP was still a vital necessity. Without that information, I might have spent considerable time finding suitable information, especially if the compounds had not been as common as those in this example. Also, for many applications the speed of the PPP enthalpy function may not be noticeable. My application required so many computations that the speed became an issue.