I am stuck at implementing a COBIA energy port class for unit operation. For context, I am experimenting with a simple heater. the unit runs and solves correctly. However, my energy stream has no data. I would like to expose the duty from my calculations to the stream data.
Referring to CO_Unit_Operations_v6.25 document, I have doubts about the following part:
Do I understand correctly that the object to connect would be of CapeCollection<CapeParameter> class?Energy Objects that connect to Energy Ports are expected to expose an ICapeCollection of
parameters, analogous to the Information Objects connected to an Information Ports described
above. The parameter “work”, of which the value is of type Real, and the dimensionality
corresponding to Watt (i.e. [m = 2, kg = 1, S = -3, A = 0, K = 0, mole = 0, …] representing kg
m2 s-3, see “Open Interface Specification: Parameter Common Interface”) is always part of an
Energy Object. In addition to that additional parameters can be present depending on the type of
energy that is being transported, as listed in table 2-5.
Using the COBIA class wizard I created a new class and implemented the mentioned interfaces in the specification. It is inheriting the following adapters:
Code: Select all
class EnergyPort :
public CapeOpenObject<EnergyPort>,
public CAPEOPEN_1_2::CapeIdentificationAdapter<EnergyPort>,
public CAPEOPEN_1_2::CapeUnitPortAdapter<EnergyPort>,
public CAPEOPEN_1_2::CapeCollectionAdapter<CAPEOPEN_1_2::CapeRealParameter,EnergyPort>,
public CAPEOPEN_1_2::CapeParameterSpecificationAdapter<EnergyPort> {
Code: Select all
void Connect(CapeInterface objectToConnect) {
CAPEOPEN_1_2::CapeCollection<CAPEOPEN_1_2::CapeParameter> newEnergyObject = objectToConnect;
unitValidationStatus = CAPEOPEN_1_2::CAPE_NOT_VALIDATED;
connectedEnergyObject = newEnergyObject;
}