blockPeriods
Information
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:
- If durationSpecified is false, then the closing event occurs when u2 becomes true.
- If durationSpecified is true, then the closing event occurs n seconds (if discreteClockSpecified=false) or n clock ticks (if discreteClockSpecified=true) after u1 becomes true, n being the value at input u2.
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:
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Boolean | leftBoundaryIncluded | true | If true, the left boundaries of the time periods are included |
| Boolean | rightBoundaryIncluded | true | If true, the right boundaries of the time periods are included |
| Boolean | durationSpecified | false | If true, closing events are given by duration on u2, else closing events is given by events on u2 |
| Boolean | discreteClockSpecified | false | If true, duration is given in clock ticks |
Connectors
| Type | Name | Default | Description |
|---|---|---|---|
| CRML.ETL.Connectors.TimeLocatorOutput | y | Vector of time periods | |
| Connectors.Boolean4Input | u1 | Opening event | |
| Connectors.WhileInput | tl | Master time period | |
| Connectors.Boolean4Input | u2 | Closing event | |
| Connectors.RealInput | continuousDuration | Time period duration | |
| Connectors.IntegerInput | discreteDuration | Time period duration in clock ticks | |
| Connectors.Boolean4Input | clock | Clock ticks |