Buildings.Fluid.Movers.BaseClasses.Characteristics.Examples

Examples to test implementation of derivative function

Information

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

Package Content

NameDescription
Buildings.Fluid.Movers.BaseClasses.Characteristics.Examples.LinearFlowDerivativeCheck LinearFlowDerivativeCheck Model to check implementation of derivative function
Buildings.Fluid.Movers.BaseClasses.Characteristics.Examples.QuadraticFlowDerivativeCheck QuadraticFlowDerivativeCheck Model to check implementation of derivative function


Buildings.Fluid.Movers.BaseClasses.Characteristics.Examples.LinearFlowDerivativeCheck Buildings.Fluid.Movers.BaseClasses.Characteristics.Examples.LinearFlowDerivativeCheck

Model to check implementation of derivative function

Information


This example checks whether the function derivative is implemented correctly. If the derivative implementation is not correct, the model will stop with an assert statement.

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

Modelica definition

model LinearFlowDerivativeCheck 
  "Model to check implementation of derivative function"
  extends Modelica.Icons.Example;
  Real x;
  Real y;
  constant Real timeToFlow(unit="m3/s2")=1 
    "Conversion factor to satisfy unit check";
initial equation 
   y=x;
equation 
  x=Buildings.Fluid.Movers.BaseClasses.Characteristics.linearFlow(
     V_flow=time*timeToFlow-2,
     V_flow_nominal={1, 0},
     dp_nominal=  {0, 3000},
     r_N=  0.5);
  der(y)=der(x);
  assert(abs(x-y) < 1E-2, "Model has an error");
end LinearFlowDerivativeCheck;

Buildings.Fluid.Movers.BaseClasses.Characteristics.Examples.QuadraticFlowDerivativeCheck Buildings.Fluid.Movers.BaseClasses.Characteristics.Examples.QuadraticFlowDerivativeCheck

Model to check implementation of derivative function

Information


This example checks whether the function derivative is implemented correctly. If the derivative implementation is not correct, the model will stop with an assert statement.

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

Modelica definition

model QuadraticFlowDerivativeCheck 
  "Model to check implementation of derivative function"
  extends Modelica.Icons.Example;
  Real x;
  Real y;
  constant Real timeToFlow(unit="m3/s2")=1 
    "Conversion factor to satisfy unit check";
initial equation 
   y=x;
equation 
  x=Buildings.Fluid.Movers.BaseClasses.Characteristics.quadraticFlow(
     V_flow=time*timeToFlow,
     V_flow_nominal={0, 1.8, 3},
     dp_nominal=  {1000, 600, 0},
     r_N=  0.5);
  der(y)=der(x);
  assert(abs(x-y) < 1E-2, "Model has an error");
end QuadraticFlowDerivativeCheck;

Automatically generated Fri May 06 14:12:42 2011.