Buildings.Obsolete.Controls.OBC.CDL.Logical
Package with obsolete models of logical blocks
Information
Package with obsolete blocks for elementary mathematical functions for boolean variables.
Package Content
Name | Description |
---|---|
Timer | Timer measuring the time from the time instant where the Boolean input became true |
Validation | Collection of models that validate the logical blocks of the CDL |
Buildings.Obsolete.Controls.OBC.CDL.Logical.Timer
Timer measuring the time from the time instant where the Boolean input became true
Information
Timer with option to accumulate time until it is reset by an input signal.
Each time the Boolean input u
becomes true, the timer runs, otherwise
it is dormant.
-
If the parameter
accumulate
isfalse
, the timer is set to zero each time the inputu
becomesfalse
. The value of inputreset
will be ignored. -
If the parameter
accumulate
istrue
, the timer accumulates time, and the timer is set to zero only when the value of the inputreset
becomestrue
.
Extends from Modelica.Icons.ObsoleteModel (Icon for classes that are obsolete and will be removed in later versions).
Parameters
Type | Name | Default | Description |
---|---|---|---|
Boolean | accumulate | false | If true, accumulate time until Boolean input 'reset' becomes true, otherwise reset timer whenever u becomes true |
Connectors
Type | Name | Description |
---|---|---|
input BooleanInput | u | Connector for signal that switches timer on if true, and off if false |
input BooleanInput | reset | Connector for signal that sets timer to zero if it switches to true. The input value will be ignored if the timer does not accumulate time |
output RealOutput | y | Timer output [s] |
Modelica definition
block Timer
"Timer measuring the time from the time instant where the Boolean input became true"
extends Modelica.Icons.ObsoleteModel;
parameter Boolean accumulate = false
"If true, accumulate time until Boolean input 'reset' becomes true, otherwise reset timer whenever u becomes true";
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u
"Connector for signal that switches timer on if true, and off if false";
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput reset
"Connector for signal that sets timer to zero if it switches to true. The input value will be ignored if the timer does not accumulate time";
Buildings.Controls.OBC.CDL.Interfaces.RealOutput y(
final quantity="Time",
final unit="s") "Timer output";
protected
discrete Modelica.SIunits.Time entryTime "Time instant when u became true";
discrete Modelica.SIunits.Time yAcc "Accumulated time up to last change to true";
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput reset_internal(
final start=false,
final fixed=true) "Internal connector";
initial equation
pre(entryTime) = time;
yAcc = 0;
equation
if not accumulate then
reset_internal = true;
else
reset_internal = reset;
end if;
when u and (not edge(reset_internal)) then
entryTime = time;
elsewhen reset then
entryTime = time;
end when;
when reset then
yAcc = 0;
elsewhen (not u) then
yAcc = pre(y);
end when;
if not accumulate then
y = if u then time - entryTime else 0.0;
else
y = if u then yAcc + (time - entryTime) else yAcc;
end if;
end Timer;