Extends from Buildings.BaseClasses.BaseIconExamples (Icon for Examples packages).
| Name | Description |
|---|---|
| EqualPercentageDerivativeCheck | |
| ExponentialDerivativeCheck |
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.
| Type | Name | Default | Description |
|---|---|---|---|
| Real | R | 50 | Rangeability |
| Real | delta | 0.01 | Value where transition occurs |
| Real | l | 0.001 | Leakage |
model EqualPercentageDerivativeCheck parameter Real R = 50 "Rangeability"; parameter Real delta = 0.01 "Value where transition occurs"; parameter Real l = 0.001 "Leakage"; Real x; Real y; initial equation y=x; equation x=Buildings.Fluid.Actuators.BaseClasses.equalPercentage(time, R, l, delta); der(y)=der(x); assert(abs(x-y) < 1E-2, "Model has an error"); end EqualPercentageDerivativeCheck;
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.
| Type | Name | Default | Description |
|---|---|---|---|
| Real | a | -1.51 | Coefficient a for damper characteristics |
| Real | b | 0.105*90 | Coefficient b for damper characteristics |
| Real | yL | 15/90 | Lower value for damper curve |
| Real | yU | 55/90 | Upper value for damper curve |
| Real | k0 | 1E6 | Flow coefficient for y=0, k0 = pressure drop divided by dynamic pressure |
| Real | k1 | 0.45 | Flow coefficient for y=1, k1 = pressure drop divided by dynamic pressure |
| Real | cL[3] | Polynomial coefficients for curve fit for y < yL | |
| Real | cU[3] | Polynomial coefficients for curve fit for y > yU |
model ExponentialDerivativeCheck
parameter Real a(unit="")=-1.51 "Coefficient a for damper characteristics";
parameter Real b(unit="")=0.105*90 "Coefficient b for damper characteristics";
parameter Real yL = 15/90 "Lower value for damper curve";
parameter Real yU = 55/90 "Upper value for damper curve";
parameter Real k0(min=0) = 1E6
"Flow coefficient for y=0, k0 = pressure drop divided by dynamic pressure";
parameter Real k1(min=0) = 0.45
"Flow coefficient for y=1, k1 = pressure drop divided by dynamic pressure";
parameter Real[3] cL(fixed=false)
"Polynomial coefficients for curve fit for y < yL";
parameter Real[3] cU(fixed=false)
"Polynomial coefficients for curve fit for y > yU";
Real x;
Real y;
initial equation
cL[1] = (ln(k0) - b - a)/yL^2;
cL[2] = (-b*yL - 2*ln(k0) + 2*b + 2*a)/yL;
cL[3] = ln(k0);
cU[1] = (ln(k1) - a)/(yU^2 - 2*yU + 1);
cU[2] = (-b*yU^2 - 2*ln(k1)*yU - (-2*b - 2*a)*yU - b)/(yU^2 - 2*yU + 1);
cU[3] = (ln(k1)*yU^2 + b*yU^2 + (-2*b - 2*a)*yU + b + a)/(yU^2 - 2*yU + 1);
y=x;
equation
x=Buildings.Fluid.Actuators.BaseClasses.exponentialDamper(y=time,a=a,b=b,cL=cL,cU=cU,yL=yL,yU=yU);
der(y)=der(x);
assert(abs(x-y) < 1E-2, "Model has an error");
end ExponentialDerivativeCheck;