Many tasks in the chemical industry require the physical properties of chemical components. Properties are molecular weight, density, critical pressure and more.
The calculation mixture properties, e.g. specific heat capacity, vapor viscosity, thermal conductivity and many more require these properties.
This code snippet explains how to access the physical properties from the CHEMCAD physical properties database:
%Retreive pure component data for any componet %on the current component list of the flowsheet try %Path to load the CCAPI DLL. Replace the path according to your user %account asmInfo = NET.addAssembly('C:\Users\...\Documents\My Simulations\CC-API\CGC.CC-API.dll'); %Starting CHEMCAD Server chemcad = CCAPI.Server; %Path to the CHEMCAD flowsheet path = '..\..\Deisobutanizer.cc7'; %Loading the CHEMCAD flowsheet to MATLAB chemcad.LoadFlowsheet(path); flowsheet = chemcad.CurrentFlowsheet; %Select the second component present in CHEMCAD flowsheet %In this case, it is N-Butane selComponent=flowsheet.GetComponentByPosition(1); %Print the physical properties of the selected component %Names of the variables are self explanatory. Name=selComponent.Name MolecularWeight=selComponent.MolecularWeight CriticalTemperature=selComponent.CriticalTemperature %R CriticalPressure=selComponent.CriticalPressure %psia AccentricFactor=selComponent.AcentricFactor NormalBoilingPoint=selComponent.NormalBoilingPoint %R %Release the COM objects chemcad.Release; chemcad=0; asmInfo=0; flowsheet=0; %It is recommended to use the following code %to handle exceptions catch e e.message if(isa(e,'NET.NetException')) e.ExceptionObject chemcad.Release; chemcad=0; asmInfo=0; flowsheet=0; end end
Files:
Download Deisobutanizer.cc7