Buildings.Utilities.Math.Functions.Examples

Collection of models that illustrate model use and test models

Information


This package contains examples for the use of models
that can be found in 
Buildings.Utilities.Math.

Extends from Buildings.BaseClasses.BaseIconExamples (Icon for Examples packages).

Package Content

NameDescription
PolynomialDerivativeCheck  
RegNonZeroPower  
RegNonZeroPowerDerivative_2_Check  
RegNonZeroPowerDerivativeCheck  
SmoothExponentialDerivativeCheck  
SpliceFunction  
SpliceFunctionDerivativeCheck  


Buildings.Utilities.Math.Functions.Examples.PolynomialDerivativeCheck

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.



Modelica definition

model PolynomialDerivativeCheck

  Real x;
  Real y;
initial equation 
   y=x;
equation 
  x=Buildings.Utilities.Math.Functions.polynomial(
                                        x=time-2, a={2, 4, -4, 5});
  der(y)=der(x);
  assert(abs(x-y) < 1E-2, "Model has an error");
end PolynomialDerivativeCheck;

Buildings.Utilities.Math.Functions.Examples.RegNonZeroPower

Modelica definition

model RegNonZeroPower
  Real y "Function value";
equation 
  y=Buildings.Utilities.Math.Functions.regNonZeroPower(
                                             time, 0.3, 0.5);
end RegNonZeroPower;

Buildings.Utilities.Math.Functions.Examples.RegNonZeroPowerDerivative_2_Check

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.



Parameters

TypeNameDefaultDescription
Realn0.33Exponent
Realdelta0.1Abscissa value where transition occurs

Modelica definition

model RegNonZeroPowerDerivative_2_Check

 parameter Real n=0.33 "Exponent";
 parameter Real delta = 0.1 "Abscissa value where transition occurs";

  Real x;
  Real y;
initial equation 
   y=x;
equation 
  x=Buildings.Utilities.Math.Functions.BaseClasses.der_regNonZeroPower(
                                                             time,n, delta, time);
  der(y)=der(x);
  assert(abs(x-y) < 1E-2, "Model has an error");

end RegNonZeroPowerDerivative_2_Check;

Buildings.Utilities.Math.Functions.Examples.RegNonZeroPowerDerivativeCheck

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.



Parameters

TypeNameDefaultDescription
Realn0.33Exponent
Realdelta0.1Abscissa value where transition occurs

Modelica definition

model RegNonZeroPowerDerivativeCheck

 parameter Real n=0.33 "Exponent";
 parameter Real delta = 0.1 "Abscissa value where transition occurs";

  Real x;
  Real y;
initial equation 
   y=x;
equation 
  x=Buildings.Utilities.Math.Functions.regNonZeroPower(
                                             time,n, delta);
  der(y)=der(x);
  assert(abs(x-y) < 1E-2, "Model has an error");

end RegNonZeroPowerDerivativeCheck;

Buildings.Utilities.Math.Functions.Examples.SmoothExponentialDerivativeCheck

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.



Modelica definition

model SmoothExponentialDerivativeCheck


  Real x;
  Real y;
  Real ex "exact function value";
initial equation 
   y=x;
equation 
  x=Buildings.Utilities.Math.Functions.smoothExponential(
                                               x=time-2, delta=0.5);
  der(y)=der(x);
  assert(abs(x-y) < 1E-2, "Model has an error");
  ex=exp(-abs(time-2));
end SmoothExponentialDerivativeCheck;

Buildings.Utilities.Math.Functions.Examples.SpliceFunction

Modelica definition

model SpliceFunction
  Real y "Function value";
equation 
  y=Buildings.Utilities.Math.Functions.spliceFunction(
                                            10, -10, time+0.1, 0.2);
end SpliceFunction;

Buildings.Utilities.Math.Functions.Examples.SpliceFunctionDerivativeCheck

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.



Modelica definition

model SpliceFunctionDerivativeCheck

  Real x;
  Real y;
initial equation 
   y=x;
equation 
  x=Buildings.Utilities.Math.Functions.spliceFunction(
                                            10, -10, time+0.1, 0.2);
  der(y)=der(x);
  assert(abs(x-y) < 1E-2, "Model has an error");

end SpliceFunctionDerivativeCheck;

HTML-documentation generated by Dymola Tue Sep 29 08:10:29 2009.