Buildings.Obsolete.Controls.OBC.CDL.Continuous

Package with obsolete models of the Control Description Language

Information

Package that contains obsolete components that were part of the OpenBuildingControl (OBC) package Buildings.Controls.OBC.CDL.Continuous.

Extends from Modelica.Icons.Package (Icon for standard packages).

Package Content

Name Description
Buildings.Obsolete.Controls.OBC.CDL.Continuous.Add Add Output the sum of the two inputs
Buildings.Obsolete.Controls.OBC.CDL.Continuous.AddParameter AddParameter Output the sum of an input plus a parameter
Buildings.Obsolete.Controls.OBC.CDL.Continuous.ChangeSign ChangeSign Change sign of the input
Buildings.Obsolete.Controls.OBC.CDL.Continuous.Derivative Derivative Block that approximates the derivative of the input
Buildings.Obsolete.Controls.OBC.CDL.Continuous.Feedback Feedback Output difference between commanded and feedback input
Buildings.Obsolete.Controls.OBC.CDL.Continuous.GreaterEqual GreaterEqual Output y is true, if input u1 is greater or equal than input u2
Buildings.Obsolete.Controls.OBC.CDL.Continuous.GreaterEqualThreshold GreaterEqualThreshold Output y is true, if input u is greater or equal than threshold
Buildings.Obsolete.Controls.OBC.CDL.Continuous.HysteresisWithHold HysteresisWithHold Hysteresis block that optionally allows to specify a hold time
Buildings.Obsolete.Controls.OBC.CDL.Continuous.LessEqual LessEqual Output y is true, if input u1 is less or equal than input u2
Buildings.Obsolete.Controls.OBC.CDL.Continuous.LessEqualThreshold LessEqualThreshold Output y is true, if input u is less or equal than threshold
Buildings.Obsolete.Controls.OBC.CDL.Continuous.LimPID LimPID P, PI, PD, and PID controller with limited output, anti-windup compensation and setpoint weighting
Buildings.Obsolete.Controls.OBC.CDL.Continuous.NumberOfRequests NumberOfRequests Outputs the number of signals that are above/below a certain threshold
Buildings.Obsolete.Controls.OBC.CDL.Continuous.Validation Validation Collection of validation models

Buildings.Obsolete.Controls.OBC.CDL.Continuous.Add Buildings.Obsolete.Controls.OBC.CDL.Continuous.Add

Output the sum of the two inputs

Buildings.Obsolete.Controls.OBC.CDL.Continuous.Add

Information

Block that outputs y as the weighted sum of the two input signals u1 and u2,

    y = k1*u1 + k2*u2;

where k1 and k2 are parameters.

Extends from Modelica.Icons.ObsoleteModel (Icon for classes that are obsolete and will be removed in later versions).

Parameters

TypeNameDefaultDescription
Realk1+1Gain for input u1
Realk2+1Gain for input u2

Connectors

TypeNameDescription
input RealInputu1Connector of Real input signal 1
input RealInputu2Connector of Real input signal 2
output RealOutputyConnector of Real output signal

Modelica definition

block Add "Output the sum of the two inputs" extends Modelica.Icons.ObsoleteModel; parameter Real k1=+1 "Gain for input u1"; parameter Real k2=+1 "Gain for input u2"; Buildings.Controls.OBC.CDL.Interfaces.RealInput u1 "Connector of Real input signal 1"; Buildings.Controls.OBC.CDL.Interfaces.RealInput u2 "Connector of Real input signal 2"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput y "Connector of Real output signal"; equation y=k1*u1+k2*u2; end Add;

Buildings.Obsolete.Controls.OBC.CDL.Continuous.AddParameter Buildings.Obsolete.Controls.OBC.CDL.Continuous.AddParameter

Output the sum of an input plus a parameter

Buildings.Obsolete.Controls.OBC.CDL.Continuous.AddParameter

Information

Block that outputs y = k u + p, where k and p are parameters and u is an input.

Extends from Modelica.Icons.ObsoleteModel (Icon for classes that are obsolete and will be removed in later versions).

Parameters

TypeNameDefaultDescription
Realp Value to be added
Realk Gain of input

Connectors

TypeNameDescription
input RealInputuConnector of Real input signal
output RealOutputyConnector of Real output signal

Modelica definition

block AddParameter "Output the sum of an input plus a parameter" extends Modelica.Icons.ObsoleteModel; parameter Real p "Value to be added"; parameter Real k "Gain of input"; Buildings.Controls.OBC.CDL.Interfaces.RealInput u "Connector of Real input signal"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput y "Connector of Real output signal"; equation y=k*u+p; end AddParameter;

Buildings.Obsolete.Controls.OBC.CDL.Continuous.ChangeSign Buildings.Obsolete.Controls.OBC.CDL.Continuous.ChangeSign

Change sign of the input

Buildings.Obsolete.Controls.OBC.CDL.Continuous.ChangeSign

Information

Block that outputs y = -u, where u is an input.

Extends from Modelica.Icons.ObsoleteModel (Icon for classes that are obsolete and will be removed in later versions).

Connectors

TypeNameDescription
input RealInputuConnector of Real input signal
output RealOutputyConnector of Real output signal

Modelica definition

block ChangeSign "Change sign of the input" extends Modelica.Icons.ObsoleteModel; Buildings.Controls.OBC.CDL.Interfaces.RealInput u "Connector of Real input signal"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput y "Connector of Real output signal"; equation y = -u; end ChangeSign;

Buildings.Obsolete.Controls.OBC.CDL.Continuous.Derivative Buildings.Obsolete.Controls.OBC.CDL.Continuous.Derivative

Block that approximates the derivative of the input

Buildings.Obsolete.Controls.OBC.CDL.Continuous.Derivative

Information

This blocks defines the transfer function between the input u and the output y as approximated derivative:

             k * s
     y = ------------ * u
            T * s + 1

If k=0, the block reduces to y=0.

Extends from Modelica.Icons.ObsoleteModel (Icon for classes that are obsolete and will be removed in later versions).

Parameters

TypeNameDefaultDescription
Realk1Gains [1]
TimeT0.01Time constant (T>0 required) [s]
Initialization
Realx_start0Initial or guess value of state
Realy_start0Initial value of output (= state)

Connectors

TypeNameDescription
input RealInputuConnector of Real input signal
output RealOutputyConnector of Real output signal

Modelica definition

block Derivative "Block that approximates the derivative of the input" extends Modelica.Icons.ObsoleteModel; parameter Real k(unit="1") = 1 "Gains"; parameter Modelica.Units.SI.Time T(min=1E-60) = 0.01 "Time constant (T>0 required)"; parameter Real x_start=0 "Initial or guess value of state"; parameter Real y_start=0 "Initial value of output (= state)"; Buildings.Controls.OBC.CDL.Interfaces.RealInput u "Connector of Real input signal"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput y "Connector of Real output signal"; output Real x "State of block"; protected parameter Boolean zeroGain = abs(k) < 1E-17 "= true, if gain equals to zero"; initial equation if zeroGain then x = u; else x = u - T*y_start/k; end if; equation der(x) = if zeroGain then 0 else (u - x)/T; y = if zeroGain then 0 else (k/T)*(u - x); end Derivative;

Buildings.Obsolete.Controls.OBC.CDL.Continuous.Feedback Buildings.Obsolete.Controls.OBC.CDL.Continuous.Feedback

Output difference between commanded and feedback input

Buildings.Obsolete.Controls.OBC.CDL.Continuous.Feedback

Information

Block that outputs y = u1 - u2, where u1 and u2 are inputs.

Extends from Modelica.Icons.ObsoleteModel (Icon for classes that are obsolete and will be removed in later versions).

Connectors

TypeNameDescription
input RealInputu1Connector of Real input signal 1
input RealInputu2Connector of Real input signal 2
output RealOutputyConnector of Real output signal

Modelica definition

block Feedback "Output difference between commanded and feedback input" extends Modelica.Icons.ObsoleteModel; Buildings.Controls.OBC.CDL.Interfaces.RealInput u1 "Connector of Real input signal 1"; Buildings.Controls.OBC.CDL.Interfaces.RealInput u2 "Connector of Real input signal 2"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput y "Connector of Real output signal"; equation y=u1-u2; end Feedback;

Buildings.Obsolete.Controls.OBC.CDL.Continuous.GreaterEqual Buildings.Obsolete.Controls.OBC.CDL.Continuous.GreaterEqual

Output y is true, if input u1 is greater or equal than input u2

Buildings.Obsolete.Controls.OBC.CDL.Continuous.GreaterEqual

Information

Block that outputs true if Real the input u1 is greater than or equal to the Real input u2. Otherwise the output is false.

Extends from Modelica.Icons.ObsoleteModel (Icon for classes that are obsolete and will be removed in later versions).

Connectors

TypeNameDescription
input RealInputu1Connector of first Real input signal
input RealInputu2Connector of second Real input signal
output BooleanOutputyConnector of Boolean output signal

Modelica definition

block GreaterEqual "Output y is true, if input u1 is greater or equal than input u2" extends Modelica.Icons.ObsoleteModel; Buildings.Controls.OBC.CDL.Interfaces.RealInput u1 "Connector of first Real input signal"; Buildings.Controls.OBC.CDL.Interfaces.RealInput u2 "Connector of second Real input signal"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y "Connector of Boolean output signal"; equation y = u1 >= u2; end GreaterEqual;

Buildings.Obsolete.Controls.OBC.CDL.Continuous.GreaterEqualThreshold Buildings.Obsolete.Controls.OBC.CDL.Continuous.GreaterEqualThreshold

Output y is true, if input u is greater or equal than threshold

Buildings.Obsolete.Controls.OBC.CDL.Continuous.GreaterEqualThreshold

Information

Block that outputs true if the Real input is greater than or equal to the parameter threshold. Otherwise the output is false.

Extends from Modelica.Icons.ObsoleteModel (Icon for classes that are obsolete and will be removed in later versions).

Parameters

TypeNameDefaultDescription
Realthreshold0Threshold for comparison

Connectors

TypeNameDescription
input RealInputuConnector of Real input signal
output BooleanOutputyConnector of Boolean output signal

Modelica definition

block GreaterEqualThreshold "Output y is true, if input u is greater or equal than threshold" extends Modelica.Icons.ObsoleteModel; parameter Real threshold=0 "Threshold for comparison"; Buildings.Controls.OBC.CDL.Interfaces.RealInput u "Connector of Real input signal"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y "Connector of Boolean output signal"; equation y = u >= threshold; end GreaterEqualThreshold;

Buildings.Obsolete.Controls.OBC.CDL.Continuous.HysteresisWithHold Buildings.Obsolete.Controls.OBC.CDL.Continuous.HysteresisWithHold

Hysteresis block that optionally allows to specify a hold time

Buildings.Obsolete.Controls.OBC.CDL.Continuous.HysteresisWithHold

Information

Model for a hysteresis block that optionally allows to specify a hold time. During the hold time, the output is not allowed to switch.

When the input u becomes greater than uHigh, the output y becomes true and remains true for at least trueHoldDuration seconds, after which time it is allowed to switch immediately.

When the input u becomes less than uLow, the output y becomes false and remains false for at least falseHoldDuration seconds, after which time it is allowed to switch immediately.

Input and output of the block

This model for example could be used to disable an economizer, and not re-enable it for 10 minutes, and vice versa. Using hysteresis can avoid the distraction from the input noise.

Extends from Modelica.Icons.ObsoleteModel (Icon for classes that are obsolete and will be removed in later versions).

Parameters

TypeNameDefaultDescription
RealuLow if y=true and u<uLow, switch to y=false
RealuHigh if y=false and u>uHigh, switch to y=true
TimetrueHoldDuration true hold duration [s]
TimefalseHoldDurationtrueHoldDurationfalse hold duration [s]

Connectors

TypeNameDescription
input RealInputuReal input signal
output BooleanOutputyBoolean output signal

Modelica definition

block HysteresisWithHold "Hysteresis block that optionally allows to specify a hold time" extends Modelica.Icons.ObsoleteModel; parameter Real uLow "if y=true and u<uLow, switch to y=false"; parameter Real uHigh "if y=false and u>uHigh, switch to y=true"; parameter Modelica.Units.SI.Time trueHoldDuration "true hold duration"; parameter Modelica.Units.SI.Time falseHoldDuration=trueHoldDuration "false hold duration"; Buildings.Controls.OBC.CDL.Interfaces.RealInput u "Real input signal"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y "Boolean output signal"; protected Buildings.Controls.OBC.CDL.Continuous.Hysteresis hysteresis( final uLow=uLow, final uHigh=uHigh) "Transform Real to Boolean signal with Hysteresis"; Buildings.Controls.OBC.CDL.Logical.TrueFalseHold truFalHol( final trueHoldDuration=trueHoldDuration, final falseHoldDuration=falseHoldDuration) "True/false hold"; equation connect(u, hysteresis.u); connect(hysteresis.y, truFalHol.u); connect(truFalHol.y, y); end HysteresisWithHold;

Buildings.Obsolete.Controls.OBC.CDL.Continuous.LessEqual Buildings.Obsolete.Controls.OBC.CDL.Continuous.LessEqual

Output y is true, if input u1 is less or equal than input u2

Buildings.Obsolete.Controls.OBC.CDL.Continuous.LessEqual

Information

Block that outputs true if the Real input u1 is less than or equal to the Real input u2. Otherwise the output is false.

Extends from Modelica.Icons.ObsoleteModel (Icon for classes that are obsolete and will be removed in later versions).

Connectors

TypeNameDescription
input RealInputu1Connector of first Real input signal
input RealInputu2Connector of second Real input signal
output BooleanOutputyConnector of Boolean output signal

Modelica definition

block LessEqual "Output y is true, if input u1 is less or equal than input u2" extends Modelica.Icons.ObsoleteModel; Buildings.Controls.OBC.CDL.Interfaces.RealInput u1 "Connector of first Real input signal"; Buildings.Controls.OBC.CDL.Interfaces.RealInput u2 "Connector of second Real input signal"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y "Connector of Boolean output signal"; equation y = u1 <= u2; end LessEqual;

Buildings.Obsolete.Controls.OBC.CDL.Continuous.LessEqualThreshold Buildings.Obsolete.Controls.OBC.CDL.Continuous.LessEqualThreshold

Output y is true, if input u is less or equal than threshold

Buildings.Obsolete.Controls.OBC.CDL.Continuous.LessEqualThreshold

Information

Block that outputs true if the Real input is less than or equal to the parameter threshold. Otherwise the output is false.

Extends from Modelica.Icons.ObsoleteModel (Icon for classes that are obsolete and will be removed in later versions).

Parameters

TypeNameDefaultDescription
Realthreshold0Threshold for comparison

Connectors

TypeNameDescription
input RealInputuConnector of Real input signal
output BooleanOutputyConnector of Boolean output signal

Modelica definition

block LessEqualThreshold "Output y is true, if input u is less or equal than threshold" extends Modelica.Icons.ObsoleteModel; parameter Real threshold=0 "Threshold for comparison"; Buildings.Controls.OBC.CDL.Interfaces.RealInput u "Connector of Real input signal"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y "Connector of Boolean output signal"; equation y = u <= threshold; end LessEqualThreshold;

Buildings.Obsolete.Controls.OBC.CDL.Continuous.LimPID Buildings.Obsolete.Controls.OBC.CDL.Continuous.LimPID

P, PI, PD, and PID controller with limited output, anti-windup compensation and setpoint weighting

Buildings.Obsolete.Controls.OBC.CDL.Continuous.LimPID

Information

PID controller in the standard form

y = k   ( e(t) + 1 ⁄ Ti   ∫ e(s) ds + Td de(t)⁄dt ),

where y is the control signal, e(t) = us - um is the control error, with us being the set point and um being the measured quantity, k is the gain, Ti is the time constant of the integral term and Td is the time constant of the derivative term.

Note that the units of k are the inverse of the units of the control error, while the units of Ti and Td are seconds.

For detailed treatment of integrator anti-windup, set-point weights and output limitation, see Modelica.Blocks.Continuous.LimPID.

Options

This controller can be configured as follows.
P, PI, PD, or PID action

Through the parameter controllerType, the controller can be configured as P, PI, PD or PID controller. The default configuration is PI.

Direct or reverse acting

Through the parameter reverseActing, the controller can be configured to be reverse or direct acting. The above standard form is reverse acting, which is the default configuration. For a reverse acting controller, for a constant set point, an increase in measurement signal u_m decreases the control output signal y (Montgomery and McDowall, 2008). Thus,

Reset of the controller output

The controller can be configured to enable an input port that allows resetting the controller output. The controller output can be reset as follows:

Note that this controller implements an integrator anti-windup. Therefore, for most applications, keeping the default setting of reset = Buildings.Types.Reset.Disabled is sufficient. However, if the controller is used in conjuction with equipment that is being switched on, better control performance may be achieved by resetting the controller output when the equipment is switched on. This is in particular the case in situations where the equipment control input should continuously increase as the equipment is switched on, such as a light dimmer that may slowly increase the luminance, or a variable speed drive of a motor that should continuously increase the speed.

References

R. Montgomery and R. McDowall (2008). "Fundamentals of HVAC Control Systems." American Society of Heating Refrigerating and Air-Conditioning Engineers Inc. Atlanta, GA.

Extends from Modelica.Icons.ObsoleteModel (Icon for classes that are obsolete and will be removed in later versions).

Parameters

TypeNameDefaultDescription
SimpleControllercontrollerTypeBuildings.Controls.OBC.CDL.T...Type of controller
Realk1Gain of controller
TimeTi0.5Time constant of integrator block [s]
TimeTd0.1Time constant of derivative block [s]
RealyMax1Upper limit of output
RealyMin0Lower limit of output
Realwp1Set-point weight for Proportional block (0..1)
Realwd0Set-point weight for Derivative block (0..1)
RealNi0.9Ni*Ti is time constant of anti-windup compensation
RealNd10The higher Nd, the more ideal the derivative block
BooleanreverseActingtrueSet to true for reverse acting, or false for direct acting control action
Initialization
Realxi_start0Initial value of integrator state
Realyd_start0Initial value of derivative output
Integrator reset
ResetresetBuildings.Obsolete.Controls....Type of controller output reset
Realy_resetxi_startValue to which the controller output is reset if the boolean trigger has a rising edge, used if reset == CDL.Types.Reset.Parameter

Connectors

TypeNameDescription
input RealInputu_sConnector of setpoint input signal
input RealInputu_mConnector of measurement input signal
output RealOutputyConnector of actuator output signal
input RealInputy_reset_inInput signal for state to which integrator is reset, enabled if reset = CDL.Types.Reset.Input
input BooleanInputtriggerResets the controller output when trigger becomes true

Modelica definition

block LimPID "P, PI, PD, and PID controller with limited output, anti-windup compensation and setpoint weighting" extends Modelica.Icons.ObsoleteModel; parameter Buildings.Controls.OBC.CDL.Types.SimpleController controllerType= Buildings.Controls.OBC.CDL.Types.SimpleController.PI "Type of controller"; parameter Real k( min=0) = 1 "Gain of controller"; parameter Modelica.Units.SI.Time Ti(min=Buildings.Controls.OBC.CDL.Constants.small)= 0.5 "Time constant of integrator block"; parameter Modelica.Units.SI.Time Td(min=0) = 0.1 "Time constant of derivative block"; parameter Real yMax = 1 "Upper limit of output"; parameter Real yMin = 0 "Lower limit of output"; parameter Real wp(min=0) = 1 "Set-point weight for Proportional block (0..1)"; parameter Real wd(min=0) = 0 "Set-point weight for Derivative block (0..1)"; parameter Real Ni(min=100*Buildings.Controls.OBC.CDL.Constants.eps) = 0.9 "Ni*Ti is time constant of anti-windup compensation"; parameter Real Nd(min=100*Buildings.Controls.OBC.CDL.Constants.eps) = 10 "The higher Nd, the more ideal the derivative block"; parameter Real xi_start=0 "Initial value of integrator state"; parameter Real yd_start=0 "Initial value of derivative output"; parameter Boolean reverseActing = true "Set to true for reverse acting, or false for direct acting control action"; parameter Buildings.Obsolete.Controls.OBC.CDL.Types.Reset reset = Buildings.Obsolete.Controls.OBC.CDL.Types.Reset.Disabled "Type of controller output reset"; parameter Real y_reset=xi_start "Value to which the controller output is reset if the boolean trigger has a rising edge, used if reset == CDL.Types.Reset.Parameter"; Buildings.Controls.OBC.CDL.Interfaces.RealInput u_s "Connector of setpoint input signal"; Buildings.Controls.OBC.CDL.Interfaces.RealInput u_m "Connector of measurement input signal"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput y "Connector of actuator output signal"; Buildings.Controls.OBC.CDL.Interfaces.RealInput y_reset_in if reset == Buildings.Obsolete.Controls.OBC.CDL.Types.Reset.Input "Input signal for state to which integrator is reset, enabled if reset = CDL.Types.Reset.Input"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput trigger if reset <> Buildings.Obsolete.Controls.OBC.CDL.Types.Reset.Disabled "Resets the controller output when trigger becomes true"; Buildings.Obsolete.Controls.OBC.CDL.Continuous.Feedback controlError "Control error (set point - measurement)"; Buildings.Controls.OBC.CDL.Continuous.IntegratorWithReset I( final k=1/Ti, final y_start=xi_start) if with_I "Integral term"; Buildings.Obsolete.Controls.OBC.CDL.Continuous.Derivative D( final k=Td, final T=Td/Nd, final y_start=yd_start) if with_D "Derivative term"; Buildings.Obsolete.Controls.OBC.CDL.Continuous.Feedback errP "P error"; Buildings.Obsolete.Controls.OBC.CDL.Continuous.Feedback errD if with_D "D error"; Buildings.Obsolete.Controls.OBC.CDL.Continuous.Feedback errI1 if with_I "I error (before anti-windup compensation)"; Buildings.Obsolete.Controls.OBC.CDL.Continuous.Feedback errI2 if with_I "I error (after anti-windup compensation)"; Buildings.Controls.OBC.CDL.Continuous.Limiter lim( final uMax=yMax, final uMin=yMin) "Limiter"; protected final parameter Real revAct = if reverseActing then 1 else -1 "Switch for sign for reverse or direct acting controller"; final parameter Boolean with_I = controllerType==Buildings.Controls.OBC.CDL.Types.SimpleController.PI or controllerType==Buildings.Controls.OBC.CDL.Types.SimpleController.PID "Boolean flag to enable integral action"; final parameter Boolean with_D = controllerType==Buildings.Controls.OBC.CDL.Types.SimpleController.PD or controllerType==Buildings.Controls.OBC.CDL.Types.SimpleController.PID "Boolean flag to enable derivative action"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant Dzero( final k=0) if not with_D "Zero input signal"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant Izero( final k=0) if not with_I "Zero input signal"; Buildings.Controls.OBC.CDL.Continuous.MultiplyByParameter uS_revAct(final k= revAct) "Set point multiplied by reverse action sign"; Buildings.Controls.OBC.CDL.Continuous.MultiplyByParameter uSetWp(final k=wp) "Set point multiplied by weight for proportional gain"; Buildings.Controls.OBC.CDL.Continuous.MultiplyByParameter uMea_revAct(final k= revAct) "Set point multiplied by reverse action sign"; Buildings.Controls.OBC.CDL.Continuous.MultiplyByParameter uSetWd(final k=wd) if with_D "Set point multiplied by weight for derivative gain"; Buildings.Controls.OBC.CDL.Continuous.Add addPD "Outputs P and D gains added"; Buildings.Controls.OBC.CDL.Continuous.MultiplyByParameter gainPID(final k=k) "Multiplier for control gain"; Buildings.Controls.OBC.CDL.Continuous.Add addPID "Outputs P, I and D gains added"; Buildings.Obsolete.Controls.OBC.CDL.Continuous.Feedback antWinErr if with_I "Error for anti-windup compensation"; Buildings.Controls.OBC.CDL.Continuous.MultiplyByParameter antWinGai(k=1/(k*Ni)) if with_I "Gain for anti-windup compensation"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant yResSig(final k=y_reset) if reset == Buildings.Obsolete.Controls.OBC.CDL.Types.Reset.Parameter "Signal for y_reset"; Buildings.Controls.OBC.CDL.Continuous.MultiplyByParameter divK(final k=1/k) if reset <> Buildings.Obsolete.Controls.OBC.CDL.Types.Reset.Disabled "Division by k for integrator reset"; Buildings.Obsolete.Controls.OBC.CDL.Continuous.Feedback addRes if reset <> Buildings.Obsolete.Controls.OBC.CDL.Types.Reset.Disabled "Adder for integrator reset"; Buildings.Controls.OBC.CDL.Logical.Sources.Constant cheYMinMax( final k=yMin < yMax) "Check for values of yMin and yMax"; Buildings.Controls.OBC.CDL.Utilities.Assert assMesYMinMax( message="LimPID: Limits must be yMin < yMax") "Assertion on yMin and yMax"; Buildings.Controls.OBC.CDL.Logical.Sources.Constant noTri(final k=false) if reset == Buildings.Obsolete.Controls.OBC.CDL.Types.Reset.Disabled "No trigger when reset is disabled"; Buildings.Controls.OBC.CDL.Continuous.Sources.Constant zer(final k=0) if reset == Buildings.Obsolete.Controls.OBC.CDL.Types.Reset.Disabled "Reset input to integrator when the reset is disabled"; equation connect(trigger, I.trigger); connect(u_s, uS_revAct.u); connect(uS_revAct.y, uSetWp.u); connect(u_m, uMea_revAct.u); connect(uS_revAct.y, uSetWd.u); connect(uSetWp.y, errP.u1); connect(errP.u2, uMea_revAct.y); connect(errD.u1, uSetWd.y); connect(errD.u2, uMea_revAct.y); connect(D.u,errD. y); connect(errI1.u1, uS_revAct.y); connect(errI1.u2, uMea_revAct.y); connect(addPD.u1, errP.y); connect(addPID.u1,addPD. y); connect(addPID.y, gainPID.u); connect(lim.u, gainPID.y); connect(lim.y, y); connect(antWinErr.y, antWinGai.u); connect(addPD.u2, Dzero.y); connect(D.y, addPD.u2); connect(addPID.u2, Izero.y); connect(addPID.u2, I.y); connect(divK.y, addRes.u1); connect(addRes.u2, addPD.y); connect(addRes.y, I.y_reset_in); connect(divK.u, yResSig.y); connect(divK.u, y_reset_in); connect(antWinErr.u1, gainPID.y); connect(antWinErr.u2, lim.y); connect(I.u, errI2.y); connect(errI1.y, errI2.u1); connect(errI2.u2,antWinGai. y); connect(controlError.u1, u_s); connect(controlError.u2, u_m); connect(cheYMinMax.y, assMesYMinMax.u); connect(noTri.y, I.trigger); connect(zer.y, I.y_reset_in); end LimPID;

Buildings.Obsolete.Controls.OBC.CDL.Continuous.NumberOfRequests Buildings.Obsolete.Controls.OBC.CDL.Continuous.NumberOfRequests

Outputs the number of signals that are above/below a certain threshold

Buildings.Obsolete.Controls.OBC.CDL.Continuous.NumberOfRequests

Information

Block that outputs the number of inputs that exceed a threshold. The parameter kind is used to determine the kind of the inequality. The table below shows the allowed settings.

Value of parameter kind Output signal incremented by 1 for each i ∈ {1, ..., nin} if
0 u[i] > t
1 u[i] ≥ t
2 u[i] ≤ t
3 u[i] < threShold

This model may be used to check how many rooms exceed a temperature threshold.

Extends from Modelica.Icons.ObsoleteModel (Icon for classes that are obsolete and will be removed in later versions).

Parameters

TypeNameDefaultDescription
Integernin Number of inputs
Realt0Threshold
Integerkind Set to 0 for u>threShold, to 1 for >=, to 2 for <= or to 3 for <

Connectors

TypeNameDescription
output IntegerOutputyNumber of input signals that violate the threshold
input RealInputu[nin]Input signals

Modelica definition

block NumberOfRequests "Outputs the number of signals that are above/below a certain threshold" extends Modelica.Icons.ObsoleteModel; parameter Integer nin "Number of inputs"; parameter Real t=0 "Threshold"; parameter Integer kind "Set to 0 for u>threShold, to 1 for >=, to 2 for <= or to 3 for <"; Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput y "Number of input signals that violate the threshold"; Buildings.Controls.OBC.CDL.Interfaces.RealInput u[nin] "Input signals"; algorithm y := 0; for i in 1:nin loop if kind == 0 then if u[i] > t then y := y+1; end if; end if; if kind == 1 then if u[i] >= t then y := y+1; end if; end if; if kind == 2 then if u[i] <= t then y := y+1; end if; end if; if kind == 3 then if u[i] < t then y := y+1; end if; end if; end for; end NumberOfRequests;