Group Exercise #16: Alarm Clock Statechart

Educational objective: hands-on experience with statecharts to prepare you for the project.

Consider the digital alarm clock in the REQUIREMENTS group project. Also consider that the internal values, the outputs and the switches (inputs) are all objects that can receive data from other objects, send data to other objects, and/or store data. Objects can also perform computations. Remember that you cannot read actuator values. (You can store them internally if you need to remember them, but you have to explicitly do that; you can't simply read an LED on/off state from the LED itself.)

16-1. In general you'll all have different sequence diagrams from the previous week's group project. Take a look at what you have and agree on ONE set of SDs to use for this group exercise (or at least one set to use as a starting point). You can just pick one of the sets, or you can make your own by combining -- or whatever makes sense. You might need to update these as you perform the next step. Don't spend a huge amount of time on picking, since most of them will probably have a problem that you don't see until the next step.

16-2. Create a statechart for the alarm clock based on the requirements. Include all states and all transition conditions. If you have trouble fitting all the conditions on arcs graphically, it is acceptable to have a table that lists the transition conditions. (See this web page: https://users.ece.cmu.edu/~koopman/ece649/project/sodamachine/portfolio/reqs/requirements2.html#buttoncontrol for an example.) Follow these design rules the best you can:

Hints: you can use pressing a button on one arc and releasing the button on a different arc. Also, since these requirements will result in a software state machine, you should assume that the state machine executes periodically at a reasonably fixed rate that you pick, such as 2 times per second, and that people will press and release the button before the button is re-sampled if you wish to make such an assumption.

16-3. Update your Sequence Diagrams until you have a good match between the SDs and what the statechart actually does.

RUBRIC

Resources: