0% found this document useful (0 votes)
71 views26 pages

Behavioral Models: by Dr. Noman Hasany

The document discusses different types of behavioral models used to model the dynamic behavior of systems, including data-driven models, event-driven models, and state machine models. It provides examples of each type of model, such as using activity diagrams and sequence diagrams for data-driven models, state charts for state machine models, and includes a detailed example of a state machine diagram modeling the states and stimuli of a microwave oven. The key points are that behavioral models show how systems respond and change states in response to internal or external stimuli over time.

Uploaded by

Muhammad Shahid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views26 pages

Behavioral Models: by Dr. Noman Hasany

The document discusses different types of behavioral models used to model the dynamic behavior of systems, including data-driven models, event-driven models, and state machine models. It provides examples of each type of model, such as using activity diagrams and sequence diagrams for data-driven models, state charts for state machine models, and includes a detailed example of a state machine diagram modeling the states and stimuli of a microwave oven. The key points are that behavioral models show how systems respond and change states in response to internal or external stimuli over time.

Uploaded by

Muhammad Shahid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26

Behavioral Models

By
Dr. Noman Hasany
Behavioral models
Behavioral models are models of the dynamic behavior of a
system as it is executing.
Stimuli types and UML diagrams:
 Data Some data arrives that has to be processed by the system.
• Modeled by activity models/sequence diagram
 Events Some event happens that triggers system processing. Events may
have associated data, although this is not always the case.
• Modeled by state machine models

Chapter 5 System modeling 2


Data-driven modelling in UML
• The UML does not support data-flow diagrams as they were originally
proposed and used for modeling data processing. The reason for this is
that DFDs focus on system functions and do not recognize system
objects. However, because data-driven systems are so common in
business, UML 2.0 introduced activity diagrams, which are similar to
data-flow diagrams.
• An alternative way of showing the sequence of processing in a system is
to use UML sequence diagrams.

3
Data Flow Architectures
• The data flow software architecture style views the entire
software system as a series of transformations on successive sets
of data, where data and operations on it are independent of each
other.
• The software system is decomposed into data processing
elements where data directs and controls the order of data
computation processing.
• Examples are:
• Pipe-n-filter
• Batch Sequence
• Process control
Batch Sequential Architecture
• In batch sequential architecture, each data transformation
subsystem or module cannot start its process until its previous
subsystem completes its computation. Data flow carries a batch of
data as a whole from one subsystem to another. Figure 5.2 shows a
typical example of batch sequential style.
Batch Sequential Architecture
• In this example, the first subsystem validates the transaction requests
(insert, delete, and update) in their totality. The sort subsystem sorts all
transaction records in an ascending order on the primary key to speed up
the update on the master file since the master file is sorted by the primary
key. The transaction update module updates the master file with the sorted
transaction requests, and then the report module generates a new list.

• All communications (connection link arrows) between subsystem modules


are conducted through transient intermediate files which can be removed
by successive subsystems. Business data processing such as banking and
utility billing are typical applications of this architecture.
Batch sequential in business data processing
Assignment: Implement in Java/python etc
public class batch_sequential {
.. .
public static void main() {
searching(kwd, inputFile, matchedFile);
counting(matchedFile, countedFile);
sorting (countedFile, reportFile);
}
public static void searching(String kwd, String inFile, String outFile)
{...}
public static void counting(String inFile, String outFile)
{...}
public static void sorting(String inFile, String outFile)
{...}
}
Assignment: Implement in Unix/Linux
• We can run a Unix Shell script as follows in batch sequential mode:

• myShell.sh

(exec) searching kwd < inputFile > matchedFile


(exec) counting < matchedFile > countedFile
(exec) sorting < countedFile > myReportFile
(exec) may be required by some Unix shell.
The redirect operators (“<" and ">”) are used to make stdin and stdout point to
specific files.
Data driven modelling in UML: activity
model of the insulin pump’s operation

Chapter 5 System modeling 10


Activity diagrams
• Activity diagrams, which show the activities involved in a process or in
data processing.
• Figure 5.2 is a UML activity diagram. Activity diagrams are intended to
show the activities that make up a system process and the flow of
control from one activity to another. The start of a process is indicated
by a filled circle; the end by a filled circle inside another circle.
Rectangles with round corners represent activities, that is, the specific
sub-processes that must be carried out. You may include objects in
activity charts.
The context of the MHC-PMS

Chapter 5 System modeling 12


Activity diagrams
• In a UML activity diagram, arrows represent the flow of work from
one activity to another. A solid bar is used to indicate activity
coordination. When the flow from more than one activity leads to a
solid bar then all of these activities must be complete before progress
is possible. When the flow from a solid bar leads to a number
of activities, these may be executed in parallel. Therefore, in Figure
5.2, the activities to inform social care and the patient’s next of kin,
and to update the detention register may be concurrent.
Process model of involuntary/unintentional detention
Activity diagrams
• Arrows may be annotated with guards that indicate the condition
when that flow is taken. In Figure 5.2, you can see guards showing the
flows for patients who are dangerous and not dangerous to society.
Patients who are dangerous to society must be detained in a secure
facility. However, patients who are suicidal and so are a danger to
themselves may be detained in an appropriate ward in a hospital.
Data flow for Order Processing
Data driven modelling in UML: sequence
diagram for Order processing

**But note that, sequence models highlight objects in a system,


whereas data-flow diagrams highlight the functions.
Chapter 5 System modeling 17
Process-Control Architecture
• Process control software architecture is suitable for the embedded system
software design where the system is manipulated by a process control variable
data.
• Process control architecture decomposes the whole system into subsystems
(modules) and connections between subsystems. There are two types of
subsystems: an executor processing unit for changing process control variables
and controller unit for calculating the amounts of the changes. Figure 5.9 shows
the data flow of a feedback close-loop process control system. The connections
between the subsystems are the data flow.
Process-Control Architecture
• The input variables and manipulated variables are applied to the
execution processor which results in a controlled variable. The set point
and controlled variables are the input data to the controller; the
difference between the controlled variable value and the set point value is
used to arrive at a new manipulated value. Car cruise-control and building
temperature control systems (AC) are examples of this process control
software architecture type of application.
Event-driven modeling
Real-time systems are often event-driven, with minimal data processing. For
example, a landline phone switching system responds to events such as
‘receiver off hook’ by generating a dial tone.
Event-driven modeling shows how a system responds to external and internal
events.
It is based on the assumption that a system has a finite number of states and
that events (stimuli) may cause a transition from one state to another.

Chapter 5 System modeling 20


State machine models
These model the behaviour of the system in response to external and
internal events.
They show the system’s responses to stimuli so are often used for modelling
real-time systems.
State machine models show system states as nodes and events as arcs
between these nodes. When an event occurs, the system moves from one
state to another.
State charts are an integral part of the UML and are used to represent state
machine models.

Chapter 5 System modeling 21


22
State diagram of a microwave oven

Chapter 5 System modeling 23


States for the microwave oven example
State Description
Waiting The oven is waiting for input. The display shows the current time.
Half power The oven power is set to 300 watts. The display shows ‘Half power’.
Full power The oven power is set to 600 watts. The display shows ‘Full power’.
Set time The cooking time is set to the user’s input value. The display shows the
cooking time selected and is updated as the time is set.
Disabled Oven operation is disabled for safety. Interior oven light is on. Display
shows ‘Not ready’.
Enabled Oven operation is enabled. Interior oven light is off. Display shows ‘Ready
to cook’.
Operation Oven in operation. Interior oven light is on. Display shows the timer
countdown. On completion of cooking, the buzzer is sounded for five
seconds. Oven light is on. Display shows ‘Cooking complete’ while buzzer
is sounding.

Chapter 5 System modeling 24


Stimuli for the microwave oven example
Stimulus Description
Half power The user has pressed the half-power button.

Full power The user has pressed the full-power button.

Timer The user has pressed one of the timer buttons.

Number The user has pressed a numeric key.

Door open The oven door switch is not closed.

Door closed The oven door switch is closed.

Start The user has pressed the Start button.

Cancel The user has pressed the Cancel button.

Chapter 5 System modeling 25


State Diagram
State machine diagram
depicting a login
process. Initially, the
state machine executes
a busy loop to wait for
user login, and then the
username/password
pair is verified. If the
pair matches the system
records, the login is
confirmed; otherwise
the login is rejected.

You might also like