Buildings.Fluid.Utilities.BaseClasses
Package with base classes for Buildings.Fluid.Utilities
Information
This package contains base classes that are used to construct the models in Buildings.Fluid.Utilities.
Extends from Modelica.Icons.BasesPackage (Icon for packages containing base classes).
Package Content
Name | Description |
---|---|
der_extendedPolynomial | Polynomial that is linearly extended at user specified values |
Buildings.Fluid.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 functions).
Inputs
Type | Name | Default | Description |
---|---|---|---|
Real | x | x value | |
Real | c[:] | Polynomial coefficients | |
Real | xMin | Minimum x value for polynomial | |
Real | xMax | Maximum x value for polynomial | |
Real | der_x |
Outputs
Type | Name | Description |
---|---|---|
Real | der_y | Derivative dy/dx |
Modelica definition
function der_extendedPolynomial
"Polynomial that is linearly extended at user specified values"
extends Modelica.Icons.Function;
input Real x "x value";
input Real[:] c "Polynomial coefficients";
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;