FCSys.Conditions.Examples

Examples

Information

Extends from Modelica.Icons.ExamplesPackage (Icon for packages containing runnable examples).

Package Content

NameDescription
FCSys.Conditions.Examples.BoundaryCondition BoundaryCondition Test the conditions for the boundary of a subregion
FCSys.Conditions.Examples.Router Router Test the Router model
FCSys.Conditions.Examples.AnodeAdapter AnodeAdapter Test the Anode adapter
FCSys.Conditions.Examples.Stoichiometry Stoichiometry Test the stoichiometry of a reaction

FCSys.Conditions.Examples.BoundaryCondition FCSys.Conditions.Examples.BoundaryCondition

Test the conditions for the boundary of a subregion FCSys.Conditions.Examples.BoundaryCondition

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model BoundaryCondition 
  "Test the conditions for the boundary of a subregion"
  extends Modelica.Icons.Example;

  ByConnector.BoundaryBus.Single.Sink boundary;
  Subregions.Subregion subregion(
    L={1,1,1}*U.cm,
    inclTransX=false,
    inclTransY=true,
    inclTransZ=false,
    graphite('inclC+'=true, 'C+'(epsilon=0.5)),
    gas(inclH2O=true));

  inner Conditions.Environment environment;

equation 
  connect(subregion.yPositive, boundary.boundary);

end BoundaryCondition;

FCSys.Conditions.Examples.Router FCSys.Conditions.Examples.Router

Test the Router model FCSys.Conditions.Examples.Router

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model Router 
  "Test the Router model"
  extends Modelica.Icons.Example;

  Conditions.Router router;
  ByConnector.BoundaryBus.Single.Source fastFlow(gas(inclH2=true,H2(materialSet(
            y=-U.A))));
  ByConnector.BoundaryBus.Single.Source slowFlow(gas(inclH2=true,H2(materialSet(
            y=-U.mA))));

  ByConnector.BoundaryBus.Single.Sink sink2(gas(inclH2=true));
  ByConnector.BoundaryBus.Single.Sink sink1(gas(inclH2=true));

equation 
  connect(router.positive2, sink1.boundary);
  connect(router.positive1, sink2.boundary);
  connect(fastFlow.boundary, router.negative2);
  connect(slowFlow.boundary, router.negative1);
end Router;

FCSys.Conditions.Examples.AnodeAdapter FCSys.Conditions.Examples.AnodeAdapter

Test the Anode adapter FCSys.Conditions.Examples.AnodeAdapter

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Modelica definition

model AnodeAdapter 
  "Test the Anode adapter"
  extends Modelica.Icons.Example;

  inner Modelica.Fluid.System system(T_ambient=293.15 + 5);
  inner Conditions.Environment environment(T=350*U.K);
  FCSys.Subregions.SubregionNoIonomer subregion(
    L={1,1,1}*U.cm,
    inclTransY=false,
    inclTransZ=false,
    gas(
      inclH2=true,
      inclH2O=true,
      H2O(initEnergy=Init.none)),
    graphite('inclC+'=true, 'incle-'=true),
    liquid(inclH2O=true));
  Adapters.MSL.Anode anodeAdapter(redeclare package LiquidMedium = Modelica.Media.CompressibleLiquids.LinearColdWater);
  Modelica.Electrical.Analog.Basic.Ground ground;

  Modelica.Fluid.Vessels.ClosedVolume gasVolume(
    use_portsData=false,
    nPorts=1,
    V=1e-6,
    use_HeatTransfer=true,
    redeclare Modelica.Fluid.Vessels.BaseClasses.HeatTransfer.IdealHeatTransfer
      HeatTransfer,
    redeclare package Medium = Adapters.MSL.Media.AnodeGas,
    medium(p(fixed=true),X(each fixed=true)));
  Modelica.Fluid.Vessels.ClosedVolume liquidVolume(
    nPorts=1,
    use_HeatTransfer=true,
    redeclare Modelica.Fluid.Vessels.BaseClasses.HeatTransfer.IdealHeatTransfer
      HeatTransfer,
    V=0.5e-6,
    use_portsData=false,
    redeclare package Medium = Modelica.Media.CompressibleLiquids.LinearColdWater,

    medium(p(fixed=true),T(fixed=true)));

equation 
  connect(ground.p, anodeAdapter.pin);

  connect(subregion.xPositive, anodeAdapter.boundary);

  connect(gasVolume.heatPort, anodeAdapter.heatPort);
  connect(gasVolume.ports[1], anodeAdapter.gasPort);
  connect(liquidVolume.heatPort, anodeAdapter.heatPort);
  connect(anodeAdapter.liquidPort, liquidVolume.ports[1]);
end AnodeAdapter;

FCSys.Conditions.Examples.Stoichiometry FCSys.Conditions.Examples.Stoichiometry

Test the stoichiometry of a reaction FCSys.Conditions.Examples.Stoichiometry

Information

Extends from Modelica.Icons.Example (Icon for runnable examples).

Parameters

TypeNameDefaultDescription
CurrentspeciesAredeclare ByConnector.Chemic… 
PotentialspeciesBredeclare ByConnector.Chemic… 
PotentialspeciesCredeclare ByConnector.Chemic… 

Modelica definition

model Stoichiometry "Test the stoichiometry of a reaction"

  extends Modelica.Icons.Example;
  import Modelica.Math.BooleanVectors.countTrue;

  // Assumptions
  // -----------
  // Included components of translational momentum
  constant Boolean inclTransX=true "X";
  constant Boolean inclTransY=false "Y";
  constant Boolean inclTransZ=false "Z";

  inner Conditions.Environment environment(T=360*U.K);

  replaceable ByConnector.Chemical.Current speciesA(
    final inclTransX=inclTransX,
    final inclTransY=inclTransY,
    final inclTransZ=inclTransZ,
    sT=2000*U.K,
    redeclare Modelica.Blocks.Sources.Ramp set(duration=100, height=-1*U.A));
  replaceable ByConnector.Chemical.Potential speciesB(
    final inclTransX=inclTransX,
    final inclTransY=inclTransY,
    final inclTransZ=inclTransZ,
    sT=3000*U.K);
  replaceable ByConnector.Chemical.Potential speciesC(
    final inclTransX=inclTransX,
    final inclTransY=inclTransY,
    final inclTransZ=inclTransZ,
    sT=4000*U.K);
  Conditions.Adapters.ChemicalReaction A(
    m=U.g/U.mol,
    final n_trans=n_trans,
    n=-1);

  Conditions.Adapters.ChemicalReaction B(
    m=U.g/U.mol,
    final n_trans=n_trans,
    n=2);

  Conditions.Adapters.ChemicalReaction C(
    m=U.g/U.mol,
    final n_trans=n_trans,
    n=2);

protected 
  final inner constant Boolean inclTrans[Axis]={inclTransX,inclTransY,
      inclTransZ} 
    "true, if each component of translational momentum is included";
  final inner constant Integer n_trans=countTrue(inclTrans) 
    "Number of components of translational momentum";

equation 
  connect(A.chemical, speciesA.chemical);
  connect(B.chemical, speciesB.chemical);
  connect(C.chemical, speciesC.chemical);
  connect(C.reaction, B.reaction);
  connect(B.reaction, A.reaction);
end Stoichiometry;