function CalcF2_compSet(filename)
global memo Specs Col HyCase 

serv = actxserver('Hysys.Application.2006.5');
HyCase = serv.SimulationCases.Open([pwd,filename]);
HyCase.Activate;
Col = HyCase.Flowsheet.Operations.Item('T-100');
Specs = Col.ColumnFlowsheet.Specifications;

D     = Col.Flowsheet.MaterialStreams.Item('D');
B     = Col.Flowsheet.MaterialStreams.Item('B');
xDs = D.ComponentMolarFractionValue;
xBs = B.ComponentMolarFractionValue;
FFlowS = HyCase.Flowsheet.MaterialStreams.Item('F').MolarFlowValue;

% Nominal, L = 123, V = 152.4 kmol/hr
memo.fval = 0;
riteTofile

%% temperature profile as function of Feed flow rate changes
FFlow = HyCase.Flowsheet.MaterialStreams.Item('F').MolarFlowValue;
Frng = [-.02,.02];
for i = 1:length(Frng)
    HyCase.Flowsheet.MaterialStreams.Item('F').MolarFlowValue = FFlow*(1+Frng(i));
    Col.ColumnFlowsheet.Run
    T = Col.ColumnFlowsheet.TemperaturesValue;
    riteTofile
    HyCase.Flowsheet.MaterialStreams.Item('F').MolarFlowValue = FFlow;
end

%% Changes in feed composition
Compfrac = HyCase.Flowsheet.MaterialStreams.Item('F').componentMolarFractionValue;
step_za = [-.002,.002];
for i = 1:length(step_za)
    compositionDisturbance(1, Compfrac, step_za(i));
    HyCase.Application.PlayScript([pwd,'\compChange.SCP'])
    Col.ColumnFlowsheet.Run
    T = Col.ColumnFlowsheet.TemperaturesValue;
    riteTofile
    HyCase.Application.PlayScript([pwd,'\compnormal.SCP'])
    Col.ColumnFlowsheet.Run
end


Compfrac = HyCase.Flowsheet.MaterialStreams.Item('F').componentMolarFractionValue;
step_zb = [-.002,.002];
for i = 1:length(step_zb)
    compositionDisturbance(2, Compfrac, step_zb(i));
    HyCase.Application.PlayScript([pwd,'\compChange.SCP'])
    Col.ColumnFlowsheet.Run
    T = Col.ColumnFlowsheet.TemperaturesValue;
    riteTofile
    HyCase.Application.PlayScript([pwd,'\compnormal.SCP'])
    Col.ColumnFlowsheet.Run
end

Compfrac = HyCase.Flowsheet.MaterialStreams.Item('F').componentMolarFractionValue;
step_zc = [-.002,.002];
for i = 1:length(step_zc)
    compositionDisturbance(3, Compfrac, step_zc(i));
    HyCase.Application.PlayScript([pwd,'\compChange.SCP'])
    Col.ColumnFlowsheet.Run
    T = Col.ColumnFlowsheet.TemperaturesValue;
    riteTofile
    HyCase.Application.PlayScript([pwd,'\compnormal.SCP'])
    Col.ColumnFlowsheet.Run
end

Compfrac = HyCase.Flowsheet.MaterialStreams.Item('F').componentMolarFractionValue;
step_zd = [-.002,.002];
for i = 1:length(step_zd)
    compositionDisturbance(4, Compfrac, step_zd(i));
    HyCase.Application.PlayScript([pwd,'\compChange.SCP'])
    Col.ColumnFlowsheet.Run
    T = Col.ColumnFlowsheet.TemperaturesValue;
    riteTofile
    HyCase.Application.PlayScript([pwd,'\compnormal.SCP'])
    Col.ColumnFlowsheet.Run 
end


% change in feed quality
    
vrng = [-0.02,0.02];
for i = 1:length(vrng)
    temptoset = fsolve(@reachq,100,[],HyCase,1+vrng(i));
    HyCase.Flowsheet.MaterialStreams.Item('F').VapourFraction.Erase
    HyCase.Flowsheet.MaterialStreams.Item('F').Temperature.Value = temptoset;
    Col.ColumnFlowsheet.Run
    T = Col.ColumnFlowsheet.TemperaturesValue;
    riteTofile
    HyCase.Flowsheet.MaterialStreams.Item('F').Temperature.Erase
    HyCase.Flowsheet.MaterialStreams.Item('F').VapourFraction.value = 0;
end



% change in column pressure (top)
Pnom_Feed = HyCase.Flowsheet.MaterialStreams.Item('F').Pressure.value;
Prng = [-.02,.02];
for i = 1:length(Prng)
    HyCase.Flowsheet.MaterialStreams.Item('F').Pressure.value = Pnom_Feed*(1+Prng(i));
    Col.ColumnFlowsheet.Run
    T = Col.ColumnFlowsheet.TemperaturesValue;
    riteTofile
    HyCase.Flowsheet.MaterialStreams.Item('F').Pressure.value = Pnom_Feed;
end

Pnom_top = Col.ColumnFlowsheet.Pressures.value(1);
Pnom_reb = Col.ColumnFlowsheet.Pressures.value(end);
Prng = [-.02,.02];
for i = 1:length(Prng)
    PressChange('PconChange.scp',serv,Col,Pnom_top*(1+Prng(i)));
    PressChange('PrebChange.scp',serv,Col,Pnom_reb+Pnom_top*Prng(i));
    Col.ColumnFlowsheet.Run
    T = Col.ColumnFlowsheet.TemperaturesValue;
    riteTofile
    PressChange('PconChange.scp',serv,Col,Pnom_top);
end

