function J = myfun(u)

% Establishing access to the UniSim Design Server and mymodel.usc
h = actxserver('UnisimDesign.Application');
hyCase = h.Activedocument ;
solv = hyCase.Solver ;
f = hyCase.Flowsheet ;
m = f.MaterialStreams ;

global scale1;
x = u.*scale1;

solv.CanSolve = 0 ;

m.Item('MR_1').PressureValue = x(1); %kPa
m.Item('MR_2').PressureValue = x(2);
m.Item('MR').MolarFlowValue = x(3); %kmole/s
m.Item('MR_2*').MolarFlowValue = x(4);
m.Item('MR_3*').MolarFlowValue = x(5);
m.Item('NG1').TemperatureValue = x(6);
m.Item('MR1').TemperatureValue = x(7);
m.Item('NG2').TemperatureValue = x(8);
m.Item('MR2').TemperatureValue = x(9);
m.Item('NG3').TemperatureValue = x(10);
m.Item('MR3').TemperatureValue = x(11);


solv.CanSolve = 1;

J = f.Operations.Item('Efficiency').Cell('B5').CellValue;


