Buildings.Fluids.Utilities.BaseClasses

Library with base classes for utility functions

Package Content

NameDescription
Buildings.Fluids.Utilities.BaseClasses.der_extendedPolynomial der_extendedPolynomial Polynomial that is linearly extended at user specified values


Buildings.Fluids.Utilities.BaseClasses.der_extendedPolynomial Buildings.Fluids.Utilities.BaseClasses.der_extendedPolynomial

Polynomial that is linearly extended at user specified values

Information


This function is the derivative of extendedPolynomial with respect to x.


Extends from Modelica.Icons.Function (Icon for a function).

Inputs

TypeNameDefaultDescription
Realc[:] Polynomial coefficients
Realx x value
RealxMin Minimum x value for polynomial
RealxMax Maximum x value for polynomial
Realder_x  

Outputs

TypeNameDescription
Realder_yDerivative dy/dx

Modelica definition

function der_extendedPolynomial 
  "Polynomial that is linearly extended at user specified values"
  extends Modelica.Icons.Function;
  input Real[:] c "Polynomial coefficients";
  input Real x "x value";
  input Real xMin "Minimum x value for polynomial";
  input Real xMax "Maximum x value for polynomial";
  input Real der_x;
  output Real der_y "Derivative dy/dx";
protected 
 Integer N = size(c,1) "Number of coefficients";
algorithm 
if x < xMin then
   der_y := 0;
   for i in 2:N loop
     der_y := der_y + (i - 1)*xMin^(i - 2)*c[i];
   end for;
  elseif x < xMax then
   der_y := 0;
   for i in 2:N loop
     der_y := der_y + (i - 1)*x^(i - 2)*c[i];
  end for;
  else
     der_y := 0;
     for i in 2:N loop
       der_y := der_y + (i - 1)*xMax^(i - 2)*c[i];
    end for;
  end if;
end der_extendedPolynomial;

HTML-documentation generated by Dymola Thu Feb 19 16:53:00 2009.