MATLAB CAPE OPEN unit operation in HYSYS

Moderator: jasper

MATLAB CAPE OPEN unit operation in HYSYS

Postby Motadi » 06 August 2018, 07:16

Hello,
I am using MATLAB unit operation with CAPE-OPEN V1.0 in Aspen HYSYS V9.0. MATLAB CAPE OPEN unit operation works fine except for the time that I make a “parameter” in the unit operation (see Figure 1). After making a “parameter”, I always get an error as in Figure 2. This error appears each time the model runs. What can be the cause of this problem?

Thank you very much,

Figure 1.png
Figure 1
Figure 1.png (21.64 KiB) Viewed 26342 times

Figure 2.png
Figure 2
Figure 2.png (3.32 KiB) Viewed 26342 times
Motadi
 
Posts: 5
Joined: 13 June 2018, 09:59

Re: MATLAB CAPE OPEN unit operation in HYSYS

Postby jasper » 12 August 2018, 11:42

It is very hard to say, from an error message like this. I will ask around to see if I can find anything, but I suppose the way to go to resolve this one is to contact AspenTech support.
User avatar
jasper
 
Posts: 1128
Joined: 24 October 2012, 15:33
Location: Spain

Re: MATLAB CAPE OPEN unit operation in HYSYS

Postby Motadi » 14 August 2018, 08:35

Thank you for the reply.
I contacted AspenTech and this is their response:
"Unfortunately, this query relates to a third party extension which we are not responsible for. As such, we will not be able to support you on this item.
AspenTech Support will be able to assist with integration issues between CAPE-OPEN and Aspen HYSYS, but with regards to the code within the unit operation itself, we suggest you contact CAPE-OPEN directly."
Motadi
 
Posts: 5
Joined: 13 June 2018, 09:59

Re: MATLAB CAPE OPEN unit operation in HYSYS

Postby jasper » 14 August 2018, 09:06

The error code 0x80040501 is the generic CAPE-OPEN error code, and comes with a textual error description, which HYSYS should display.

AspenTech surely knows well that CAPE-OPEN is a standard set, and not a person or company - I am not impressed by their efforts to help you.

What you can do is use a logger (either COLTT, by CO-LaN, or OATS/COULIS, by COCOSimulator) to log the interaction, and get the error description from the log. Would you be so kind?
User avatar
jasper
 
Posts: 1128
Joined: 24 October 2012, 15:33
Location: Spain

Re: MATLAB CAPE OPEN unit operation in HYSYS

Postby Motadi » 14 August 2018, 20:07

Thank you very much for the answer.
I made a log with COLTT which is attached here:
aspenhysys_081418_215119.zip
(5.38 KiB) Downloaded 974 times
The name of the parameter is "testPar".
Motadi
 
Posts: 5
Joined: 13 June 2018, 09:59

Re: MATLAB CAPE OPEN unit operation in HYSYS

Postby Motadi » 20 August 2018, 15:00

Hello,
By analyzing the log, the error code was related to the fact that a "Default" value was not defined for the defined "parameter". This was confusing, because I did not get any error while using cape open v1.1.
This was the error description in the log: "Error returned from get_DefaultValue - 0x80040501".

So this problem is solved, however I have another problem: I want to get singlephase property "activity" for the liquid phase, however I get error. Here is the error description in the log generated by COLTT:

Property Phase Basis Calc Value returned
activity Liquid (null) mixture
COLTT <duplicate of 1> : Windows error code returned is: 0x80131500 - not known
COLTT <duplicate of 1> : Getting error details from IErrorInfo interface:
COLTT <duplicate of 1> : Call to GetSource
GetSource returns:
Interface : ICapeThermoMaterialObject
COLTT <duplicate of 1> : Return from GetSource - Succeeded
COLTT <duplicate of 1> : Call to GetDescription
GetDescription returns:
Description : Cannot calculate property {activity,Liquid,,,Mixture} because the phase fraction has not been set


I am using this command: value=getSinglePhaseProperty('activity','Liquid',T,P,moleFraction)
The error log says "the phase fraction has not been set", but "phase fraction" is not an input to this command.

I appreciate your help,

Best regards,
Motadi
 
Posts: 5
Joined: 13 June 2018, 09:59

Re: MATLAB CAPE OPEN unit operation in HYSYS

Postby jasper » 20 August 2018, 18:09

Apologies, I missed your post.

That is certainly an interesting message that you flag there. You are correct about the default value.

The other message is rather interesting. Why would Aspen HYSYS possibly require a phase fraction to be set to calculate an activity? Can you calculate other properties under the same conditions?
User avatar
jasper
 
Posts: 1128
Joined: 24 October 2012, 15:33
Location: Spain

Re: MATLAB CAPE OPEN unit operation in HYSYS

Postby jasper » 20 August 2018, 18:10

Note that CAPE-OPEN specifies that single-phase properties depend on T, P and X, and can be calculated under single phase (non-equilibrium) conditions. So phase fraction should not be required for calculation of activity for a given phase.
User avatar
jasper
 
Posts: 1128
Joined: 24 October 2012, 15:33
Location: Spain

Re: MATLAB CAPE OPEN unit operation in HYSYS

Postby jasper » 20 August 2018, 18:11

Can you get logFugacityCoefficient? In that case you can work around the problem.
User avatar
jasper
 
Posts: 1128
Joined: 24 October 2012, 15:33
Location: Spain

Re: MATLAB CAPE OPEN unit operation in HYSYS

Postby Motadi » 21 August 2018, 08:25

jasper wrote:Apologies, I missed your post.

That is certainly an interesting message that you flag there. You are correct about the default value.

The other message is rather interesting. Why would Aspen HYSYS possibly require a phase fraction to be set to calculate an activity? Can you calculate other properties under the same conditions?


Yes, I can calculate some other properties such as "logFugacityCoefficient, Compressibility, compressibilityFactor, fugacity, ..." but NOT these properties "activity, activityCoefficient, diffusionCoefficient, gibbsEnergy, heatCapacityCp, etc. ". I will discuss this with AspenTech support.

jasper wrote:Can you get logFugacityCoefficient? In that case you can work around the problem.


Yes, I can get it. So, this can be a work around the problem.

Thank you for your help,
Motadi
 
Posts: 5
Joined: 13 June 2018, 09:59

Next

Return to MATLAB Unit Operation (AmsterCHEM)

Who is online

Users browsing this forum: No registered users and 1 guest

cron