MixerExample Constructor

Creates an instance of the CMixerExample unit operation.

Definition

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

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 MixerExample()
{
    // Add Ports using the UnitPort 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 RealParameter  constructor.
    RealParameter real = 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");
    this.Parameters.Add(real);

    // Add a real valued parameter using the IntegerParameter  constructor.
    this.Parameters.Add(new IntegerParameter("Integer Parameter", "This is an example of an integer parameter.", 12, 12, 0, 100, CapeParamMode.CAPE_INPUT_OUTPUT));

    // Add a real valued parameter using the BooleanParameter  constructor.
    this.Parameters.Add(new BooleanParameter("Boolean Parameter", "This is an example of a boolean parameter.", false, 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 OptionParameter constructor.
    this.Parameters.Add(new OptionParameter("OptionParameter", "This is an example of an option parameter.", "Test Value", "Test Value", options, true, CapeParamMode.CAPE_INPUT_OUTPUT));

    // Add an available report.
    this.Reports.Add("Report 2");
}

See Also