Hysys Column Stage Error

22 Ansichten (letzte 30 Tage)
지원 구
지원 구 am 30 Nov. 2023
Bearbeitet: 지원 구 am 4 Dez. 2023
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.

Antworten (1)

Angelo Yeo
Angelo Yeo am 30 Nov. 2023
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 Kommentare
Angelo Yeo
Angelo Yeo am 30 Nov. 2023
Do you get the same error message? It would be good if you can provide reproducible steps and error messages.
지원 구
지원 구 am 4 Dez. 2023
Bearbeitet: 지원 구 am 4 Dez. 2023
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.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by