Hysys Column Stage Error

21 ビュー (過去 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