Traffic Simulation_Software Architecture Design

Embed Size (px)

Citation preview

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    1/35

    XXX CompanyCreation Date:

    Software Architecture Design

    Traffic Simulation Systemesign

    Version 1.00

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    2/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    Revision History

    Date Version Description Author

    2011/04/26 1.0 Created Dang Han (Viet

    Nam)

    Page 2 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    3/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    Table of Contents

    1. Brief Description .........................................................................................................4

    2. References ..................................................................................................................4

    3. Architectural Representation ....................................................................................... 4

    4. Logical View ................................................................................................................4

    5. Use-Case View .............................................................................................................5

    5.1 Use case of Home Group ............................................................................................................... 5

    5.1.1 Use case Model...................................................................................................................... 6

    5.1.2 Use case Realization ........................................................................................... ................... 7

    5.1.2.1 Participants classes ............................................................................................................................ ....7

    5.1.2.2 Sequence Diagram ..................................................................................................................................8

    1. Delete ..............................................................................................................................................................8

    2. Add Map Object ...............................................................................................................................................9

    5.2 Use case of Simulation group ...................................................................................................... 12

    5.2.1 Use case Model.................................................................................................................... 12

    5.2.2 Use case Realization ................................................................................................... ........ 13

    5.2.2.1 Participants classes ..............................................................................................................................13

    5.2.2.2 Sequence Diagram ................................................................................................................................15

    A. Start ......................................................................................................................................................... .....15

    2. Stop ...............................................................................................................................................................20

    3. Pause .......................................................................................................................................................... ..21

    4. Vehicle Setting: ............................................................................................................................................22

    5. Vehicle Statistic: ...........................................................................................................................................236. Pedestrian Setting: .......................................................................................................................................24

    7. Pedestrian Statistic: ............................................................................................................................... ......25

    5.3 Use case of View group ............................................................................................................... 28

    5.3.1 Use case Model.................................................................................................................... 28

    5.3.2 Use case Realization ................................................................................................... ........ 29

    5.3.2.1 Participants classes ..............................................................................................................................29

    5.3.2.2 Sequence Diagram ................................................................................................................................29

    5.4 Use case of File group ................................................................................................................. 30

    5.4.1 Use case Model.................................................................................................................... 31

    5.4.2 Use case Realization ................................................................................................... ........ 31

    5.4.2.1 Participants classes ..............................................................................................................................31

    5.4.2.2 Sequence Diagram ................................................................................................................................32

    5.5 The Others .................................................................................................................................. 325.5.1 Use case Model.................................................................................................................... 33

    5.5.2 Use case Realization ................................................................................................... ........ 33

    5.5.2.1 Participants classes ..............................................................................................................................33

    5.5.2.2 Sequence Diagram ................................................................................................................................34

    6. Deployment View ...................................................................................................... 35

    7. Implementation View ................................................................................................. 35

    Page 3 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    4/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    esign

    1. Brief Description

    This document describes the structure of Traffic Simulation. The purpose of this document is showing the overall

    design for all functions of the system.

    Note: Many diagrams in this document are showed clearest when the reader select the zoom mode from 200% and

    up.

    2. References

    Nothing

    3. Architectural Representation

    The architectural representation of the Traffic Simulation is composed of these views: Logical view, Uses case,

    Deployment and Implementation View.

    4. Logical View

    This section describes the logical structure of the system. It starts from the overview of the architecture and thenpresents its key structural and behavioral elements.

    Traffic Simulation is developed based on MFC framework and Windows API. It has 4 main functions:

    Create map objects such as road, traffic light.

    Set up property for map objects or pedestrians, show statistic of them.

    Simulate the move of all moveable objects on the road.

    File Common functions of multi document interface application such as new, open, save.

    MFC Framework

    Traffic Simulation

    Create MapObj

    Setting

    Simulate

    Create MapObj

    Setting

    Simulate

    Documentnew, open, save

    Windows API

    Page 4 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    5/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    5. Use-Case View

    This section shows the architecturally significant use-case. For each use case, Use case model and realizations are

    described. Each use case realization is a collaboration of design elements from the business components and

    common elements and services.

    Use Use-case static view that is the participants of the use case.

    Use case dynamic view that is the collaboration between the use case participants.

    5.1 Use case of Home Group

    Home group of use cases describe the design for all functions in Home tab of application

    This group consists of 2 main sections: clipboard and MapTool.

    Clipboard: allow user to do cut, copy, paste and delete a map object in view.

    MapTool: allow user to add map objects such as Road, Traffic Light to view.

    Page 5 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    6/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    5.1.1 Use case Model

    This group of function has 5 main use cases:

    Cut: click Select in toolbar, and then select a map object in view, finally click [Cut] button in tool bar to delete

    selected object in view and place it into clipboard.

    Copy: click Select in toolbar, and then select a map object in view, finally click [Copy] button in tool bar to make

    a copy of selected object into clipboard.

    Paste: click [Paste] button in tool bar to paste the object in clipboard into view.

    Delete: click Select in toolbar, and then select a map object in view, finally click [Delete] button in tool bar to

    delete the selected object.

    Add Map objects: click an object in tool bar such as Road, and then click into view to place the selected object in

    view.

    Page 6 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    7/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    5.1.2 Use case Realization

    5.1.2.1 Participants classes

    Main participant classes that used for this group of functions are shown as the following diagramEach user event is processed manually from [CTrafficSimulationView ] class

    Page 7 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    8/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    5.1.2.2 Sequence Diagram

    1. Delete

    Use [CTrafficSimulationView], [CTrafficSimulationDoc], [CMapObj], [CDetector], [CDetector] in thisrealization. Sequence diagram for delete function is developed as below diagram.

    Page 8 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    9/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    2. Add Map Object

    This realization is represented to 2 parts Overview and detail to understand easily.

    Overview

    Use [CTrafficSimulationView], [CMapTool] in this realization. There are 5 main events from user processed

    here:

    - Click an object in Map Tool to select the object would be operate

    - Left Button Down on view to add new map object corresponding to selected map tool.

    - Left Button Up on view to complete adding the object in view

    - Mouse Move on view to specify the shape of map object such as Rectangle.

    - Double Click on view to complete drawing road.

    Sequence diagram for add map object function is developed as below diagram.

    Page 9 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    10/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    Page 10 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    11/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    Details (with CLaneTool)

    The sequence below makes clearly about left button down event with selecting CLaneTool.

    Page 11 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    12/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    5.2 Use case of Simulation group

    Use cases of Simulation group describe the design for all functions in Simulation tab.

    This group consists of 3 main sections:

    Control: Start, Pause and Stop simulating progress

    Vehicle: set up properties for vehicle such as speed limit and make statistic graph which will be displayed on

    view.

    Pedestrian: set up properties for pedestrian such as pedestrian type and make statistic graph in the other windows.

    5.2.1 Use case Model

    This group consists of following use case:

    Start: Start traffic simulating progress

    Pause: Pause traffic simulating progress

    Stop: Stop traffic simulating progress

    Vehicle Setting: Set up vehicle property for simulation

    Vehicle Statistic: Display Statistic graph of vehicle simulation while simulation is starting

    Pedestrian Setting: Set up pedestrian property for simulation

    Pedestrian Statistic: Draw statistic graph for pedestrian and display in other window.

    Page 12 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    13/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    5.2.2 Use case Realization

    5.2.2.1 Participants classes

    Main participant classes use for this group of functions are shown as the following diagram

    User event is processed manually from [CTrafficSimulationView ] class

    Page 13 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    14/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    Page 14 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    15/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    5.2.2.2 Sequence Diagram

    A. Start

    This realization is represented by overview and detail parts to make understand easily.

    Start (Overview)

    Add map objects by Home Group functions into view, and then Click [Start] button in [Simulation tab]. This

    application will generate vehicles and start simulating.

    Sequence diagram for start simulation function is developed as below diagram

    Page 15 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    16/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    Page 16 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    17/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    Vehicle Start (Detail)

    This sequence shows the detail for realization of starting vehicle. Streets and moveable objects would be inserted

    here.

    Page 17 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    18/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    Pedestrian Start (Detail)

    This sequence shows the detail for realization of starting pedestrians. Pedestrian objects would be generated here.

    Page 18 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    19/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    Page 19 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    20/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    2. Stop

    Click [Stop] button to stop simulation while simulation is starting. All vehicle and pedestrian objects generated

    from starting would be removed here.

    Sequence diagram for stop simulation function is developed as below diagram

    Page 20 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    21/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    3. Pause

    Click [Pause] button to pause simulation while simulation is starting. All vehicle and pedestrian objects generated

    from starting would not be removed here. User can click to start to continue simulation before.

    Sequence diagram for pause simulation function is developed as below diagram:

    Page 21 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    22/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    4. Vehicle Setting:

    This use case is used to set up vehicle property for simulation. Click [ Settings] button to display [Vehicle

    Simulation Settings] dialog, and then move scroll to adjust values.

    Sequence diagram for vehicle setting function is developed as below diagram. Modified value will be set and used

    in [draw] event later.

    Page 22 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    23/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    5. Vehicle Statistic:

    Display Statistic graph of vehicle simulation while simulation is starting

    Sequence diagram for vehicle statistic function is developed as below diagram. In this use case, Traffic

    Simulation just remembers the display status of graph. This value would be used to draw at [ Start Simulation]

    function.

    Page 23 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    24/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    6. Pedestrian Setting:

    Set up pedestrian property for simulation

    Page 24 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    25/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    Sequence diagram for pedestrian setting function is developed as below diagram. Modified value would be set and

    used in [Start Simulation] function later.

    7. Pedestrian Statistic:

    This use case uses to draw statistic graph for pedestrian and display in other window.

    Firstly, click [Statistic] button of Pedestrian in toolbar to display [Pedestrians Simulation Statistics]

    dialog. Then, click [Output] button on this dialog to fill graph type into list box.

    Page 25 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    26/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    Select a type and click [Show Graph] to see [Pedestrian Simulation Statistic Graph] window.

    Page 26 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    27/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    Sequence diagram for pedestrian statistics function is developed as below diagram. Statistic file would be created

    and data would be drawn by an external tool.

    Page 27 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    28/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    5.3 Use case of View group

    Use cases of View group describe the design for all functions in View tab.

    5.3.1 Use case Model

    This group consists of 2 main sections:

    Show/Hide status bar: Show or Hide status bar at the bottom of window application.

    New Window: Open another window for the active document.

    User

    View

    Show/ Hide Status bar

    New Window

    Page 28 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    29/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    5.3.2 Use case Realization

    5.3.2.1 Participants classes

    This group of use cases is processed by [CMainFrame] class. This class uses other MFC classes to control status barand new window functions.

    CMainFrame

    #m_wndRibbonBar: CMFCRibbonBar#m_MainButton: CMFCRibbonApplicationButton#m_PanelImages: CMFCToolBarImages#m_wndStatusBar: CMFCRibbonStatusBar

    -DECLARE_DYNAMIC(CMainFrame)-CMainFrame()+UpdateUI(pCurrView: CTraff icSimulationView): void+PreCreateWindow(cs: CREATESTRUCT): BOOL-CMainFrame()+AssertValid(): void+Dump(dc: CDumpContext): void#OnCreate(lpCreateStruct: LPCREATESTRUCT): int#OnWindowManager(): void#OnApplicationLook(id: UINT): void#OnUpdateApplicationLook(pCmdUI: CCmdUI): void-DECLARE_MESSAGE_MAP()

    5.3.2.2 Sequence Diagram

    Because these use cases use existing MFC class to implement, theres no considerable logic to describe here.

    Page 29 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    30/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    5.4 Use case of File group

    Use cases of View group describe the design for all functions from Control Button.

    Page 30 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    31/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    5.4.1 Use case Model

    This group consists of 6 main functions:

    New: create new simulation document, display in a new tab

    Open: open a simulation file that was saved before

    Save: save active document to file

    Save As: save active document to file with another name

    Close: Close active document

    Exit: Exit application

    User

    File

    New

    Open

    Save

    Save As

    Close

    Exit

    5.4.2 Use case Realization

    5.4.2.1 Participants classes

    This group of use cases is processed by [CMainFrame] class. This class uses default functions of MFC classed to

    control file operations.

    Page 31 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    32/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    CTrafficSimulationView

    +m_selection: CRoadMapObjList+m_bActive: BOOL+m_backColor: COLORREF+m_backBuffer: CDC+m_backBuffer2: CDC+m_backBitmap: CBitmap+m_backBitmap2: CBitmap+m_nViewWidth: int+m_nViewHeight: int+m_doubleBufferMutex: CMutex+m_pStatisticWnd: CStatsWnd+m_pSimSetDlg: CVehSimSetDlg+m_canbitblt: BOOL+m_lockCount: int+m_pWaitDlg: CWaitDlg

    CTrafficSimulationDoc

    #m_sizeDoc: CSize#m_simManager: CSimManager+m_objects: CRoadMapObjList

    1

    1

    5.4.2.2 Sequence Diagram

    Because these use cases use existing functions MFC class to implement, theres no considerable logic to describe

    here.

    5.5 The Others

    Set display style of application.

    Page 32 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    33/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    5.5.1 Use case Model

    Select a style type in style combobox to change the graphical use interface of application.

    User

    Select Style

    5.5.2 Use case Realization

    5.5.2.1 Participants classes

    This group of use cases is processed by [CMainFrame] class..

    CMainFrame

    #m_wndRibbonBar: CMFCRibbonBar#m_MainButton: CMFCRibbonApplicationButton#m_PanelImages: CMFCToolBarImages#m_wndStatusBar: CMFCRibbonStatusBar

    -DECLARE_DYNAMIC(CMainFrame)-CMainFrame()+UpdateUI(pCurrView: CTraff icSimulationView): void+PreCreateWindow(cs: CREATESTRUCT): BOOL-CMainFrame()+AssertValid(): void+Dump(dc: CDumpContext): void#OnCreate(lpCreateStruct: LPCREATESTRUCT): int#OnWindowManager(): void#OnApplicationLook(id: UINT): void#OnUpdateApplicationLook(pCmdUI: CCmdUI): void-DECLARE_MESSAGE_MAP()

    Page 33 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    34/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    5.5.2.2 Sequence Diagram

    This use case is processed from [CMainFrame] class. Because these use cases use MFC function to implement,processing logic is simple here.

    : User

    : CMainFrame

    1 [Select Style]

    2 : OnApplicationLook(id: UINT): void

    3 [CMFCVisualManager::SetDefaultManager]

    4 [RedrawWindow]

    Page 34 of 35

  • 8/6/2019 Traffic Simulation_Software Architecture Design

    35/35

    Traffic SimulationVersion: 1.00

    YYYY.MM.DD

    Software Architecture Design.doc

    6. Deployment View

    Traffic Simulation is a simple application. Just execute it in Windows OS which .NET framework was installed.

    .NET Framework

    Traffic Simulation

    Windows OS

    7. Implementation View

    Source-code Components Organization

    All header files and source files are placed in one folder of project.