Sie sind auf Seite 1von 5

Funcoes_User - 1

Function Ifunc2(Tipo As String, Inominal As Double) As Double

If Tipo = "F" And Inominal >= 16 Then


Ifunc2 = Inominal * 1.6

ElseIf Tipo = "F" And Inominal < 16 Then


Ifunc2 = Inominal * 1.9

ElseIf Tipo = "DC" Then


Ifunc2 = Inominal * 1.3

ElseIf Tipo = "DM" Then


Ifunc2 = Inominal * 1.45
End If

End Function

Function ValidProt(Iservico As Double, Inominal As Double, Iz As Double, I2 As Double) As String

If Iservico <= Inominal <= Iz And I2 <= 1.45 * Iz Then


ValidProt = "OK"
Else
ValidProt = "Não OK"
End If

End Function

Function Validuperc(Ramal As String, uperc As Double) As String

If Ramal = "MT" And uperc <= 6 Then


Validuperc = "OK"

ElseIf Ramal = "MT" And uperc > 6 Then


Validuperc = "Não OK"

ElseIf Ramal = "BT" And uperc <= 3 Then


Validuperc = "OK"

ElseIf Ramal = "BT" And uperc > 3 Then


Validuperc = "Não OK"

End If

End Function

Function Kagrup(Tipo As String, NumCircuitos As Double) As Double

If Tipo = "Mono" And NumCircuitos = 1 Then


Kagrup = 1

ElseIf Tipo = "Mono" And NumCircuitos = 2 Then


Kagrup = 0.97

ElseIf Tipo = "Mono" And NumCircuitos = 3 Then


Kagrup = 0.87

ElseIf Tipo = "Multi" And NumCircuitos = 1 Then


Kagrup = 1

ElseIf Tipo = "Multi" And NumCircuitos >= 2 Then


Kagrup = 0.72

End If

End Function
Funcoes_User - 2

Function uperc(Metal As String, Comprimento As Double, Seccao As Double, Cosphi As Double, Sinphi As D
ouble, Corrente As Double, Tensao As Double) As Double

Dim roLscosphi As Double

Dim tauLsinphi As Double

Lscosphi = (Comprimento / Seccao) * Cosphi

tauLsinphi = 0.00008 * Comprimento * Sinphi

If Metal = "Cu" And Tensao = 400 Then

uperc = 100 * (((0.0225 * Lscosphi + tauLsinphi) * Corrente) / 231)

ElseIf Metal = "Al" And Tensao = 400 Then

uperc = 100 * (((0.036 * Lscosphi + tauLsinphi) * Corrente) / 231)

ElseIf Metal = "Cu" And Tensao = 231 Then

uperc = 2 * 100 * (((0.0225 * Lscosphi + tauLsinphi) * Corrente) / 231)

ElseIf Metal = "Al" And Tensao = 231 Then

uperc = 2 * 100 * (((0.036 * Lscosphi + tauLsinphi) * Corrente) / 231)

End If

End Function

Function Ksec(Seccao As Double) As Double

If Seccao <= 95 Then


Ksec = 1

ElseIf Seccao > 95 And Seccao <= 120 Then


Ksec = 0.9

ElseIf Seccao > 120 And Seccao <= 150 Then


Ksec = 0.85

ElseIf Seccao > 150 And Seccao <= 185 Then


Ksec = 0.8

ElseIf Seccao > 185 And Seccao <= 240 Then


Ksec = 0.75

ElseIf Seccao > 240 Then


Ksec = 0.72

End If

End Function

Function Rcabo(Metal As String, Comprimento As Double, Seccao As Double) As Double

If Metal = "Cu" Then


Rcabo = 0.0225 * (Comprimento / Seccao)

ElseIf Metal = "Al" Then


Rcabo = 0.036 * (Comprimento / Seccao)
Funcoes_User - 3

End If

End Function

Function RTrafo(Perdasfull As Double, Strafo As Double, Tensao As Double) As Double

Dim CorrenteTrafo As Double

CorrenteTrafo = Strafo / (Sqr(3) * Tensao)

RTrafo = (Perdasfull) / (3 * (CorrenteTrafo ^ 2))

End Function

Function RTotal(TipoDefeito As String, KSLSN As Double, RTotalAnt As Double, RParcial As Double) As Do


uble

If TipoDefeito = "Monofásico" Then


RTotal = RTotalAnt + (1 + KSLSN) * RParcial

ElseIf TipoDefeito = "Trifásico" Then


RTotal = RTotalAnt + RParcial

End If

End Function

Function XTotal(TipoDefeito As String, KSLSN As Double, XTotalAnt As Double, XParcial As Double) As Do


uble

If TipoDefeito = "Monofásico" Then


XTotal = XTotalAnt + (1 + KSLSN) * XParcial

ElseIf TipoDefeito = "Trifásico" Then


XTotal = XTotalAnt + XParcial

End If

End Function

Function XTrafo(Strafo As Double, Tensao As Double, uperc As Double, RTrafo As Double) As Double

Dim ZTrafo2 As Double

Dim RTrafo2 As Double

ZTrafo2 = ((((Tensao ^ 2) / Strafo) * uperc) ^ 2)

RTrafo2 = ((RTrafo / 1000) ^ 2)

XTrafo = Math.Sqr(ZTrafo2 - RTrafo2)

End Function

Function Iccircuito(Tensao As Double, Resistencia As Double, Reactancia As Double) As Double

Dim Reactancia2 As Double

Dim Resistencia2 As Double

Dim Impedancia As Double


Funcoes_User - 4

Reactancia2 = (Reactancia / 1000) ^ 2

Resistencia2 = (Resistencia / 1000) ^ 2

Impedancia = Math.Sqr(Reactancia2 + Resistencia2)

Iccircuito = Tensao / (Math.Sqr(3) * (Impedancia))

End Function

Function PoderkA(Iccircuito As Double) As Double

If Iccircuito <= 6 Then


PoderkA = 6

ElseIf Iccircuito > 6 And Iccircuito <= 10 Then


PoderkA = 10

ElseIf Iccircuito > 10 And Iccircuito <= 15 Then


PoderkA = 15

ElseIf Iccircuito > 15 And Iccircuito <= 20 Then


PoderkA = 20

ElseIf Iccircuito > 20 And Iccircuito <= 25 Then


PoderkA = 25

ElseIf Iccircuito > 25 Then


PoderkA = 50

End If

End Function

Function LMaximo(Metal As String, SeccaoFase As Double, KSLSN As Double, Imagnetico As Double) As Doub
le

Dim XCabos As Double


Dim Numerador As Double
Dim Denominador As Double

If SeccaoFase <= 120 Then


XCabos = 1

ElseIf SeccaoFase > 120 And SeccaoFase <= 150 Then


XCabos = 1.15

ElseIf SeccaoFase > 150 And SeccaoFase <= 185 Then


XCabos = 1.2

ElseIf SeccaoFase > 185 And SeccaoFase <= 240 Then


XCabos = 1.25

ElseIf SeccaoFase > 240 Then


XCabos = 1.3

End If

Numerador = 0.8 * 230 * SeccaoFase

If Metal = "Cu" Then


Denominador = 0.0225 * (XCabos) * (1 + KSLSN) * Imagnetico

ElseIf Metal = "Al" Then


Denominador = 0.036 * (XCabos) * (1 + KSLSN) * Imagnetico
Funcoes_User - 5

End If

LMaximo = Numerador / Denominador

End Function

Function Imagnetico(Inominal As Double, Curva As String) As Double

If Curva = "DC" Then


Imagnetico = 3 * Inominal

ElseIf Curva = "C" Then


Imagnetico = 5 * Inominal

ElseIf Curva = "B" Then


Imagnetico = 3 * Inominal

ElseIf Curva = "D" Then


Imagnetico = 20 * Inominal

Else
Imagnetico = 20 * Inominal

End If

End Function

Function Ucontacto(Metal As String, SeccaoPE As Double, SeccaoL As Double, Comprimento As Double, KSLS
N As Double) As Double

Dim Numerador As Double


Dim Denominador As Double

Numerador = 0.0225 * Comprimento * 0.8 * 230 * SeccaoL

If Metal = "Cu" Then


Denominador = SeccaoPE * 0.0225 * (1 + KSLSN) * Comprimento

ElseIf Metal = "Al" Then


Denominador = SeccaoPE * 0.036 * (1 + KSLSN) * Comprimento

End If

Ucontacto = Numerador / Denominador

End Function