-
Notifications
You must be signed in to change notification settings - Fork 1
/
calc_trafo
executable file
·169 lines (134 loc) · 4.28 KB
/
calc_trafo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/usr/bin/python3
import math
import CoilForm
import Core
def lookupWire(area):
rc = -1
len = 2*(area/math.pi)**(1/2)
for AWG in range(40,0,-1):
Bitola = 0.005*92**((36-AWG)/39)*25.4
# print (AWG, len, Bitola, sep=", ")
if len <= Bitola:
rc = AWG
break
return rc
def getWireDiameterByDesignation(designation):
Bitola = 0.005*92**((36-designation)/39)*25.4
return Bitola
def getWireAreaByDesignation(designation):
Bitola = 0.005*92**((36-designation)/39)*25.4
rc = (Bitola/2.0) ** 2 * math.pi
return rc
def lookupCoilForm(area):
forms = CoilForm.CoilForm.load("reels.csv")
selectForms = CoilForm.CoilForm.lookupCoilForms(forms, area, area*1.5)
if len(selectForms) != 0:
i = 0
for bob in selectForms:
print (f'{i} : {bob}')
i = i+1
sel=input("selecione o carretel a ser usado, da lista acima: ")
return selectForms[int(sel)]
return None
def lookupCore(L):
forms = Core.Core.load("cores.csv")
selectCores = Core.Core.lookupCoresBySize(forms, L*0.9, L)
if len(selectCores) != 0:
i = 0
for c in selectCores:
print (f'{i} : {c}')
i = i+1
sel=input("selecione o laminado a ser usado, da lista acima: ")
return selectCores[int(sel)]
return None
# premissas
Pw = float(input("Potência (watts) ? "))
Zi = float(input("Impedancia do primario (ohms) ? "))
Zo = float(input("Impedancia do secundario (ohms) ? "))
F = float(input("Frequencia (Hz) ? "))
Tipo = input("Transformador PP ou SE ? ")
DC = 3.0
if Tipo.upper() == "PP":
Iq = float(input("Corrente de repouso (A) ? "))
# calculos
Vi = (Pw*Zi)**(1/2)
Ip = Pw/Vi
if Tipo.upper() == "SE":
Iq = Ip * 1.414213562 # corrente quiescente = corrente de pico no primário
Ii = (Ip**2 + Iq**2)**(1/2) # soma a corrente DC com AC no primario
Bm = 5000.0
if Tipo.upper() == "PP":
Ii = Ip
Bm = 8000.0
Imax = Ii * 2 ** (0.5)
soma = Iq**2
for Angulo in range (10,350,10):
Ix = Imax * math.sin(Angulo*math.pi/180)
if Ix > -(Iq):
Ix2 = (Ix+Iq)**2
else:
Ix2 = 0
soma = soma + Ix2
media = soma/36
Ii = media**(1/2)
Vo = (Pw*Zo)**(1/2)
Io = Pw/Vo
Si = Ii/DC
So = Io/DC
Sm = 7.5*((1.5*Pw)/F)**(1/2)
Sg = 1.1*Sm
Ls = round(Sg**(1/2),1)
print(f'Secçao minima do nucleo: {Sg:.2f} cm2, perna central de {Ls:.2f} cm')
coilForm = lookupCoilForm(Sg*100)
if coilForm is None:
print("Nenhum carretel encontrado na lista de carreteis")
H = float(input("Empilhamento do nucleo (cm) ? "))
else:
H = coilForm.stack/10
print(f'Usando o carretel {coilForm.supplier}:{coilForm.model}, Empilhamento = {H} (cm)')
core = lookupCore(coilForm.leg)
if core is None:
print("Nenhum laminado encontrado na lista de laminados")
L = float(input("Largura da perna central (cm) ? "))
else:
L = core.leg/10
print(f'Usando o laminado {core.supplier}:{core.model}, Perna central = {L:.2f} (cm)')
Sgo = L * H
Smo = Sgo / 1.1
Wi = lookupWire(Si)
Wo = lookupWire(So)
Ni = int(Vi * 100000000 / (4.44 * Bm * Smo * F))
No = int(Vo / Vi * Ni)
gap = round(12.56 * Ni * Iq / (Bm * 2),3)
Swi = getWireAreaByDesignation(Wi)
Swo = getWireAreaByDesignation(Wo)
Scu = float(Ni) * Swi + float(No) * Swo
Sw = (core.b - core.g) * core.e
SwScuRatio = float(Sw / Scu)
print(f'Window Area = ({core.b:.2f} - {core.g:.2f}) * {core.e:.2f} = {Sw:.2f}')
print(f'Copper Area = {Scu:.2f}')
# Resultados
print("\n\n*** Resultados ***")
print(f'Secção usada {L:.2f} cm x {H} cm = {Sgo:.2f} cm2')
print(f'Lamina: {core.supplier}:{core.model}')
print(f'Carretel: {coilForm.supplier}:{coilForm.model}')
print(f'Tensao primario: {Vi:.1f} V @ {Ii:.3f} A')
print(f'Tensao secundário: {Vo:.1f} V @ {Io:.3f} A')
print(f'Espiras primario: {Ni} fio AWG {Wi}')
print(f'Espiras secundario: {No} fio AWG {Wo}')
if Tipo.upper() == "SE":
print(f'Gap: {gap:.2f} mm na perna central e laterais')
if SwScuRatio >= 3.0:
print(f'Construção possível razão de áreas: {SwScuRatio:.2f}')
else:
print(f'Construção impossível razão de áreas: {SwScuRatio:.2f}')
insThick = 0.050 # AWG 14 = 0.064; AWG 33 = 0.030
winLength = coilForm.length - coilForm.thickness * 2
nWi = int(winLength / (insThick + Swi))
nWo = int(winLength / (insThick + Swo))
nLi = int(float(Ni) / nWi + 0.95)
nLo = int(float(No)/ nWo + 0.95)
nWi = Ni / nLi
nWo = No / nLo
print(f'{nLi} camadas de {nWi:.1f} espiras fio AWG {Wi}')
print(f'{nLo} camadas de {nWo:.1f} espiras fio AWG {Wo}')