Change Number of the Segments of the Absorber using MATLAB

Performance of an absorber also depends on the number of the segments.

To visualize the effect of change of number of segments on concentration profiles in CHEMCAD is difficult and slow procedure.

Following code snippet shows how to change the number of the segments and plot concentration profiles.

%Plot the concentration of the components along the
%height of the absorber column. This code snippet shows
%how to change the number of the segments using .NET Interface.


%Path to load the CCAPI DLL. Replace the path according to your user
%account
try
asmInfo = NET.addAssembly('..\CGC.CC-API.dll');

%Starting CHEMCAD Server
chemcad = CCAPI.Server;

%Path to the CHEMCAD flowsheet
path = '..\Absorber.cc7';

%Loading the CHEMCAD flowsheet to MATLAB
chemcad.LoadFlowsheet(path);
flowsheet = chemcad.CurrentFlowsheet;

%Select SCDS column from the flowsheet
SCDSColumn=flowsheet.GetUnitOperationById(1) ;


%Get the results of Column Hydraulics

columnResult=SCDSColumn.GetColumnHydraulics(CCAPI.ColumnType.Tray)

stageData=columnResult.StageData;
numberOfStages=SCDSColumn.NoOfStages;
height=1:1:numberOfStages;
nitrogenFlow=1:1:numberOfStages;
oxygenFlow =1:1:numberOfStages;
hclFlow =1:1:numberOfStages;
waterFlowFirst=1:1:numberOfStages;
u=1;
for i=1:numberOfStages
    
height(i)=stageData.Get(u).StageHeight;
nitrogenFlow(i)=stageData.Get(u).LiquidFlowRate.Get(0).MolarFlow;
 oxygenFlow(i)=stageData.Get(u).LiquidFlowRate.Get(1).MolarFlow;
hclFlow(i)=stageData.Get(u).LiquidFlowRate.Get(2).MolarFlow;
waterFlowFirst(i)=stageData.Get(u).LiquidFlowRate.Get(3).MolarFlow;
u=1+1;
end

figure

%Plot the result of first run
plot(waterFlowFirst,height,'-o')
title('Column Height')
xlabel('kmol/s')
ylabel('Column Height(m)')
legend('Water 20 stages')

%Change the number of the segments
SCDSColumn.NoOfStages=25;

chemcad.Run;
columnResult=SCDSColumn.GetColumnHydraulics(CCAPI.ColumnType.Tray);
stageData=columnResult.StageData;
numberOfStages=SCDSColumn.NoOfStages;
waterFlowSecond=1:1:numberOfStages;
u=1;

for i=1:numberOfStages
    
height(i)=stageData.Get(u).StageHeight;
nitrogenFlow(i)=stageData.Get(u).LiquidFlowRate.Get(0).MolarFlow;
 oxygenFlow(i)=stageData.Get(u).LiquidFlowRate.Get(1).MolarFlow;
hclFlow(i)=stageData.Get(u).LiquidFlowRate.Get(2).MolarFlow;
waterFlowSecond(i)=stageData.Get(u).LiquidFlowRate.Get(3).MolarFlow;
u=u+1;
end

%Plot the result from second run
hold on 
plot(waterFlowSecond,height,'-o')
title('Column Height')
xlabel('kmol/s')
ylabel('Column Height(m)')
legend('Water 20 stages','Water 25 stages')
hold off
chemcad.Release;

chemcad=0;
flowsheet=0;
catch e 
e.message
if(isa(e,'NET.NetException'))
e.ExceptionObject
chemcad.Release;
chemcad=0;
flowsheet=0;
clear;
 end

Output:

Files:
Download Absorber.cc7