1. 모델별 config 파일 생성 및 적용

2. 지그 연결이 끊어지는 경우 다시 한번 자동으로 RETRY
3. 세모 플러스 검사 추가
4. EP 검사(3번)마다 장치 설정 따로 할 수 있도록 설정 화면 수정
5. 스코프, 스펙트럼 통신 중 발생할 수 있는 오류 최소화 하기 위해 중간에 장치 버퍼 CLEAR 추가
6. 버전 2.2.4
This commit is contained in:
hyelinjung 2026-03-25 15:50:47 +09:00
parent 1cedc93a66
commit e32a0b90d6
5 changed files with 4276 additions and 3479 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -116,14 +116,10 @@
<Reference Include="Google.Protobuf, Version=3.6.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> <Reference Include="Google.Protobuf, Version=3.6.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.6.1\lib\net45\Google.Protobuf.dll</HintPath> <HintPath>..\packages\Google.Protobuf.3.6.1\lib\net45\Google.Protobuf.dll</HintPath>
</Reference> </Reference>
<Reference Include="Interop.bpac"> <Reference Include="Ivi.Visa.Interop, Version=8.0.0.0, Culture=neutral, PublicKeyToken=a128c98f1d7717c1, processorArchitecture=AMD64">
<HintPath>C:\Program Files\Brother bPAC3 SDK\Samples\VBNET\NamePlt\bin\x64\Release\Interop.bpac.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Ivi.Visa.Interop, Version=5.11.0.0, Culture=neutral, PublicKeyToken=a128c98f1d7717c1, processorArchitecture=AMD64">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<EmbedInteropTypes>True</EmbedInteropTypes> <EmbedInteropTypes>True</EmbedInteropTypes>
<HintPath>C:\Windows\assembly\GAC_64\Ivi.Visa.Interop\5.11.0.0__a128c98f1d7717c1\Ivi.Visa.Interop.dll</HintPath> <HintPath>..\..\..\..\..\..\Windows\assembly\GAC_64\Ivi.Visa.Interop\8.0.0.0__a128c98f1d7717c1\Ivi.Visa.Interop.dll</HintPath>
</Reference> </Reference>
<Reference Include="K4os.Compression.LZ4, Version=1.1.11.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL"> <Reference Include="K4os.Compression.LZ4, Version=1.1.11.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
<HintPath>..\packages\K4os.Compression.LZ4.1.1.11\lib\net46\K4os.Compression.LZ4.dll</HintPath> <HintPath>..\packages\K4os.Compression.LZ4.1.1.11\lib\net46\K4os.Compression.LZ4.dll</HintPath>

View File

@ -7,34 +7,47 @@ Module ScopeMoudule
Public Function ScopeOpen(ScopeID As String, timeoutNum As Integer) As String Public Function ScopeOpen(ScopeID As String, timeoutNum As Integer) As String
Try Try
ScopeClear()
If ScopeID = "" Then
Return "FAIL"
End If
myMgr = New Ivi.Visa.Interop.ResourceManager myMgr = New Ivi.Visa.Interop.ResourceManager
myscope = New Ivi.Visa.Interop.FormattedIO488 myscope = New Ivi.Visa.Interop.FormattedIO488
myscope.IO = myMgr.Open(ScopeID) myscope.IO = myMgr.Open(ScopeID)
myscope.IO.Clear()
myscope.IO.Timeout = timeoutNum myscope.IO.Timeout = timeoutNum
DrainDeviceOutput()
strQueryResult = DoQueryString("*IDN?") strQueryResult = DoQueryString("*IDN?")
Debug.Print("Identification string: " + strQueryResult) Debug.Print("Identification string: " + strQueryResult)
Return strQueryResult Return strQueryResult
Catch ex As System.Runtime.InteropServices.COMException
Debug.Print("ErrorCode 값: " & ex.ErrorCode)
Debug.Print("ErroMassage 값: " & ex.Message.ToString)
Debug.Print("HResult 값: " & ex.HResult)
Return "FAIL"
Catch ex As Exception Catch ex As Exception
Return "FAIL" Return "FAIL"
End Try End Try
End Function End Function
Public Function ScopeRunCk() As Boolean ''계측기 버퍼 비우기
Public Sub DrainDeviceOutput(Optional readTimeoutMs As Integer = 200)
Dim prevTimeout As Integer = myscope.IO.Timeout
Try Try
strQueryResult = DoQueryString("*IDN?") myscope.IO.Timeout = readTimeoutMs
If InStr(strQueryResult, "KEYSIGHT") > 0 Then Dim s As String = myscope.ReadString
Return False Debug.Print("남아있는 데이터: " + s)
Else Do While Not String.IsNullOrWhiteSpace(s)
Return True s = myscope.ReadString
End If Loop
Catch ex As Exception Catch
Return True checkError()
Finally
myscope.IO.Timeout = prevTimeout
End Try End Try
End Function End Sub
Public Function DoCommand(command As String) As String Public Function DoCommand(command As String) As String
Dim errStr As String Dim errStr As String
@ -53,15 +66,6 @@ Module ScopeMoudule
End Function End Function
' Public Sub DoCommand(command As String)
' On Error GoTo VisaComError
' myscope.WriteString(command)
' CheckInstrumentErrors()
' Exit Sub
'VisaComError:
' MsgBox("VISA COM Error: " + vbCrLf + CStr(Err.Number) + ", " + Err.Source + "," + Err.Description, vbExclamation, "VISA COM Error")
' End Sub
Public Function DoQueryString(query As String) As String Public Function DoQueryString(query As String) As String
Dim errStr As String Dim errStr As String
@ -76,28 +80,20 @@ Module ScopeMoudule
Return DoQueryString Return DoQueryString
Catch ex As Exception Catch ex As Exception
Try
DrainDeviceOutput()
Catch
End Try
Return "VISA COM Error: " + vbCrLf + CStr(Err.Number) + ", " + Err.Source + "," + Err.Description Return "VISA COM Error: " + vbCrLf + CStr(Err.Number) + ", " + Err.Source + "," + Err.Description
End Try End Try
End Function End Function
' Public Function DoQueryString(query As String) As String
' Dim errStr As String
' On Error GoTo VisaComError
' myscope.WriteString(query)
' DoQueryString = myscope.ReadString
' CheckInstrumentErrors()
' Return DoQueryString
'VisaComError:
' MsgBox("VISA COM Error: " + vbCrLf + CStr(Err.Number) + ", " + Err.Source + "," + Err.Description, vbExclamation, "VISA COM Error")
' Return "FAIL"
' End Function
Private Function CheckInstrumentErrors() As String Private Function CheckInstrumentErrors() As String
Dim strerrval As String Dim strerrval As String
Dim strout As String = "" Dim strout As String = ""
Try
myscope.WriteString(":SYSTem:ERRor?") myscope.WriteString(":SYSTem:ERRor?")
strerrval = myscope.ReadString strerrval = myscope.ReadString
While Val(strerrval) <> 0 While Val(strerrval) <> 0
strout = "INST Error: " + strerrval strout = "INST Error: " + strerrval
@ -112,9 +108,30 @@ Module ScopeMoudule
Return strout Return strout
End If End If
Return "" Return ""
Catch ex As Exception
Main_Form.txbWindow.AppendText("Error check Message Error:" & ex.Message & vbCrLf)
Return ex.Message
End Try
End Function End Function
Private Sub checkError()
Dim strerrval As String
Try
myscope.WriteString(":SYSTem:ERRor?")
strerrval = myscope.ReadString
While Val(strerrval) <> 0
myscope.WriteString(":SYSTem:ERRor?")
strerrval = myscope.ReadString
End While
Catch ex As Exception
Main_Form.txbWindow.AppendText("VISA BUFFER CLEAR ERROR:" & ex.Message & vbCrLf)
End Try
End Sub
''' <summary>스코프 버퍼 초기화. 연결된 경우에만 동작.</summary> ''' <summary>스코프 버퍼 초기화. 연결된 경우에만 동작.</summary>
Public Sub ScopeClear() Public Sub ScopeClear()
Try Try

View File

@ -6,25 +6,47 @@ Module SpectrumModule
Public Function SpecOpen(SpecID As String, ToCount As Integer) As String Public Function SpecOpen(SpecID As String, ToCount As Integer) As String
Try Try
SpecClear()
myMgr = New Ivi.Visa.Interop.ResourceManager myMgr = New Ivi.Visa.Interop.ResourceManager
mySpec = New Ivi.Visa.Interop.FormattedIO488 mySpec = New Ivi.Visa.Interop.FormattedIO488
mySpec.IO = myMgr.Open(SpecID) mySpec.IO = myMgr.Open(SpecID)
mySpec.IO.Clear()
mySpec.IO.Timeout = ToCount mySpec.IO.Timeout = ToCount
SpecDrainDeviceOutput(200)
strQueryRes = SpecQueryStr("*IDN?") strQueryRes = SpecQueryStr("*IDN?")
Return strQueryRes Return strQueryRes
Catch ex As System.Runtime.InteropServices.COMException
Debug.Print("ErrorCode 값: " & ex.ErrorCode)
Debug.Print("ErroMassage 값: " & ex.Message)
Debug.Print("HResult 값: " & ex.HResult)
Return "FAIL"
Catch ex As Exception Catch ex As Exception
Return "FAIL" Return "FAIL"
End Try End Try
End Function End Function
Public Sub SpecDrainDeviceOutput(Optional readTimeoutMs As Integer = 200)
Dim prevTimeout As Integer = mySpec.IO.Timeout
Try
mySpec.IO.Timeout = readTimeoutMs
Dim s As String = mySpec.ReadString
Do While Not String.IsNullOrWhiteSpace(s)
s = mySpec.ReadString
Loop
Catch
' 타임아웃/에러 그만
Finally
mySpec.IO.Timeout = prevTimeout
End Try
End Sub
Public Function RunCommand(command As String) As String Public Function RunCommand(command As String) As String
Dim errStr As String Dim errStr As String
Try Try
mySpec.IO.Clear()
SpecDrainDeviceOutput(200)
mySpec.WriteString(command) mySpec.WriteString(command)
errStr = CheckError() errStr = CheckError()
If errStr.Replace(" ", "") <> "" Then If errStr.Replace(" ", "") <> "" Then
@ -41,6 +63,8 @@ Module SpectrumModule
Public Function SpecQueryStr(query As String) As String Public Function SpecQueryStr(query As String) As String
Dim errStr As String Dim errStr As String
Try Try
mySpec.IO.Clear()
SpecDrainDeviceOutput(200)
mySpec.WriteString(query) mySpec.WriteString(query)
SpecQueryStr = mySpec.ReadString SpecQueryStr = mySpec.ReadString
errStr = CheckError() errStr = CheckError()
@ -58,8 +82,8 @@ Module SpectrumModule
Private Function CheckError() As String Private Function CheckError() As String
Dim strerrval As String Dim strerrval As String
Dim strout As String = "" Dim strout As String = ""
Try
mySpec.WriteString(":SYSTem:ERRor?") mySpec.WriteString(":SYSTem:ERRor?")
strerrval = mySpec.ReadString strerrval = mySpec.ReadString
While Val(strerrval) <> 0 While Val(strerrval) <> 0
strout = "INST Error: " + strerrval strout = "INST Error: " + strerrval
@ -74,7 +98,12 @@ Module SpectrumModule
Return strout Return strout
End If End If
Return "" Return ""
Catch ex As Exception
Main_Form.txbWindow.AppendText("Error check Message Error:" & ex.Message & vbCrLf)
Return ex.Message
End Try
End Function End Function
''' <summary>스펙트럼 분석기 버퍼 초기화. 연결된 경우에만 동작.</summary> ''' <summary>스펙트럼 분석기 버퍼 초기화. 연결된 경우에만 동작.</summary>