Page 1 of 1

About how to call vaporPressure by Aspen based on C-O V1.0

PostPosted: 19 December 2014, 12:15
by z740568564
Hello jasper
Recently,I am very interested in COM programming,so i tried to use Aspen's Property package and my program to simulate pump.When it comes to " pump's allow installation height",I feel helpless.As you konw,i need to call the inlet material's vaporPressure, i think the function must be"Getprop" but i always failed.So,i put my code as follow,hope you can give me a suggestion , TYVM(thank you very much)!
"BOOL CMaterialObject10::GetvaporPressure(CString propertyName,PhysicalPropertyBasis basis,CVariant &value)
{
if(!capeThermoMaterialObject) {NotifyError(CurrentFile,CurrentFunction,CurrentLine,19);return 0;}
HRESULT hr;
VARIANT compIds;
compIds.vt=VT_EMPTY;
CString base;
if(basis==Basis_Mole) base=_T("mole");
else if(basis==Basis_Mass) base=_T("mass");
else base=_T("");
CString calcType=_T("Pure");
VARIANT v;
v.vt=VT_EMPTY;
hr=capeThermoMaterialObject->GetProp(CBSTR(propertyName),CBSTR(L"overall"),compIds,CBSTR(calcType),CBSTR(base),&v);
value.Set(v,TRUE);
return 1;

}"

Re: About how to call vaporPressure by Aspen based on C-O V

PostPosted: 19 December 2014, 12:18
by starchow
you are very smart! hope there are other people to help you!

Re: About how to call vaporPressure by Aspen based on C-O V

PostPosted: 19 December 2014, 12:25
by jasper
Your message is not clear to me. capeThermoMaterialObject is a pointer to a material object, not to a property package, I imagine? Who implements this material object? Are you writing a pump that is running as unit operation in AspenPlus? If so, then you should call CalcProp before calling GetProp. The phase is a bit of an unfortunate argument for temperature dependent properties, and has no meaning, except for that you should expect to retrieve the property using GetProp on the same phase as you have calculated it on; I would try "Vapor" or "Liquid". Basis should be none (NULL), calcType should be "Pure". You will get one value for each compound. Composition is irrelevant, temperature should be irrelevant (but don't be surprised it fails in case you did not set one, although it should not fail on that, it might). Temperature of course is relevant and should be set prior to CalcProp.

Re: About how to call vaporPressure by Aspen based on C-O V

PostPosted: 19 December 2014, 13:42
by z740568564
thans for your reply.i think i get it .yes,i make a unit operation in Chinese that can be used in the Aspen Plus . The material Object is not writed by me,i quote part of the eg.CPP MIxer.And The most program (material Object) is wtited by my Brother (we have a same teacher) .The fuction "Caculate" is writen by me.and there is another qustion ; how can i get surfacetension by GetProp in V1.0. hope your reply thank you very much!

Re: About how to call vaporPressure by Aspen based on C-O V

PostPosted: 19 December 2014, 14:22
by jasper
If you are implementing a unit operation, the material object is written by AspenTech (if you run it in AspenPlus) or by me (if you run in COFE) or in general by the software vendor of the simulation environment; the unit operation accesses thermodynamics only via the simulation environment's material objects.

Surface tension: same story - CalcProp, then GetProp. CalcType = mixture. Phase: in 1.1 it is clearly a two-phase property. In 1.0 this is undocumented, and mostly implemented as a single phase liquid property.