COBIA EnergyPort Class
Posted: 06 August 2021, 09:13
Greetings,
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:
Using the COBIA class wizard I created a new class and implemented the mentioned interfaces in the specification. It is inheriting the following adapters:
Perhaps the last two are redundant since I already have a ParameterCollection and RealParameter classes. Anyhow, I am not sure how to implement the Connect method. If I try something like:
I get an error that no suitable user-defined conversion from CapeInterface to CapeCollection exists. I had no problem assigning CapeInterface to CapeThermoMaterial before in the MaterialPort Class. So I thought I could implement it analogously, but I seem to be mistaken. Any advice?
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;
}