Download presentation
Presentation is loading. Please wait.
Published byGerard Barton Modified over 9 years ago
1
CSCI1600: Embedded and Real Time Software Lecture 7: Modeling II: Discrete Systems Steven Reiss, Fall 2015
2
Embedded Systems Are sets of tasks The task is the primary abstraction to be used If we want to understand the system We want to model it Should we model the whole system Or should we just model the individual tasks
3
How to Model a Task English description Typically used first Imprecise, hard to check, incomplete Formal mathematics Very precise Difficult to understand Hard to express external events Formal diagrams Combine formal math with understanding Diagrams make it easier to comprehend what is there Provide a framework for the math and understanding
4
Modeling Control Systems Control oriented systems Typically respond to external stimuli Reaction based on previous interactions These determine the state of the system Stimulus moves system to a new state Control is state-oriented Natural model is finite state automata
5
Basic Finite State Automata
6
Problem Want to automatically trigger switch When train goes from R to L What does sensing look like What does train look like When should you trigger the switch C D AB
7
Problem Can only trigger one switch at a time Switch trigger Should be momentary (>100ms, <500ms) What does this task do? How many tasks should it be? Is it a FSA?
8
Problem Problem: when is the train on which block When is train completely on A/C or B or D side of switch Handling initial conditions Handling reversing directions C D A B
9
Issues with Basic FSA Need to specify actions Semi-external events: timers Internal events from other automata Conditional events Multiple FSA’s in parallel Counters and other variables State space blowup
10
Actions: Moore vs Mealy Machine
11
Moore vs. Mealy Which is more useful? Are they equivalent?
12
Extended State Machines Each arc has condition/action To traverse arc, condition must hold When traversing arc, action is taken There are a finite set of (bounded) variables Conditions can reference these Condition can be Event Time out Expression over variables Combination of the two
13
Extended State Machines Actions Can access and change variables Can be { var = expression; … } Can do something external When no condition is true Stay in same state When multiple conditions are true What should be done Nondeterminism, Allow priority specification
14
Digital Watch Four buttons Chimes, alarms, time, stopwatch, light How does it work? Number of states? Lots of tasks Specifying each Specifying their interaction
15
Statecharts David Harel (80’s) Part of UML Extended FSM notation
16
Concurrency Concurrent FSMs Same box, dashed line State of overall is cross-product of states Can have array (n copies)
17
Hierarchical Automata Allow abstraction Can be used to generalize groups of states Can be used for clustering Can have multiple levels What state to goto inside?
18
Start and Stop States Start states are large dots Stop states are encircled dots Hierarchal elements can have internal start states
19
History Mechanism Keep track of state in nested automata Circled-H is entry point Default entry Can point to start state
20
Delays and Timeouts Delays cause a state to hold until time has expired time< in state Timeouts are automatic events <time in state Separate timeout event
21
Homework Read Chapter 4
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.