About how to call vaporPressure by Aspen based on C-O V1.0
Posted: 19 December 2014, 12:15
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;
}"
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;
}"