I used the COM CAPE-OPEN Wizard 2.0 to generate a unit operation framework.
Classes for parameters, ports, material etc. are therefore automatically generated.
1. There is a typo in the "material" classes:
It reads "Propery" instead of "Property", e.g. "GetOverallPropery()". This is sometimes confusing when not using autocompletion all the time

2. I'm still failing to get properties out of the material object. Here some code of my calculate() function, where I want to get the pressure of an inlet:
Code: Select all
COMSmartPtr<MaterialPort> aPort = (MaterialPort*)(Port*)portCollection.items[0];
Material material = aPort->GetMaterial();
CVariant value = material->GetOverallPropery(L"pressure", NULL, false);
//check count
if (value.GetCount() != 1){
SetError(L"Invalid value for pressure from material object: scalar expected", L"ICapeUnit", L"Calculate");
return ECapeUnknownHR;
}
The "default" wizard implementation is used:
Code: Select all
CVariant GetOverallPropery(BSTR name,BSTR basis,bool isSpecialProp) override {
CVariant res;
HRESULT hr=mat->GetOverallProp(name,basis,res.OutputArgument());
if (FAILED(hr)) throw COException(CO_Error(mat,hr));
return res;
}
What do I have to do here, what is wrong with my approach?