Hysys Column Stage Error

조회 수: 18 (최근 30일)
지원 구
지원 구 2023년 11월 30일
편집: 지원 구 2023년 12월 4일
Hello. I try to optimize the columns in Aspen Hysys via Matlab.
And I have a problem to access the column stage control.
aspen = actxserver('Hysys.Application.V12.1');
FileNamePath = 'Aspen Name';
simcase = aspen.SimulationCases.Open([cd, strcat('\', FileNamePath, '.hsc')]);
Oper = simcase.Flowsheet.Operation;
Oper.Item('T-100').Columnflowsheet.Operation.Item("Main_TS")
When I do this, there is an error.
Error using Interface.~~~~~/Item
Invoke Error, Dispatch Exception: Not spefied error.
Anyone know, how to access the stages of side inlet flows in columns??
Thank you.

답변 (1개)

Angelo Yeo
Angelo Yeo 2023년 11월 30일
It looks like the error is related to "invoke". Would you invoke simulation cases and see if you can proceed?
aspen = actxserver('Hysys.Application.V12.1');
FileNamePath = 'Aspen Name';
simcase = aspen.SimulationCases.Open([cd, strcat('\', FileNamePath, '.hsc')]);
simcase.invoke('Activate'); % Add this
Oper = simcase.Flowsheet.Operation;
Oper.Item('T-100').Columnflowsheet.Operation.Item("Main_TS")
Also, you can find a good example of how to manipulate Hysys via COM server in the link below.
  댓글 수: 3
Angelo Yeo
Angelo Yeo 2023년 11월 30일
Do you get the same error message? It would be good if you can provide reproducible steps and error messages.
지원 구
지원 구 2023년 12월 4일
편집: 지원 구 2023년 12월 4일
Thank you. Below code is my code and other codes are running well.
Also, Operations.Item('T-100').Columnflowsheet.Operation is run well. But, accessing to the Main_TS is not allowed.
aspen = actxserver('Hysys.Application.V12.1');
FileNamePath = 'File name';
simcase = aspen.SimulationCases.Open([cd, strcat('\', FileNamePath, '.hsc')]);
simcase.Visible = true;
simcase.invoke('Activate');
Flowsheet = simcase.Flowsheet;
Operations = simcase.Flowsheet.Operation;
Streams = simcase.Flowsheet.MaterialStreams;
Energies = simcase.Flowsheet.EnergyStreams;
Column1 = simcase.Flowsheet.Operation.Item('T-100'); % T-100: Column1 name
Column2 = simcase.Flowsheet.Operation.Item('T-101'); % T-101: Column2 name
Solve = simcase.Solver;
Solve.CanSolve = 0;
Streams.Item('1').PressureValue = pressure_column2; % Changed well
Solve.CanSolve = 1;
Operations.Item('SPRDHT-1').Cell('B2').CellValue = trayNumber_column2; % Changed well
Column1.ColumnFlowsheet.Run; % Run well
Column2.ColumnFlowsheet.Run; % Run well
Converge1 = Operations.Item('T-100').ColumnFlowsheet.CfsConverged; % Read well
Converge2 = Operations.Item('T-101').ColumnFlowsheet.CfsConverged; % Read well
% ================================== About Main_TS ==================================
% But to access the optional inlet streams step by step.
% I run the below code at first, to see that the Main_TS path running well.
Operations.Item('T-100').Columnflowsheet.Operation.Item("Main_TS"); % Error
% Error message is
% Error using Interface.~~~~~~/Item
% Invoke Error, Dispatch Exception: Unspecified error.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by