1、HYAPCK采集GPS乱码问题
2015版以后的HYPACK的定位DLL采用的是GPS.DLL,不是nmea.DLL,最近使用的时候发现,GPS采集设置必须只选择必须的,比如定位,速度和航向等,见下图所示。如果使用默认选择即全选,记录的RAW数据会出现乱码,导致无法进行定位处理和单波束处理。
万般无赖之下,只能采用自编程序读取定位和水深信息,然后加载潮位改正,结果发现这个比HYPACK处理单波束快多了。
2、UTC时间和北京时间的转换
海洋调查经常使用UTC时间,而有些时候近岸工程使用的是北京时间,之间相差8个小时,需要转换,下面是这两个时间转化的函数:
'UTC转换为北京时间 函数可直接调用
Function UTCToBeijing(UTCyear As Long, UTCmonth As Long, UTCday As Long, UTChour As Long) As String
Dim year As Long, month As Long, day As Long, hour As Long, lastday As Long, lastlastday As Long
year = 0: month = 0: day = 0: hour = 0
lastday = 0 ' 月的最后一天日期
lastlastday = 0 '上月的最后一天日期
year = UTCyear
month = UTCmonth
day = UTCday
hour = UTChour + 8 'UTC+8转换为北京时间
If (month = 1 Or month = 3 Or month = 5 Or month = 7 Or month = 8 Or month = 10 Or month = 12) Then
lastday = 31
If month = 3 Then
If year Mod 400 = 0 Or (year Mod 4 = 0 And year Mod 100 <> 0) Then '判断是否为闰年
lastlastday = 29 '闰年的2月为29天,平年为28天
Else
lastlastday = 28
End If
End If
If month = 8 Then
lastlastday = 31
End If
Else
If month = 4 Or month = 6 Or month = 9 Or month = 11 Then
lastday = 30
lastlastday = 31
Else
lastlastday = 31
If year Mod 400 = 0 Or (year Mod 4 = 0 And year Mod 100 <> 0) Then '闰年的2月为29天,平年为28天
lastday = 29
Else
lastday = 28
End If
End If
End If
If hour >= 24 Then '当算出的时大于或等于24:00时,应减去24:00,日期加一天
hour = hour - 24
day = day + 1
If day > lastday Then '当算出的日期大于该月最后一天时,应减去该月最后一天的日期,月份加上一个月
day = day - lastday
month = month + 1
If month > 12 Then '当算出的月份大于12,应减去12,年份加上1年
month = month - 12
year = year + 1
End If
End If
End If
UTCToBeijing = CStr(year) & " " & CStr(month) & " " & CStr(day) & " " & CStr(hour)
End Function
'UTC转换为北京时间 函数可直接调用
Function BeijingToUTC(UTCyear As Long, UTCmonth As Long, UTCday As Long, UTChour As Long) As String
Dim year As Long, month As Long, day As Long, hour As Long, lastday As Long, lastlastday As Long
year = 0: month = 0: day = 0: hour = 0
lastday = 0 ' 月的最后一天日期
lastlastday = 0 '上月的最后一天日期
year = UTCyear
month = UTCmonth
day = UTCday
hour = UTChour - 8 'Beijing-8转换为UTC时间
If hour < 0 Then '当算出的时小于0:00时,应加上24:00,日期减一天
hour = hour + 24
day = day - 1
If day = 0 Then '当算出的日期等于0时,月份减一个月,应加上上月最后一天的日期
month = month - 1
If month = 0 Then '当算出的月份等于0,应加上12,年份减去1年
month = month + 12
year = year - 1
End If
If (month = 1 Or month = 3 Or month = 5 Or month = 7 Or month = 8 Or month = 10 Or month = 12) Then
lastday = 31
If month = 3 Then
If year Mod 400 = 0 Or (year Mod 4 = 0 And year Mod 100 <> 0) Then '判断是否为闰年
lastlastday = 29 '闰年的2月为29天,平年为28天
Else
lastlastday = 28
End If
End If
If month = 8 Then
lastlastday = 31
End If
Else
If month = 4 Or month = 6 Or month = 9 Or month = 11 Then
lastday = 30
lastlastday = 31
Else
lastlastday = 31
If year Mod 400 = 0 Or (year Mod 4 = 0 And year Mod 100 <> 0) Then '闰年的2月为29天,平年为28天
lastday = 29
Else
lastday = 28
End If
End If
End If
day = day + lastday
End If
End If
BeijingToUTC = CStr(year) & " " & CStr(month) & " " & CStr(day) & " " & CStr(hour)
End Function
发表评论: