THIẾT kế CHẾ tạo hệ THỐNG TRUYỀN THANH KHÔNG dây điều KHIỂN từ XA BẰNG kỹ THUẬT số

110 1 0
THIẾT kế CHẾ tạo hệ THỐNG TRUYỀN THANH KHÔNG dây điều KHIỂN từ XA BẰNG kỹ THUẬT số

Đ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

BỘ GIÁO DỤC VÀ ĐÀO TẠO TRƯỜNG ĐẠI HỌC BÁCH KHOA HÀ NỘI - LUẬN VĂN THẠC SĨ KHOA HỌC NGÀNH : KỸ THUẬT ĐIỆN TỬ HỆ THỐNG THÔNG TIN ĐỊNH VỊ NGÔ DUY TÂN NGƯỜI HƯỚNG DẪN: NGUYỄN VŨ SƠN HÀ NỘI - 2007 LỜI CAM ĐOAN Tôi tên là: Ngô Duy Tân, học viên lớp cao học Điện tử – Viễn thơng khố 2005 - 2007 xin cam đoan: Bản luận văn “Hệ thống thơng tin định vị” tơi viết với hướng dẫn khoa học nhiệt tình Tiến sĩ Nguyễn Vũ Sơn – giảng viên Khoa Điện tử – Viễn Thông, Đại học Bách Khoa Hà Nội Nội dung luận văn không chép từ tài liệu công bố Các sản phẩm, kết nêu luận văn kết nghiên cứu, thực nghiệm thực tế Hà nội, tháng 11/2007 Học viên Ngô Duy Tân MỤC LỤC LỜI CAM ĐOAN MỤC LỤC DANH MỤC CÁC CHỮ VIẾT TẮT DANH MỤC CÁC HÌNH VẼ DANH MỤC CÁC BẢNG MỞ ĐẦU CHƯƠNG GIỚI THIỆU CHUNG 1.1 Hệ thống thông tin định vị 1.2 Các loại hình ứng dụng 1.3 Những tảng công nghệ cho ứng dụng hệ thống thông tin định vị 10 CHƯƠNG HỆ THỐNG VỆ TINH ĐỊNH VỊ TOÀN CẦU 11 2.1 Sơ lược trình phát triển 11 2.2 Nguyên tắc chung hệ thống vệ tinh định vị toàn cầu 11 2.3 Hệ thống GPS 14 2.3.1 Kiến trúc hệ thống GPS 15 2.3.2 Phần vũ trụ (chùm vệ tinh GPS) 16 2.3.2 Phần điều khiển (các trạm điều khiển mặt đất) 16 2.1.3 Phần người sử dụng 18 2.4 Tín hiệu hệ thống GPS 19 2.5 Máy thu tín hiệu GPS 21 2.6 Các phép đo tín hiệu vệ tinh tổ hợp chúng nhằm xác định vị trí tốc độ máy thu 23 2.6.1 Phép đo mã 23 2.6.2 Phép đo pha sóng mang 24 2.6.3 Phép đo Doppler 25 2.6.4 Sai phân phép đo kỹ thuật DGPS 26 2.6.5 Tổ hợp tuyến tính giá trị đo pha khác tần số 26 2.7 Các nguồn sai số phép đo tín hiệu vệ tinh định vị toàn cầu 29 CHƯƠNG III HỆ THỐNG QUẢN LÝ, GIÁM SÁT CÁC PHƯƠNG TIỆN GIAO THÔNG 32 3.1 Tổng quan hệ thống 32 3.2 Thiết kế, chế tạo thiết bị điện tử gắn xe 33 3.2.1 Sơ đồ khối 33 3.2.2 Mô tả khối chức 34 3.2.3 Thiết kế, chế tạo mô đun điện tử xử lý trung tâm 63 3.2.4 Một số kết đạt 79 KẾT LUẬN VÀ KIẾN NGHỊ 80 TÀI LIỆU THAM KHẢO 81 Phụ lục 1: 82 LISTING MÃ NGUỒN PHẦN MỀM CHO VI ĐIỀU KHIỂN PIC16F876 82 Phụ lục 2: 93 LISTING MÃ NGUỒN PHẦN MỀM TRÊN VB6.0 93 DANH MỤC CÁC CHỮ VIẾT TẮT Từ viết tắt Từ đầy đủ AVL Automatic Vehicle Location BPSK Binary Phase-Shift Keying C/A Clear/Access hay Coarse/Acquisition CDMA Code Division Multiple Access GIS Geographic Information System GLONASS Global'naya Navigatsionnaya Sputnikovaya Sistema - Global Navigation Satellite System GPRS General Packet Radio Service GPS Global Positioning System GPST GPS Time GSM Global System for Mobile Communications MCS Master Control Station NAVSTAR Navigation Signal Timing and Ranging NMEA National Marine Electronics Associatio PPS Precise Positioning Service PVT Position, Velocity and Time SPS Standard Positioning Service SA Selective Availability UTC Universal Time Coordinated USART Universal Synchronous/Asynchronous Receiver/Transmitter DANH MỤC CÁC HÌNH VẼ Hình 2.1 Q trình thu nhận tín hiệu vệ tinh máy thu Hình 2.2 Ngun tắc xác định vị trí, tốc độ thời gian máy thu dùng hệ thống vệ tinh định vị Hình 2.3 Qui trình định vị hệ thống vệ tinh định vị tồn cầu Hình 2.4 Hệ thống vệ tinh GPS Hình 2.5 Cấu trúc phần điều khiển hệ thống vệ tinh GPS Hình 2.6 Một số máy thu GPS Hình 2.7 Dải phổ tín hiệu GPS Hình 3.1 Sơ đồ khối hệ thống AVL Hình 3.2 Sơ đồ khối thiết bị điện tử gắn xe Hình 3.3 Sơ đồ chân chip vi điều khiển PIC16F876 Hình 3.4 Sơ đồ khối chức PIC16F876 Hình 3.5 Mơ đun thu nhận tín hiệu GPS AG-MTI1\ Hình 3.6 Các thơng số kích thước mơ đun AG-MTI1 Hình 3.7 Mơ đun SIM300 Hình 3.8 Hình dạng kích thước mơ đun SIM300 Hình 3.9 Mạch lọc nguồn Hình 3.10 Quá trình khởi động tín hiệu PWRKEY Hình 3.11 Tắt mơ đun SIM300 tín hiệu điều khiển PWRKEY Hình 3.12 Restart mơ đun SIM300 đường điều khiển PWRKEY Hình 3.13 Sơ đồ kết nối cổng nối tiếp mơ đun SIM300 Hình 3.14 Giao tiếp mơ đun SIM300 SIM card Hình 3.15 Sơ đồ chân SIM card Hình 3.16 Mạch thị trạng thái kết nối GSM Hình 3.17 Sơ đồ nguyên lý khối nguồn Hình 3.18 Sơ đồ nguyên lý khối xử lý trung tâm Hình 3.19 Sơ đồ chân IC tách/ghép kênh CD4052 Hình 3.20 Sơ đồ khối chức IC CD4052 Hình 3.21 Sơ đồ mạch điện tử tạo kết nối RS-232 Hình 3.22 Sơ đồ nguyên lý mạch giao tiếp với mơ đun SIM300 Hình 3.23 Kết nối với mơ đun AG-MTI1 Hình 3.24 Sơ đồ ngun lý khối mạch vào Hình 3.25 Sơ đồ nguyên lý mạch điện tử xử lý trung tâm Hình 3.26 Sơ đồ mạch in PCB mặt (top layer) Hình 3.27 Sơ đồ mạch in PCB mặt (bottom layer) Hình 3.28 Hình ảnh mơ 3D mạch in PCB (bằng phần mềm Protel DXP) Hình 3.29 Sơ đồ thuật tốn Hình 3.30 Giao diện chương trình Hình 3.31 Bảng lưu trữ thơng tin xe Hình 3.32 Bảng số liệu bám xe (tracking data) Hình 3.33 Giao diện cài đặt cho thiết bị xe DANH MỤC CÁC BẢNG Bảng 2.1 Tóm tắt khả định vị dùng hệ thống GPS Bảng 2.2 Các loại tổ hợp tuyến tính hai giá trị đo pha hai tần số L1 L2 dành cho phương pháp sai phân kép với phép đo pha Bảng 2.3 Các nguồn sai số phép đo tín hiệu vệ tinh định vị toàn cầu GPS Bảng 3.1 Bảng mô tả giao diện 20 chân mô đun AG-MTI1 Bảng 3.2 Định dạng khung GGA Bảng 3.3 Định dạng liệu khung GLL Bảng 3.4 Định dạng khung số liệu GSA Bảng 3.5 Định dạng khung số liệu GSV Bảng 3.6 Định dạng khung số liệu RMC Bảng 3.7 Định dạng khung số liệu VTG Bảng 3.8 Các đặc trưng kỹ thuật mô đun SIM300 Bảng 3.9 Tốc độ truyền GPRS kiểu mã hóa Bảng 3.10 Bảng phân loại nhóm chức tín hiệu mô đun SIM300 Bảng 3.11 Các tham số lệnh AT+CFUN Bảng 3.12 Các tín hiệu giao tiếp với SIM card Bảng 3.13 tín hiệu SIM card Bảng 3.14 Trạng thái mô đun SIM300 đèn báo trạng thái LED Bảng 3.15 Tần số thu/phát mô đun SIM300 Bảng 3.16 Công suất thu/phát mơ đun SIM300 Bảng 3.18 Bảng tín hiệu đầu nối 60 chân mô đun SIM300 Bảng 3.19 Bảng hoạt động IC CD4052 MỞ ĐẦU Ngày nay, phát triển vô mạnh mẽ công nghệ vi điện tử, công nghệ thông tin truyền thông, đặc biệt Internet tạo tảng công nghệ vững cho nhiều ứng dụng thực tiễn khác nhau, góp phần làm thay đổi chức cách thức quản lý số lĩnh vực định Chúng ta nghe nói nhiều đến ứng dụng “từ xa” như: học từ xa (e-learning), khám chữa bệnh từ xa (e-medicine), hội thảo từ xa (e-conference),… Tuy nhiên, ứng dụng công nghệ cao dựa vào hệ thống vệ tinh định vị toàn cầu (hệ thống GPS) hệ thống thông tin địa lý (GIS) phát triển ứng dụng vào Việt Nam từ cách không lâu Các ứng dụng GPS/GIS Việt Nam giới hạn lĩnh vực hẹp, chưa có tích hợp nhiều cơng nghệ tiên tiến để hình thành ứng dụng có quy mơ rộng khắp Bên cạnh đó, quản lý giám sát từ xa đặc biệt giám sát vị trí nhu cầu có tiềm ứng dụng Việt Nam Nhận thức tình hình nhu cầu thực tế tác giả luận văn lựa chọn đề tài: Hệ thống thông tin định vị Nội dung đề tài tập trung chủ yếu vào ứng dụng công nghệ GPS/GIS mạng thông tin di động GPRS Internet để hoàn thiện hệ thống quản lý, giám sát đối tượng từ xa Nội dung luận văn bao gồm chương chính: Chương Giới thiệu chung Chương Hệ thống vệ tinh định vị toàn cầu Chương Hệ thống quản lý, giám sát phương tiện giao thông Nội dung chương phần giới thiệu tổng quan hệ thống thơng tin định vị Chương trình bày số vấn đề lý thuyết hệ thống định vị toàn cầu đặc biệt hệ thống GPS Nội dung chương q trình tích hợp triển khai ứng dụng công nghệ GPS, GIS, GPRS Internet để hình thành nên hệ thống giám sát vị trí phương tiện giao thơng từ xa Trong đó, tác giả trình bày q trình thiết kế, chế tạo mô đun điện tử phát triển phần mềm (firmware software) liên quan đến ứng dụng Do hạn chế thời gian, kinh nghiệm điều kiện thực tế nên nội dung luận văn cịn nhiều điểm thiết sót Tác giả mong nhận đóng góp ý kiến để luận văn hoàn thiện Tác giả xin chân thành cảm ơn TS Nguyễn Vũ Sơn, giảng viên khoa Điện tử-Viễn thông, đồng nghiệp bạn bè động viên, giúp đỡ tác giả q trình hồn thành luận văn Hà Nội, tháng 11/2007 Học viên Ngô Duy Tân CHƯƠNG GIỚI THIỆU CHUNG 1.1 Hệ thống thông tin định vị Hệ thống thông tin định vị hay gọi hệ thống dựa thơng tin vị trí đối tượng chuyển động hệ thống phát triển nhằm mục đích giám sát, theo dõi vị trí, trạng thái đối tượng chuyển động Tuỳ theo yêu cầu ứng dụng q trình theo dõi, giám sát địi hỏi tức thời (online hay real-time) hay không tức thời (off-line) Hệ thống kết hợp bốn thành phần sau đây: - Hệ thống định vị vệ tinh tồn cầu - Mạng thơng tin di động - Mạng Internet - Hệ thống thông tin địa lý 1.2 Các loại hình ứng dụng Hiện nay, ứng dụng hệ thống thông tin định vị chia thành bốn nhóm sau đây: a Quản lý đội xe (Fleet management) Đây ứng dụng phổ biến hiệu tổ chức, công ty hay cá nhân có nhu cầu quản lý vị trí đội xe họ Khi biết xác vị trí thành viên đội xe đơn vị quản lý có phương án điều phối, quản lý thành viên đó, đặc biệt chuyến cơng tác vùng xa xôi, hẻo lánh Như tiết kiệm nhiều chi phí quản lý điều hành đồng thời làm tăng hiệu kinh tế cho tổ chức b Cung cấp thơng tin gắn với vị trí (localized information) Trong ứng dụng này, thông tin liên quan đến địa điểm tập hợp lưu trữ sở liệu trung tâm Với sở liệu này, người sử dụng dễ dàng tìm địa gần di chuyển Các thơng tin vị trí trạm xăng, khách sạn, nhà hàng, trung tâm mua sắm,… c Các ứng dụng cứu hộ cấp cứu Khi người sử dụng rơi phải trường hợp khẩn cấp cần hỗ trợ trung tâm thơng tin vị trí tình trạng người sử dụng 95 End Sub Private Sub btnClearLabels_Click() Dim i As Long, handle As Long 'clear all labels for each layer For i = To Map1.NumLayers - handle = Map1.LayerHandle(i) Map1.ClearLabels handle Next End Sub Private Sub btnColorLayer_Click() Dim handle As Long, i As Long, fieldIndex As Long Dim colorScheme As New MapWinGIS.ShapefileColorScheme Dim sf As MapWinGIS.Shapefile Dim break As MapWinGIS.ShapefileColorBreak 'check to make sure the selected item is not nothing If (lvLegend.SelectedItem Is Nothing) Then Exit Sub On Error GoTo Cancel 'get the field index to color by fieldIndex = InputBox("Enter the Field index to color by.", "Field Index", 0) 'create a coloring scheme on the field index value handle = lvLegend.SelectedItem.Tag Set sf = Map1.GetObject(handle) 'find the max and values for that field Dim As Double, max As Double = sf.CellValue(0, 0) max = sf.CellValue(0, 0) For i = To sf.NumShapes - If (sf.CellValue(fieldIndex, i) < min) Then = sf.CellValue(fieldIndex, i) End If If (sf.CellValue(fieldIndex, i) > max) Then max = sf.CellValue(fieldIndex, i) End If Next 96 With colorScheme LayerHandle = handle 'the field value to color by colorScheme.fieldIndex = fieldIndex 'create a new break object Set break = New MapWinGIS.ShapefileColorBreak break.Caption = "test" break.StartColor = RGB(255, 0, 0) break.EndColor = RGB(0, 0, 255) break.StartValue = break.EndValue = max 'add the break colorScheme.Add break End With 'apply the coloring scheme for this layer Map1.ApplyLegendColors colorScheme Cancel: End Sub Private Sub btnDrawPoint_Click() Dim hDraw As Long Dim xProjCenter As Double, yProjCenter As Double Dim xScreenCenter As Double, yScreenCenter As Double Dim extents As MapWinGIS.extents Set extents = Map1.extents 'find the center of the view xProjCenter = extents.xMin + ((extents.xMax - extents.xMin) / 2) yProjCenter = extents.yMin + ((extents.yMax - extents.yMin) / 2) 'create a new drawing surface If (SpatiallyReferenced.Value = True) Then hDraw = Map1.NewDrawing(dlSpatiallyReferencedList) Map1.DrawPoint xProjCenter, yProjCenter, 50, RGB(255, 0, 0) Else Map1.ProjToPixel xProjCenter, yProjCenter, xScreenCenter, yScreenCenter hDraw = Map1.NewDrawing(dlScreenReferencedList) 97 Map1.DrawPoint xScreenCenter, yScreenCenter, 50, RGB(255, 0, 0) End If End Sub Private Sub btnDrawLine_Click() Dim hDraw As Long Dim yProjCenter As Double, xProjMin As Double, xProjMax As Double Dim yScreenCenter As Double, xScreenMin As Double, xScreenMax As Double Dim extents As MapWinGIS.extents Set extents = Map1.extents 'find the center of the view yProjCenter = extents.yMin + ((extents.yMax - extents.yMin) / 2) xProjMin = extents.xMin xProjMax = extents.xMax 'create a new drawing surface If (SpatiallyReferenced.Value = True) Then hDraw = Map1.NewDrawing(dlSpatiallyReferencedList) Map1.DrawLine xProjMin, yProjCenter, xProjMax, yProjCenter, 5, RGB(0, 255, 0) Else Map1.ProjToPixel xProjMin, yProjCenter, xScreenMin, yScreenCenter Map1.ProjToPixel xProjMax, yProjCenter, xScreenMax, yScreenCenter hDraw = Map1.NewDrawing(dlScreenReferencedList) Map1.DrawLine xScreenMin, yScreenCenter, xScreenMax, yScreenCenter, 5, RGB(0, 255, 0) End If End Sub Private Sub Form_Unload(Cancel As Integer) bQuit = True Unload Me End Sub Private Sub lvLegend_ItemCheck(ByVal Item As MSComctlLib.ListItem) Dim handle As Long Dim i As Long 'cycle through all of the layers to set visibility For i = To lvLegend.ListItems.Count 98 'get the handle of the layer handle = lvLegend.ListItems(i).Tag If (lvLegend.ListItems(i).Checked = True) Then Map1.LayerVisible(handle) = True Else Map1.LayerVisible(handle) = False End If Next End Sub Private Sub btnMoveLayerDown_Click() Dim handle As Long Dim name As String Dim Index As Long Dim Item As ListItem Dim retval As Boolean Dim visible As Boolean 'check to make sure the selected item is not nothing If (lvLegend.SelectedItem Is Nothing) Then Exit Sub handle = lvLegend.SelectedItem.Tag Index = lvLegend.SelectedItem.Index name = lvLegend.SelectedItem.text visible = lvLegend.SelectedItem.Checked 'move the selected layer down If Index < lvLegend.ListItems.Count Then retval = Map1.MoveLayerDown(Map1.LayerPosition(handle)) lvLegend.ListItems.Remove Index Set Item = lvLegend.ListItems.Add(Index + 1, , name) Item.ListSubItems.Add , , handle Item.Tag = handle Item.Checked = visible End If End Sub Private Sub btnMoveLayerUp_Click() Dim handle As Long 99 Dim name As String Dim Index As Long Dim Item As ListItem Dim retval As Boolean Dim visible As Boolean 'check to make sure the selected item is not nothing If (lvLegend.SelectedItem Is Nothing) Then Exit Sub handle = lvLegend.SelectedItem.Tag Index = lvLegend.SelectedItem.Index name = lvLegend.SelectedItem.text visible = lvLegend.SelectedItem.Checked 'move the selected layer up If (Index > 1) Then retval = Map1.MoveLayerUp(Map1.LayerPosition(handle)) lvLegend.ListItems.Remove Index Set Item = lvLegend.ListItems.Add(Index - 1, , name) Item.ListSubItems.Add , , handle Item.Tag = handle Item.Checked = visible End If End Sub Private Sub btnZoomToSelLayer_Click() Dim handle As Long If (Not lvLegend.SelectedItem.Tag Is Nothing) Then handle = lvLegend.SelectedItem.Tag Map1.ZoomToLayer handle End If End Sub Private Sub cbFieldToUse_DropDown() 'clear all the items in the combo box cbFieldToUse.Clear Dim i As Long, handle As Long 'add all the fields for this layer to the combo box If cbLayerToLabel.ListCount > And cbLayerToLabel.text "" Then handle = Split(cbLayerToLabel.text, " - ")(0) 100 Dim sf As MapWinGIS.Shapefile Set sf = Map1.GetObject(handle) For i = To sf.NumFields - cbFieldToUse.AddItem (i & " - " & sf.Field(i).name) Next End If End Sub Private Sub cbLayerToLabel_DropDown() 'clear all the items in the combo box cbLayerToLabel.Clear 'add all the layers of the map to the combo box Dim i As Long, handle As Long, layerName As String For i = To Map1.NumLayers - handle = Map1.LayerHandle(i) layerName = Map1.layerName(handle) cbLayerToLabel.AddItem (handle & " - " & layerName) Next End Sub Private Sub cmdFontColor_Click() Dim newColor As Long cdlOpen.CancelError = True On Error GoTo ERRORHANDLER cdlOpen.ShowColor On Error GoTo newColor = cdlOpen.color cmdFontColor.BackColor = newColor ERRORHANDLER: 'cancel was clicked End Sub Private Sub cmdLabel_Click() Dim sf As MapWinGIS.Shapefile Dim handle As Long Dim fieldIndex As Long Dim text As String Dim i As Long 101 If (cbLayerToLabel.text = "" Or cbFieldToUse = "") Then Exit Sub On Error Resume Next 'get the layer handle handle = Split(cbLayerToLabel, " - ")(0) 'get the field index fieldIndex = Split(cbFieldToUse, " - ")(0) Set sf = Map1.GetObject(handle) For i = To sf.NumShapes - text = sf.CellValue(fieldIndex, i) Map1.AddLabel handle, text, cmdFontColor.BackColor, sf.Shape(i).extents.xMin, sf.Shape(i).extents.yMin, hjCenter Next i End Sub Private Sub cmdRemoveLayer_Click() End Sub Private Sub Form_Load() Map1.Width = Screen.Width \ Screen.TwipsPerPixelX - 1.1 * Map1.Left Map1.CursorMode = cmNone ' Map1.SendSelectBoxFinal = True Map1.SendMouseUp = True Map1.SendMouseMove = True 'add the header to the list view lvLegend.ColumnHeaders.Add , , "Name", lvLegend.Width / lvLegend.ColumnHeaders.Add , , "Handle", lvLegend.Width / cmbCity.AddItem "Hanoi" cmbCity.AddItem "Ho Chi Minh" End Sub Private Sub cmdZoomIn_Click() Map1.ZoomIn (0.3) End Sub Private Sub cmdZoomOut_Click() Map1.ZoomOut (0.3) 102 End Sub Private Sub cmdZoomPrev_Click() Map1.ZoomToPrev End Sub Private Sub cmdZoomToLayer_Click() Dim handle As Long On Error GoTo ERRORHANDLER 'check to make sure the selected item is not nothing If (lvLegend.SelectedItem Is Nothing) Then Exit Sub handle = lvLegend.SelectedItem.Tag Map1.ZoomToLayer (handle) ERRORHANDLER: 'cancel was clicked End Sub Private Sub cmdZoomToShape_Click() Dim shpIndex As Integer Dim handle As Long 'check to make sure the selected item is not nothing If (lvLegend.SelectedItem Is Nothing) Then Exit Sub On Error GoTo ERRORHANDLER handle = lvLegend.SelectedItem.Tag shpIndex = InputBox("Enter the shape index to zoom to.", "Zoom to shape", 0) Map1.ZoomToShape handle, shpIndex ERRORHANDLER: 'cancel was clicked End Sub Private Sub lvLegend_ItemClick(ByVal Item As MSComctlLib.ListItem) Dim i As Long, handle As Long 'cycle through all the layers and unselect any selected shapes For i = To Map1.NumLayers - handle = Map1.LayerHandle(i) Map1.ShapeLayerLineColor(handle) = Map1.ShapeLayerLineColor(handle) Map1.ShapeLayerFillColor(handle) = Map1.ShapeLayerFillColor(handle) Next 103 End Sub Private Sub Map1_FileDropped(ByVal Filename As String) 'If a shapefile is dropped on the map then load it ' AddShapefile (Filename) End Sub Private Sub AddShapefile(Filename As String) Dim FileSys As New Scripting.FileSystemObject Dim sf As MapWinGIS.Shapefile, handle As Long Dim ErrMsg As String Dim Item As ListItem If LCase(Right(Filename, 3)) = "shp" Then Set sf = New MapWinGIS.Shapefile If sf.Open(Filename) = False Then ErrMsg = sf.ErrorMsg(sf.LastErrorCode) MsgBox "The file, " & Filename & " failed to open for the following reason:" & vbCrLf & ErrMsg, vbCritical Exit Sub Else handle = Map1.AddLayer(sf, True) 'exit if this is not a vaild layer handle If handle < Then Exit Sub 'set the name of this layer Map1.layerName(handle) = FileSys.GetFileName(sf.Filename) 'add the layer to the legend Set Item = lvLegend.ListItems.Add(1, , Map1.layerName(handle)) Item.ListSubItems.Add , , handle Item.Tag = handle Item.Checked = True 'set random colors for the fill color and outline color Map1.ShapeLayerFillColor(handle) = RGB((255 - 1) * Rnd, (255 - 1) * Rnd, (255 - 1) * Rnd) Map1.ShapeLayerLineColor(handle) = RGB((255 - 1) * Rnd, (255 - 1) * Rnd, (255 - 1) * Rnd) End If Else MsgBox "The file, " & Filename & " is not a shapefile." 104 End If End Sub Private Sub Map1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long) Dim ex As Double Dim ey As Double Map1.PixelToProj x, y, ex, ey txtLong.text = Format(ex, "###.######") txtLat.text = Format(ey, "###.######") End Sub Private Sub Map1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Long, ByVal y As Long) 'This will draw a point where you click on the map if you have a 'spatially referenced shapefile or grid displayed on the map Dim ex As Double, ey As Double 'Convert pixel coordinates of mouse up event e.x and e.y to projected coordinates returned by x and y Map1.PixelToProj x, y, ex, ey 'Create a new drawing layer in map1 ' Map1.NewDrawing (dlSpatiallyReferencedList) 'Draw a red point where the mouse up event occured in map1 CreateMobile ex, ey, "Car ID", RGB(255, 0, 0) End Sub Private Sub Map1_SelectBoxFinal(ByVal Left As Long, ByVal Right As Long, ByVal Bottom As Long, ByVal Top As Long) 'Example of selection using a bounding box 'For this event to be called, you must have set the property: Map1.SendSelectBoxFinal = True 'Find all of the shapes in layer that are selected by this box Dim sf As MapWinGIS.Shapefile Dim ex As New MapWinGIS.extents Dim xMin As Double, yMin As Double, xMax As Double, yMax As Double Dim Result As Boolean Dim ShapeIDs As Variant '() As Long Dim handle As Long Dim i As Long 'check to make sure the selected item is not nothing If (lvLegend.SelectedItem Is Nothing) Then Exit Sub 105 handle = lvLegend.SelectedItem.Tag If Map1.CursorMode cmSelection Then Exit Sub If Map1.NumLayers > Then Set sf = Map1.GetObject(handle) Map1.PixelToProj Left, Bottom, xMin, yMin Map1.PixelToProj Right, Top, xMax, yMax ex.SetBounds xMin, yMin, 0, xMax, yMax, Result = sf.SelectShapes(ex, 0, INTERSECTION, ShapeIDs) If Result = True Then Map1.ShapeLayerFillColor(handle) = Map1.ShapeLayerFillColor(handle) 'reset the color of the shapes Map1.ShapeLayerLineColor(handle) = Map1.ShapeLayerLineColor(handle) For i = To UBound(ShapeIDs) Map1.ShapeFillColor(handle, ShapeIDs(i)) = vbYellow Map1.ShapeLineColor(handle, ShapeIDs(i)) = vbRed Next i End If End If End Sub Private Sub mnuCarDetail_Click() frmCarDetails.Show End Sub Private Sub mnuCinfig_Click() frmConfig.Show End Sub Private Sub mnuHelp_Click() frmAbout.Show End Sub Private Sub mnuQuit_Click() Unload Me End Sub Public Function GetOpenFile() As String Dim Filename As String Dim FileSys As New Scripting.FileSystemObject cdlOpen.CancelError = False cdlOpen.Filter = "Mapinfo Table File|;*.tab" 106 cdlOpen.ShowOpen Filename = cdlOpen.Filename If FileSys.FileExists(Filename) = False Then MsgBox "The file, " & Filename & " was not found.", vbCritical GetOpenFile = "" Else GetOpenFile = Filename End If End Function Private Sub CreateMobile(lon As Double, lat As Double, car_id As String, color As OLE_COLOR) 'Create our symbol Dim handle As Long Map1.ClearDrawings Map1.ClearLabels handle handle = lvLegend.SelectedItem.Tag Map1.AddLabel handle, car_id, color, lon, lat, hjCenter Map1.NewDrawing dlSpatiallyReferencedList Map1.LockWindow (MapWinGIS.tkLockMode.lmLock) Map1.DrawCircle lon, lat, SYMBOL_RADIUS, color, True Map1.LockWindow (MapWinGIS.tkLockMode.lmUnlock) End Sub Private Sub mnuTrackingData_Click() frmTrackingData.Show End Sub Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) Select Case Button.Index Case 1: mnuQuit_Click Case 3: AddLayer Case 4: RemoveLayer Case 6: Map1.CursorMode = cmZoomIn Case 7: Map1.CursorMode = cmZoomOut Case 8: Map1.CursorMode = cmPan Case 9: Map1.ZoomToMaxExtents Case 11: frmTrackingData.Show 'frmCarDetails.Show End Select End Sub 107 Public Sub AddLayer() Dim Filename As String Dim FileSys As New Scripting.FileSystemObject Dim sf As New MapWinGIS.Shapefile cdlOpen.CancelError = True On Error GoTo ERRORHANDLER cdlOpen.Filter = sf.CdlgFilter 'this gives you a filter for shapefiles cdlOpen.ShowOpen Filename = cdlOpen.Filename If FileSys.FileExists(Filename) = False Then MsgBox "The file, " & Filename & " was not found.", vbCritical Exit Sub Else AddShapefile Filename End If Exit Sub ERRORHANDLER: End Sub Public Sub RemoveLayer() Dim handle As Long 'check to make sure the selected item is not nothing If (lvLegend.SelectedItem Is Nothing) Then Exit Sub handle = lvLegend.SelectedItem.Tag 'remove this layer from the map Map1.RemoveLayer (handle) 'remove this layer from the legend Dim i As Long For i = To lvLegend.ListItems.Count If (lvLegend.ListItems(i).Tag = handle) Then lvLegend.ListItems.Remove (i) End If Next End Sub 108 TÓM TẮT LUẬN VĂN Học viên: Ngô Duy tân Tên luận văn: “Hệ thống thông tin định vị” Người hướng dẫn khoa học: TS Nguyễn Vũ Sơn Ngày nay, với phát triển mạnh mẽ công nghệ điện tử-tin họctruyền thông đặc biệt mạng Internet, mạng thông tin di động Việc tích hợp cơng nghệ thành ứng dụng có ý nghĩa thực tiễn, đáp ứng đòi hỏi ngày tăng tổ chức, cá nhân vấn đề đặt với nhà nghiên cứu phát triển công nghệ nhà quản lý Nắm bắt xu hướng công nghệ nhu cầu thực tế, đề tài luận văn “Hệ thống thơng tin định vị” bao gồm phần sau: - Phần giới thiệu lý thuyến hệ thống định vị toàn cầu - Ứng dụng hệ thống định vị tồn cầu GPS cơng tác giám sát, quản lý phương tiện giao thông Phần ứng dụng tích hợp cơng nghệ: mạng thơng tin di động (GPRS/GSM), hệ thống định vị tồn cầu (GPS) mạng Internet để phát triển hệ thống giám sát quản lý phương tiện giao thông từ xa Thông tin thu nhận xe gồm có: vị trí địa lý, tốc độ, thời gian thực trạng thái khác Các thông tin tập hợp thành khung số liệu truyền máy tính trung tâm qua mạng GPRS/GSM Máy tính trung tâm tập hợp sử lý liệu để tuỳ theo yêu cầu sử dụng Sản phẩm luận văn có tiềm ứng dụng điều kiện Việt Nam Nếu triển khai thành cơng có ý nghĩa ứng dụng quản lý, giám sát phương tiện giao thông đặc biệt cho hệ thống xe bus, taxi đoàn xe chuyên dụng 109 SUMMARY OF THE MSC THESIS Student: Ngo Duy Tan Supervisor: Dr Nguyen Vu Son Name of the thesis: “Positioning information system” Nowadays, the rapid development of micro-electronics, informatics and communications technology has formed a good foundations for hi-tech applications The integration of Internet, wireless communications has also met strict requirements of clients Being aware of the technology trend and clients’ requirements, the project “Positioning information system” has been selected as the Msc Thesis The thesis can be divided into two main parts: - Theory and background of satellite-based postioning systems - Development of real-time GPS-based automatic vehicle location system The main goal of the thesis is to complete a system to monitor moving vehicles with assistance of GPS technology, and GPRS/GSM cellular wireless communications network The device located on the moving vehicle collects the following data: location and velocity of the vehicle (from GPS receiver) and some specific status data This data is packed in to an message an being sent to the Master control station via GPRS/GSM network At the control center, the data is acquired, extracted and processed by users’ requirements This system is expected to be very successful and applicable to many clients with flexibility and effectiveness ... 1.1 Hệ thống thông tin định vị 1.2 Các loại hình ứng dụng 1.3 Những tảng công nghệ cho ứng dụng hệ thống thông tin định vị 10 CHƯƠNG HỆ THỐNG VỆ TINH ĐỊNH VỊ TOÀN CẦU... vệ tinh máy thu Hình 2.2 Ngun tắc xác định vị trí, tốc độ thời gian máy thu dùng hệ thống vệ tinh định vị Hình 2.3 Qui trình định vị hệ thống vệ tinh định vị tồn cầu Hình 2.4 Hệ thống vệ tinh... nghệ định vị tồn cầu cịn gọi cơng nghệ định vị nhờ vệ tinh vệ tinh thành phần quan trọng để tạo khả định vị toàn cầu 2.2 Nguyên tắc chung hệ thống vệ tinh định vị toàn cầu Các hệ thống vệ tinh định

Ngày đăng: 20/07/2022, 08:06

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

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

Tài liệu liên quan