Name | Description |
---|---|
WristWatch | |
Regular | |
Out | |
Stopwatch | |
Utilities |
This example is a StateGraph2 implementation of David Harel's Wristwatch presented in "Statecharts: A Visual Formalism for Complex Systems", see literature.
As an application example, D. Harel used a Citizen Quartz Multi-Alarm III wristwatch as a case study to prove that his new formalism was flexible and powerful enough to describe a behavior that contains numerous modes with only four input signals coming from the buttons of the watch.
The watch display comprises six different displays showing time, 12/24h time setting, AM/PM setting, alarm on/off, chime on/offand stop watch indication. It is operated by four buttons: A, B, C and D. The watch can display time and date (day of month, weekday, date, month, year). It has a chime function, display back-light for improved illumination, low-battery warning, a stop watch with lap/reg mode options and two alarms.
Button A works as a switch between display modes of the watch. The different display modes are: Time (default), alarm1, alarm2, and stopwatch. In each of these, button C will enter update mode where the current time or the alarm time can be set. Inside the update modes, C will flip through different time entities and finally return from update mode. Button B is used to exit update regardless of which internal state being active. In stopwatch mode, button B is used as on/off switch. Additionally, the illumination is turned on every time B is pressed down, and shut off on release. Button D serves as an on/off switch of the current active display mode. If in time mode, pressing button D will result in display of the current date. In stopwatch mode, button D works as a selector between reg/lap display mode.
To run model interactively, enable Realtime in the Experiment setup and set load result interval to 0.01.
Extends from Modelica.Icons.Example (Icon for runnable examples).
Name | Description |
---|---|
initialStep | =true, if initial step (start state machine at entry ports of Parallel) |
use_inPort | =true, if inPort enabled |
use_outPort | =true, if outPort enabled |
use_suspend | =true, if suspend and resume ports enabled |
use_activePort | =true, if activePort enabled |
Name | Description |
---|---|
inPort[nIn] | If enabled, port for one or more input transitions |
outPort[nOut] | If enabled, port for one or more output transitions |
resume[nResume] | If enabled, port for zero, one or more resume transitions |
suspend[nSuspend] | If enabled, port for zero, one or more suspend transitions |
activePort | = true if Parallel component is active, otherwise it is not active |
Name | Description |
---|---|
initialStep | =true, if initial step (start state machine at entry ports of Parallel) |
use_inPort | =true, if inPort enabled |
use_outPort | =true, if outPort enabled |
use_suspend | =true, if suspend and resume ports enabled |
use_activePort | =true, if activePort enabled |
Name | Description |
---|---|
inPort[nIn] | If enabled, port for one or more input transitions |
outPort[nOut] | If enabled, port for one or more output transitions |
resume[nResume] | If enabled, port for zero, one or more resume transitions |
suspend[nSuspend] | If enabled, port for zero, one or more suspend transitions |
activePort | = true if Parallel component is active, otherwise it is not active |
Name | Description |
---|---|
initialStep | =true, if initial step (start state machine at entry ports of Parallel) |
use_inPort | =true, if inPort enabled |
use_outPort | =true, if outPort enabled |
use_suspend | =true, if suspend and resume ports enabled |
use_activePort | =true, if activePort enabled |
Name | Description |
---|---|
inPort[nIn] | If enabled, port for one or more input transitions |
outPort[nOut] | If enabled, port for one or more output transitions |
resume[nResume] | If enabled, port for zero, one or more resume transitions |
suspend[nSuspend] | If enabled, port for zero, one or more suspend transitions |
activePort | = true if Parallel component is active, otherwise it is not active |