thiết kế và chế tạo thiết bị đo độ bọt chi tiết đúc áp lực giao tiếp với máy tính

115 336 0
thiết kế và chế tạo thiết bị đo độ bọt chi tiết đúc áp lực giao tiếp với máy tính

Đ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 SƯ PHẠM KỸ THUẬT THÀNH PHỐ HỒ CHÍ MINH LUẬN VĂN THẠC SĨ HUỲNH THANH TUẤN THIẾT KẾ VÀ CHẾ TẠO THIẾT BỊ ĐO ĐỘ BỌT CHI TIẾT ĐÚC ÁP LỰC GIAO TIẾP VỚI MÁY TÍNH NGÀNH: KỸ THUẬT CƠ KHÍ - 60520103 S K C0 Tp Hồ Chí Minh, tháng 09/2014 BỘ GIÁO DỤC VÀ ĐÀO TẠO TRƯỜNG ĐẠI HỌC SƯ PHẠM KỸ THUẬT THÀNH PHỐ HỒ CHÍ MINH LUẬN VĂN THẠC SĨ HUỲNH THANH TUẤN THIẾT KẾ VÀ CHẾ TẠO THIẾT BỊ ĐO ĐỘ BỌT CHI TIẾT ĐÚC ÁP LỰC GIAO TIẾP VỚI MÁY TÍNH NGÀNH: KỸ THUẬT CƠ KHÍ MÃ SỐ: 60520103 Tp Hồ Chí Minh, tháng 09 năm 2014 BỘ GIÁO DỤC VÀ ĐÀO TẠO TRƯỜNG ĐẠI HỌC SƯ PHẠM KỸ THẬT THÀNH PHỐ HỒ CHÍ MINH LUẬN VĂN THẠC SĨ HUỲNH THANH TUẤN THIẾT KẾ VÀ CHẾ TẠO THIẾT BỊ ĐO ĐỘ BỌT CHI TIẾT ĐÚC ÁP LỰC GIAO TIẾP VỚI MÁY TÍNH NGÀNH: KỸ THUẬT CƠ KHÍ MÃ SỐ: 60520103 Hướng dẫn khoa học: TS HUỲNH NGUYỄN HOÀNG Tp Hồ Chí Minh, tháng 09 năm 2014 LÝ LỊCH KHOA HỌC (Dùng cho nghiên cứu sinh & học viên cao học) Hình 3x4 I LÝ LỊCH SƠ LƢỢC: Họ tên: HUỲNH THANH TUẤN Giới tính: Nam Ngày, tháng, năm sinh: 16/04/1982 Nơi sinh: Tiền Giang Quê quán: Tiền Giang Dân tộc: Kinh Chức vụ, đơn vị công tác trước học tập, nghiên cứu: Giáo viên khoa Cơ Khí – May – Xây Dựng trường Trung cấp nghề khu vực Cai Lậy Địa liên lạc: Ấp Tây 2, Xã Long Định, Huyện Châu Thành, Tỉnh Tiền Giang Điện thoại quan: 0733919922 Di động: 0917644190 Fax: 0733.710.723 Email: tuantcncl@gmail.com II QUÁ TRÌNH ĐÀO TẠO: Cao đẳng liên thông Đại học Hệ đào tạo: Cao đẳng Chính qui Thời gian đào tạo từ: 9/2001 đến 5/2005 Nơi học: Trường Cao Đẳng Sư Phạm Kỹ Thuật Vĩnh Long Ngành học: Cơ Khí Chế Tạo Máy Tên môn thi tốt nghiệp: Cơ lý thuyết, Cơ sở công nghệ chế tao máy thực hành tiện Ngày nơi thi tốt nghiệp: 1/2004 Trường Cao Đẳng Sư Phạm Kỹ Thuật Vĩnh Long Hệ đào tạo: Đại Học hệ vừa làm vừa học Thời gian đào tạo từ: 9/2009 đến 11/2011 Nơi học: Trường Đại Học Sư Phạm Kỹ Thuật TP HỒ CHÍ MINH Ngành học: Cơ Khí Chế Tạo Máy Ngày tốt nghiệp: 11/2011 Trường Đại Học Sư Phạm Kỹ Thuật TP HỒ CHÍ MINH i Thạc sĩ: Hệ đào tạo: Chính qui Thời gian đào tạo từ: 4/2012 đến 10/2014 Nơi học: Trường Đại Học Sư Phạm Kỹ Thuật TP.Hồ Chí Minh Ngành học: Kỹ Thuật Cơ Khí Tên luận văn: Thiết kế chế tạo thiết bị đo độ bọt chi tiết đúc áp lực giao tiếp với máy tính Ngày nơi bảo vệ luận văn: 11/10/2014, Trường Đại Học Sư Phạm Kỹ Thuật TP.Hồ Chí Minh Người hướng dẫn: TS Huỳnh Nguyễn Hoàng Trình độ ngoại ngữ: Anh văn trình độ B III QUÁ TRÌNH CÔNG TÁC CHUYÊN MÔN KỂ TỪ KHI TỐT NGHIỆP ĐẠI HỌC: Thời gian Nơi công tác Công việc đảm nhiệm Từ 11/2007 Trường Trung Cấp Nghề Khu đến Vực Cai Lậy Giáo viên dạy nghề cắt gọt kim loại thuộc Khoa Cơ Khí – May – Xây Dựng LỜI CAM ĐOAN Tôi xin cam đoan công trình nghiên cứu Các số liệu, kết nêu luận văn trung thực chưa công bố công trình khác Tp.Hồ Chí Minh, ngày … tháng …năm 2014 (Ký tên ghi rõ họ tên) Huỳnh Thanh Tuấn ii LỜI CẢM ƠN Xin chân thành gửi lời cảm ơn đến TS Huỳnh Nguyễn Hoàng tận tình hướng dẫn suốt trình thực luận văn Xin chân thành gửi lời cảm ơn đến toàn thể quí thầy cô trường Đại học Sư Phạm Kỹ Thuật TP Hồ Chí Minh giảng dạy, hướng dẫn tạo điều kiện, môi trường học tập tốt cho Xin cảm ơn anh em học viên lớp CKM2012B ngành Kỹ Thuật Cơ Khí chia sẽ, hỗ trợ, giúp đỡ suốt trình học tập Cảm ơn ba mẹ, anh chị em bạn bè động viên suốt thời gian học Xin kính chúc sức khỏe chân thành cảm ơn Học viên Huỳnh Thanh Tuấn iii TÓM TẮT LUẬN VĂN Đề tài thực việc thiết kế chế tạo thiết bị khí tự động, kết hợp với cân điện tử giao tiếp với tính, để tính toán phần trăm độ bọt chi tiết đúc áp lực dựa nguyên lý lực đẩy Archimedes Luận văn thực nghiệm phần cứng với việc sử dụng thiết bị khí, kết hợp cân điện tử giao tiếp với máy tính Sử dụng phần mềm visuatudio để thiết kế giao diện viết code để tính toán trình cân chi tiết môi trường chân không môi trường chất lỏng.Từ đó, máy tính nhận kết từ cân điện tử nhập yêu cầu cần thiết cho phần mềm, phần mềm tự động tính toán cho ta kết phần trăm độ bọt chi tiết mà ta tiến hành cân ABSTRACT Thisthesisperformed the design and manufacture of mechanical equipment automation, combined with electronic scales and communicate with the computer, to calculate the percentage of the level of detail molded foam pressure based on the principle of thrust Archimedes Thesis is experimentedon hardware with the use of mechanical equipment, combine withelectronic scales and communicate with the computer Using Visual Studio software to design the interface and write code to calculate the detailed balance in vacuum environment and liquid environment Therefrom, the computer will receive the results from an electronic scale and enter necessary requirements for software, the software will automatically calculate and give us the results of the foam percentage of detail that we are conducting weight iv MỤC LỤC Trang tựa TRANG Quyết định giao đề tài Lý lịch cá nhân i Lời cam đoan ii Cảm tạ iii Tóm tắt iv Mục lục v Danh sách chữ viết tắt ix Danh sách hình xi Danh sách bảng xiii Chƣơng TỔNG QUAN 1.1 Tổng quan lĩnh vực nghiên cứu 1.2 Mục đích đề tài 1.3 Nhiệm vụ giới hạn đề tài 1.4 Phương pháp nghiên cứu Chƣơng CƠ SỞ LÝ THUYẾT 2.1 Hiện trạng kỹ thuật 2.1.1 Lịch sử phát triển đúc áp lực 2.1.2 Nguyên lý làm việc đúc áp lực chất lượng vật đúc 2.1.2.1 Nguyên lý làm việc 2.1.2.2 Chất lượng vật đúc 2.1.3 Giới thiệu số phương pháp kiểm tra đánh giá đo lường độ bọt 2.1.3.1 Phương pháp Archimedes 10 2.1.3.2 Phương pháp kiểm tra độ bọt thông qua độ cứng vết lõm bể mặt ( Hardness Indentation ) 11 2.1.3.2 Phương pháp kiểm tra độ bọt máy quét điện tử ( Scanning Electron Microscopy 11 v 2.1.3.4 Đo độ bọt phương pháp kĩ thuật số ( Direct Digital Method ) 12 2.1.4 Hiện trạng kỹ thuật Việt Nam 12 2.2 Tính độ bọt theo nguyên lý Archimedes 13 2.2.1 Tính toán độ bọt 14 2.2.2 Tính sai số 16 2.2.3 Khối lượng tối đa chi tiết đo 17 2.2.3.1 Trong không khí 17 2.2.3.2 Trong chất lỏng 17 2.2.3.2 Các thông số môi trường 18 Chƣơng KẾT CẤU CƠ KHÍ 19 3.1 Mô hình thiết kế 3D 19 3.2 Mô hình thiết kế chi tiết 21 3 Cấu tạo cấu máy 23 Chƣơng THIẾT BỊ ĐO 24 4.1 Cân điện tử 24 4.1.1 Cấu tạo cân điện tử 24 4.1.2 Thông số kỹ thuật 26 Chƣơng HỆ THỐNG ĐIỆN VÀ VẬN HÀNH ĐIỀU CHỈNH MÁY 28 5.1 Sơ đồ mạch điện 28 5.2 Nguyên lý hoạt động 29 5.3 Máy biến áp 29 5.3.1Tính toán lõi thép máy biến áp 29 5.3.1.1 Đo kích thước lõi sắt ( đơn vị tính cm ) 29 5.3.1.2 Tính tiết diện lõi sắt 30 vi 5.3.1.3 Tính công suất MBA 30 5.3.2 Tính toán quấn dây 30 5.3.2.1 Tính số vòng dây quấn 30 5.3.2.1 Tính tiết diện dây quấn máy 32 5.4 Mô hình điện thực tế 33 5.5 Mô tả hình ảnh cách vận hành máy 35 5.5.1 Mô tả hình ảnh 35 5.5.2 Vận hành máy 36 5.5.3 Điều chỉnh máy 36 Chƣơng PHƢƠNG THỨC VÀ GIAO THỨC QUA CỔNG COM 37 6.1 Phương thức giao tiếp qua cổng COM chuẩn RS-232 37 6.1.1 Giới thiệu chuẩn giao tiếp RS-232 37 6.1.2 Các đặc trưng chuẩn giao tiếp RS-232 37 6.1.3 Cáp kết nối 41 6.2 Giao thức giao tiếp qua cổng COM 43 Chƣơng LẬP TRÌNH VÀ GIAO DIỆN 44 7.1 Lập trình 44 7.1.1 Chọn ngôn ngữ lập trình 44 7.1.2 Các đối tượng điều khiển sử dụng chương trình 45 7.1.3 Phương pháp kết nối xử lí liệu 46 7.1.3.1 Hướng dẫn kết nối cổng COM ( chuẩn RS-232) cân điện tử 46 7.1.3.2 Sơ đồ kết nối chân 47 7.1.3.3 Công cụ mở cổng COM nhận liệu 47 7.1.3.4 Xử lí liệu 49 7.1.4 Biến module 49 7.1.4.1 Các khái niệm 49 vii Phụ lục GVHD: TS Huỳnh Nguyễn Hoàng textSize = g.MeasureString("V" & vbCrLf & "", myFont) xLocation = x_vl_5 + ((W_c(4) - textSize.Width) / 2) yLocation = Ltrn + ((32 - textSize.Height) / 2) g.DrawString("V" & vbCrLf & " ", myFont, myForeBrush, xLocation, yLocation) ' End Title -' Row data Dim i As Byte For i = To (amount - 1) ' Vẽ n dòng data ' Module draw -g.DrawLine(Pens.Black, x_vl_1, Ltrn + H_c_t + i * H_c, x_vl_1, Ltrn + H_c_t + (i + 1) * H_c) 'Kẻ dọc g.DrawLine(Pens.Black, x_vl_2, Ltrn + H_c_t + i * H_c, x_vl_2, Ltrn + H_c_t + (i + 1) * H_c) 'Kẻ dọc g.DrawLine(Pens.Black, x_vl_3, Ltrn + H_c_t + i * H_c, x_vl_3, Ltrn + H_c_t + (i + 1) * H_c) 'Kẻ dọc g.DrawLine(Pens.Black, x_vl_4, Ltrn + H_c_t + i * H_c, x_vl_4, Ltrn + H_c_t + (i + 1) * H_c) 'Kẻ dọc g.DrawLine(Pens.Black, x_vl_5, Ltrn + H_c_t + i * H_c, x_vl_5, Ltrn + H_c_t + (i + 1) * H_c) 'Kẻ dọc g.DrawLine(Pens.Black, x_vl_6, Ltrn + H_c_t + i * H_c, x_vl_6, Ltrn + H_c_t + (i + 1) * H_c) 'Kẻ dọc g.DrawLine(Pens.Black, Ltr, Ltrn + H_c_t + (i + 1) * H_c, Ltr + W_tbl, Ltrn + H_c_t + (i + 1) * H_c) 'Kẻ ngang ' -End module draw ' -Module fill data ''''''''' Column ''''''''' textSize = g.MeasureString(CStr(i + 1), myFont) xLocation = x_vl_1 + ((W_c(0) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + i * H_c + ((24 - textSize.Height) / 2) g.DrawString(CStr(i + 1), myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' textSize = g.MeasureString(Str(Math.Round(mL(i), 3)), myFont) xLocation = x_vl_2 + ((W_c(1) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + i * H_c + ((24 - textSize.Height) / 2) g.DrawString(Math.Round(mL(i), 3), myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' textSize = g.MeasureString(Str(Math.Round(mF(i), 3)), myFont) HVTH: Huỳnh Thanh Tuấn Trang 84 Phụ lục GVHD: TS Huỳnh Nguyễn Hoàng xLocation = x_vl_3 + ((W_c(2) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + i * H_c + ((24 - textSize.Height) / 2) g.DrawString(Math.Round(mF(i), 3), myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' textSize = g.MeasureString(Str(Math.Round(p(mL(i), mF(i)), 3)), myFont) xLocation = x_vl_4 + ((W_c(3) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + i * H_c + ((24 - textSize.Height) / 2) g.DrawString(Math.Round(p(mL(i), mF(i)), 3), myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' textSize = g.MeasureString(Str(Math.Round(V(mL(i), mF(i)), 3)), myFont) xLocation = x_vl_5 + ((W_c(4) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + i * H_c + ((24 - textSize.Height) / 2) g.DrawString(Math.Round(V(mL(i), mF(i)), 3), myFont, myForeBrush, xLocation, yLocation) ' -End module fill data Next ' End row data '=========================End draw table Dichte========================================== frmPrint.picPreview.Image = BMP End Sub End Module HVTH: Huỳnh Thanh Tuấn Trang 85 Phụ lục GVHD: TS Huỳnh Nguyễn Hoàng Module_tbl_leg_dichte.vb: module vẽ bảng thành phần vật liệu Module Module_tbl_leg_dichte Public Sub tbl_leg_dichte() Dim textSize As SizeF Dim myForeBrush As Brush = Brushes.Black Dim myFont As New Font("Times New Roman", 10, FontStyle.Regular) Dim BMP As Bitmap = Bitmap.FromFile(Application.StartupPath & "\background.bmp") Dim g As Graphics = Graphics.FromImage(BMP) Dim xLocation, yLocation As Single ' Create a Graphics object from the picture box & clear it 'Printing Title textSize = g.MeasureString("POROSITY TEST RESULT", New Font("Times New Roman", 20, FontStyle.Bold)) xLocation = (frmPrint.picPreview.Image.Width - textSize.Width) / yLocation = 20 g.DrawString("POROSITY TEST RESULT", New Font("Times New Roman", 20, FontStyle.Bold), Brushes.Black, xLocation, yLocation) g.DrawLine(Pens.Black, xLocation, 50, xLocation + textSize.Width, 50) 'End print Tile 'Printing Company xLocation = 40 yLocation = 100 g.DrawString("Company: " & frmPrint.txt_company.Text, New Font("Times New Roman", 14, FontStyle.Regular), Brushes.Black, xLocation, yLocation) 'Insert logo ' g.DrawImage(Image.FromFile("D:\nhat\logo.png"), 400, 100) 'End insert logo 'End print Company 'Printing User xLocation = 40 yLocation = 120 g.DrawString("User: " & frmPrint.txt_username.Text, New Font("Times New Roman", 14, FontStyle.Regular), Brushes.Black, xLocation, yLocation) g.DrawLine(Pens.Black, xLocation, 170, xLocation + 700, 170) 'End print User '=========================Draw Table Leg dichte============================================== Dim leg_elm() As String = {"Si", "Cu", "Mn", "Mg", "Fe", "Zn", "Ni", "Ti", "Sn", "Cr", "V", "Al", "C", "P", "Mo", "Co", "W"} ' Nguyên tố Dim dichte() As String = {"2.330", "8.960", "7.400", "1.740", "7.860", "7.130", "8.880", "11.340", "7.280", "7.19", "6.07", "2.700", "2.150", "1.828", "10.200", "8.900", "19.250"} HVTH: Huỳnh Thanh Tuấn Trang 86 Phụ lục GVHD: TS Huỳnh Nguyễn Hoàng Dim Ato() As String = {"28.086", "63.540", "54.940", "24.312", "55.850", "65.370", "58.710", "207.190", "118.690", "51.996", "50.942", "26.982", "12.012", "30.974", "95.940", "58.933", "183.840"} ' Sửa đổi -Dim Ltr As Integer = 170 'Lề trái Dim Ltrn As Integer = 200 ' Lề Dim W_tbl As Integer = 460 ' Độ rộng bảng Dim W_c() As Integer = {104, 124, 120, 112} ' Rộng ô Dim H_c_t As Integer = 32 ' Cao ô tiêu đề ' Dim x_vl_1 As Integer = Ltr ' x đường kẻ dọc Dim x_vl_2 As Integer = Ltr + W_c(0) ' x đường kẻ dọc Dim x_vl_3 As Integer = x_vl_2 + W_c(1) ' x đường kẻ dọc Dim x_vl_4 As Integer = x_vl_3 + W_c(2) ' x đường kẻ dọc Dim x_vl_5 As Integer = x_vl_4 + W_c(3) ' x đường kẻ dọc Dim H_c As Integer = 24 ' Cao ô trừ ô tiêu đề Dim n As Byte ' Số dòng data n = 13 ' Title -g.DrawLine(Pens.Black, Ltr, Ltrn, Ltr + W_tbl, Ltrn) ' đường ngang đầu g.DrawLine(Pens.Black, x_vl_1, Ltrn, x_vl_1, Ltrn + H_c_t) 'Kẻ dọc g.DrawLine(Pens.Black, x_vl_2, Ltrn, x_vl_2, Ltrn + H_c_t) 'Kẻ dọc g.DrawLine(Pens.Black, x_vl_3, Ltrn, x_vl_3, Ltrn + H_c_t) 'Kẻ dọc g.DrawLine(Pens.Black, x_vl_4, Ltrn, x_vl_4, Ltrn + H_c_t) 'Kẻ dọc g.DrawLine(Pens.Black, x_vl_5, Ltrn, x_vl_5, Ltrn + H_c_t) 'Kẻ dọc g.DrawLine(Pens.Black, Ltr, Ltrn + H_c_t, Ltr + W_tbl, Ltrn + H_c_t) ' gạch hết dòng tiêu đề textSize = g.MeasureString("Alloy" & vbCrLf & "element", myFont) xLocation = x_vl_1 + ((W_c(0) - textSize.Width) / 2) yLocation = Ltrn + ((32 - textSize.Height) / 2) g.DrawString("Alloy" & vbCrLf & "element", myFont, myForeBrush, xLocation, yLocation) textSize = g.MeasureString("Density", myFont) xLocation = x_vl_2 + ((W_c(1) - textSize.Width) / 2) yLocation = Ltrn + ((32 - textSize.Height) / 2) g.DrawString("Density", myFont, myForeBrush, xLocation, yLocation) textSize = g.MeasureString("Atomic mass", myFont) xLocation = x_vl_3 + ((W_c(2) - textSize.Width) / 2) HVTH: Huỳnh Thanh Tuấn Trang 87 Phụ lục GVHD: TS Huỳnh Nguyễn Hoàng yLocation = Ltrn + ((32 - textSize.Height) / 2) g.DrawString("Atomic mass", myFont, myForeBrush, xLocation, yLocation) textSize = g.MeasureString("Mass [%]", myFont) xLocation = x_vl_4 + ((W_c(3) - textSize.Width) / 2) yLocation = Ltrn + ((32 - textSize.Height) / 2) g.DrawString("Mass [%]", myFont, myForeBrush, xLocation, yLocation) ' End Title -' Row data Dim i As Byte For i = To CByte(n - 1) ' Vẽ n dòng data ' Module draw -g.DrawLine(Pens.Black, x_vl_1, Ltrn + H_c_t + i * H_c, x_vl_1, Ltrn + H_c_t + (i + 1) * H_c) 'Kẻ dọc g.DrawLine(Pens.Black, x_vl_2, Ltrn + H_c_t + i * H_c, x_vl_2, Ltrn + H_c_t + (i + 1) * H_c) 'Kẻ dọc g.DrawLine(Pens.Black, x_vl_3, Ltrn + H_c_t + i * H_c, x_vl_3, Ltrn + H_c_t + (i + 1) * H_c) 'Kẻ dọc g.DrawLine(Pens.Black, x_vl_4, Ltrn + H_c_t + i * H_c, x_vl_4, Ltrn + H_c_t + (i + 1) * H_c) 'Kẻ dọc g.DrawLine(Pens.Black, x_vl_5, Ltrn + H_c_t + i * H_c, x_vl_5, Ltrn + H_c_t + (i + 1) * H_c) 'Kẻ dọc g.DrawLine(Pens.Black, Ltr, Ltrn + H_c_t + (i + 1) * H_c, Ltr + W_tbl, Ltrn + H_c_t + (i + 1) * H_c) 'Kẻ ngang ' -End module draw ' -Module fill data ''''''''' Column ''''''''' textSize = g.MeasureString(leg_elm(i), myFont) xLocation = x_vl_1 + ((W_c(0) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + i * H_c + ((24 - textSize.Height) / 2) g.DrawString(leg_elm(i), myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' textSize = g.MeasureString(dichte(i), myFont) xLocation = x_vl_2 + ((W_c(1) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + i * H_c + ((24 - textSize.Height) / 2) g.DrawString(dichte(i), myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' textSize = g.MeasureString(Ato(i), myFont) xLocation = x_vl_3 + ((W_c(2) - textSize.Width) / 2) HVTH: Huỳnh Thanh Tuấn Trang 88 Phụ lục GVHD: TS Huỳnh Nguyễn Hoàng yLocation = Ltrn + H_c_t + i * H_c + ((24 - textSize.Height) / 2) g.DrawString(Ato(i), myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' textSize = g.MeasureString(mass(i), myFont) xLocation = x_vl_4 + ((W_c(3) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + i * H_c + ((24 - textSize.Height) / 2) g.DrawString(mass(i), myFont, myForeBrush, xLocation, yLocation) ' -End module fill data Next ' End row data '=========================End draw table Leg dichte========================================== frmPrint.picPreview.Image = BMP End Sub End Module HVTH: Huỳnh Thanh Tuấn Trang 89 Phụ lục GVHD: TS Huỳnh Nguyễn Hoàng Module_tbl_porosity.vb: module vẽ bảng độ bọt Module Module_tbl_porosity Public Sub tbl_porosity() ' username = txt_username.Text ' company = txt_company.Text 'PagePrint() Dim textSize As SizeF Dim myForeBrush As Brush = Brushes.Black Dim myFont As New Font("Times New Roman", 10, FontStyle.Regular) Dim BMP As Bitmap = Bitmap.FromFile(Application.StartupPath & "\background.bmp") Dim g As Graphics = Graphics.FromImage(BMP) Dim xLocation, yLocation As Single Dim p_array(amount - 1), Vh_array(amount - 1), Vp_array(amount - 1) As Single For z = To (amount - 1) p_array(z) = p(mL(z), mF(z)) Vh_array(z) = Vh(p_array(z), V(mL(z), mF(z))) Vp_array(z) = Vp(p_array(z)) Next 'Printing Title textSize = g.MeasureString("POROSITY TEST RESULT", New Font("Times New Roman", 20, FontStyle.Bold)) xLocation = (frmPrint.picPreview.Image.Width - textSize.Width) / yLocation = 20 g.DrawString("POROSITY TEST RESULT", New Font("Times New Roman", 20, FontStyle.Bold), Brushes.Black, xLocation, yLocation) g.DrawLine(Pens.Black, xLocation, 50, xLocation + textSize.Width, 50) 'End print Tile 'Printing Company xLocation = 40 yLocation = 100 g.DrawString("Company: " & frmPrint.txt_company.Text, New Font("Times New Roman", 14, FontStyle.Regular), Brushes.Black, xLocation, yLocation) 'Insert logo ' g.DrawImage(Image.FromFile("D:\nhat\logo.png"), 400, 100) 'End insert logo 'End print Company 'Printing User xLocation = 40 yLocation = 120 g.DrawString("User: " & frmPrint.txt_username.Text, New Font("Times New Roman", 14, FontStyle.Regular), Brushes.Black, xLocation, yLocation) HVTH: Huỳnh Thanh Tuấn Trang 90 Phụ lục GVHD: TS Huỳnh Nguyễn Hoàng g.DrawLine(Pens.Black, xLocation, 170, xLocation + 700, 170) 'End print User '=========================Draw Table Porosity============================================== ' Sửa đổi -Dim Ltr As Integer = 158 'Lề trái Dim Ltrn As Integer = 200 ' Lề Dim W_tbl As Integer = 484 ' Độ rộng bảng Dim W_c() As Integer = {92, 128, 132, 132} ' Rộng ô Dim H_c_t As Integer = 52 ' Cao ô tiêu đề ' Dim x_vl_1 As Integer = Ltr ' x đường kẻ dọc Dim x_vl_2 As Integer = Ltr + W_c(0) ' x đường kẻ dọc Dim x_vl_3 As Integer = x_vl_2 + W_c(1) ' x đường kẻ dọc Dim x_vl_4 As Integer = x_vl_3 + W_c(2) ' x đường kẻ dọc Dim x_vl_5 As Integer = x_vl_4 + W_c(3) ' x đường kẻ dọc Dim H_c As Integer = 24 ' Cao ô trừ ô tiêu đề ' Title -g.DrawLine(Pens.Black, Ltr, Ltrn, Ltr + W_tbl, Ltrn) ' đường ngang đầu g.DrawLine(Pens.Black, x_vl_1, Ltrn, x_vl_1, Ltrn + H_c_t) 'Kẻ dọc g.DrawLine(Pens.Black, x_vl_2, Ltrn, x_vl_2, Ltrn + H_c_t) 'Kẻ dọc g.DrawLine(Pens.Black, x_vl_3, Ltrn, x_vl_3, Ltrn + H_c_t) 'Kẻ dọc g.DrawLine(Pens.Black, x_vl_4, Ltrn, x_vl_4, Ltrn + H_c_t) 'Kẻ dọc g.DrawLine(Pens.Black, x_vl_5, Ltrn, x_vl_5, Ltrn + H_c_t) 'Kẻ dọc g.DrawLine(Pens.Black, Ltr, Ltrn + H_c_t, Ltr + W_tbl, Ltrn + H_c_t) ' gạch hết dòng tiêu đề textSize = g.MeasureString("Object" & vbCrLf & "", myFont) xLocation = x_vl_1 + ((W_c(0) - textSize.Width) / 2) yLocation = Ltrn + ((32 - textSize.Height) / 2) g.DrawString("Object" & vbCrLf & " ", myFont, myForeBrush, xLocation, yLocation) textSize = g.MeasureString("P" & vbCrLf & "", myFont) xLocation = x_vl_2 + ((W_c(1) - textSize.Width) / 2) yLocation = Ltrn + ((32 - textSize.Height) / 2) g.DrawString("P" & vbCrLf & " ", myFont, myForeBrush, xLocation, yLocation) textSize = g.MeasureString("Vh" & vbCrLf & "", myFont) xLocation = x_vl_3 + ((W_c(2) - textSize.Width) / 2) HVTH: Huỳnh Thanh Tuấn Trang 91 Phụ lục GVHD: TS Huỳnh Nguyễn Hoàng yLocation = Ltrn + ((32 - textSize.Height) / 2) g.DrawString("Vh" & vbCrLf & " ", myFont, myForeBrush, xLocation, yLocation) textSize = g.MeasureString("Vp" & vbCrLf & "", myFont) xLocation = x_vl_4 + ((W_c(3) - textSize.Width) / 2) yLocation = Ltrn + ((32 - textSize.Height) / 2) g.DrawString("Vp" & vbCrLf & " ", myFont, myForeBrush, xLocation, yLocation) ' End Title -' Row data Dim i As Byte For i = To (amount - 1) ' Vẽ n dòng data ' Module draw -g.DrawLine(Pens.Black, x_vl_1, Ltrn + H_c_t + i * H_c, x_vl_1, Ltrn + H_c_t + (i + 1) * H_c) 'Kẻ dọc g.DrawLine(Pens.Black, x_vl_2, Ltrn + H_c_t + i * H_c, x_vl_2, Ltrn + H_c_t + (i + 1) * H_c) 'Kẻ dọc g.DrawLine(Pens.Black, x_vl_3, Ltrn + H_c_t + i * H_c, x_vl_3, Ltrn + H_c_t + (i + 1) * H_c) 'Kẻ dọc g.DrawLine(Pens.Black, x_vl_4, Ltrn + H_c_t + i * H_c, x_vl_4, Ltrn + H_c_t + (i + 1) * H_c) 'Kẻ dọc g.DrawLine(Pens.Black, x_vl_5, Ltrn + H_c_t + i * H_c, x_vl_5, Ltrn + H_c_t + (i + 1) * H_c) 'Kẻ dọc g.DrawLine(Pens.Black, Ltr, Ltrn + H_c_t + (i + 1) * H_c, Ltr + W_tbl, Ltrn + H_c_t + (i + 1) * H_c) 'Kẻ ngang ' -End module draw ' -Module fill data ''''''''' Column ''''''''' textSize = g.MeasureString(CStr(i + 1), myFont) xLocation = x_vl_1 + ((W_c(0) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + i * H_c + ((24 - textSize.Height) / 2) g.DrawString(CStr(i + 1), myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' textSize = g.MeasureString(Str(Math.Round(p(mL(i), mF(i)), 3)), myFont) xLocation = x_vl_2 + ((W_c(1) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + i * H_c + ((24 - textSize.Height) / 2) g.DrawString(Math.Round(p(mL(i), mF(i)), 3), myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' HVTH: Huỳnh Thanh Tuấn Trang 92 Phụ lục GVHD: TS Huỳnh Nguyễn Hoàng textSize = g.MeasureString(Str(Math.Round(Vh(p(mL(i), mF(i)), V(mL(i), mF(i))), 3)), myFont) xLocation = x_vl_3 + ((W_c(2) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + i * H_c + ((24 - textSize.Height) / 2) g.DrawString(Math.Round(Vh(p(mL(i), mF(i)), V(mL(i), mF(i))), 3), myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' textSize = g.MeasureString(Str(Math.Round(Vp(p(mL(i), mF(i))), 2)), myFont) xLocation = x_vl_4 + ((W_c(3) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + i * H_c + ((24 - textSize.Height) / 2) g.DrawString(Math.Round(Vp(p(mL(i), mF(i))), 2), myFont, myForeBrush, xLocation, yLocation) ' -End module fill data Next ' End row data ' row Averange -' -Module fill Averange ''''''''' Column ''''''''' textSize = g.MeasureString("Average " & Chr(181), myFont) xLocation = x_vl_1 + ((W_c(0) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + (amount + 1) * H_c + ((24 - textSize.Height) / 2) g.DrawString("Average " & Chr(181), myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' textSize = g.MeasureString(Str(Math.Round(AVERAGE(p_array), 3)), myFont) xLocation = x_vl_2 + ((W_c(1) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + (amount + 1) * H_c + ((24 - textSize.Height) / 2) g.DrawString(Math.Round(AVERAGE(p_array), 3), myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' textSize = g.MeasureString(Str(Math.Round(AVERAGE(Vh_array), 3)), myFont) xLocation = x_vl_3 + ((W_c(2) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + (amount + 1) * H_c + ((24 - textSize.Height) / 2) g.DrawString(Math.Round(AVERAGE(Vh_array), 3), myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' textSize = g.MeasureString(Str(Math.Round(AVERAGE(Vp_array), 2)), myFont) HVTH: Huỳnh Thanh Tuấn Trang 93 Phụ lục GVHD: TS Huỳnh Nguyễn Hoàng xLocation = x_vl_4 + ((W_c(3) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + (amount + 1) * H_c + ((24 - textSize.Height) / 2) g.DrawString(Math.Round(AVERAGE(Vp_array), 2), myFont, myForeBrush, xLocation, yLocation) ' -End module fill Averange ' -Module fill Std.Dev ''''''''' Column ''''''''' textSize = g.MeasureString("Std.Dev σ", myFont) xLocation = x_vl_1 + ((W_c(0) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + (amount + 2) * H_c + ((24 - textSize.Height) / 2) g.DrawString("Std.Dev σ", myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' textSize = g.MeasureString(Str(Math.Round(STDEVP(p_array), 3)), myFont) xLocation = x_vl_2 + ((W_c(1) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + (amount + 2) * H_c + ((24 - textSize.Height) / 2) g.DrawString(Math.Round(STDEVP(p_array), 3), myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' textSize = g.MeasureString(Str(Math.Round(STDEVP(Vh_array), 3)), myFont) xLocation = x_vl_3 + ((W_c(2) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + (amount + 2) * H_c + ((24 - textSize.Height) / 2) g.DrawString(Math.Round(STDEVP(Vh_array), 3), myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' textSize = g.MeasureString(Str(Math.Round(STDEVP(Vp_array), 2)), myFont) xLocation = x_vl_4 + ((W_c(3) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + (amount + 2) * H_c + ((24 - textSize.Height) / 2) g.DrawString(Math.Round(STDEVP(Vp_array), 2), myFont, myForeBrush, xLocation, yLocation) ' -End module fill Std.Dev ' -Module fill +3 ''''''''' Column ''''''''' textSize = g.MeasureString(Chr(181) & " + 3σ", myFont) xLocation = x_vl_1 + ((W_c(0) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + (amount + 4) * H_c + ((24 - textSize.Height) / 2) g.DrawString(Chr(181) & " + 3σ", myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' HVTH: Huỳnh Thanh Tuấn Trang 94 Phụ lục GVHD: TS Huỳnh Nguyễn Hoàng textSize = g.MeasureString(Str(Math.Round(AVERAGE(p_array), 3) + Math.Round(STDEVP(p_array), 3)), myFont) xLocation = x_vl_2 + ((W_c(1) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + (amount + 4) * H_c + ((24 - textSize.Height) / 2) g.DrawString(Math.Round(AVERAGE(p_array), 3) + Math.Round(STDEVP(p_array), 3), myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' textSize = g.MeasureString(Str(Math.Round(AVERAGE(Vh_array), 3) + Math.Round(STDEVP(Vh_array), 3)), myFont) xLocation = x_vl_3 + ((W_c(2) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + (amount + 4) * H_c + ((24 - textSize.Height) / 2) g.DrawString(Math.Round(AVERAGE(Vh_array), 3) + Math.Round(STDEVP(Vh_array), 3), myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' Dim s As Single If (Math.Round(AVERAGE(Vp_array), 2) + Math.Round(STDEVP(Vp_array), 2)) > Then s=1 Else s = Math.Round(AVERAGE(Vp_array), 2) + Math.Round(STDEVP(Vp_array), 2) End If textSize = g.MeasureString(Str(s), myFont) xLocation = x_vl_4 + ((W_c(3) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + (amount + 4) * H_c + ((24 - textSize.Height) / 2) g.DrawString(s, myFont, myForeBrush, xLocation, yLocation) ' -End module fill +3 ' -Module fill -3 ''''''''' Column ''''''''' textSize = g.MeasureString(Chr(181) & " - 3σ", myFont) xLocation = x_vl_1 + ((W_c(0) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + (amount + 5) * H_c + ((24 - textSize.Height) / 2) g.DrawString(Chr(181) & " - 3σ", myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' If (Math.Round(AVERAGE(p_array), 3) - Math.Round(STDEVP(p_array), 3)) < Then s=0 Else HVTH: Huỳnh Thanh Tuấn Trang 95 Phụ lục GVHD: TS Huỳnh Nguyễn Hoàng s = Math.Round(AVERAGE(p_array), 3) - Math.Round(STDEVP(p_array), 3) End If textSize = g.MeasureString(Str(s), myFont) xLocation = x_vl_2 + ((W_c(1) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + (amount + 5) * H_c + ((24 - textSize.Height) / 2) g.DrawString(s, myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' If (Math.Round(AVERAGE(Vh_array), 3) Math.Round(STDEVP(Vh_array), 3)) < Then s=0 Else s = Math.Round(AVERAGE(Vh_array), 3) Math.Round(STDEVP(Vh_array), 3) End If textSize = g.MeasureString(Str(s), myFont) xLocation = x_vl_3 + ((W_c(2) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + (amount + 5) * H_c + ((24 - textSize.Height) / 2) g.DrawString(s, myFont, myForeBrush, xLocation, yLocation) ''''''''' Column ''''''''' If (Math.Round(AVERAGE(Vp_array), 2) Math.Round(STDEVP(Vp_array), 2)) < Then s=0 Else s = Math.Round(AVERAGE(Vp_array), 2) Math.Round(STDEVP(Vp_array), 2) End If textSize = g.MeasureString(Str(s), myFont) xLocation = x_vl_4 + ((W_c(3) - textSize.Width) / 2) yLocation = Ltrn + H_c_t + (amount + 5) * H_c + ((24 - textSize.Height) / 2) g.DrawString(s, myFont, myForeBrush, xLocation, yLocation) ' -End module fill -3 ' End Averange '=========================End draw table Porosity========================================== frmPrint.picPreview.Image = BMP End Sub End Module HVTH: Huỳnh Thanh Tuấn Trang 96 TÀI LIỆU THAM KHẢO [1] Phạm Hùng Kim Khánh, Tài liệu lập trình hệ thống, http://uet.vnu.edu.vn ngày truy câp 5/01/2014 [2] Tan Hoang Mai company,2013,Tìm hiểu cân điện tử, http://candientucaocap.com/Tu-van/tim-hieu-ve-can-dien-tu.html, ngày truy cập 30 /8/2013 [3] Trung Tâm Đào Tạo Và Phát Triển Sắc Ký, 2014, Hướng dẫn sử dụng, kiểm tra, hiệu chuẩn cân phân tích, [4] Huỳnh Nguyễn Hoàng,2005,Ein Beitrag zur Simulation des Druckgießens,Luận văn Tiến sĩ, Đại học Otto-von-Guericke, Magdeburg.Đức [5] Giáo trình đúc kim loại, 2005, chương 3: Tính toán thiết kế thiết bị đo theo nguyên lý archimedes từ trang 15 đến trang 43, TS Huỳnh Nguyễn Hoàng, ĐHSPKT – TPHCM [6] Giáo trình công nghệ kim loại, chương 5: đúc hợp kim từ trang 58 đến trang 70, PGS.TS Hoàng Trọng Bá ĐHSPKT – TPHCM [7] Giáo trình visual basic 6.0, Nguyễn Sơn Hải, Cụm công nghệ thông tin Bộ Giáo Dục Đào Tạo tháng – 2006 [8] Giáo trình visual studio – 123doc.vn S K L 0

Ngày đăng: 29/10/2016, 16:09

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

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

Tài liệu liên quan