Revision d28d3a890d7f80be4090cc840312915b900d6834 (click the page title to view the current version)
Behavioral Modeling - Power Window
- Feature modeling
- Component and statemachine modeling
- Variability in behavior using inheritance
- Variability in behavior using strategy pattern
- Scenarios and properties
- An example positive scenario
- It must be possible to go from closed to open via partiallyOpen state
- It must be impossible for the user to request opening and the window remains closed
- It
must be impossible for the window to be
closedand continue sendingmotorUpcommand - The
window must never continue
movingUpafter an object was detected
This example demonstrates modeling both structure and behavior with variability.
Feature modeling
We model features as final, that is, we do not allow dynamic reconfiguration. Feature configuration from the first snapshot remains unchanged for the entire trace.
Metamodel
Model
The optional feature express indicates the functionality
of automatically closing the window. The feature
pinchProtection indicates the functionality of obstacle
detection and stopping the window closure.
Component and statemachine modeling
Metamodel
Simple component modeling.
Inside the components, we will embed statemachines modeling their behavior.
Model
Commands received by the window motor.
Window motor
Requests from the user. Observe, that the request
expressUp is optional.
Alphabet variability
The user request expressUp is only available when the
feature express is present.
Window controller with an optional component
pinchDetector.
Linking the feature with the optional component (structural variability)
The component pinchDetector is only required if we
support the feature pinchProtection.
Disabling
objectDetected port
Without the feature pinchProtection, the port
objectDetected should be inactive. Having the feature will
allow receiving the signal objectDetected.
Variability in behavior using inheritance
Two kinds of window controllers:
With continuous chime
With intermittent chime
Variability in behavior using strategy pattern
We first define an abstract chiming strategy: chiming can be
audible but only if active (expressed by
nesting).
Concrete strategies:
Now we can parameterize the controller with a chiming strategy. Chiming should be active when moving up in express mode. The chime should be emitted only when the chiming is audible.
We can choose the chiming strategy using the following constraint:
Scenarios and properties
An example positive scenario
It must be possible to go from closed to open via partiallyOpen state
It must be impossible for the user to request opening and the window remains closed
It
must be impossible for the window to be closed and continue
sending motorUp command
It is a safety property to prevent burning the motor.
The
window must never continue movingUp after an object was
detected
It is a safety property to prevent injury.
