Académique Documents
Professionnel Documents
Culture Documents
Version 1.00
Traffic Simulation
Version: 1.00
YYYY.MM.DD
Revision History
Page 2 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
Table of Contents
2. References ..................................................................................................................4
5. Use-Case View.............................................................................................................5
7. Implementation View.................................................................................................35
Page 3 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
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 then
presents 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.
Traffic Simulation
Create MapObj
Simulate
MFC Framework
Windows API
Page 4 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
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.
Page 5 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
Page 6 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
Page 7 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
1. Delete
Use [CTrafficSimulationView], [CTrafficSimulationDoc], [CMapObj], [CDetector], [CDetector] in this
realization. Sequence diagram for delete function is developed as below diagram.
Page 8 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
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
Traffic Simulation
Version: 1.00
YYYY.MM.DD
Page 10 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
Page 11 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
Page 12 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
Page 13 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
Page 14 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
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.
Page 15 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
Page 16 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
Page 17 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
Page 18 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
Page 19 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
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
Traffic Simulation
Version: 1.00
YYYY.MM.DD
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
Traffic Simulation
Version: 1.00
YYYY.MM.DD
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
Traffic Simulation
Version: 1.00
YYYY.MM.DD
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
Traffic Simulation
Version: 1.00
YYYY.MM.DD
6. Pedestrian Setting:
Set up pedestrian property for simulation
Page 24 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
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
Traffic Simulation
Version: 1.00
YYYY.MM.DD
Select a type and click [Show Graph] to see [Pedestrian Simulation Statistic Graph] window.
Page 26 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
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
Traffic Simulation
Version: 1.00
YYYY.MM.DD
View
Page 28 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
CMainFrame
#m_wndRibbonBar: CMFCRibbonBar
#m_MainButton: CMFCRibbonApplicationButton
#m_PanelImages: CMFCToolBarImages
#m_wndStatusBar: CMFCRibbonStatusBar
<<CppMacro>>-DECLARE_DYNAMIC(CMainFrame)
<<create>>-CMainFrame()
+UpdateUI(pCurrView: CTrafficSimulationView): void
+PreCreateWindow(cs: CREATESTRUCT): BOOL
<<destroy>>-CMainFrame()
+AssertValid(): void
+Dump(dc: CDumpContext): void
#OnCreate(lpCreateStruct: LPCREATESTRUCT): int
#OnWindowManager(): void
#OnApplicationLook(id: UINT): void
#OnUpdateApplicationLook(pCmdUI: CCmdUI): void
<<CppMacro>>-DECLARE_MESSAGE_MAP()
Page 29 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
Page 30 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
File
New
Open
User
Save
Save As
Close
Exit
Page 31 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
CTrafficSimulationDoc
#m_sizeDoc: CSize
#m_simManager: CSimManager
+m_objects: CRoadMapObjList
1
1
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
Page 32 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
Select Style
User
CMainFrame
#m_wndRibbonBar: CMFCRibbonBar
#m_MainButton: CMFCRibbonApplicationButton
#m_PanelImages: CMFCToolBarImages
#m_wndStatusBar: CMFCRibbonStatusBar
<<CppMacro>>-DECLARE_DYNAMIC(CMainFrame)
<<create>>-CMainFrame()
+UpdateUI(pCurrView: CTrafficSimulationView): void
+PreCreateWindow(cs: CREATESTRUCT): BOOL
<<destroy>>-CMainFrame()
+AssertValid(): void
+Dump(dc: CDumpContext): void
#OnCreate(lpCreateStruct: LPCREATESTRUCT): int
#OnWindowManager(): void
#OnApplicationLook(id: UINT): void
#OnUpdateApplicationLook(pCmdUI: CCmdUI): void
<<CppMacro>>-DECLARE_MESSAGE_MAP()
Page 33 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
: CMainFrame
: User
1 [Select Style]
3 [CMFCVisualManager::SetDefaultManager]
4 [RedrawWindow]
Page 34 of 35
Traffic Simulation
Version: 1.00
YYYY.MM.DD
6. Deployment View
Traffic Simulation is a simple application. Just execute it in Windows OS which .NET framework was installed.
Windows OS
Traffic Simulation
.NET Framework
7. Implementation View
Source-code Components Organization
All header files and source files are placed in one folder of project.
Page 35 of 35