Baltimore SIGAda • Rational Rose Real Time Presentation
Baltimore SIGAda • Real-Time System Design Concepts
Baltimore SIGAda • Characteristics of Real-Time Systems • Responsiveness • Timeliness • Concurrency • Dynamic structure and behaviour • Distribution • Reliability
Baltimore SIGAda • Hard Real-Time Systems • Deterministic system behaviour • Soft Real-Time Systems • System combinations of Soft and Hard Real-Time Systems
Baltimore SIGAda • Hard Real-Time Systems are often designed with an additional component that is not part of the UML Standard – Timing Diagrams. Hard Real-Time Systems are often designed to interact with sensors and activators on the equipment that the system is communicating with.
Baltimore SIGAda • Hard real-time systems that are safety-critical may contain within the architecture a watchdog timer implementation. • Watchdog timers may be built into a microprocessor card and are typically driven by a periodic reset signal from the primary processor. If the reset signal fails to reset the watchdog timer within that time, the watchdog timer restarts the main processor.
Baltimore SIGAda • Real-time systems may make use of a technique called “interrupts”. Interrupts may be disabled and the result is a portion of code that is “atomic”. Some portions of a real-time system to operate correctly are labelled “critical sections” are must be atomic for the system to operate properly.
Baltimore SIGAda • Modeling Real-Time Systems
Baltimore SIGAda • Concurrency support from operating systems and programming languages is limited. • Many complex real-time systems are state-based. The behaviour of these systems may be difficult to design and understand.
Baltimore SIGAda • In order to model states with concurrency one needs a notation, a process and a tool. • This pyramid of building blocks is represented by the Unified Modeling Language, the Rational Unified Process and the Rational Rose Real-Time Modeling tool.
Baltimore SIGAda • UML and Rose Realtime handle concurrency with the capsule. The capsule provides this capability to model concurrency. • To support concurrency a passive object must exercise control over “critical” or “atomic” sections of code where variable could be accessed simultaneously. An example of the problem is the Shared Data Bug.
Baltimore SIGAda • Active Objects and Finite State Machines • State – condition in which an active object persists and behaves in a predetermined way for some time • Transition -- path connecting two states • Trigger – an event which fires a transition • Action – work performed by action code when transition is fired by the triggering event
Baltimore SIGAda • Capsule enforce the O-O concept of encapsulation. • Capsules interact via asynchronous message passing. • Capsules encapsulate the finite state machine behaviour, an execution thread, and the properties of the capsule.
Baltimore SIGAda • Capsules may be concurrent or distributed. • Capsules may be tested independently. • Demonstrate use of a capsule in a concurrent architecture. • In a Class Diagram identify the UML notation for a capsule. • Attributes • Operations • Ports • Finite State Machine • Structure Diagram
Baltimore SIGAda • UML Models • Use Case Model – similar to requirements • Design Model – realized by class diagrams • Implementation Model – collection of components • Test Model – test cases and procedures
Baltimore SIGAda • Rose Real-Time Views • Use-Case View – use-case diagrams; interaction diagrams – sequence and collaboration diagrams; • Logical View – class diagrams; structure diagrams; state diagrams; collaboration diagrams; sequence diagrams; • Implementation (Component) View – executables, C++ Libraries; C++ External Libraries • Deployment View – software components are mapped to hardware deployment configuration • See Rational Training Course DEV160 Modeling Behaviour with UML • Demonstrate the views to the working group.
Baltimore SIGAda • Use-Case View diagrams consist of use-case and interaction diagrams • Use Case Diagrams consist of actors and use cases • Actors are outside of the system and interact with the system • Use cases are actions performed by the system
Baltimore SIGAda • Interaction Diagrams consist of collaboration diagrams • Framework for sequence diagrams
Baltimore SIGAda • Sequence Diagrams are interactions between elements as a time ordered set of messages. • Contain instances of capsules.
Baltimore SIGAda • Logical View contains Class Diagrams, Structure Diagrams, State Diagrams, Collaboration Diagrams and Sequence Diagrams.
Baltimore SIGAda • Class Diagrams depict static view of Packages, Capsules, Classes, Protocols and Relationships
Baltimore SIGAda • Structure Diagrams are a specialized Collaboration Diagram. • Contain Capsule roles, Ports and Connectors. • Structure diagrams are contained within a capsule.
Baltimore SIGAda • State Diagrams depict high level behaviour of a capsule in a finite state machine • Contain States, substates and transitions
Baltimore SIGAda • Component View describes organization of static software modules • The software is built in this view (i.e. compiled) • Contains executables and C and C++ Libraries
Baltimore SIGAda • Deployment View is where software components are mapped onto hardware • Contains processors and component instances • Processors describe on what processor the built component is run on • Component instances are executable components
Baltimore SIGAda • Socket Interface Presentation • The purpose of this presentation is to describe how a Socket Interface may be implemented using Rational Rose.
Baltimore SIGAda • This demo uses the following Architecture:
Baltimore SIGAda • This is the Class Diagram for the server (ReceiverSameThread) and client (SenderSameThread) capsules. They represent the top-level capsules for the ping/pong example. The IPC and TCP capsules are incarnated by the top-level capsules onto a physical thread configured with the RTCustomController implementation class.
Baltimore SIGAda • The Class Diagram depicts a composition relationship between the top-level capsules and the IPC and TCP capsules. The next two slides describe a composition relationship.
Baltimore SIGAda • Server Side Socket Connection Description
Baltimore SIGAda • The IPCReceiver capsule is incarnated by the top-level capsules onto a physical thread configured with the RTCustomController implementation class i.e. a RTCustomController thread. • The frame service in Rose Real-Time is used to incarnate an IPCReceiver capsule role.
Baltimore SIGAda • An example of how the frame service is used below to incarnate (i.e. create or instanstiate) capsule roles, destroy capsule roles, plug in capsule roles (i.e. import) or unplug capsule roles (i.e. deport) • id = frame.incarnate(iPCReceiver, IPCReceiver, EmptyObject, CustomIPCThread );
Baltimore SIGAda The frame service call is action code contained within the transition Labelled initialize. This is a state diagram for the capsule ReceiverSameThread.
Baltimore SIGAda • The incarnated TCPServer and TCPClient architecture
Baltimore SIGAda • Here is structure diagram which contains a capsule role labelled iPCReceiver.
Baltimore SIGAda • The previous slides shows a structure diagram for ReceiverSameThread which contains a capsule role labelled IPCReceiver. This capsule role has a symbol in the lower right corner that indicates that there is a nested capsule role within this capsule role.
Baltimore SIGAda • The structure diagram for IPCReceiver capsule contains a capsule role labelled customIPCLayer of class TCPServer.
Baltimore SIGAda • iPCReceiver refers to the optional Capsule Role • IPCReceiver is the address to myData • EmptyObject is an optional piece of data that is delivered to the capsule in its initial transition. • CustomIPCThread refers to the logical thread in which the capsule runs on.
Baltimore SIGAda • The IPCReceiver capsule controls the number of messages exchanged with the TCPclient capsule through the contained optional capsule 'customIPCLayer'.
Baltimore SIGAda • The capsule role labelled customIPCLayer of class TCPServer is connected via a connector to a port labelled talkRemote. • The talkRemote port is a conjugated, wired, protected, end port in the structure diagram for IPCReceiver.
Baltimore SIGAda • In the previous slide, the rounded rectangle attached to the end port refers to the state machine of the associated capsule. So messages coming in on this port are delivered to, and are processed by the associated capsule’s state machine. The connected boxes inside the rounded rectangle refer to a connection. Ports that have the connected boxes in it are wired ports.
Baltimore SIGAda • This is the state diagram for the IPCReceiver capsule.
Baltimore SIGAda • The following slide depicts how action code contained within the transition labelled Initialize will incarnate a TCPServer.
Baltimore SIGAda • An example of how the frame service is used below to incarnate (i.e. create or instanstiate) capsule roles, destroy capsule roles, plug in capsule roles (i.e. import) or unplug capsule roles (i.e. deport) • id = frame.incarnate(customIPCLayer, TCPServer, EmptyObject, CustomIPCThread );
Baltimore SIGAda • The action code in the transition labelled ping uses the talkRemote port to send the pong signal. The format for sending data in Rose Real-Time is port_name.signal(data).send(); • The pong signal is defined in a protocol class and optionally may have data associated with them. Action code is below. • talkRemote.pong().send();
Baltimore SIGAda • This is the state diagram for the TCPServer capsule.
Baltimore SIGAda • The transition for internalSetup sets a variable called internalFd which will be used by 'wakeup' calls to unblock the RTCustomController. • internalFD is a internal UDP socket descriptor. • UDP sockets are connectionless and have no protocol. There are suitable to use for the purpose of local host (board) communication. • internalFd = makeUdpConnection();
Baltimore SIGAda • A connectionless service is one in which transmissions take place without a pre-established path between the source and destination. Because packets may arrive by different paths and in random sequences, there is no way to guarantee delivery of a message in a connectionless service. Because it can not guarantee delivery, a connectionless service is described as a best effort service.
Baltimore SIGAda • The Action Code for the choice point labelled internalOK checks the value of internalFd [which is an internal socket descriptor] to see if if it has been set to a value other than -1 which it was initialized to. • Action code is on next slide.
Baltimore SIGAda • if( internalFd < 0 ) • return 0; // not OK • // Follow the FALSE path • // of the Choice Point • ioMonitor.add( internalFd, RTIOMonitor::CanRead ); • return 1; // OK • // Follow the TRUE path • // of the Choice Point