Syntax
y = Periods(u1 = opening_event [, u2 = closing_event or duration] [, clock = clock] [, tl = master_time_locator]);
Description
Each instance of this block creates a Periods.
A time locator is composed of several time periods on the continuous physical clock that may overlap (cf. illustration in the Diagram Layer).
A time period is a time interval betwen to events. A time period is opened at each opening event. All opened time periods are closed when a closing event occurs.
An event occurs when a Boolean4 becomes true.
The opening event occurs when u1 becomes true inside the master time period specified by the while block connected at input tl. If no master time period is specified, then the opening event occurs whenever u1 becomes true.
There are two ways of
specitying the closing event according to parameter
durationSpecified:
Therefore, the type of
u2 is Boolean4 if
durationSpecified=false, Real if durationSpecified=true and clockSpecified=false, and Integer if
durationSpecified=true and discreteClockSpecified=true.
Additionally, all time periods are closed when the master time period closes.
If u2 is not connected, then there is no closing event from u2 (but closing events may come from tl is tl is connected).
The boundaries of the
time periods are open or closed according to parameters
leftBoundaryIncluded and
rightBoundaryIncluded.
The maximum number of overlapping time periods is set by the parameter nMaxOverlap. If the number of overlapping time periods exceeds nMaxOverlap, an error is raised.
A time period is represented by a Boolean that is true when the time period is open, and false when the time period is closed.
The time periods that constitute the continuous time locator are stored in vector y.timePeriod[].
The master time period can be created using the While block.
The events u1 and u2 can be generated by converting Boolean signals to Boolean4 signals with the block BooleanToBoolean4.
Example
This block is demonstrated with the following example: