Files
ECO2/ArinWarev1/Calculator/Result/C에너지소요량.vb
2019-10-24 21:24:21 +09:00

402 lines
15 KiB
VB.net

Public Class C에너지소요량
Dim Midx As Integer
Public Mon As String
Private ErrMsg As String = "에너지소요량 계산되지 않았습니다"
Private DSETR As DSR
Private Result As CResult
Public Sub New(ByRef pdsetr As DSR, ByRef presult As CResult, Optional ByVal pmIdx As Integer = 0)
DSETR = pdsetr
Result = presult
Mon = "M" & Format(pmIdx, "00")
Me.Midx = pmIdx
End Sub
Public Sub Calc_Summary()
If Midx <> 0 Then
MsgBox("계산식은 0번 합계필드만 가능합니다.", MsgBoxStyle.Critical, "확인")
Return
End If
Dim I10 As Decimal = 0
Dim I20 As Decimal = 0
Dim I30 As Decimal = 0
Dim I40 As Decimal = 0
Dim I50 As Decimal = 0
Dim I60 As Decimal = 0
Dim IH As Decimal = 0
Dim IC As Decimal = 0
Dim IL As Decimal = 0
Dim IW As Decimal = 0
Dim IV As Decimal = 0
Dim I4 As Decimal = 0 '//난방
Dim I5 As Decimal = 0 '//냉방
Dim I6 As Decimal = 0 '//조명
Dim I7 As Decimal = 0 '//급탕
Dim I8 As Decimal = 0 '//환기
For i As Integer = 1 To 12
'//12월을 다더해서 0번열에 기록한다.
I10 += Result.E소요량(i).난방
I20 += Result.E소요량(i).난방보조
I30 += Result.E소요량(i).냉방
I40 += Result.E소요량(i).냉방보조
I50 += Result.E소요량(i).급탕
I60 += Result.E소요량(i).급탕보조
IH += Result.E소요량(i).난방S
IC += Result.E소요량(i).냉방S
IL += Result.E소요량(i).조명S
IW += Result.E소요량(i).급탕S
IV += Result.E소요량(i).환기S
I4 += Result.일차E소요량(i).난방전력
I5 += Result.일차E소요량(i).냉방전력
I6 += Result.일차E소요량(i).조명전력
I7 += Result.일차E소요량(i).급탕전력
I8 += Result.일차E소요량(i).환기전력
Next
Me.난방 = I10
Me.난방보조 = I20
Me.냉방 = I30
Me.냉방보조 = I40
Me.급탕 = I50
Me.급탕보조 = I60
If (I4 + I5 + I6 + I7 + I8 <> 0) Then
Me.난방S = IH - (Result.생산E(0).태양광전력생산량 + Result.생산E(0).열병합전력생산량) / (I4 + I5 + I6 + I7 + I8) * I4
Me.냉방S = IC - (Result.생산E(0).태양광전력생산량 + Result.생산E(0).열병합전력생산량) / (I4 + I5 + I6 + I7 + I8) * I5
Me.조명S = IL - (Result.생산E(0).태양광전력생산량 + Result.생산E(0).열병합전력생산량) / (I4 + I5 + I6 + I7 + I8) * I6
Me.급탕S = IW - (Result.생산E(0).태양광전력생산량 + Result.생산E(0).열병합전력생산량) / (I4 + I5 + I6 + I7 + I8) * I7
Me.환기S = IV - (Result.생산E(0).태양광전력생산량 + Result.생산E(0).열병합전력생산량) / (I4 + I5 + I6 + I7 + I8) * I8
End If
End Sub
ReadOnly Property 소요량() As Decimal
Get
Return 난방S + 냉방S + 조명S + 환기S + 급탕S
End Get
End Property
ReadOnly Property 면적소요량() As Decimal
Get
Return 난방면적 + 냉방면적 + 조명면적 + 급탕면적 + 환기면적
End Get
End Property
Property 난방S() As Decimal
Get
If Midx = 0 Then
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Return 0
Else
Return TOSG(DR(0)("난방"))
End If
Else
Return 난방 + 난방보조
End If
End Get
Set(ByVal value As Decimal)
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Else
DR(0)("난방") = value
End If
End Set
End Property
Property 난방() As Decimal
Get
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Return 0
Else
Return TOSG(DR(0)("난방에너지소요량"))
End If
End Get
Set(ByVal value As Decimal)
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Else
DR(0)("난방에너지소요량") = value
End If
End Set
End Property
Property 난방보조() As Decimal
Get
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Return 0
Else
Return TOSG(DR(0)("난방보조에너지소요량"))
End If
End Get
Set(ByVal value As Decimal)
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Else
DR(0)("난방보조에너지소요량") = value
End If
End Set
End Property
ReadOnly Property 난방면적() As Decimal
Get
If Result.사용면적.H = 0 Then
Return 0
Else
Return Me.난방S / Result.사용면적.H
End If
End Get
End Property
Property 냉방S() As Decimal
Get
If Midx = 0 Then
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Return 0
Else
Return TOSG(DR(0)("냉방"))
End If
Else
Return 냉방 + 냉방보조
End If
End Get
Set(ByVal value As Decimal)
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Else
DR(0)("냉방") = value
End If
End Set
End Property
Property 냉방() As Decimal
Get
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Return 0
Else
Return TOSG(DR(0)("냉방에너지소요량"))
End If
End Get
Set(ByVal value As Decimal)
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Else
DR(0)("냉방에너지소요량") = value
End If
End Set
End Property
Property 냉방보조() As Decimal
Get
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Return 0
Else
Return TOSG(DR(0)("냉방보조에너지소요량"))
End If
End Get
Set(ByVal value As Decimal)
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Else
DR(0)("냉방보조에너지소요량") = value
End If
End Set
End Property
ReadOnly Property 냉방면적() As Decimal
Get
If Result.사용면적.C = 0 Then
Return 0
Else
Return Me.냉방S / Result.사용면적.C
End If
End Get
End Property
Property 조명S() As Decimal
Get
If Midx = 0 Then
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Return 0
Else
Return TOSG(DR(0)("조명"))
End If
Else
Return Result.E분석(Midx).조명에너지요구량
End If
End Get
Set(ByVal value As Decimal)
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Else
DR(0)("조명") = value
End If
End Set
End Property
ReadOnly Property 조명면적() As Decimal
Get
If Result.사용면적.L = 0 Then
Return 0
Else
Return Me.조명S / Result.사용면적.L
End If
End Get
End Property
Property 급탕S() As Decimal
Get
If Midx = 0 Then
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Return 0
Else
Return TOSG(DR(0)("급탕"))
End If
Else
Return 급탕 + 급탕보조
End If
End Get
Set(ByVal value As Decimal)
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Else
DR(0)("급탕") = value
End If
End Set
End Property
Property 급탕() As Decimal
Get
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Return 0
Else
'#If DEBUG Then
' Dim f As String = "c:\temp\1\급탕에너지소요량.txt"
' Dim b As New System.Text.StringBuilder
' If System.IO.File.Exists(f) = False Then
' b.AppendLine("Mon 급탕에너지소요량")
' End If
' b.AppendLine(Mon + vbTab + DR(0)("급탕에너지소요량").ToString)
' My.Computer.FileSystem.WriteAllText(f, b.ToString, True)
'#End If
Return TOSG(DR(0)("급탕에너지소요량"))
End If
End Get
Set(ByVal value As Decimal)
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Else
DR(0)("급탕에너지소요량") = value
End If
End Set
End Property
Property 급탕보조() As Decimal
Get
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Return 0
Else
#If DEBUG Then
'Dim f As String = "c:\temp\1\급탕보조에너지소요량.txt"
'Dim b As New System.Text.StringBuilder
'If System.IO.File.Exists(f) = False Then
' b.AppendLine("Mon 급탕보조에너지소요량")
'End If
'b.AppendLine(Mon + vbTab + DR(0)("급탕보조에너지소요량").ToString)
'My.Computer.FileSystem.WriteAllText(f, b.ToString, True)
#End If
Return TOSG(DR(0)("급탕보조에너지소요량"))
End If
End Get
Set(ByVal value As Decimal)
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Else
DR(0)("급탕보조에너지소요량") = value
End If
End Set
End Property
ReadOnly Property 급탕면적() As Decimal
Get
If Result.사용면적.W = 0 Then
Return 0
Else
'#If DEBUG Then
' Dim f As String = "c:\temp\1\급탕면적.txt"
' Dim b As New System.Text.StringBuilder
' If System.IO.File.Exists(f) = False Then
' b.AppendLine("급탕S 사용면적")
' End If
' b.AppendLine(급탕S.ToString() + vbTab + Result.사용면적.W.ToString)
' My.Computer.FileSystem.WriteAllText(f, b.ToString, True)
'#End If
Return 급탕S / Result.사용면적.W
End If
End Get
End Property
Property 환기S() As Decimal
Get
If Midx = 0 Then
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Return 0
Else
Return TOSG(DR(0)("환기"))
End If
Else
Return Result.E분석(Midx).환기에너지요구량
End If
End Get
Set(ByVal value As Decimal)
Dim DR() As DSR.에너지소요량Row = CType(DSETR.에너지소요량.Select("mon='" & Mon & "'"), DSR.에너지소요량Row())
If DR.GetUpperBound(0) = -1 Then
MsgBox(ErrMsg)
Else
DR(0)("환기") = value
End If
End Set
End Property
ReadOnly Property 환기면적() As Decimal
Get
If Result.사용면적.V = 0 Then
Return 0
Else
Return 환기S / Result.사용면적.V
End If
End Get
End Property
End Class