## FCSys.Conditions.ByConnector.Reaction

Conditions for a Reaction connector

### Information

Extends from Modelica.Icons.Package (Icon for standard packages).

### Package Content

Name | Description
--- | ---
Rate | Impose a reaction rate via a Reaction connector
Offset | Add a potential to a Reaction connector
Material | Material conditions
Translational | Translational conditions
ThermalAdvective | Conditions for thermal advection

## FCSys.Conditions.ByConnector.Reaction.Rate

Impose a reaction rate via a Reaction connector

### Information

Extends from FCSys.Icons.Conditions.Single (Icon for a single-connector boundary condition).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
Specification
Material
replaceable function materialSpec | Material.reactionRate | Quantity
Boolean | internalMaterial | true | Use internal specification
RealExpression | materialSet | redeclare Sources.RealExpres… | Source of internal specification
X-axis translational
replaceable function transXSpec | Translational.velocity | Quantity
Boolean | internalTransX | true | Use internal specification
RealExpression | transXSet | redeclare Sources.RealExpres… | Source of internal specification
Y-axis translational
replaceable function transYSpec | Translational.velocity | Quantity
Boolean | internalTransY | true | Use internal specification
RealExpression | transYSet | redeclare Sources.RealExpres… | Source of internal specification
Z-axis translational
replaceable function transZSpec | Translational.velocity | Quantity
Boolean | internalTransZ | true | Use internal specification
RealExpression | transZSet | redeclare Sources.RealExpres… | Source of internal specification
Thermal
replaceable function thermalSpec | ThermalAdvective.specificEnt… | Quantity
Boolean | internalThermal | true | Use internal specification
RealExpression | thermalSet | redeclare Sources.RealExpres… | Source of internal specification
Measurement
replaceable function materialMeas | Material.potential | Material quantity
replaceable function transXMeas | Translational.force | X-axis translational quantity
replaceable function transYMeas | Translational.force | Y-axis translational quantity
replaceable function transZMeas | Translational.force | Z-axis translational quantity
replaceable function thermalMeas | ThermalAdvective.heatRate | Thermal quantity
Assumptions
Included transport axes
Boolean | inclTransX | true | X
Boolean | inclTransY | true | Y
Boolean | inclTransZ | true | Z

### Connectors

Type | Name | Description
--- | --- | ---
input RealInput | u_material | Material specification
input RealInput | u_transX | X-axis translational specification
input RealInput | u_transY | Y-axis translational specification
input RealInput | u_transZ | Z-axis translational specification
input RealInput | u_thermal | Thermal specification
output RealOutput | y_transX | X-axis translational measurement
output RealOutput | y_transY | Y-axis translational measurement
output RealOutput | y_transZ | Z-axis translational measurement
output RealOutput | y_thermal | Thermal measurement
Reaction | reaction | Stoichiometric connector for the chemical reaction
Specification
Material
replaceable function materialSpec | Quantity
X-axis translational
replaceable function transXSpec | Quantity
Y-axis translational
replaceable function transYSpec | Quantity
Z-axis translational
replaceable function transZSpec | Quantity
Thermal
replaceable function thermalSpec | Quantity
Measurement
replaceable function materialMeas | Material quantity
replaceable function transXMeas | X-axis translational quantity
replaceable function transYMeas | Y-axis translational quantity
replaceable function transZMeas | Z-axis translational quantity
replaceable function thermalMeas | Thermal quantity
output RealOutput | y_material | Material measurement

### Modelica definition

    model Rate
      "Impose a reaction rate via a Reaction connector"
      import Modelica.Math.BooleanVectors.countTrue;
      import Modelica.Math.BooleanVectors.enumerate;
      import Modelica.Blocks.Sources;
      extends FCSys.Icons.Conditions.Single;

      // Specification
      // -------------
      // Material
      replaceable function materialSpec = Material.reactionRate constrainedby
        Material.Partial "Quantity";
      parameter Boolean internalMaterial=true "Use internal specification";
      replaceable Sources.RealExpression materialSet if internalMaterial
        constrainedby Modelica.Blocks.Interfaces.SO
        "Source of internal specification";

      //
      // X-axis translational
      replaceable function transXSpec = Translational.velocity constrainedby
        Translational.Partial "Quantity";

      parameter Boolean internalTransX=true if inclTransX
        "Use internal specification";
      replaceable Sources.RealExpression transXSet if inclTransX and internalTransX
        constrainedby Modelica.Blocks.Interfaces.SO
        "Source of internal specification";

      //
      // Y-axis translational
      replaceable function transYSpec = Translational.velocity constrainedby
        Translational.Partial "Quantity";

      parameter Boolean internalTransY=true if inclTransY
        "Use internal specification";
      replaceable Sources.RealExpression transYSet if inclTransY and internalTransY
        constrainedby Modelica.Blocks.Interfaces.SO
        "Source of internal specification";

      //
      // Z-axis translational
      replaceable function transZSpec = Translational.velocity constrainedby
        Translational.Partial "Quantity";

      parameter Boolean internalTransZ=true if inclTransZ
        "Use internal specification";
      replaceable Sources.RealExpression transZSet if inclTransZ and internalTransZ
        constrainedby Modelica.Blocks.Interfaces.SO
        "Source of internal specification";

      //
      // Thermal
      replaceable function thermalSpec = ThermalAdvective.specificEntropyTemperature
        constrainedby ThermalAdvective.Partial "Quantity";

      parameter Boolean internalThermal=true "Use internal specification";
      replaceable Sources.RealExpression thermalSet if internalThermal
        constrainedby Modelica.Blocks.Interfaces.SO
        "Source of internal specification";

      // Measurement
      // -----------
      // Material
      replaceable function materialMeas = Material.potential constrainedby
        Material.Partial "Material quantity";

      // X-axis translational
      replaceable function transXMeas = Translational.force constrainedby
        Translational.Partial "X-axis translational quantity";

      // Y-axis translational
      replaceable function transYMeas = Translational.force constrainedby
        Translational.Partial "Y-axis translational quantity";

      // Z-axis translational
      replaceable function transZMeas = Translational.force constrainedby
        Translational.Partial "Z-axis translational quantity";

      // Thermal
      replaceable function thermalMeas = ThermalAdvective.heatRate constrainedby
        ThermalAdvective.Partial "Thermal quantity";

      // Included components of translational momentum
      parameter Boolean inclTransX=true "X";
      parameter Boolean inclTransY=true "Y";
      parameter Boolean inclTransZ=true "Z";

      // Inputs
      Connectors.RealInput u_material if not internalMaterial
        "Material specification";
      Connectors.RealInput u_transX if inclTransX and not internalTransX
        "X-axis translational specification";
      Connectors.RealInput u_transY if inclTransY and not internalTransY
        "Y-axis translational specification";
      Connectors.RealInput u_transZ if inclTransZ and not internalTransZ
        "Z-axis translational specification";
      Connectors.RealInput u_thermal if not internalThermal "Thermal specification";

      // Outputs
      final Connectors.RealOutput y_material=materialMeas(
          reaction.Ndot,
          reaction.g,
          reaction.phi,
          reaction.mPhidot,
          reaction.sT,
          reaction.Qdot) "Material measurement";
      final Connectors.RealOutput y_transX=transXMeas(
          reaction.Ndot,
          reaction.g,
          reaction.phi,
          reaction.mPhidot,
          reaction.sT,
          reaction.Qdot,
          i=transCart[Axis.x]) if inclTransX "X-axis translational measurement";
      final Connectors.RealOutput y_transY=transYMeas(
          reaction.Ndot,
          reaction.g,
          reaction.phi,
          reaction.mPhidot,
          reaction.sT,
          reaction.Qdot,
          i=transCart[Axis.y]) if inclTransY "Y-axis translational measurement";
      final Connectors.RealOutput y_transZ=transZMeas(
          reaction.Ndot,
          reaction.g,
          reaction.phi,
          reaction.mPhidot,
          reaction.sT,
          reaction.Qdot,
          i=transCart[Axis.z]) if inclTransZ "Z-axis translational measurement";
      final Connectors.RealOutput y_thermal=thermalMeas(
          reaction.Ndot,
          reaction.g,
          reaction.phi,
          reaction.mPhidot,
          reaction.sT,
          reaction.Qdot) "Thermal measurement";

      Connectors.Reaction reaction(final n_trans=n_trans)
        "Stoichiometric connector for the chemical reaction";

    protected
      final inner parameter Integer n_trans=countTrue({inclTransX,inclTransY,
          inclTransZ}) "Number of components of translational momentum";
      final inner parameter Integer transCart[Axis]=enumerate({inclTransX,
          inclTransY,inclTransZ})
        "Translational-momentum-component indices of the Cartesian axes";

      Connectors.RealOutputInternal _u_material=materialSpec(
          reaction.Ndot,
          reaction.g,
          reaction.phi,
          reaction.mPhidot,
          reaction.sT,
          reaction.Qdot) "Internal, working value of material specification";
      Connectors.RealOutputInternal _u_transX=transXSpec(
          reaction.Ndot,
          reaction.g,
          reaction.phi,
          reaction.mPhidot,
          reaction.sT,
          reaction.Qdot,
          i=transCart[Axis.x]) if inclTransX
        "Internal, working value of X-axis translational specification";
      Connectors.RealOutputInternal _u_transY=transYSpec(
          reaction.Ndot,
          reaction.g,
          reaction.phi,
          reaction.mPhidot,
          reaction.sT,
          reaction.Qdot,
          i=transCart[Axis.y]) if inclTransY
        "Internal, working value of Y-axis translational specification";
      Connectors.RealOutputInternal _u_transZ=transZSpec(
          reaction.Ndot,
          reaction.g,
          reaction.phi,
          reaction.mPhidot,
          reaction.sT,
          reaction.Qdot,
          i=transCart[Axis.z]) if inclTransZ
        "Internal, working value of Z-axis translational specification";
      Connectors.RealOutputInternal _u_thermal=thermalSpec(
          reaction.Ndot,
          reaction.g,
          reaction.phi,
          reaction.mPhidot,
          reaction.sT,
          reaction.Qdot) "Internal, working value of thermal specification";

    equation
      // Material
      connect(u_material, _u_material);

      connect(materialSet.y, _u_material);

      // X-axis translational
      connect(u_transX, _u_transX);

      connect(transXSet.y, _u_transX);

      // Y-axis translational
      connect(u_transY, _u_transY);

      connect(transYSet.y, _u_transY);

      // Z-axis translational
      connect(u_transZ, _u_transZ);

      connect(transZSet.y, _u_transZ);

      // Thermal
      connect(u_thermal, _u_thermal);

      connect(thermalSet.y, _u_thermal);
    end Rate;

## FCSys.Conditions.ByConnector.Reaction.Offset

Add a potential to a Reaction connector

### Information

Extends from FCSys.Conditions.ByConnector.Reaction.Rate (Impose a reaction rate via a Reaction connector).

### Parameters

Type | Name | Default | Description
--- | --- | --- | ---
Specification
Material
replaceable function materialSpec | Material.potential | Quantity
Boolean | internalMaterial | true | Use internal specification
RealExpression | materialSet | redeclare Sources.RealExpres… | Source of internal specification
X-axis translational
replaceable function transXSpec | Conditions.ByConnector.React… | Quantity
Boolean | internalTransX | true | Use internal specification
RealExpression | transXSet | redeclare Sources.RealExpres… | Source of internal specification
Y-axis translational
replaceable function transYSpec | Conditions.ByConnector.React… | Quantity
Boolean | internalTransY | true | Use internal specification
RealExpression | transYSet | redeclare Sources.RealExpres… | Source of internal specification
Z-axis translational
replaceable function transZSpec | Conditions.ByConnector.React… | Quantity
Boolean | internalTransZ | true | Use internal specification
RealExpression | transZSet | redeclare Sources.RealExpres… | Source of internal specification
Thermal
replaceable function thermalSpec | Conditions.ByConnector.React… | Quantity
Boolean | internalThermal | true | Use internal specification
RealExpression | thermalSet | redeclare Sources.RealExpres… | Source of internal specification
Measurement
replaceable function materialMeas | Conditions.ByConnector.React… | Material quantity
replaceable function transXMeas | Conditions.ByConnector.React… | X-axis translational quantity
replaceable function transYMeas | Conditions.ByConnector.React… | Y-axis translational quantity
replaceable function transZMeas | Conditions.ByConnector.React… | Z-axis translational quantity
replaceable function thermalMeas | Conditions.ByConnector.React… | Thermal quantity
Assumptions
Included transport axes
Boolean | inclTransX | true | X
Boolean | inclTransY | true | Y
Boolean | inclTransZ | true | Z

### Connectors

Type | Name | Description
--- | --- | ---
input RealInput | u_material | Material specification
input RealInput | u_transX | X-axis translational specification
input RealInput | u_transY | Y-axis translational specification
input RealInput | u_transZ | Z-axis translational specification
input RealInput | u_thermal | Thermal specification
output RealOutput | y_transX | X-axis translational measurement
output RealOutput | y_transY | Y-axis translational measurement
output RealOutput | y_transZ | Z-axis translational measurement
output RealOutput | y_thermal | Thermal measurement
Reaction | reaction | Stoichiometric connector for the chemical reaction
Specification
Material
replaceable function materialSpec | Quantity
X-axis translational
replaceable function transXSpec | Quantity
Y-axis translational
replaceable function transYSpec | Quantity
Z-axis translational
replaceable function transZSpec | Quantity
Thermal
replaceable function thermalSpec | Quantity
Measurement
replaceable function materialMeas | Material quantity
replaceable function transXMeas | X-axis translational quantity
replaceable function transYMeas | Y-axis translational quantity
replaceable function transZMeas | Z-axis translational quantity
replaceable function thermalMeas | Thermal quantity
output RealOutput | y_material | Material measurement

### Modelica definition

    model Offset
      "Add a potential to a Reaction connector"

      extends FCSys.Conditions.ByConnector.Reaction.Rate(
        redeclare replaceable function materialSpec = Material.potential,
        redeclare replaceable function transXSpec = Conditions.ByConnector.Reaction.Translational.velocity,

        redeclare replaceable function transYSpec = Conditions.ByConnector.Reaction.Translational.velocity,

        redeclare replaceable function transZSpec = Conditions.ByConnector.Reaction.Translational.velocity,

        redeclare replaceable function thermalSpec = Conditions.ByConnector.Reaction.ThermalAdvective.specificEntropyTemperature,

        redeclare replaceable function materialMeas = Conditions.ByConnector.Reaction.Material.reactionRate,

        redeclare replaceable function transXMeas = Conditions.ByConnector.Reaction.Translational.force,

        redeclare replaceable function transYMeas = Conditions.ByConnector.Reaction.Translational.force,

        redeclare replaceable function transZMeas = Conditions.ByConnector.Reaction.Translational.force,

        redeclare replaceable function thermalMeas = Conditions.ByConnector.Reaction.ThermalAdvective.heatRate);

      // Note:  In Dymola 2014, the paths must be explicitly given to prevent
      // the error "Cannot show the parameter dialog for redeclared class […]".

    end Offset;