fix: 오차 계산 방법 고정 방식으로 수정

- 이전 표준편차 계산 방식 주석처리
- 오차범위 표시 UI 폰트 크기 변경
This commit is contained in:
kje97 2025-06-12 11:46:45 +09:00
parent 53bd4fd889
commit dfd6bc4252
3 changed files with 99 additions and 64 deletions

View File

@ -45,6 +45,7 @@ Partial Class weightForm
Me.playTimer = New System.Windows.Forms.Timer(Me.components) Me.playTimer = New System.Windows.Forms.Timer(Me.components)
Me.statusTimer = New System.Windows.Forms.Timer(Me.components) Me.statusTimer = New System.Windows.Forms.Timer(Me.components)
Me.cmdSerialPort = New System.IO.Ports.SerialPort(Me.components) Me.cmdSerialPort = New System.IO.Ports.SerialPort(Me.components)
Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
Me.pnWeightTop.SuspendLayout() Me.pnWeightTop.SuspendLayout()
Me.pnWeightMid.SuspendLayout() Me.pnWeightMid.SuspendLayout()
Me.gbWeightBot.SuspendLayout() Me.gbWeightBot.SuspendLayout()
@ -59,9 +60,10 @@ Partial Class weightForm
' '
Me.pnWeightTop.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle Me.pnWeightTop.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.pnWeightTop.Controls.Add(Me.lbWeightTop) Me.pnWeightTop.Controls.Add(Me.lbWeightTop)
Me.pnWeightTop.Location = New System.Drawing.Point(12, 7) Me.pnWeightTop.Location = New System.Drawing.Point(14, 9)
Me.pnWeightTop.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
Me.pnWeightTop.Name = "pnWeightTop" Me.pnWeightTop.Name = "pnWeightTop"
Me.pnWeightTop.Size = New System.Drawing.Size(940, 85) Me.pnWeightTop.Size = New System.Drawing.Size(1074, 106)
Me.pnWeightTop.TabIndex = 17 Me.pnWeightTop.TabIndex = 17
' '
'lbWeightTop 'lbWeightTop
@ -69,9 +71,9 @@ Partial Class weightForm
Me.lbWeightTop.AutoSize = True Me.lbWeightTop.AutoSize = True
Me.lbWeightTop.Font = New System.Drawing.Font("함초롬바탕", 36.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(129, Byte)) Me.lbWeightTop.Font = New System.Drawing.Font("함초롬바탕", 36.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(129, Byte))
Me.lbWeightTop.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer)) Me.lbWeightTop.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(192, Byte), Integer))
Me.lbWeightTop.Location = New System.Drawing.Point(215, 9) Me.lbWeightTop.Location = New System.Drawing.Point(246, 11)
Me.lbWeightTop.Name = "lbWeightTop" Me.lbWeightTop.Name = "lbWeightTop"
Me.lbWeightTop.Size = New System.Drawing.Size(501, 62) Me.lbWeightTop.Size = New System.Drawing.Size(623, 78)
Me.lbWeightTop.TabIndex = 3 Me.lbWeightTop.TabIndex = 3
Me.lbWeightTop.Text = "패 킹 박 스 무 게 측 정" Me.lbWeightTop.Text = "패 킹 박 스 무 게 측 정"
' '
@ -79,9 +81,10 @@ Partial Class weightForm
' '
Me.pnWeightMid.BackColor = System.Drawing.Color.Black Me.pnWeightMid.BackColor = System.Drawing.Color.Black
Me.pnWeightMid.Controls.Add(Me.lbWeight) Me.pnWeightMid.Controls.Add(Me.lbWeight)
Me.pnWeightMid.Location = New System.Drawing.Point(12, 100) Me.pnWeightMid.Location = New System.Drawing.Point(14, 125)
Me.pnWeightMid.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
Me.pnWeightMid.Name = "pnWeightMid" Me.pnWeightMid.Name = "pnWeightMid"
Me.pnWeightMid.Size = New System.Drawing.Size(940, 168) Me.pnWeightMid.Size = New System.Drawing.Size(1074, 210)
Me.pnWeightMid.TabIndex = 18 Me.pnWeightMid.TabIndex = 18
' '
'lbWeight 'lbWeight
@ -89,9 +92,9 @@ Partial Class weightForm
Me.lbWeight.BackColor = System.Drawing.Color.Gold Me.lbWeight.BackColor = System.Drawing.Color.Gold
Me.lbWeight.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D Me.lbWeight.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.lbWeight.Font = New System.Drawing.Font("함초롬바탕", 69.74999!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(129, Byte)) Me.lbWeight.Font = New System.Drawing.Font("함초롬바탕", 69.74999!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(129, Byte))
Me.lbWeight.Location = New System.Drawing.Point(51, 14) Me.lbWeight.Location = New System.Drawing.Point(58, 18)
Me.lbWeight.Name = "lbWeight" Me.lbWeight.Name = "lbWeight"
Me.lbWeight.Size = New System.Drawing.Size(842, 139) Me.lbWeight.Size = New System.Drawing.Size(962, 174)
Me.lbWeight.TabIndex = 14 Me.lbWeight.TabIndex = 14
Me.lbWeight.Text = "측정중" Me.lbWeight.Text = "측정중"
Me.lbWeight.TextAlign = System.Drawing.ContentAlignment.TopCenter Me.lbWeight.TextAlign = System.Drawing.ContentAlignment.TopCenter
@ -105,62 +108,67 @@ Partial Class weightForm
Me.gbWeightBot.Controls.Add(Me.lbNowg) Me.gbWeightBot.Controls.Add(Me.lbNowg)
Me.gbWeightBot.Controls.Add(Me.lbNowWeight) Me.gbWeightBot.Controls.Add(Me.lbNowWeight)
Me.gbWeightBot.Controls.Add(Me.picb_scale) Me.gbWeightBot.Controls.Add(Me.picb_scale)
Me.gbWeightBot.Location = New System.Drawing.Point(12, 270) Me.gbWeightBot.Location = New System.Drawing.Point(14, 338)
Me.gbWeightBot.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
Me.gbWeightBot.Name = "gbWeightBot" Me.gbWeightBot.Name = "gbWeightBot"
Me.gbWeightBot.Size = New System.Drawing.Size(940, 279) Me.gbWeightBot.Padding = New System.Windows.Forms.Padding(3, 4, 3, 4)
Me.gbWeightBot.Size = New System.Drawing.Size(1074, 349)
Me.gbWeightBot.TabIndex = 23 Me.gbWeightBot.TabIndex = 23
Me.gbWeightBot.TabStop = False Me.gbWeightBot.TabStop = False
' '
'pnNow 'pnNow
' '
Me.pnNow.Controls.Add(Me.lbNow) Me.pnNow.Controls.Add(Me.lbNow)
Me.pnNow.Location = New System.Drawing.Point(7, 54) Me.pnNow.Location = New System.Drawing.Point(8, 68)
Me.pnNow.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
Me.pnNow.Name = "pnNow" Me.pnNow.Name = "pnNow"
Me.pnNow.Size = New System.Drawing.Size(264, 72) Me.pnNow.Size = New System.Drawing.Size(302, 90)
Me.pnNow.TabIndex = 21 Me.pnNow.TabIndex = 21
' '
'lbNow 'lbNow
' '
Me.lbNow.AutoSize = True Me.lbNow.AutoSize = True
Me.lbNow.Font = New System.Drawing.Font("함초롬바탕", 36.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(129, Byte)) Me.lbNow.Font = New System.Drawing.Font("함초롬바탕", 36.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(129, Byte))
Me.lbNow.Location = New System.Drawing.Point(3, 5) Me.lbNow.Location = New System.Drawing.Point(3, 6)
Me.lbNow.Name = "lbNow" Me.lbNow.Name = "lbNow"
Me.lbNow.Size = New System.Drawing.Size(258, 62) Me.lbNow.Size = New System.Drawing.Size(320, 78)
Me.lbNow.TabIndex = 7 Me.lbNow.TabIndex = 7
Me.lbNow.Text = "현재 무게 :" Me.lbNow.Text = "현재 무게 :"
' '
'pnExpect 'pnExpect
' '
Me.pnExpect.Controls.Add(Me.lbExpect) Me.pnExpect.Controls.Add(Me.lbExpect)
Me.pnExpect.Location = New System.Drawing.Point(21, 149) Me.pnExpect.Location = New System.Drawing.Point(24, 186)
Me.pnExpect.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
Me.pnExpect.Name = "pnExpect" Me.pnExpect.Name = "pnExpect"
Me.pnExpect.Size = New System.Drawing.Size(213, 76) Me.pnExpect.Size = New System.Drawing.Size(243, 95)
Me.pnExpect.TabIndex = 18 Me.pnExpect.TabIndex = 18
' '
'lbExpect 'lbExpect
' '
Me.lbExpect.AutoSize = True Me.lbExpect.AutoSize = True
Me.lbExpect.Font = New System.Drawing.Font("함초롬바탕", 27.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(129, Byte)) Me.lbExpect.Font = New System.Drawing.Font("함초롬바탕", 27.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(129, Byte))
Me.lbExpect.Location = New System.Drawing.Point(11, 13) Me.lbExpect.Location = New System.Drawing.Point(13, 16)
Me.lbExpect.Name = "lbExpect" Me.lbExpect.Name = "lbExpect"
Me.lbExpect.Size = New System.Drawing.Size(200, 49) Me.lbExpect.Size = New System.Drawing.Size(254, 61)
Me.lbExpect.TabIndex = 9 Me.lbExpect.TabIndex = 9
Me.lbExpect.Text = "예상 무게 :" Me.lbExpect.Text = "예상 무게 :"
' '
'pnError 'pnError
' '
Me.pnError.Controls.Add(Me.lbError) Me.pnError.Controls.Add(Me.lbError)
Me.pnError.Location = New System.Drawing.Point(292, 214) Me.pnError.Location = New System.Drawing.Point(334, 268)
Me.pnError.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
Me.pnError.Name = "pnError" Me.pnError.Name = "pnError"
Me.pnError.Size = New System.Drawing.Size(329, 62) Me.pnError.Size = New System.Drawing.Size(376, 78)
Me.pnError.TabIndex = 20 Me.pnError.TabIndex = 20
' '
'lbError 'lbError
' '
Me.lbError.Font = New System.Drawing.Font("함초롬바탕", 27.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(129, Byte)) Me.lbError.Font = New System.Drawing.Font("함초롬바탕", 25.0!, System.Drawing.FontStyle.Bold)
Me.lbError.Location = New System.Drawing.Point(1, 4) Me.lbError.Location = New System.Drawing.Point(1, 5)
Me.lbError.Name = "lbError" Me.lbError.Name = "lbError"
Me.lbError.Size = New System.Drawing.Size(339, 52) Me.lbError.Size = New System.Drawing.Size(387, 65)
Me.lbError.TabIndex = 15 Me.lbError.TabIndex = 15
Me.lbError.Text = "(오차: +100, -100)" Me.lbError.Text = "(오차: +100, -100)"
' '
@ -168,17 +176,18 @@ Partial Class weightForm
' '
Me.pnWeightEX.Controls.Add(Me.lbWeightEX) Me.pnWeightEX.Controls.Add(Me.lbWeightEX)
Me.pnWeightEX.Controls.Add(Me.lbWeightEXg) Me.pnWeightEX.Controls.Add(Me.lbWeightEXg)
Me.pnWeightEX.Location = New System.Drawing.Point(240, 149) Me.pnWeightEX.Location = New System.Drawing.Point(274, 186)
Me.pnWeightEX.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
Me.pnWeightEX.Name = "pnWeightEX" Me.pnWeightEX.Name = "pnWeightEX"
Me.pnWeightEX.Size = New System.Drawing.Size(197, 76) Me.pnWeightEX.Size = New System.Drawing.Size(225, 95)
Me.pnWeightEX.TabIndex = 19 Me.pnWeightEX.TabIndex = 19
' '
'lbWeightEX 'lbWeightEX
' '
Me.lbWeightEX.Font = New System.Drawing.Font("함초롬바탕", 32.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(129, Byte)) Me.lbWeightEX.Font = New System.Drawing.Font("함초롬바탕", 32.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(129, Byte))
Me.lbWeightEX.Location = New System.Drawing.Point(6, 10) Me.lbWeightEX.Location = New System.Drawing.Point(7, 12)
Me.lbWeightEX.Name = "lbWeightEX" Me.lbWeightEX.Name = "lbWeightEX"
Me.lbWeightEX.Size = New System.Drawing.Size(151, 57) Me.lbWeightEX.Size = New System.Drawing.Size(173, 71)
Me.lbWeightEX.TabIndex = 13 Me.lbWeightEX.TabIndex = 13
Me.lbWeightEX.Text = "0" Me.lbWeightEX.Text = "0"
Me.lbWeightEX.TextAlign = System.Drawing.ContentAlignment.MiddleRight Me.lbWeightEX.TextAlign = System.Drawing.ContentAlignment.MiddleRight
@ -187,9 +196,9 @@ Partial Class weightForm
' '
Me.lbWeightEXg.AutoSize = True Me.lbWeightEXg.AutoSize = True
Me.lbWeightEXg.Font = New System.Drawing.Font("함초롬바탕", 24.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(129, Byte)) Me.lbWeightEXg.Font = New System.Drawing.Font("함초롬바탕", 24.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(129, Byte))
Me.lbWeightEXg.Location = New System.Drawing.Point(152, 19) Me.lbWeightEXg.Location = New System.Drawing.Point(174, 24)
Me.lbWeightEXg.Name = "lbWeightEXg" Me.lbWeightEXg.Name = "lbWeightEXg"
Me.lbWeightEXg.Size = New System.Drawing.Size(36, 41) Me.lbWeightEXg.Size = New System.Drawing.Size(44, 52)
Me.lbWeightEXg.TabIndex = 8 Me.lbWeightEXg.TabIndex = 8
Me.lbWeightEXg.Text = "g" Me.lbWeightEXg.Text = "g"
' '
@ -197,9 +206,9 @@ Partial Class weightForm
' '
Me.lbNowg.AutoSize = True Me.lbNowg.AutoSize = True
Me.lbNowg.Font = New System.Drawing.Font("함초롬바탕", 36.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(129, Byte)) Me.lbNowg.Font = New System.Drawing.Font("함초롬바탕", 36.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(129, Byte))
Me.lbNowg.Location = New System.Drawing.Point(587, 64) Me.lbNowg.Location = New System.Drawing.Point(671, 80)
Me.lbNowg.Name = "lbNowg" Me.lbNowg.Name = "lbNowg"
Me.lbNowg.Size = New System.Drawing.Size(54, 62) Me.lbNowg.Size = New System.Drawing.Size(67, 78)
Me.lbNowg.TabIndex = 2 Me.lbNowg.TabIndex = 2
Me.lbNowg.Text = "g" Me.lbNowg.Text = "g"
' '
@ -208,9 +217,9 @@ Partial Class weightForm
Me.lbNowWeight.BackColor = System.Drawing.SystemColors.Control Me.lbNowWeight.BackColor = System.Drawing.SystemColors.Control
Me.lbNowWeight.Font = New System.Drawing.Font("함초롬바탕", 60.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(129, Byte)) Me.lbNowWeight.Font = New System.Drawing.Font("함초롬바탕", 60.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(129, Byte))
Me.lbNowWeight.ForeColor = System.Drawing.Color.DarkBlue Me.lbNowWeight.ForeColor = System.Drawing.Color.DarkBlue
Me.lbNowWeight.Location = New System.Drawing.Point(274, 29) Me.lbNowWeight.Location = New System.Drawing.Point(313, 36)
Me.lbNowWeight.Name = "lbNowWeight" Me.lbNowWeight.Name = "lbNowWeight"
Me.lbNowWeight.Size = New System.Drawing.Size(313, 104) Me.lbNowWeight.Size = New System.Drawing.Size(358, 130)
Me.lbNowWeight.TabIndex = 12 Me.lbNowWeight.TabIndex = 12
Me.lbNowWeight.Text = "0" Me.lbNowWeight.Text = "0"
Me.lbNowWeight.TextAlign = System.Drawing.ContentAlignment.MiddleRight Me.lbNowWeight.TextAlign = System.Drawing.ContentAlignment.MiddleRight
@ -218,9 +227,10 @@ Partial Class weightForm
'picb_scale 'picb_scale
' '
Me.picb_scale.Image = CType(resources.GetObject("picb_scale.Image"), System.Drawing.Image) Me.picb_scale.Image = CType(resources.GetObject("picb_scale.Image"), System.Drawing.Image)
Me.picb_scale.Location = New System.Drawing.Point(627, 42) Me.picb_scale.Location = New System.Drawing.Point(717, 52)
Me.picb_scale.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
Me.picb_scale.Name = "picb_scale" Me.picb_scale.Name = "picb_scale"
Me.picb_scale.Size = New System.Drawing.Size(284, 231) Me.picb_scale.Size = New System.Drawing.Size(325, 289)
Me.picb_scale.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom Me.picb_scale.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
Me.picb_scale.TabIndex = 11 Me.picb_scale.TabIndex = 11
Me.picb_scale.TabStop = False Me.picb_scale.TabStop = False
@ -242,14 +252,14 @@ Partial Class weightForm
' '
'weightForm 'weightForm
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 12.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 15.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(964, 561) Me.ClientSize = New System.Drawing.Size(1102, 701)
Me.Controls.Add(Me.gbWeightBot) Me.Controls.Add(Me.gbWeightBot)
Me.Controls.Add(Me.pnWeightMid) Me.Controls.Add(Me.pnWeightMid)
Me.Controls.Add(Me.pnWeightTop) Me.Controls.Add(Me.pnWeightTop)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Margin = New System.Windows.Forms.Padding(4, 3, 4, 3) Me.Margin = New System.Windows.Forms.Padding(5, 4, 5, 4)
Me.MaximizeBox = False Me.MaximizeBox = False
Me.MinimizeBox = False Me.MinimizeBox = False
Me.Name = "weightForm" Me.Name = "weightForm"
@ -293,4 +303,5 @@ Partial Class weightForm
Friend WithEvents playTimer As Timer Friend WithEvents playTimer As Timer
Friend WithEvents statusTimer As Timer Friend WithEvents statusTimer As Timer
Friend WithEvents cmdSerialPort As IO.Ports.SerialPort Friend WithEvents cmdSerialPort As IO.Ports.SerialPort
Friend WithEvents ToolTip1 As ToolTip
End Class End Class

View File

@ -121,7 +121,7 @@
<data name="picb_scale.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="picb_scale.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
vgAADr4B6kKxwAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACe7SURBVHhe7d0J vQAADr0BR/uQrQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACe7SURBVHhe7d0J
tHx5Wd/rbpp5FEQZBEEUiOIVRUER4YYh2JggieAN0wWH4HgTE5BJBBGDoKKi4MQSBBQVMAy5IsqgDRgg tHx5Wd/rbpp5FEQZBEEUiOIVRUER4YYh2JggieAN0wWH4HgTE5BJBBGDoKKi4MQSBBQVMAy5IsqgDRgg
CUYcEEEZjMzIPA/NzfddYje5vr/6n33Oqdq7aj/PWp+1WNr/ql/Vqar9VtWuvc8CAAAAAAAAAAAAAAAA CUYcEEEZjMzIPA/NzfddYje5vr/6n33Oqdq7aj/PWp+1WNr/ql/Vqar9VtWuvc8CAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAB25krphumm6TbSCrp5ulG6agJYjUulu6anprem/09ace9Nv52+J9Uw AAAAAAAAAAAAAAAAAAAAAAAAAAB25krphumm6TbSCrp5ulG6agJYjUulu6anprem/09ace9Nv52+J9Uw
@ -306,6 +306,9 @@
<metadata name="cmdSerialPort.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="cmdSerialPort.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>348, 17</value> <value>348, 17</value>
</metadata> </metadata>
<metadata name="ToolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>503, 17</value>
</metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
AAABAAEApa4AAAEAIAAQ0QEAFgAAACgAAAClAAAAXAEAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAABAAEApa4AAAEAIAAQ0QEAFgAAACgAAAClAAAAXAEAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

View File

@ -1,4 +1,5 @@
Imports System.Windows.Forms Imports System.Windows.Forms
Imports System.Windows.Forms.VisualStyles.VisualStyleElement
Public Class weightForm Public Class weightForm
Private weightSum As Integer Private weightSum As Integer
@ -18,13 +19,13 @@ Public Class weightForm
Private weight(2) Private weight(2)
Dim weights As New List(Of Double)() ' 실측 측정값 저장용 'Dim weights As New List(Of Double)() ' 실측 측정값 저장용
Dim avg As Double = 0.0 ' 평균 'Dim avg As Double = 0.0 ' 평균
Dim stdDev As Double = 0.0 ' 표준편차 'Dim stdDev As Double = 0.0 ' 표준편차
Dim k As Double = 2.0 ' 오차 계수 'Dim k As Double = 2.0 ' 오차 계수
Dim errorRate As Double = 0.0 ' 허용 오차 비율 'Dim errorRate As Double = 0.0 ' 허용 오차 비율
Dim weightErrorPlus As Double = 0.0 ' 허용 오차 상한 'Dim weightErrorPlus As Double = 0.0 ' 허용 오차 상한
Dim weightErrorMinus As Double = 0.0 ' 허용 오차 하한 'Dim weightErrorMinus As Double = 0.0 ' 허용 오차 하한
Private Sub weightForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load Private Sub weightForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ZeroTimer.Enabled = True ZeroTimer.Enabled = True
@ -157,19 +158,31 @@ Public Class weightForm
End Try End Try
End Sub End Sub
Private Sub UpdateErrorRange() 'Private Sub UpdateErrorRange()
If weights.Count >= 2 Then ' If mainForm.rdbWeightAuto.Checked = True Then
avg = weights.Average() ' ' 자동 모드: 오차 계수(k) 오차 범위 산출
stdDev = Math.Sqrt(weights.Select(Function(x) (x - avg) ^ 2).Average()) ' Dim autoErrorRate As Double = 0.02 ' : 2% 오차
errorRate = (k * stdDev) / avg ' weightErrorPlus = weightSum * autoErrorRate
' weightErrorMinus = weightSum * autoErrorRate
weightErrorPlus = weightSum * errorRate ' 'If lbNowWeight.Text >= weightSum - weightErrorMinus And
weightErrorMinus = weightSum * errorRate ' ' lbNowWeight.Text <= weightSum + weightErrorPlus Then
' 'End If
' 폼에 오차 범위 표시 ' Else
lbError.Text = "(오차: +" & weightErrorPlus.ToString() & ", -" & weightErrorMinus.ToString() & ")" ' ' 수동 모드: 평균, 표준편차 기반 오차 범위 산출
End If ' If weights.Count >= 2 Then
End Sub ' avg = weights.Average()
' stdDev = Math.Sqrt(weights.Select(Function(x) (x - avg) ^ 2).Average())
' errorRate = (k * stdDev) / avg
' weightErrorPlus = weightSum * errorRate
' weightErrorMinus = weightSum * errorRate
' '폼에 오차 범위 표시
' lbError.Text = "(오차: +" & weightErrorPlus.ToString() & ", -" & weightErrorMinus.ToString() & ")"
' End If
' End If
'End Sub
'Private Function weight_compare() As Boolean 'Private Function weight_compare() As Boolean
' If lbNowWeight.Text >= weightSum - weightErrorMinus And lbNowWeight.Text <= weightSum + weightErrorPlus Then ' If lbNowWeight.Text >= weightSum - weightErrorMinus And lbNowWeight.Text <= weightSum + weightErrorPlus Then
@ -180,17 +193,25 @@ Public Class weightForm
'End Function 'End Function
Private Function weight_compare() As Boolean Private Function weight_compare() As Boolean
Dim tip As New System.Windows.Forms.ToolTip()
Dim nowWeight As Double = Double.Parse(lbNowWeight.Text) Dim nowWeight As Double = Double.Parse(lbNowWeight.Text)
Dim autoErrorRate As Double = 0.02 '오차 계수(k) 오차 범위 산출 2% 오차
' 기준 무게 기반 허용 오차 범위 계산 완료된 상태에서 비교 Dim weightError As Double = weightSum * autoErrorRate
Dim upperBound As Double = weightSum + weightErrorPlus
Dim lowerBound As Double = weightSum - weightErrorMinus Dim upperBound As Double = weightSum + weightError
Dim lowerBound As Double = weightSum - weightError
' 라벨 텍스트 간결하게
lbError.Text = "(오차: ±" & weightError.ToString("F2") & ")"
' 툴팁에 상세 정보 표시
tip.SetToolTip(lbError, "허용구간: " & lowerBound.ToString("F2") & " ~ " & upperBound.ToString("F2"))
Return (nowWeight >= lowerBound) AndAlso (nowWeight <= upperBound) Return (nowWeight >= lowerBound) AndAlso (nowWeight <= upperBound)
End Function End Function
Public Sub delay(ByVal milliSecond As Double) Public Sub delay(ByVal milliSecond As Double)
Dim delayTime As Date = Now.AddSeconds(milliSecond / 1000) Dim delayTime As Date = Now.AddSeconds(milliSecond / 1000)
Do Until Now > delayTime Do Until Now > delayTime
@ -214,9 +235,9 @@ Public Class weightForm
Next Next
Loop Loop
weights.Add(Double.Parse(weight(0))) 'weights.Add(Double.Parse(weight(0)))
weights.Add(Double.Parse(weight(1))) 'weights.Add(Double.Parse(weight(1)))
UpdateErrorRange() 'UpdateErrorRange()
If weight(0) - weight(1) < 10 And weight(0) - weight(1) > -10 Then If weight(0) - weight(1) < 10 And weight(0) - weight(1) > -10 Then
Return True Return True