Đồ án Nghiên cứu về công nghệ không dây WiMax và ứng dụng

rtPS (Các dịch vụ thăm dò thời gian thực): được thiết kế hỗ trợ các luồng dịch vụ thời gian thực mà tạo ra các gói dữ liệu kích thước thay đổi trên cơ sở định kỳ, như video MPEG. Dịch vụ cung cấp các cơ hội yêu cầu unicast định kỳ thời gian thực, mà thỏa mãn các nhu cầu thời gian thực của luồng và cho phép SS chỉ ra kích thước cấp phát mong muốn. Dịch vụ này đòi hỏi overhead yêu cầu hơn UGS, nhưng hỗ trợ các kích thước cấp phát thay đổi để tối ưu hiệu quả truyền dữ liệu. BS sẽ cung cấp các cơ hội unicast định kỳ. SS bị cấm sử dụng các cơ hội yêu cầu cạnh tranh đối với kết nối đó. BS có thể đưa ra các cơ hội yêu cầu unicast được quy định bởi dịch vụ này dù là các yêu cầu chu kỳ hiện tại chưa hoàn thành. Điều này dẫn đến SS chỉ sử dụng các cơ hội yêu cầu unicast để đạt được các cơ hội truyền dẫn đường lên (SS vẫn có thể sử dụng các loại burst cấp phát dữ liệu tự nguyện cho truyền dẫn đường lên cũng được).

doc230 trang | Chia sẻ: oanh_nt | Lượt xem: 1498 | Lượt tải: 0download
Bạn đang xem trước 20 trang tài liệu Đồ án Nghiên cứu về công nghệ không dây WiMax và ứng dụng, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
cture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds - xu - dr * song_u(Round(x, 2))) End If k = ds - xu - dr * song_u(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend Loop k = ds - xp td = sample 'Ve song EKG tu phai qua trai Do While (td > 0) x = 13.09 'Ve song u While Round(x, 2) >= 12.9 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds - xu - dr * song_u(Round(x, 2))) End If k = ds - xu - dr * song_u(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 11.19 'Ve song t While Round(x, 2) >= 9.8 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds - xt - dr * song_t(Round(x, 2))) End If k = ds - xt - dr * song_t(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 8.19 'Ve song s While Round(x, 2) >= 8.03 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds - xs_v5 - dr * song_s_v5(Round(x, 2))) End If k = ds - xs_v5 - dr * song_s_v5(Round(x, 2)) x = x - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 6.21 'Ve song r While Round(x, 2) >= 5.8 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds - xqrs - dr * song_qrs(Round(x, 2))) End If k = ds - xqrs - dr * song_qrs(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 3.91 'Ve song q While Round(x, 2) >= 3.5 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds - xq - dr * song_q(Round(x, 2))) End If k = ds - xq - dr * song_q(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 1.99 'Ve song p While Round(x, 2) >= 0.01 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds - dr * song_p(Round(x, 2))) End If k = ds - dr * song_p(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend Loop End Sub Private Sub draw_ekg_v6(ByVal sample As Integer) Dim k As Single Dim x As Single Dim td As Integer Dim i As Integer Dim check As Boolean k = ds - xp td = sample check = False Picture1.ForeColor = &H80000005 Picture1.Line (10, 1)-(10, Picture1.ScaleHeight) 'Ve song EKG tu trai qua phai Do While (check = False) x = 0.01 'Ve song p While Round(x, 2) < 2 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) 'Xoa truoc khi ve Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds - dr * song_p(Round(x, 2))) 'Ve song End If k = ds - dr * song_p(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 3.5 'Ve song q While Round(x, 2) < 3.92 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds - xq - dr * song_q(Round(x, 2))) End If k = ds - xq - dr * song_q(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 5.8 'Ve song r While Round(x, 2) < 6.22 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds - xqrs - dr * song_qrs(Round(x, 2))) End If k = ds - xqrs - dr * song_qrs(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 8.03 'Ve song s While Round(x, 2) < 8.2 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds - xs_v6 - dr * song_s_v6(Round(x, 2))) End If k = ds - xs_v6 - dr * song_s_v6(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 9.8 'Ve song t While Round(x, 2) < 11.2 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds - xt - dr * song_t(Round(x, 2))) End If k = ds - xt - dr * song_t(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 12.9 'Ve song u While Round(x, 2) < 13.1 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds - xu - dr * song_u(Round(x, 2))) End If k = ds - xu - dr * song_u(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend Loop k = ds - xp td = sample 'Ve song EKG tu phai qua trai Do While (td > 0) x = 13.09 'Ve song u While Round(x, 2) >= 12.9 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds - xu - dr * song_u(Round(x, 2))) End If k = ds - xu - dr * song_u(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 11.19 'Ve song t While Round(x, 2) >= 9.8 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds - xt - dr * song_t(Round(x, 2))) End If k = ds - xt - dr * song_t(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 8.19 'Ve song s While Round(x, 2) >= 8.03 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds - xs_v6 - dr * song_s_v6(Round(x, 2))) End If k = ds - xs_v6 - dr * song_s_v6(Round(x, 2)) x = x - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 6.21 'Ve song r While Round(x, 2) >= 5.8 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds - xqrs - dr * song_qrs(Round(x, 2))) End If k = ds - xqrs - dr * song_qrs(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 3.91 'Ve song q While Round(x, 2) >= 3.5 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds - xq - dr * song_q(Round(x, 2))) End If k = ds - xq - dr * song_q(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 1.99 'Ve song p While Round(x, 2) >= 0.01 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds - dr * song_p(Round(x, 2))) End If k = ds - dr * song_p(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend Loop End Sub Private Sub draw_ekg_v4(ByVal sample As Integer) Dim k As Single Dim x As Single Dim td As Integer Dim i As Integer Dim check As Boolean k = ds - xp td = sample check = False Picture1.ForeColor = &H80000005 Picture1.Line (td, 1)-(td, Picture1.ScaleHeight) Picture1.Line (td + 10, 1)-(td + 10, Picture1.ScaleHeight) Picture1.Line (td - 10, 1)-(td - 10, Picture1.ScaleHeight) 'Ve song EKG tu trai qua phai Do While (check = False) x = 1.5 'Ve song q While Round(x, 2) < 1.9 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds_v4 - xq_v4 - dr * song_q_v4(Round(x, 2))) End If k = ds_v4 - xq_v4 - dr * song_q_v4(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 1.09 'Ve song p While Round(x, 2) < 1.81 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) 'Xoa truoc khi ve Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds_v4 - dr * song_p(Round(x, 2))) 'Ve song End If k = ds_v4 - dr * song_p(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 3.72 'Ve song q While Round(x, 2) < 4.1 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds_v4 - xq_v4 - dr * song_q_v4(Round(x, 2))) End If k = ds_v4 - xq_v4 - dr * song_q_v4(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 5.8 'Ve song r While Round(x, 2) < 6.09 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds_v4 - xqrs_v4 - dr * song_qrs_v4(Round(x, 2))) End If k = ds_v4 - xqrs_v4 - dr * song_qrs_v4(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 8.06 'Ve song s While Round(x, 2) < 8.4 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds_v4 - xs_v4 - dr * song_s_v4(Round(x, 2))) End If k = ds_v4 - xs_v4 - dr * song_s_v4(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 10.2 'Ve song t While Round(x, 2) < 11.2 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds_v4 - xt - dr * song_t(Round(x, 2))) End If k = ds_v4 - xt - dr * song_t(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 12.9 'Ve song u While Round(x, 2) < 13.1 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds_v4 - xu - dr * song_u(Round(x, 2))) End If k = ds_v4 - xu - dr * song_u(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend Loop k = ds - xp td = sample 'Ve song EKG tu phai qua trai Do While (td > 0) x = 13.09 'Ve song u While Round(x, 2) >= 12.9 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds_v4 - xu - dr * song_u(Round(x, 2))) End If k = ds_v4 - xu - dr * song_u(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 11.19 'Ve song t While Round(x, 2) >= 10.2 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds_v4 - xt - dr * song_t(Round(x, 2))) End If k = ds_v4 - xt - dr * song_t(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 8.39 'Ve song s While Round(x, 2) >= 8.06 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds_v4 - xs_v4 - dr * song_s_v4(Round(x, 2))) End If k = ds_v4 - xs_v4 - dr * song_s_v4(Round(x, 2)) x = x - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 6.08 'Ve song r While Round(x, 2) >= 5.8 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds_v4 - xqrs_v4 - dr * song_qrs_v4(Round(x, 2))) End If k = ds_v4 - xqrs_v4 - dr * song_qrs_v4(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 4.09 'Ve song q While Round(x, 2) >= 3.72 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds_v4 - xq_v4 - dr * song_q_v4(Round(x, 2))) End If k = ds_v4 - xq_v4 - dr * song_q_v4(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 1.8 'Ve song p While Round(x, 2) >= 1.09 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds_v4 - dr * song_p(Round(x, 2))) End If k = ds_v4 - dr * song_p(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 1.89 'Ve song q While Round(x, 2) >= 1.5 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds_v4 - xq_v4 - dr * song_q_v4(Round(x, 2))) End If k = ds_v4 - xq_v4 - dr * song_q_v4(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend Loop End Sub Private Sub draw_ekg_v3(ByVal sample As Integer) Dim k As Single Dim x As Single Dim td As Integer Dim i As Integer Dim check As Boolean k = ds_v3 - xp_v3 td = sample check = False Picture1.ForeColor = &H80000005 Picture1.Line (10, 1)-(10, Picture1.ScaleHeight) 'Ve song EKG tu trai qua phai Do While (check = False) x = 1.55 'Ve song p While Round(x, 2) < 2.1 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) 'Xoa truoc khi ve Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds_v3 - dr * song_p_v3(Round(x, 2))) 'Ve song End If k = ds_v3 - dr * song_p_v3(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 3.7 'Ve song q While Round(x, 2) < 3.91 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds_v3 - xq_v3 - dr * song_q_v3(Round(x, 2))) End If k = ds_v3 - xq_v3 - dr * song_q_v3(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 5.98 'Ve song r While Round(x, 2) < 6.06 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds_v3 - xqrs_v3 - dr * song_qrs_v3(Round(x, 2))) End If k = ds_v3 - xqrs_v3 - dr * song_qrs_v3(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 8.02 'Ve song s While Round(x, 2) < 8.3 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds_v3 - xs_v3 - dr * song_s_v3(Round(x, 2))) End If k = ds_v3 - xs_v3 - dr * song_s_v3(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 10.17 'Ve song t While Round(x, 2) < 10.6 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds_v3 - xt_v3 - dr * song_t_v3(Round(x, 2))) End If k = ds_v3 - xt_v3 - dr * song_t_v3(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 12.35 'Ve song u While Round(x, 2) < 12.65 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds_v3 - xu_v3 - dr * song_u_v3(Round(x, 2))) End If k = ds_v3 - xu_v3 - dr * song_u_v3(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend Loop k = ds_v3 - xp_v3 td = sample 'Ve song EKG tu phai qua trai Do While (td > 0) x = 12.64 'Ve song u While Round(x, 2) >= 12.35 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds_v3 - xu_v3 - dr * song_u_v3(Round(x, 2))) End If k = ds_v3 - xu_v3 - dr * song_u_v3(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 10.5 'Ve song t While Round(x, 2) >= 10.17 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds_v3 - xt_v3 - dr * song_t_v3(Round(x, 2))) End If k = ds_v3 - xt_v3 - dr * song_t_v3(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 8.29 'Ve song s While Round(x, 2) >= 8.02 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds_v3 - xs_v3 - dr * song_s_v3(Round(x, 2))) End If k = ds_v3 - xs_v3 - dr * song_s_v3(Round(x, 2)) x = x - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 6.06 'Ve song r While Round(x, 2) >= 5.98 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds_v3 - xqrs_v3 - dr * song_qrs_v3(Round(x, 2))) End If k = ds_v3 - xqrs_v3 - dr * song_qrs_v3(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 3.9 'Ve song q While Round(x, 2) >= 3.7 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds_v3 - xq_v3 - dr * song_q_v3(Round(x, 2))) End If k = ds_v3 - xq_v3 - dr * song_q_v3(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 2.19 'Ve song p While Round(x, 2) >= 1.55 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds_v3 - dr * song_p_v3(Round(x, 2))) End If k = ds_v3 - dr * song_p_v3(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend Loop End Sub Private Sub draw_ekg_v1(ByVal sample As Integer) Dim k As Single Dim x As Single Dim td As Integer Dim i As Integer Dim check As Boolean k = ds_v1 - xp_v1 td = sample check = False Picture1.ForeColor = &H80000005 Picture1.Line (td + 10, 1)-(td + 10, Picture1.ScaleHeight) 'Ve song EKG tu trai qua phai Do While (check = False) x = 1.55 'Ve song p While Round(x, 2) < 2.1 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) 'Xoa truoc khi ve Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds_v1 - dr * song_p_v1(Round(x, 2))) 'Ve song End If k = ds_v1 - dr * song_p_v1(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 3.7 'Ve song q While Round(x, 2) < 3.91 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds_v1 - xq_v1 - dr * song_q_v1(Round(x, 2))) End If k = ds_v1 - xq_v1 - dr * song_q_v1(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 5.96 'Ve song r While Round(x, 2) < 6.1 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds_v1 - xqrs_v1 - dr * song_qrs_v1(Round(x, 2))) End If k = ds_v1 - xqrs_v1 - dr * song_qrs_v1(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 8.02 'Ve song s While Round(x, 2) < 8.3 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds_v1 - xs_v1 - dr * song_s_v1(Round(x, 2))) End If k = ds_v1 - xs_v1 - dr * song_s_v1(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 10.17 'Ve song t While Round(x, 2) < 10.6 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds_v1 - xt_v1 - dr * song_t_v1(Round(x, 2))) End If k = ds_v1 - xt_v1 - dr * song_t_v1(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 12.35 'Ve song u While Round(x, 2) < 12.65 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td + 10, ds_v1 - xu_v1 - dr * song_u_v1(Round(x, 2))) End If k = ds_v1 - xu_v1 - dr * song_u_v1(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend Loop k = ds_v1 - xp_v1 td = sample 'Ve song EKG tu phai qua trai Do While (td > 0) x = 12.64 'Ve song u While Round(x, 2) >= 12.35 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds_v1 - xu_v1 - dr * song_u_v1(Round(x, 2))) End If k = ds_v1 - xu_v1 - dr * song_u_v1(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 10.5 'Ve song t While Round(x, 2) >= 10.17 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds_v1 - xt_v1 - dr * song_t_v1(Round(x, 2))) End If k = ds_v1 - xt_v1 - dr * song_t_v1(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 8.3 'Ve song s While Round(x, 2) >= 8.02 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds_v1 - xs_v1 - dr * song_s_v1(Round(x, 2))) End If k = ds_v1 - xs_v1 - dr * song_s_v1(Round(x, 2)) x = x - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 6.1 'Ve song r While Round(x, 2) >= 5.96 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds_v1 - xqrs_v1 - dr * song_qrs_v1(Round(x, 2))) End If k = ds_v1 - xqrs_v1 - dr * song_qrs_v1(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 3.9 'Ve song q While Round(x, 2) >= 3.7 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds_v1 - xq_v1 - dr * song_q_v1(Round(x, 2))) End If k = ds_v1 - xq_v1 - dr * song_q_v1(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 2.19 'Ve song p While Round(x, 2) >= 1.55 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &H8000000D Picture1.Line (td, k)-(td - 10, ds_v1 - dr * song_p_v1(Round(x, 2))) End If k = ds_v1 - dr * song_p_v1(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend Loop End Sub Private Sub Command1_Click() Unload Me End Sub Private Sub Command2_Click() If val_speed > 0 Then val_speed = val_speed - 1 Text5.Text = val_speed * 10 + 10 & " mm/s" Timer1.Interval = val_speed * 20 + 1 End If End Sub Private Sub Command7_Click() If val_speed < 4 Then val_speed = val_speed + 1 Text5.Text = val_speed * 10 + 10 & " mm/s" Timer1.Interval = val_speed * 20 + 1 End If End Sub Private Sub Command4_Click() If f_nt < 0.07 Then f_nt = f_nt + 0.01 cal_td_nt = calculate_td_nt Text3.Text = Round(f_nt * 100 - 3) * 10 End If End Sub Private Sub Command5_Click() If f_nt > 0.05 Then f_nt = f_nt - 0.01 cal_td_nt = calculate_td_nt Text3.Text = Round(f_nt * 100 - 3) * 10 End If End Sub Private Sub Command6_Click() If Combo1.Text = " I" Then Combo1.Text = "II" ElseIf Combo1.Text = "II" Then Combo1.Text = "III" ElseIf Combo1.Text = "III" Then Combo1.Text = "V1" ElseIf Combo1.Text = "V1" Then Combo1.Text = "V2" ElseIf Combo1.Text = "V2" Then Combo1.Text = "V3" ElseIf Combo1.Text = "V3" Then Combo1.Text = "V4" ElseIf Combo1.Text = "V4" Then Combo1.Text = "V5" ElseIf Combo1.Text = "V5" Then Combo1.Text = "V6" ElseIf Combo1.Text = "V6" Then Combo1.Text = "aVF" ElseIf Combo1.Text = "aVF" Then Combo1.Text = "aVL" ElseIf Combo1.Text = "aVL" Then Combo1.Text = "aVR" Else Combo1.Text = " I" End If End Sub Private Sub Form_Load() dr = 1500 f_nt = 0.06 val_speed = 2 Combo1.AddItem " I" Combo1.AddItem "II" Combo1.AddItem "III" Combo1.AddItem "V1" Combo1.AddItem "V2" Combo1.AddItem "V3" Combo1.AddItem "V4" Combo1.AddItem "V5" Combo1.AddItem "V6" Combo1.AddItem "aVF" Combo1.AddItem "aVL" Combo1.AddItem "aVR" Combo1.Text = " I" change End Sub Private Sub change() cal_td = calculate_td cal_td_v = calculate_td_v cal_td_nt = calculate_td_nt cal_td_aVF = calculate_td_aVF cal_td_aVL = calculate_td_aVL cal_td_aVR = calculate_td_aVR cal_td_i = calculate_td_i cal_td_iii = calculate_td_iii cal_td_v5 = calculate_td_v5 cal_td_v4 = calculate_td_v4 cal_td_v3 = calculate_td_v3 cal_td_v1 = calculate_td_v1 xp = dr * song_p(0.01) xq = xp - dr * song_q(3.5) xqrs = xp - dr * song_qrs(5) xs = xp - dr * song_s(7.5) xt = xp - dr * song_t(9.5) xu = xp - dr * song_u(12) xp_v3 = dr * song_p_v3(1.2) xq_v3 = xp_v3 - dr * song_q_v3(3.5) xqrs_v3 = xp_v3 - dr * song_qrs_v3(5) xs_v3 = xp_v3 - dr * song_s_v3(7.5) xt_v3 = xp_v3 - dr * song_t_v3(9.5) xu_v3 = xp_v3 - dr * song_u_v3(12) xp_v1 = dr * song_p_v1(1.2) xq_v1 = xp_v1 - dr * song_q_v1(3.5) xqrs_v1 = xp_v1 - dr * song_qrs_v1(5.5) xs_v1 = xp_v1 - dr * song_s_v1(7.5) xt_v1 = xp_v1 - dr * song_t_v1(9.5) xu_v1 = xp_v1 - dr * song_u_v1(12) xs_aVF = xp - dr * song_s_aVF(3.3) xs_aVL = xp - dr * song_s_aVL(8.4) xs_i = xp - dr * song_s_i(7.5) xs_v5 = xp - dr * song_s_v5(7.5) xs_v6 = xp - dr * song_s_v6(7.5) xq_v4 = xp - dr * song_q_v4(3) xqrs_v4 = xp - dr * song_qrs_v4(5.5) xs_v4 = xp - dr * song_s_v4(7.5) xp_aVR = dr * song_p_aVR(0.8) xq_aVR = xp_aVR - dr * song_q_aVR(3.5) xs_aVR = xp_aVR - dr * song_s_aVR(5.5) xt_aVR = xp_aVR - dr * song_t_aVR(10) xu_aVR = xp_aVR - dr * song_u_aVR(12) xp_iii = dr * song_p_iii(1.2) xq_iii = xp_iii - dr * song_q_iii(3.5) xqrs_iii = xp_iii - dr * song_qrs_iii(5.5) xs_iii = xp_iii - dr * song_s_iii(8.5) xt_iii = xp_iii - dr * song_t_iii(10) xp_v = dr * song_p_v(1.65) xq_v = xp_v - dr * song_q(3.5) xqrs_v = xp_v - dr * song_qrs_v(5.5) xs_v = xp_v - dr * song_s_v(7.8) xt_v = xp_v - dr * song_t_v(9.8) xu_v = xp_v - dr * song_u(12.5) End Sub Private Sub Slider2_Change() dr = 500 * Slider2.Value change End Sub Private Sub Timer1_Timer() Static tdd As Integer If Combo1.Text = "II" Then draw_ekg (tdd) If tdd >= cal_td Then tdd = cal_td / 10 Else tdd = tdd + cal_td / 10 End If ElseIf Combo1.Text = "V2" Then draw_ekg_v (tdd) If tdd >= cal_td_v Then tdd = cal_td_v / 10 Else tdd = tdd + cal_td_v / 10 End If ElseIf Combo1.Text = "aVF" Then draw_ekg_aVF (tdd) If tdd >= cal_td_aVF Then tdd = cal_td_aVF / 10 Else tdd = tdd + cal_td_aVF / 10 End If ElseIf Combo1.Text = "aVL" Then draw_ekg_aVL (tdd) If tdd >= cal_td_aVL Then tdd = cal_td_aVL / 10 Else tdd = tdd + cal_td_aVL / 10 End If ElseIf Combo1.Text = "aVR" Then draw_ekg_aVR (tdd) If tdd >= cal_td_aVR Then tdd = cal_td_aVR / 10 Else tdd = tdd + cal_td_aVR / 10 End If ElseIf Combo1.Text = " I" Then draw_ekg_i (tdd) If tdd >= cal_td_i Then tdd = cal_td_i / 10 Else tdd = tdd + cal_td_i / 10 End If ElseIf Combo1.Text = "III" Then draw_ekg_iii (tdd) If tdd >= cal_td_iii Then tdd = cal_td_iii / 10 Else tdd = tdd + cal_td_iii / 10 End If ElseIf Combo1.Text = "V5" Then draw_ekg_v5 (tdd) If tdd >= cal_td_v5 Then tdd = cal_td_v5 / 10 Else tdd = tdd + cal_td_v5 / 10 End If ElseIf Combo1.Text = "V6" Then draw_ekg_v6 (tdd) If tdd >= cal_td_v5 Then tdd = cal_td_v5 / 10 Else tdd = tdd + cal_td_v5 / 10 End If ElseIf Combo1.Text = "V4" Then draw_ekg_v4 (tdd) If tdd >= cal_td_v4 Then tdd = cal_td_v4 / 10 Else tdd = tdd + cal_td_v4 / 10 End If ElseIf Combo1.Text = "V3" Then draw_ekg_v3 (tdd) If tdd >= cal_td_v3 Then tdd = cal_td_v3 / 10 Else tdd = tdd + cal_td_v3 / 10 End If ElseIf Combo1.Text = "V1" Then draw_ekg_v1 (tdd) If tdd >= cal_td_v1 Then tdd = cal_td_v1 / 10 Else tdd = tdd + cal_td_v1 / 10 End If End If End Sub Private Sub Timer2_Timer() Static tdd As Integer nhip_tho (tdd) If tdd >= cal_td_nt Then tdd = cal_td_nt / 10 Else tdd = tdd + cal_td_nt / 10 End If End Sub Private Function calculate_td() As Integer Dim m As Integer Dim x As Single x = 0.01 While Round(x, 2) < 2 x = Round(x, 2) + f m = m + 1 Wend x = 3.5 While Round(x, 2) < 3.92 x = Round(x, 2) + f m = m + 1 Wend x = 5.8 While Round(x, 2) < 6.22 x = Round(x, 2) + f m = m + 1 Wend x = 8.1 While Round(x, 2) < 8.27 x = Round(x, 2) + f m = m + 1 Wend x = 9.07 While Round(x, 2) < 11.2 x = Round(x, 2) + f m = m + 1 Wend x = 12.9 While Round(x, 2) < 13.1 x = Round(x, 2) + f m = m + 1 Wend calculate_td = 10 * m End Function Private Function calculate_td_aVF() As Integer Dim m As Integer Dim x As Single x = 0.01 While Round(x, 2) < 2 x = Round(x, 2) + f m = m + 1 Wend x = 3.33 While Round(x, 2) < 4.17 x = Round(x, 2) + f m = m + 1 Wend x = 5.8 While Round(x, 2) < 6.22 x = Round(x, 2) + f m = m + 1 Wend x = 3.77 While Round(x, 2) < 3.9 x = Round(x, 2) + f m = m + 1 Wend x = 9.07 While Round(x, 2) < 11.2 x = Round(x, 2) + f m = m + 1 Wend x = 12.9 While Round(x, 2) < 13.1 x = Round(x, 2) + f m = m + 1 Wend calculate_td_aVF = 10 * m End Function Private Function calculate_td_v() As Integer Dim m As Integer Dim x As Single x = 1.65 While Round(x, 2) < 2 x = Round(x, 2) + f_v m = m + 1 Wend x = 3.7 While Round(x, 2) < 3.92 x = Round(x, 2) + f_v m = m + 1 Wend x = 5.97 While Round(x, 2) < 6.04 x = Round(x, 2) + f_v m = m + 1 Wend x = 8.02 While Round(x, 2) < 8.15 x = Round(x, 2) + f_v m = m + 1 Wend x = 10 While Round(x, 2) < 10.5 x = Round(x, 2) + f_v m = m + 1 Wend x = 12.9 While Round(x, 2) < 13.1 x = Round(x, 2) + f_v m = m + 1 Wend calculate_td_v = 10 * m End Function Private Function calculate_td_aVL() As Integer Dim m As Integer Dim x As Single x = 0.01 While Round(x, 2) < 2 x = Round(x, 2) + f m = m + 1 Wend x = 3.5 While Round(x, 2) < 3.92 x = Round(x, 2) + f m = m + 1 Wend x = 5.8 While Round(x, 2) < 6.22 x = Round(x, 2) + f m = m + 1 Wend x = 8.03 While Round(x, 2) < 8.4 x = Round(x, 2) + f m = m + 1 Wend x = 9.07 While Round(x, 2) < 11.2 x = Round(x, 2) + f m = m + 1 Wend x = 12.9 While Round(x, 2) < 13.1 x = Round(x, 2) + f m = m + 1 Wend calculate_td_aVL = 10 * m End Function Private Function calculate_td_aVR() As Integer Dim m As Integer Dim x As Single x = 1.35 While Round(x, 2) < 2.1 x = Round(x, 2) + f m = m + 1 Wend x = 3.6 While Round(x, 2) < 4.1 x = Round(x, 2) + f m = m + 1 Wend x = 5.8 While Round(x, 2) < 6.3 x = Round(x, 2) + f m = m + 1 Wend x = 10.25 While Round(x, 2) < 10.5 x = Round(x, 2) + f m = m + 1 Wend x = 12.3 While Round(x, 2) < 12.6 x = Round(x, 2) + f m = m + 1 Wend calculate_td_aVR = 10 * m End Function Private Function calculate_td_i() As Integer Dim m As Integer Dim x As Single x = 0.01 While Round(x, 2) < 2 x = Round(x, 2) + f m = m + 1 Wend x = 3.5 While Round(x, 2) < 3.92 x = Round(x, 2) + f m = m + 1 Wend x = 5.8 While Round(x, 2) < 6.22 x = Round(x, 2) + f m = m + 1 Wend x = 8.03 While Round(x, 2) < 8.45 x = Round(x, 2) + f m = m + 1 Wend x = 9.07 While Round(x, 2) < 11.2 x = Round(x, 2) + f m = m + 1 Wend x = 12.9 While Round(x, 2) < 13.1 x = Round(x, 2) + f m = m + 1 Wend calculate_td_i = 10 * m End Function Private Function calculate_td_iii() As Integer Dim m As Integer Dim x As Single x = 1.5 While Round(x, 2) < 2.4 x = Round(x, 2) + f m = m + 1 Wend x = 3.65 While Round(x, 2) < 3.92 x = Round(x, 2) + f m = m + 1 Wend x = 5.97 While Round(x, 2) < 6.11 x = Round(x, 2) + f m = m + 1 Wend x = 8.07 While Round(x, 2) < 8.5 x = Round(x, 2) + f m = m + 1 Wend x = 10.2 While Round(x, 2) < 10.6 x = Round(x, 2) + f m = m + 1 Wend calculate_td_iii = 10 * m End Function Private Function calculate_td_v5() As Integer Dim m As Integer Dim x As Single x = 0.01 While Round(x, 2) < 2 x = Round(x, 2) + f m = m + 1 Wend x = 3.5 While Round(x, 2) < 3.92 x = Round(x, 2) + f m = m + 1 Wend x = 5.8 While Round(x, 2) < 6.22 x = Round(x, 2) + f m = m + 1 Wend x = 8.03 While Round(x, 2) < 8.2 x = Round(x, 2) + f m = m + 1 Wend x = 9.8 While Round(x, 2) < 11.2 x = Round(x, 2) + f m = m + 1 Wend x = 12.9 While Round(x, 2) < 13.1 x = Round(x, 2) + f m = m + 1 Wend calculate_td_v5 = 10 * m End Function Private Function calculate_td_v4() As Integer Dim m As Integer Dim x As Single x = 1.5 While Round(x, 2) < 1.9 x = Round(x, 2) + f m = m + 1 Wend x = 1.09 While Round(x, 2) < 1.81 x = Round(x, 2) + f m = m + 1 Wend x = 3.72 While Round(x, 2) < 4.1 x = Round(x, 2) + f m = m + 1 Wend x = 5.8 While Round(x, 2) < 6.09 x = Round(x, 2) + f m = m + 1 Wend x = 8.06 While Round(x, 2) < 8.4 x = Round(x, 2) + f m = m + 1 Wend x = 10.2 While Round(x, 2) < 11.2 x = Round(x, 2) + f m = m + 1 Wend x = 12.9 While Round(x, 2) < 13.1 x = Round(x, 2) + f m = m + 1 Wend calculate_td_v4 = 10 * m End Function Private Function calculate_td_v3() As Integer Dim m As Integer Dim x As Single x = 1.55 While Round(x, 2) < 2.2 x = Round(x, 2) + f m = m + 1 Wend x = 3.7 While Round(x, 2) < 3.91 x = Round(x, 2) + f m = m + 1 Wend x = 5.98 While Round(x, 2) < 6.06 x = Round(x, 2) + f m = m + 1 Wend x = 8.02 While Round(x, 2) < 8.3 x = Round(x, 2) + f m = m + 1 Wend x = 10.17 While Round(x, 2) < 10.51 x = Round(x, 2) + f m = m + 1 Wend x = 12.35 While Round(x, 2) < 12.65 x = Round(x, 2) + f m = m + 1 Wend calculate_td_v3 = 10 * m End Function Private Function calculate_td_v1() As Integer Dim m As Integer Dim x As Single x = 1.55 While Round(x, 2) < 2.2 x = Round(x, 2) + f m = m + 1 Wend x = 3.7 While Round(x, 2) < 3.91 x = Round(x, 2) + f m = m + 1 Wend x = 5.96 While Round(x, 2) < 6.1 x = Round(x, 2) + f m = m + 1 Wend x = 8.02 While Round(x, 2) < 8.3 x = Round(x, 2) + f m = m + 1 Wend x = 10.17 While Round(x, 2) < 10.51 x = Round(x, 2) + f m = m + 1 Wend x = 12.35 While Round(x, 2) < 12.65 x = Round(x, 2) + f m = m + 1 Wend calculate_td_v1 = 10 * m End Function Private Function calculate_td_nt() As Integer Dim m As Integer Dim x As Single x = 0 While Round(x, 2) < 2 * pi x = Round(x, 2) + f_nt m = m + 1 Wend calculate_td_nt = 10 * m End Function Private Sub Timer3_Timer() Randomize Text1.Text = 80 + Int((4 * Rnd)) End Sub ‘ Form SpO2 Const pi = 3.14159265 Const l = 1 Const f = 0.01 'Dieu tan so cua song Const ds = 2500 'Dieu chinh vi tri cua song Const dr = 4000 'Dieu chinh bien do cua song Dim xt As Integer, xu As Integer Dim cal_td As Integer Private Sub Form_Load() ProgressBar1.Orientation = ccOrientationVertical xt = dr * song_t(1) xu = xt - dr * song_u(6) cal_td = calculate_td End Sub Private Sub Timer1_Timer() Static tdd As Integer draw_SpO2 (tdd) If tdd >= cal_td Then tdd = cal_td / 10 Else tdd = tdd + cal_td / 10 End If End Sub Private Sub Timer2_Timer() Randomize Text1.Text = 78 + Int((4 * Rnd)) Randomize Text2.Text = 97 + Int((3 * Rnd)) ProgressBar1.Value = Val(Text2.Text) - 95 End Sub Private Function song_t(ByVal x As Single) As Single Dim a As Single, b As Single, t1 As Single, t2 As Single, harm2 As Single Dim i As Integer, n As Integer a = 0.25 x = x - 0.15 - 0.045 b = (2 * l) / 0.45 n = 100 t1 = 1 / l t2 = 0 For i = 1 To n harm2 = (((Sin((pi / (2 * b)) * (b - (2 * i)))) / (b - (2 * i)) + (Sin((pi / (2 * b)) * (b + (2 * i)))) / (b + (2 * i))) * (2 / pi)) * Cos((i * pi * x) / l) t2 = t2 + harm2 Next song_t = a * (t1 + t2) End Function Private Function song_u(ByVal x As Single) As Single Dim a As Single, b As Single, u1 As Single, u2 As Single, harm4 As Single Dim i As Integer, n As Integer a = 0.08 x = x - 0.433 b = (2 * l) / 0.35 n = 100 u1 = 1 / l u2 = 0 For i = 1 To n harm4 = (((Sin((pi / (2 * b)) * (b - (2 * i)))) / (b - (2 * i)) + (Sin((pi / (2 * b)) * (b + (2 * i)))) / (b + (2 * i))) * (2 / pi)) * Cos((i * pi * x) / l) u2 = u2 + harm4 Next song_u = a * (u1 + u2) End Function Private Sub draw_SpO2(ByVal sample As Integer) Dim k As Single Dim x As Single Dim td As Integer Dim i As Integer Dim check As Boolean k = ds - xt td = sample check = False Picture1.ForeColor = &H80000005 Picture1.Line (td, 1)-(td, Picture1.ScaleHeight) Picture1.Line (td + 10, 1)-(td + 10, Picture1.ScaleHeight) ' 'Ve song tu trai qua phai Do While (check = False) x = 1.9 'Ve song t While Round(x, 2) < 2.37 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) 'Xoa truoc khi ve Picture1.ForeColor = &HFF80FF Picture1.Line (td, k)-(td + 10, ds - dr * song_t(Round(x, 2))) 'Ve song End If k = ds - dr * song_t(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend If (check = True) Then Exit Do x = 6.43 'Ve song u While Round(x, 2) < 6.75 If td 0 Then Picture1.ForeColor = &H80000005 Picture1.Line (td + 20, 1)-(td + 20, Picture1.ScaleHeight) Picture1.ForeColor = &HFF80FF Picture1.Line (td, k)-(td + 10, ds - xu - dr * song_u(Round(x, 2))) End If k = ds - xu - dr * song_u(Round(x, 2)) x = Round(x, 2) + f If td + 10 > Picture1.ScaleWidth Then check = True Else td = td + 10 End If If (check = True) Then Exit Do Wend Loop k = ds - xt td = sample 'Ve song tu phai qua trai Do While (td > 0) x = 6.74 'Ve song u While Round(x, 2) >= 6.43 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &HFF80FF Picture1.Line (td, k)-(td - 10, ds - xu - dr * song_u(Round(x, 2))) End If k = ds - xu - dr * song_u(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend x = 2.36 'Ve song t While Round(x, 2) >= 1.9 If td Picture1.ScaleWidth Then Picture1.ForeColor = &H80000005 Picture1.Line (td - 20, 1)-(td - 20, Picture1.ScaleHeight) Picture1.ForeColor = &HFF80FF Picture1.Line (td, k)-(td - 10, ds - dr * song_t(Round(x, 2))) End If k = ds - dr * song_t(Round(x, 2)) x = Round(x, 2) - f If td - 10 < 0 Then Exit Sub Else td = td - 10 End If Wend Loop End Sub Private Function calculate_td() As Integer Dim m As Integer Dim x As Single x = 1.9 While Round(x, 2) < 2.37 x = Round(x, 2) + f m = m + 1 Wend x = 6.43 While Round(x, 2) < 6.75 x = Round(x, 2) + f m = m + 1 Wend calculate_td = 10 * m End Function ‘ Form NIBP Dim val_cycle As Byte Dim val_Pump As Byte Private Sub Command1_Click() If Label_Status.Caption = "IDLE" Then Select Case val_cycle Case 0: Label10.Caption = "Manual" val_cycle = 1 Case 1: Label10.Caption = "1min" val_cycle = 2 Case 2: Label10.Caption = "2min" val_cycle = 3 Case 3: Label10.Caption = "3min" val_cycle = 4 Case 4: Label10.Caption = "4min" val_cycle = 5 Case 5: Label10.Caption = "5min" val_cycle = 6 Case 6: Label10.Caption = "10min" val_cycle = 7 Case 7: Label10.Caption = "15min" val_cycle = 8 Case 8: Label10.Caption = "30min" val_cycle = 0 End Select End If End Sub Private Sub Command10_Click() If Label_Status.Caption = "IDLE" Then Select Case val_Pump Case 0: Label14.Caption = "100mHg" val_Pump = 1 Case 1: Label14.Caption = "120mHg" val_Pump = 2 Case 2: Label14.Caption = "140mHg" val_Pump = 3 Case 3: Label14.Caption = "160mHg" val_Pump = 4 Case 4: Label14.Caption = "180mHg" val_Pump = 0 End Select End If End Sub Private Sub Command2_Click() Label_Status.Caption = "IDLE" Text1.Text = "---" Text2.Text = "---" Text3.Text = "---" Text4.Text = "---" End Sub Private Sub Command3_Click() Label_Status.Caption = "MEASURE" Timer1.Enabled = True Text1.Text = "---" Text2.Text = "---" Text3.Text = "---" Text4.Text = "---" End Sub Private Sub Command4_Click() Unload Me End Sub Private Sub Command9_Click() If Label_Status.Caption = "IDLE" Then If Label12.Caption = "Neonate" Then Label12.Caption = "Adult" Label14.Caption = "170mHg" Else Label12.Caption = "Neonate" Label14.Caption = "140mHg" End If End If End Sub Private Sub Form_Load() val_cycle = 1 val_Pump = 1 End Sub Private Sub Timer1_Timer() If Label_Status.Caption = "MEASURE" Then If Label12.Caption = "Neonate" Then Timer1.Enabled = True Select Case val_Pump Case 0: Label14.Caption = "0mHg" val_Pump = 1 Case 1: Label14.Caption = "20mHg" val_Pump = 2 Case 2: Label14.Caption = "40mHg" val_Pump = 3 Case 3: Label14.Caption = "60mHg" val_Pump = 4 Case 4: Label14.Caption = "80mHg" val_Pump = 5 Case 5: Label14.Caption = "100mHg" val_Pump = 6 Case 6: Label14.Caption = "120mHg" val_Pump = 7 Case 7: Label14.Caption = "140mHg" val_Pump = 8 Case 8: Label14.Caption = "120mHg" val_Pump = 9 Case 9: Label14.Caption = "100mHg" val_Pump = 10 Case 10: Label14.Caption = "80mHg" val_Pump = 11 Case 11: Label14.Caption = "60mHg" val_Pump = 12 Case 12: Label14.Caption = "40mHg" val_Pump = 13 Case 13: Label14.Caption = "20mHg" Timer1.Enabled = False Text1.Text = "110" Text2.Text = "77" Text3.Text = "88" Text4.Text = "80" val_Pump = 1 End Select Else Label12.Caption = "Adult" Select Case val_Pump Case 0: Label14.Caption = "0mHg" val_Pump = 1 Case 1: Label14.Caption = "20mHg" val_Pump = 2 Case 2: Label14.Caption = "40mHg" val_Pump = 3 Case 3: Label14.Caption = "60mHg" val_Pump = 4 Case 4: Label14.Caption = "80mHg" val_Pump = 5 Case 5: Label14.Caption = "100mHg" val_Pump = 6 Case 6: Label14.Caption = "120mHg" val_Pump = 7 Case 7: Label14.Caption = "140mHg" val_Pump = 8 Case 8: Label14.Caption = "160mHg" val_Pump = 9 Case 9: Label14.Caption = "170mHg" val_Pump = 10 Case 10: Label14.Caption = "160mHg" val_Pump = 11 Case 11: Label14.Caption = "140mHg" val_Pump = 12 Case 12: Label14.Caption = "120mHg" val_Pump = 13 Case 13: Label14.Caption = "100mHg" val_Pump = 14 Case 14: Label14.Caption = "80mHg" val_Pump = 15 Case 15: Label14.Caption = "60mHg" val_Pump = 16 Case 16: Label14.Caption = "40mHg" val_Pump = 17 Case 17: Label14.Caption = "30mHg" Timer1.Enabled = False Text1.Text = "117" Text2.Text = "79" Text3.Text = "92" Text4.Text = "80" val_Pump = 1 End Select End If End If End Sub

Các file đính kèm theo tài liệu này:

  • docDAN089.doc
Tài liệu liên quan