Exercise Unit 2: Modeling Paradigms - RT-UML. UML: The Unified Modeling Language. Statecharts. RT-UML in AnyLogic

Similar documents
State Machine Diagrams

Engineering Design w/embedded Systems

SOFTWARE DESIGN COSC 4353 / Dr. Raj Singh

Lecture 33 April 4, Unied Modelling Language. ECE155: Engineering Design with Embedded Systems Winter Patrick Lam version 1

Introduction to Software Engineering. 6. Modeling Behaviour

Unified Modeling Language 2

Finite State Machine Modeling for Software Product Lines. Finite State Machines and Statecharts

CHAPTER 1. Topic: UML Overview. CHAPTER 1: Topic 1. Topic: UML Overview

STATE MACHINES. Figure 1: State Machines

BISS 2013: Simulation for Decision Support

Software Service Engineering

UNIT-4 Behavioral Diagrams

Meltem Özturan

INTRODUCTION TO UNIFIED MODELING MODEL (UML) & DFD. Slides by: Shree Jaswal

UML 2.0 State Machines

UML- a Brief Look UML and the Process

UML 2.0 UML 2.0. Scott Uk-Jin Lee. Division of Computer Science, College of Computing Hanyang University ERICA Campus

What is a Class Diagram? A diagram that shows a set of classes, interfaces, and collaborations and their relationships

What is a Class Diagram? Class Diagram. Why do we need Class Diagram? Class - Notation. Class - Semantic 04/11/51

Statecharts 1.- INTRODUCTION 1.- INTRODUCTION

visualstate Reference Guide

For 100% Result Oriented IGNOU Coaching and Project Training Call CPD: ,

SOFTWARE ENGINEERING UML FUNDAMENTALS. Saulius Ragaišis.

Unified Modeling Language

Activity Diagram Written Date : September 02, 2016

Object-Oriented Modeling. State Machine Diagram. Slides accompanying Version 1.0

Object-Oriented and Classical Software Engineering

Pieter van den Hombergh. Fontys Hogeschool voor Techniek en Logistiek. September 9, 2016

UML Fundamental. OutLine. NetFusion Tech. Co., Ltd. Jack Lee. Use-case diagram Class diagram Sequence diagram

Course 3 7 March

UML Diagrams & And Some Of Their Elements

Course "Softwaretechnik" Book Chapter 2 Modeling with UML

Ingegneria del Software Corso di Laurea in Informatica per il Management

UML. By Somenath Mukhopadhyay.

The Unified Modeling Language User Guide

CISC 322 Software Architecture

1 Introduction. 1.1 Introduction

Dynamic Modeling - Finite State Machines

Architecture-Centric Evolution in Software Product Lines:

The Unified Modeling Language (UML)

Modeling Hybrid Systems with Petri Nets

Unified Modeling Language for Real-Time Systems Design

Design and UML Class Diagrams

Unified Modeling Language (UML)

Specifications Part 1

CA314 Object Oriented Analysis & Design - 7. File name: CA314_Section_07_Ver01 Author: L Tuohey No. of pages: 16

SCXML State Chart XML. Previously, in this course...

Object Oriented Modeling

A Comparison of Event-driven Process Chains and UML Activity Diagram for Denoting Business Processes

Interactions A link message

Chapter 10. Object-Oriented Analysis and Modeling Using the UML. McGraw-Hill/Irwin

What's New in UML 2.0

Model Driven Development Unified Modeling Language (UML)

Thirty one Problems in the Semantics of UML 1.3 Dynamics

SCXML State Chart XML

Lecture 16: Hierarchical State Machines II

UML REFERENCE SHEETS. 2013, 2014 Michael Marking; all rights reserved, including moral rights. Web site:

UNIT II. Syllabus. a. An Overview of the UML: Visualizing, Specifying, Constructing, Documenting

From Analysis to Design. LTOOD/OOAD Verified Software Systems

Business-Driven Software Engineering Lecture 5 Business Process Model and Notation

Chapter 4. Capturing the Requirements. 4th Edition. Shari L. Pfleeger Joanne M. Atlee

UML Primer. -Elango Sundaram

Petri Nets" Computer Science 520/620 Spring 2011 Prof. L. Osterweil" Software Models and Representations" Part 3" Some Semantics"

Computer Science 520/620 Spring 2011 Prof. L. Osterweil" Software Models and Representations" Part 3" Petri Nets"

Chapter 12. UML and Patterns. Copyright 2008 Pearson Addison-Wesley. All rights reserved

Transport Layer. The transport layer is responsible for the delivery of a message from one process to another. RSManiaol

Combined Modeling and Programming with State Machines

Introduction to Software Engineering. 5. Modeling Objects and Classes

Ingegneria del Software Corso di Laurea in Informatica per il Management. Introduction to UML

Formal specification of semantics of UML 2.0 activity diagrams by using Graph Transformation Systems

Overall Plan of Simulation and Modeling I. Chapters

UML Modeling I. Instructor: Yongjie Zheng September 3, CS 490MT/5555 Software Methods and Tools

UNIT-II Introduction to UML

Computer Science 520/620 Spring 2013 Prof. L. Osterweil" Use Cases" Software Models and Representations" Part 4" More, and Multiple Models"

Computer Science 520/620 Spring 2013 Prof. L. Osterweil" Software Models and Representations" Part 4" More, and Multiple Models" Use Cases"

UNIT I. 3. Write a short notes on process view of 4+1 architecture. 4. Why is object-oriented approach superior to procedural approach?

Unified Modeling Language (UML)

Chapter 2: The Object-Oriented Design Process

Finite State Machines and Statecharts

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico

System Design, Modeling, and Simulation using Ptolemy II

What is the difference between unicast and multicast? (P# 114)

Activities Radovan Cervenka

Object-Oriented Software Engineering Practical Software Development using UML and Java

Section 8. The Basic Step Algorithm

Computer Science 520/620 Spring 2014 Prof. L. Osterweil" Use Cases" Software Models and Representations" Part 4" More, and Multiple Models"

Object-Oriented Analysis and Design Using UML

Advanced Software Engineering

Execution of UML State Machines Using Modelica

OMG Modeling Glossary B

Software Engineering Lab Manual

Simulation-Based Analysis of UML Statechart Diagrams: Methods and Case Studies 1

Object-Oriented Analysis and Design. Pre-UML Situation. The Unified Modeling Language. Unification Efforts

CSE 403: Software Engineering, Spring courses.cs.washington.edu/courses/cse403/15sp/ UML Class Diagrams. Emina Torlak

State Machine Specification Directly in Java and C++ Alexander Sakharov

What is UML / why. UML is graphical and notational representation for software system requirements analysis and design. (Software Engineering )

EVENTS AND SIGNALS. Figure 1: Events. kinds of events Signal Event

History of object-oriented approaches

12 Tutorial on UML. TIMe TIMe Electronic Textbook

UML Start-Up Training UB1

Transcription:

Exercise Unit 2: Modeling Paradigms - RT-UML UML: The Unified Modeling Language Statecharts RT-UML in AnyLogic Simulation and Modeling I Modeling with RT-UML 1

RT-UML: UML Unified Modeling Language a mix of visual modeling languages for software engineering pragmatically successful well-developed tools (IBM Rational Software, etc.) broad acceptance in industry history: 1996 defined by the "three amigos": Grady Booch, Jim Rumbaugh, Ivar Jacobson 1997 standardized as UML 1.1 by Object Management Group (OMG) since 2005: UML 2.0 since 2008: UML 2.2 (latest specification) problems: semantics and interaction of the formalisms no description of time and randomness Diagram types structural diagrams behavior diagrams physical diagrams and diagrams for model management Simulation and Modeling I Modeling with RT-UML 2

RT-UML: UML Structural Diagrams Class Diagram Component Diagram Object Diagram Collaboration Diagram Composite Structure Diagram (= active objects with ports) Use Case Diagram Behavior Diagrams Sequence Diagram Timing Diagram Activity Diagram (similar to Petri nets) Interaction Overview Diagram State Machine Diagram (= statecharts) Communication Diagram others Deployment Diagram, Package Diagram Simulation and Modeling I Modeling with RT-UML 3

Real-Time UML RT-UML: communicating active objects in UML 2 conform variant: message-sending active objects as Composite Structure Diagrams (internal) statecharts as State Machine Diagrams (anyhow) applications: initially for embedded, real-time and communication systems also well suited for manufacturing systems, workflow systems,... RT-UML for simulation we need additional constructs to express time or randomness defined as standard-conform extensions of UML ("profiles") implemented in proprietary tool realizations AnyLogic: flexible modeling paradigm for simulation uses ideas of RT-UML (but not conform to UML 2) extensions for deterministic and random times probabilities discrete and continuous state changes Simulation and Modeling I Modeling with RT-UML 4

Modeling Paradigms: RT-UML UML: The Unified Modeling Language Statecharts RT-UML in AnyLogic Simulation and Modeling I Modeling with RT-UML 5

RT-UML: Statecharts Model of object's event-oriented behavior describes all possible states of an object describes how state changes as the result of events initial state [not all items checked] /get next item [all items checked && some items not in stock] item received [some items not in stock] Checking do/check item Waiting /get first item [all items checked && all items available] item received [all items available] transition Dispatching do/initiate delivery activity delivered Delivered self-transition state Simulation and Modeling I Modeling with RT-UML 6

RT-UML: Statecharts Representation as a state machine Activity associated with states: Do / Activity ongoing non-atomic execution within state machine may be interrupted Action associated with transitions results in a change in state occurs quickly and is uninterruptible (atomic) Transition relationship between two states if object is in the first state, it will perform certain actions and enter the second state when a specified event occurs and specified conditions/guards are satisfied transition label: Event [Guard] / Action Simulation and Modeling I Modeling with RT-UML 7

RT-UML: Statecharts Transition label: Event [Guard] / Action event can trigger a state transition guard logical condition returns "true" or "false" guarded transition occurs only if guard evaluates to "true" state responds (conditionally) to event with action Extensions superstates / composite states combine several substates, which inherit transitions from superstate concurrent sections: system may be in different states at same time ( AND-states ) Simulation and Modeling I Modeling with RT-UML 8

Modeling Paradigms: RT-UML UML: The Unified Modeling Language Statecharts RT-UML in AnyLogic Simulation and Modeling I Modeling with RT-UML 9

AnyLogic s modeling paradigm is a variant of RT-UML inclusion of time and randomness events are triggered after certain times (deterministic + random) competing events can be triggered with a probability basic model elements active objects: model real-world objects statecharts: internal behavior of active objects ports: asynchronous message passing variables: shared variables Simulation and Modeling I Modeling with RT-UML 10

Active objects main building blocks of AnyLogic models model real-world objects mapped to Java classes structure diagram: this object encapsulated object port reference text box connector parameter variable port (without queue) statechart event dynamic event collection variable (may be used to implement port queue) Simulation and Modeling I Modeling with RT-UML 11

Elements of structure diagram: this object pane of current structure diagram public elements appear in dashed boundaries in structure diagram encapsulated objects may be placed anywhere on pane solid frames: only presentation shapes to depict class boundaries encapsulated objects port displayed by red circle with letter `A` instances of other active objects some interface elements, like ports, displayed displayed as a small square port queues need to be implemented, e.g., via collection variables may be defined as public or private (via check box) port references public ports of encapsulated objects this object encapsulated object port reference port (without queue) statechart text box (dynamic) event (collection) variable Simulation and Modeling I Modeling with RT-UML 12 connector parameter

variables plain or collection variables plain variables displayed as orange circles with `V` collection variables (array or list) displayed as three orange dots may be declared as public or private (via check box) parameters similar to plain variables should be used to initialize different model instances may be propagated through model hierarchy statechart activities executed inside active object (dynamic) events this object encapsulated object port reference port (without queue) used to schedule events at user-defined times with user-defined actions a dynamic event deletes itself after its action a simple event survives and can be restarted statechart text box (dynamic) event connector parameter (collection) variable Simulation and Modeling I Modeling with RT-UML 13

connectors a line between two ports for message transport a connection from port to statechart via port.map(statechart): incoming messages are signaled to statechart (message trigger) this object encapsulated object port reference text box connector parameter variable port (without queue) statechart event dynamic event collection variable (may be used to implement port queue) Simulation and Modeling I Modeling with RT-UML 14

Message passing primary interaction mechanism via port.send(message): messages can model real-world objects, e.g., parts, products, people, can be of any Java class can contain arbitrary data (e.g., attributes, packet lengths, ) transmission of messages sent and received at ports asynchronous sending does not affect receiver receiving does not affect sender immediate: messages go to the destination port without advancement of the simulation clock broadcasting possible messages with multiple recipients Simulation and Modeling I Modeling with RT-UML 15

Ports bidirectional message processing depends on direction of message receive() onreceive() port Object onsend() send() Simulation and Modeling I Modeling with RT-UML 16

When a message is sent at a port 1. onsend() method called: On send action of the port is executed. If it returns false, message not processed further. Otherwise: 2. If public port: message forwarded along port connections outside active object send() method is called at all public ports to which this port is mapped receive() method is called at all private ports and connected ports of encapsulated objects 3. If private port: message forwarded along port connections inside active objects send() method is called at all public ports to which this port is mapped receive() is called at all connected ports of encapsulated objects Simulation and Modeling I Modeling with RT-UML 17

When a message is received on a port 1. Message type check: check if message can be cast to message type of the port. If not, message is discarded. 2. onreceive() method is called: On receive action of the port is executed. If it returns false, message not processed further. Otherwise: 3. If port is public: message forwarded along port connections inside active object, receive() is called on all ports of encapsulated objects and private ports mapped to this port. If port is private: above does not happen. 4. Method receivemessage() called at all statecharts that are mapped to the port: trigger of type message for transitions Simulation and Modeling I Modeling with RT-UML 18

Role of statecharts in AnyLogic behavior of active objects states events causing state transitions actions that result from a state transition An AnyLogic statechart: initial state pointer simple state branch transition deep or shallow property of history composite state H H states are selected via check boxes in AnyLogic (shallow) history state final state (deep) history state Simulation and Modeling I Modeling with RT-UML 19

State represents a location of control with set of reactions to conditions and/or events composite states ( OR-states ) control always resides in one simple state set of reactions: union of current simple state and all composite states containing it composite state A simple state simple state B C Simulation and Modeling I Modeling with RT-UML 20

Transition controls flow between two states statechart may enter other state if specified trigger event is signalled while statechart is in particular state and specified guard condition is true actions may be associated with exiting the state (exit action) with the transition (transition action) with entering next state (entry action) transition A transition C B internal transition may freely cross simple and composite state borders internal transition lies inside state both start and end on the border of state neither entry nor exit actions are executed when transition is taken current simple state will not be exited Simulation and Modeling I Modeling with RT-UML 21

Initial state pointer points to initial state within level of hierarchy when control is passed to composite state simple state is found inside by following initial state pointer this state becomes current one exactly one initial state pointer on each level initial state pointers A C B D Simulation and Modeling I Modeling with RT-UML 22

Final states termination point of a statechart action is executed statechart terminates activity transitions may not exit final state A B C D History States references to most recently visited state shallow history: to composite or simple state on the same hierarchy level deep history: to simple state within composite states selected via check box example: E was the most recently visited state upon entering A shallow history state final states B A H H C D E F deep history state Simulation and Modeling I Modeling with RT-UML 23

Branch represents transition branching or connection point one default exit point: transition taken, if all other outgoing transitions are not enabled runtime error, if no transitions are enabled and no default branch exit can model immediate choices initial state pointer branch simple state A D transition C E B composite state H H F (shallow) history state final state (deep) history state Simulation and Modeling I Modeling with RT-UML 24

Action execution order 1. State exit actions - starting with the old simple state up the state hierarchy to the highest exited composite state 2. Transition action 3. State entry actions - starting with the highest entered composite state down the state hierarchy to new simple or pseudo state (branch or history state) 4. If control enters a pseudo state: - its action code is executed - control then goes out of the pseudo state immediately - control can stop in a simple state only Simulation and Modeling I Modeling with RT-UML 25

Current state N, transition T1: K L M N I1 I2 T2 T1 V T3 S P T4 Q R I3 N state exit action M state exit action T1 transition action branch action T2 or T3, assume T2: T2 transition action I1 initial state pointer action (not entry/exit of state L) M state entry action I2 initial state pointer action N state entry action If T3 is selected: L state exit action K state exit action (no action of state V) T3 transition action S state entry action P state entry action branch action P state exit action T4 transition action (guard open since branch exit) Q state entry action I3 initial state pointer action R state entry action Simulation and Modeling I Modeling with RT-UML 26

Triggering a transition statechart enters a simple state: triggers of outgoing transitions are collected statechart begins to wait for triggers to be signaled when trigger is signaled, guard of the transition is evaluated if guard is true, transition may be taken if guard is false, wait for other signal when several triggers are signaled at the same time & corresponding guards are true transition to be taken is chosen randomly (equiprobabilistic serialization of concurrent events) Simulation and Modeling I Modeling with RT-UML 27

Types of triggers timeout triggered after specified amount of time after entering state when syntax of trigger evaluates to double (either fixed value or sampled from random distribution, see methods in class Utilities ) example: 2.56 value 0.0 triggers transition immediately rate triggered after exponentially distributed amount of time after entering state (special case of timeout) when syntax evaluates to double example: 2.56 (rate of exponential distribution) identical to timeout with exponential(2.56) condition triggered when an expression becomes true (equation solving) when the syntax evaluates to boolean example: x > 10 Simulation and Modeling I Modeling with RT-UML 28

message triggered by messages arriving to the statechart: via connected ports (e.g., port.map(statechart) ): message arriving to port is forwarded to statechart via method receivemessage(message)of the statechart via method receivemessage(message): posts message of specified type to the statechart without queueing via method fireevent(message) : adds a message of specified type to the statechart queue (to be consumed in zero-time steps) message may be of any basic type or Java class type match initiates trigger, if in corresponding state trigger may also depend on other properties of message if message equals: e.g., a particular String if expression is true: use msg to refer to current message method getevent() of statechart retrieves message from queue (e.g., in action code) Simulation and Modeling I Modeling with RT-UML 29

Summary of basic model elements active objects: model real-world objects ports: asynchronous message passing (collection) variables statecharts: internal behavior of active objects all can be visualized Summary of statechart behavior states represent system states (states of object) transitions represent state changes transition label: event [guard] / action a transition may be taken if the trigger event occurs and the specified guard condition is true an action can be performed when the transition is taken all statecharts execute concurrently Simulation and Modeling I Modeling with RT-UML 30

possible events timeout: after a fixed time has elapsed (timeout may be computed according to some distribution) rate: after an exponentially distributed time has elapsed (special case) condition: when an expression becomes true message: after arrival of a message at the statechart queue; occurs, when Java object arrives at port, which is connected to statechart (via port.map(statechart)) when explicitly called from Java code (via statechart.receivemessage()or statechart.fireevent()) examples in chapter Modeling Paradigms queueing systems Stop and Wait protocol a Wireless LAN model Simulation and Modeling I Modeling with RT-UML 31

Summary of AnyLogic High-level simulation environment general purpose discrete, continuous (and hybrid) modeling paradigm is a variant of RT-UML (real-time Unified Modeling Language) Underlying is discrete-event simulation simulation clock is always advanced to the time of the next event (anywhere in the model) and the event is then executed (transition is taken and the actions are performed) time ties are broken randomly Java-based textual model parts in Java executable model + simulation engine mapped on Java other Java code can be linked Simulation and Modeling I Modeling with RT-UML 32