MixerExample110 Constructor

Creates an instance of the CMixerExample110 unit operation.

Definition

Namespace: CapeOpen
Assembly: CapeOpen (in CapeOpen.dll) Version: 1.0.0.0 (1.0.0.0)
public MixerExample110()

Remarks

This constructor demonstates the addition of a BooleanParameter, IntegerParameter, OptionParameter, and a RealParameter parameter to the parameter collection. In addition, the mixer unit has three UnitPort ports added to the port collection. See the documentation for the OnCalculate method for details on its implementation.

Example

An example of how to create a unit operation. Parameter and port objects are created and added the their respective collections. Ports are implemented by the UnitPort class and are placed in the Port Collection. Parameters are added to the Parameter Collection class. The available parameter classes are RealParameter, IntegerParameter, BooleanParameter, and OptionParameter.
C#
public MixerExample110()
{
    // Add Ports using the CUnitPort constructor.
    this.Ports.Add(new UnitPort("Inlet Port1", "Test Inlet Port1", CapePortDirection.CAPE_INLET, CapePortType.CAPE_MATERIAL));
    this.Ports.Add(new UnitPort("Inlet Port2", "Test Inlet Port2", CapePortDirection.CAPE_INLET, CapePortType.CAPE_MATERIAL));
    this.Ports.Add(new UnitPort("Outlet Port", "Test Outlet Port", CapePortDirection.CAPE_OUTLET, CapePortType.CAPE_MATERIAL));

    // Add a real valued parameter using the CRealParameter  constructor.
    this.Parameters.Add(new RealParameter("PressureDrop", "Drop in pressure between the outlet from the mixer and the pressure of the lower pressure inlet.", 0.0, 0.0, 0.0, 100000000.0, CapeParamMode.CAPE_INPUT, "Pa"));

    // Add a real valued parameter using the CIntParameter  constructor.
    this.Parameters.Add(new IntegerParameter("Integer Parameter", 12, CapeParamMode.CAPE_INPUT_OUTPUT));

    // Add a real valued parameter using the CBoolParameter  constructor.
    this.Parameters.Add(new BooleanParameter("Boolean Parameter", false, CapeOpen.CapeParamMode.CAPE_INPUT_OUTPUT));

    // Create an array of strings for the option parameter restricted value list.
    String[] options = { "Test Value", "Another Value" };

    // Add a string valued parameter using the COptionParameter constructor.
    this.Parameters.Add(new OptionParameter("Option Paramter", "Example Option Parameter", "Test Value", "Test Value", options, true, CapeParamMode.CAPE_INPUT_OUTPUT));

    // Add an available report.
    this.Reports.Add("Calculation Report");
    this.calcReport = "The unit has not been calcauted.";
}

See Also