Composite Condition¶
Composite Condition is a Tool that combines two Conditions, Condition A and Condition B, into a Calculated Condition. It writes a Formula using union(), intersect() or subtract(). See Formulas and Calculated Items for details.
Using it¶
- Open the Tools tab, and choose Composite Condition in the list.
- Type a Name.
- Choose Condition A and Condition B: one in the Details Pane, or type in Search Items to find a Calculated Condition of the Analysis by name. Click the chosen Condition's name to choose another.
- Choose the Logic. None is chosen when the form opens.
- Click Execute. plintz creates the Calculated Condition, adds it to the Details Pane and clears the form.
Both Conditions need a Maximum Duration, as for and and or. A Condition made by comparing a Signal has none: set one with removeLongerThan() in a Formula first, or make it with Value Search, which has Maximum capsule duration, or use Periodic Condition, which has one. Without it, the Formula fails with "condition must have a maximum duration. Consider using removeLongerThan() to apply a maximum duration", and the form says so and creates nothing.
The logic¶
A Capsule is half-open, [start, end): Capsules that only touch don't overlap.
| Logic | Meaning | Capsules | Formula | Maximum Duration |
|---|---|---|---|---|
| Union | Either condition is present | those of both Conditions, merged where they overlap or touch | $a.union($b) |
none |
| Intersection | Both conditions are present | the overlap of each Capsule of A with each of B | $a.intersect($b) |
the smaller of the two |
| A minus B | A when B is not present | the Capsules of A with the parts B covers cut out | $a.subtract($b) |
that of A |
For example, with A holding 00:00 to 03:00 and B holding 02:00 to 05:00, Union holds 00:00 to 05:00, Intersection 02:00 to 03:00, and A minus B 00:00 to 02:00. If B only starts where A ends, at 03:00, Intersection is empty and A minus B is A. A Capsule of A that has a Capsule of B inside it is split in two by A minus B, and one inside a Capsule of B is gone.
Union has no Maximum Duration, as or has none: to use its result in and, or, not, aggregate(), or another Composite Condition, give it one with removeLongerThan() or setMaximumDuration() in a Formula.
The Formula it writes¶
Condition A is bound to $a and Condition B to $b:
$a.union($b)
$a.intersect($b)
$a.subtract($b)
The Item is an ordinary Calculated Condition: ƒ opens the Formula editor with the Formula above, not the Tool, where you can combine more Conditions. See Tools.
Available operations¶
The Tool supports Union, Intersection and A minus B. It doesn't offer Outside, Touches or Join, whose behavior isn't defined in the project documentation. The Tool doesn't preview the result. Create the Calculated Condition, then view it on the trend.