REAL-TIME SYSTEMS DESIGN AND ANALYSIS phần 7 potx

53 264 0
REAL-TIME SYSTEMS DESIGN AND ANALYSIS phần 7 potx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

294 5 SOFTWARE SYSTEM DESIGN 3.3.5 VehicleDetector This class represents the proximity detection loop located near the stop line associated with an approach. The class is based on the OnOff- Sensor class. The Vehicle Presence Detector object is responsible for managing the follow- ing functions: 1. Filtering of vehicle service requests (ACTUATED mode). 2. Generation of vehicle service request event (ACTUATED mode). 3. Maintenance of the vehicle count statistic (FIXED, ACTUATED, and ADAP- TIVE modes). Figure 21 illustrates the attributes, methods, and events of the VehicleDetec- tor class. OnOffSensor − m_State: boolean − m_IgnoreState: boolean + OnOffSensor() +* ~ OnOffSensor () + setState() : void + resetState() : void + ignoreState() : void + watchState() : void VehicleDetector + VehicleDetector() −* ~ VehicleDetector () Figure 21 VehicleDetector class. 3.3.5.1 VehicleDetector Relationships ž Association link from class Approach ž Generalization link to class OnOffSensor 3.3.5.2 VehicleDetector Attributes Inherited from superclass. 5.6 APPENDIX: CASE STUDY IN SOFTWARE REQUIREMENTS SPECIFICATION 295 3.3.5.3 VehicleDetector Methods Inherited from superclass. Overridden methods are described in Table 18. Table 18 VehicleDetector class-attributes Method Type Notes VehicleDetector () public: Constructor. ∼ VehicleDetector () private abstract: Destructor. setState () public: void Set the m State attribute and trigger the onVehicleEntry event. resetState () public: void Clear the m State attribute and trigger the onVehicleExit event. 3.3.5.4 VehicleDetector Behavioral Details 296 5 SOFTWARE SYSTEM DESIGN m_Approach[i].m_VehicleDetector :VehicleDetector m_Approach[i] :Approach «singleton» m_IntersectionController :IntersectionController Name: IntersectionController- Vehicle Detector Author: Team 2 Version: 1.0 Created: 07-Dec-2002 21:54:19 Updated: 09-Dec-2002 13:58:06 {t1 = 0} *[While Approach Aspect == {G,Y]*]:onEntryStateSet(void) {t1 <= 50 ms} onVehicleEntry(approach) {t2 = 0} *[While Approach Aspect == [G,Y]*]:onEntryStateCleared(void) {t2 <= 20 ms} m_Count ++ {t3 = 0} [if (Approach Aspect Changes to RR)]:clearCount(void) {t3 <= 20 ms} m_Count = 0 Figure 22 VehicleDetector class sequence diagram. 5.6 APPENDIX: CASE STUDY IN SOFTWARE REQUIREMENTS SPECIFICATION 297 Intersection Controller-Operating m_VehicleDetector[i] Blocked Vehicle Over Loop + Do Action / setState(void) + Do Action / m_Approach[i].onEntryStateSet(void) Vehicle Has Passed Loop + Do Action / resetState(void) + Do Action / m_Approach[i].onEntryStateCleared(void) m_Approach[i] Updating Count + Do Action / m_Count++ Blocked Triggering Approach + Do Action / m_IntersectionController.onVehicleEntry(int) Clearing Count + Do Action / m_Count = 0 Name: IntersectionController- Vehicle Detector Author: Team 2 Version: 1.0 Created: 06-Dec-2002 15:21:47 Updated: 07-Dec-2002 21:46:52 Vehicle Entry Vehicle Exit onEntryStateCleared onEntryStateSet clearCount() Figure 23 VehicleDetector class statechart. 3.3.6 Override This is class represents the set of pushbuttons on the manual override console. 298 5 SOFTWARE SYSTEM DESIGN Override − m_IntersectionController: IntersectionController* + Override() −* ~ Override () + onActivate(OverrideType) : int + onDeactivate(OverrideType) : int + onSetPhase() : int Figure 24 Override class. 3.3.6.1 Override Relationships ž Dependency link to class OverrideType ž Association link to class IntersectionController ž Generalization link from class RemoteOverride 3.3.6.2 Override Attributes Table 19 Override class-attributes Attribute Type Notes m IntersectionController private: IntersectionController Pointer to the m IntersectionController object. 3.3.6.3 Override Methods Table 20 Override class-methods Method Type Notes Override () public: Constructor. ∼ Override () private abstract: Destructor. onActivate (OverrideType) public: int param: type [OverrideType - in] Event triggered by receipt of an activation command from the local override console. onDeactivate (OverrideType) public: int param: type [OverrideType - in] Event triggered by receipt of an deactivation command from the local override console. onSetPhase () public: int Event triggered by receipt of an advance phase command from the local override console. 5.6 APPENDIX: CASE STUDY IN SOFTWARE REQUIREMENTS SPECIFICATION 299 3.3.6.4 Override Behavioral Details m_ManualOverride :Override «singleton» m_IntersectionController :IntersectionController «resource» :Manual Control Panel Name: IntersectionController- Manual Override Author: Team 2 Version: 1.0 Created: 04-Dec-2002 08:30:25 Updated: 05-Dec-2002 18:52:22 {t0 = 0} dispatchCommand(command = Activate Manual Override) {t0 <= 10 ms} onActivate(type) {t0 <= 20 ms} onOverrideActivated(type) m_PreviousMode = m_Mode m_Mode = Manual setPhase(phase = Default) checkPhase(phase) {t0 <= 220 ms} m_Status:= 0 (OK) {t0 <= 250 ms} m_Status:= 0 (OK) {t1 = 0} *[While Override Active]:dispatchCommand(command = Advance Phase) {t1 <= 10 ms} {t1 <= 20 ms} *[While Override Active]:setPhase() setPhase() checkPhase(phase) {t1 <= 220 ms} *[While Override Active]: m_Status:= 0 (OK) {t1 <= 250 ms} *[While Override Active]: m_Status:= 0 (OK) {t2 = 0} dispatchCommand(command = Deactivate Manual Override) {t2 <= 10 ms} onDeactivate(type) {t2 <= 20 ms} onOverrideDeactivated(type) m_Mode = m_PreviousMode setPhase(phase) checkPhase(phase) {t2 <= 220 ms} m_Status:= 0 (OK) {t2 <= 250 ms} m_Status:= 0 (OK) *[While Override Active]:onSetPhase() Figure 25 Override class sequence diagram. 300 5 SOFTWARE SYSTEM DESIGN 3.3.7 RemoteOverride This class represents the commands available on the Remote Software console. Additionally, the class provides an interface for remote access to and update of intersection traffic data and cycle parameters for coordinated intersection control (option). The RemoteOverride class is responsible for managing the following functions: 1. Triggering the appropriate mode change. 2. Generation and handling of events required to control intersection phase. 3. Acting as a substitute for the Calculate Cycle Parameters method of the Inter- section Control object (in coordinated mode, not covered by this specification). Figure 26 illustrates the attributes, methods, and events of the Remote Over- ride class. Override − m_IntersectionController: IntersectionController* + Override() −* ~ Override () + onActivate(OverrideType) : int + onDeactivate(OverrideType) : int + onSetPhase() : int RemoteOverride − m_Network: Network* + RemoteOverride() −* ~ RemoteOverride () + onSetParameters(Parameters*) : int + onGetStatus() : Status* Figure 26 Remote override class. 3.3.7.1 Remote Override Relationships ž Dependency link to class Status ž Generalization link to class Override 5.6 APPENDIX: CASE STUDY IN SOFTWARE REQUIREMENTS SPECIFICATION 301 ž Association link from class IntersectionController ž Association link to class Network 3.3.7.2 RemoteOverride Attributes In addition to those inherited from the super- class Override, RemoteOverride attributes are as listed in Table 21. Table 21 RemoteOverride class-attributes Attribute Type Notes m Network private: Network Pointer to the m Network object. 3.3.7.3 RemoteOverride Methods In addition to those inherited from the super- class Override, RemoteOverride methods are as listed in Table 22. Table 22 RemoteOverride class-methods Method Type Notes RemoteOverride () public: Constructor. ∼ RemoteOverride () private abstract: Destructor. onSetParameters (Parameters ∗ ) public: int param: parameters [Parameters ∗ -in] Event triggered under coordinated control; used to set the intersection timing parameters under remote control. Completes within 100 ms. onGetStatus () public: Status ∗ Event triggered under coordinated control; used to get the intersection timing parameters under remote control. Completes within 100 ms. 3.3.7.4 RemoteOverride Behavioral Details Behavior of the RemoteOverride class is identical to that of the Override class for methods inherited from the superclass. 3.3.8 PreEmpt This class manages the wireless transponder interface to autho- rized emergency vehicles and accesses the m IntersectionControl object in order to display the correct traffic signals, allowing the emergency vehicle priority access to the intersection. The PreEmpt class is responsible for managing the following functions: 1. Triggering the appropriate mode change. 2. Reception of emergency vehicle preemption requests. 3. Decryption and validation of emergency vehicle preemption requests. 4. Generation and handling of events required to control intersection phase. 302 5 SOFTWARE SYSTEM DESIGN Figure 27 illustrates the attributes, methods, and events of the PreEmpt class. «singleton» PreEmpt − m_IntersectionController: IntersectionController* + PreEmpt() −* ~PreEmpt () + onActivate() : int + onDeactivate() : int + onTimeout() : void Figure 27 PreEmpt class. 3.3.8.1 PreEmpt Relationships ž Association link from class IntersectionController ž Association link to class IntersectionController 3.3.8.2 PreEmpt Attributes Table 23 PreEmpt class-attributes Attribute Type Notes m IntersectionController private: IntersectionController Pointer to the m Intersection controller object. 3.3.8.3 PreEmpt Methods Table 24 PreEmpt class-methods Method Type Notes PreEmpt () public: Constructor. ∼PreEmpt () private abstract: Destructor. onActivate () public: int Event triggered by receipt of an activate signal from the emergency vehicle transponder. onDeactivate () public: int Event triggered by receipt of an deactivate signal from the emergency vehicle transponder. onTimeout () public: void Event triggered if a deactivate signal is not received after the timeout interval has elapsed. 5.6 APPENDIX: CASE STUDY IN SOFTWARE REQUIREMENTS SPECIFICATION 303 3.3.8.4 PreEmpt Behavioral Details m_PreEmpt :PreEmpt «singleton» m_IntersectionController :IntersectionController Name: IntersectionController- Emergency Preempt Author: Team 2 Version: 1.0 Created: 09-Dec-2002 13:39:37 Updated: 09-Dec-2002 13:45:09 {t1 = 0} m_PreviousMode = m_Mode m_Mode = Preempt {t1 <= 100 ms} {t2 = 0} m_Mode = m_PreviousMode setPhase(phase = Default) {t2 <= 100 ms} onPreemptRequest() m_Status:= 0 onPreemptCleared() m_Status:= 0 Figure 28 PreEmpt sequence diagram. 3.3.9 Network This class manages communication via the Ethernet port. Figure 29 below illustrates the attributes, methods, and events of the Network Interface class. «singleton» Network + Network() −* ~Network () + receivePacket() : void + sendPacket(void*) : int + dispatchCommand(int) : void Figure 29 Network class. 3.3.9.1 Network Relationships ž Association link from class IntersectionController ž Association link from class Maintenance ž Association link from class RemoteOverride [...]... source of performance deterioration and missed deadlines in real-time systems Moreover the increased use of object-oriented languages such as C++, Java, and sometimes Ada1 in real-time systems can make the problem more insidious But these languages are rapidly displacing the lower-level languages like C and assembly language in real-time embedded systems programming, and it is probably a good thing because... compiler Real-time systems have been built with a wide range of programming languages, Some of this chapter has been adapted from Phillip A Laplante, Software Engineering for Image Processing, CRC Press, Boca Raton, FL, 2003 1 Ada has also been called “object based” to recognize is uniqueness as both object oriented and procedural Real-Time Systems Design and Analysis, By Phillip A Laplante ISBN 0- 471 -22855-9... of Electrical and Electronics Engineers 321 322 6 PROGRAMMING LANGUAGES AND THE SOFTWARE PRODUCTION PROCESS including various dialects of C, C++, C#, Java, Fortran, Pascal, Ada 95, assembly language, and even Visual BASIC, and Basic Of this list C++, Java, and C# are object-oriented, while the others are procedural Ada 95 has elements of both object-oriented and procedural languages, and can be used... used either way, depending on the skill and preferences of the programmer Applicative languages such as LISP and Prolog have also been used to build real-time systems [Allard91], but this is rather unusual and this discussion of languages is confined to those just listed An appropriate question is: “What is the fitness of a language for real-time applications and what criteria can be used to measure... interrupt handlers, memory managers, and the like Linked lists, trees, heaps and other dynamic data structures can benefit from the clarity and economy introduced by dynamic allocation Furthermore, in cases where just a pointer is used to pass a data structure, the overhead for dynamic allocation can be quite 326 6 PROGRAMMING LANGUAGES AND THE SOFTWARE PRODUCTION PROCESS reasonable When writing real-time systems, ... construction of interrupt handlers and other code used for real-time event processing Moreover poor handling of exceptions can degrade performance For example, floating-point overflow errors can propagate bad data through an algorithm and instigate time-consuming errorrecovery routines For example, in ANSI-C, the raise and signal facilities are provided A signal is a type of software interrupt handler that is used... portrays a generic exception handler that reacts to a certain error condition #include main () { void handler (int sig); signal (SIGINT, handler); if (error) raise (SIGINT); } /*set up to handle SIGINT */ /*do some processing /*anomaly detected */ */ /*continue processing */ /*handle error here */ void handler (int sig) { } 328 6 PROGRAMMING LANGUAGES AND THE SOFTWARE PRODUCTION PROCESS... construct interrupt handlers to react to a signal from external hardware, and to handle certain traps, such as floating-point overflow, by replacing the standard C library handlers This situation was illustrated in the case study in the Appendix of Chapter 2 Of all the procedural languages discussed in this chapter, Ada has the most explicit exception handling facility Exception handling in Ada looks... high-integrity real-time systems While C and Fortran both have mechanisms for this (procedures and subroutines), other languages such as Ada tend to foster more modular design because of the requirement to have clearly defined input and outputs in the module parameter lists In Ada 95 the notion of a package embodies the concept of Parnas information hiding exquisitely The Ada package consists of a specification and. .. several programming language features that stand out in procedural languages that are of interest in real-time systems, particularly: ž ž ž ž ž ž Versatile parameter passing mechanisms Dynamic memory allocation facilities Strong typing Abstract data typing Exception handling Modularity These language features help promote the desirable properties of software and best real-time engineering practices 2 From . abstract: ~ErrorHandler() Constructor.public:ErrorHandler() NotesTypeMethod Figure 35 ErrorHandler class-methods. 3.3.13.3 ErrorHandler Behavioral Details «singleton» m_ErrorHandler :ErrorHandler «singleton» m_IntersectionController :IntersectionController m_IncidentLog :Database Name:. Decryption and validation of emergency vehicle preemption requests. 4. Generation and handling of events required to control intersection phase. 302 5 SOFTWARE SYSTEM DESIGN Figure 27 illustrates. SOFTWARE SYSTEM DESIGN 3.3 .7 RemoteOverride This class represents the commands available on the Remote Software console. Additionally, the class provides an interface for remote access to and update

Ngày đăng: 13/08/2014, 08:20

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan