Código de Python - Programa para el calculo del envejecimiento de transformador con carga y temperaturas variables

sin imagen de perfil

Programa para el calculo del envejecimiento de transformador con carga y temperaturas variablesgráfica de visualizaciones


Python

Publicado el 15 de Mayo del 2014 por Sergio
2.614 visualizaciones desde el 15 de Mayo del 2014
Esta aplicación lo que hace es calcular el envejecimiento prematuro que puede sufrir un transformador debido al aumento de carga. Calcula además, temperaturas del aceite y de otras partes del transformador. Todo se desarrolló de acuerdo a “IEEE Guide for loading mineral-oil immersed transformers”, IEEE Std. C57.91-1905(R2004) donde aparece el programa original desarrollado en BASIC. Si bien este programa no fue desarrollado profesionalmente y puede ser utilizado casi exclusivamente por alguien que se dedique a la industria de la Ing. Eléctrica.

El contenido del archivo datos_trafo.txt es algo como:
28000,75,51690,0,21078,36986
52267,65,63.0,80,55.0,25.0,30.0
2,0,5,1.00
75600,31400,1,4910
0,0,36986
89.9,73.3,74.1,69.6,48.0
2,1,60,12
0,30.0,.751
1,29.5,.64
6,28.2,.56
7,29.8,.62
10,35.9,.88
13,39.6,1.03
14,40,1.07
15,40,1.10
16,39.6,1.10
18,36.8,1.04
21,32.5,.88
24,30.0,.73

Versión 1

Publicado el 15 de Mayo del 2014gráfica de visualizaciones de la versión: Versión 1
2.615 visualizaciones desde el 15 de Mayo del 2014
estrellaestrellaestrellaestrellaestrella
estrellaestrellaestrellaestrella
estrellaestrellaestrella
estrellaestrella
estrella

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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 04 10:24:20 2014

@author: Serge
"""
 
from numpy import array,floor,zeros,exp,absolute
 
#                 Creando archivo de salida
sal=open("registro.txt","w")
 
print "\nPrograma para el calculo del envejecimiento de \
transformador con carga y temperaturas variables \n\n"
 
sal.write("Programa para el cálculo del envejecimiento de \
transformador con carga y temperaturas variables \n\n")
 
#                 Abriendo datos del Transformador
 
Datos=open('datos_trafo.txt','r')
 
#                        Leyendo Primera linea
a=Datos.readline()
a1=a.split(',')
 
xkva1=(float(a1[0]))
tkva1=(float(a1[1]))
pw=(float(a1[2]))
pe=(float(a1[3]))
ps=(float(a1[4]))
pc=(float(a1[5]))
 
#                        Leyendo Segunda linea
a=Datos.readline()
a2=a.split(',')
 
xkva2=(float(a2[0]))
thkva2=(float(a2[1]))
thewa=(float(a2[2]))
thehsa=(float(a2[3]))
thetor=(float(a2[4]))
thebor=(float(a2[5]))
tar=(float(a2[6]))
 
#                        Leyendo Tercera linea
a=Datos.readline()
a3=a.split(',')
 
mc=(float(a3[0]))
puelhs=(float(a3[1]))
tauw=(float(a3[2]))
hhs=(float(a3[3]))
 
#                        Leyendo Cuarta linea
a=Datos.readline()
a4=a.split(',')
 
wcc=(float(a4[0]))
wtank=(float(a4[1]))
mf=(float(a4[2]))
gfluid=(float(a4[3]))
 
 
#                        Leyendo Quinta linea
a=Datos.readline()
a5=a.split(',')
 
mcore=(float(a5[0]))
timcor=(float(a5[1]))
pcoe=(float(a5[2]))
 
 
#                        Leyendo Sexta linea
a=Datos.readline()
a6=a.split(',')
 
ths=(float(a6[0]))
tw=(float(a6[1]))
tto=(float(a6[2]))
ttdo=(float(a6[3]))
tbo=(float(a6[4]))
 
#print ths
 
#                        Leyendo Septima linea
a=Datos.readline()
a7=a.split(',')
 
ma=(float(a7[0]))
mpr=(float(a7[1]))
dtp=(float(a7[2]))
jj=(float(a7[3]))
 
#                        Leyendo tim(j), amb(j), pul(j)
 
tim=[]; amb=[]; pul=[]
 
for line in Datos:
    a8=line.split(',')
    tim.append(float(a8[0]))
    amb.append(float(a8[1]))
    pul.append(float(a8[2]))
 
tim=array(tim);amb=array(amb);pul=array(pul)
tim=tim*60
Datos.close()
#                           Fin de lectura
 
#                       Definiendo función fnv
 
def fnv(b,c,tmu):
    FNV=b*exp(c/(tmu+273))
    return FNV
 
timcor=timcor*60
 
if ma==1:
    x=0.5
    yn=0.8
    z=0.5
    thedor=thetor
    print "Modo de Enfriamiento: OA"
    sal.write("Modo de Enfriamiento: OA\n")
elif ma==2:
    x=0.5
    yn=0.9
    z=0.5
    thedor=thetor
    print "Modo de enfriamiento: FA"
    sal.write("\nModo de enfriamiento: FA\n")
elif ma==3:
    x=0.5
    yn=0.9
    z=1
    thedor=thewa
    print "Modo de enfriamiento: NDFOA"
    sal.write("Modo de enfriamiento: NDFOA\n")
elif ma==4:
    x=1
    yn=1
    z=1
    thedor=thetor
    print "Modo de enfriamiento: DFOA"
    sal.write("Modo de enfriamiento: NDFOA\n")
 
twr=tar+thkva2
twrt=tar+thewa
thsr=tar+thehsa
ttor=tar+thetor
tbor=tar+thebor
ttdor=thedor+tar
twor=(hhs*(ttdor-tbor))+tbor
tdaor=(ttdor+tbor)/2
tfaver=(ttor+tbor)/2
tfave=(tto+tbo)/2
two=tbo+(hhs*(ttdo-tbo))
 
if mc==1:
    tk=225
    cpw=6.798
elif mc==2:
    tk=234.5
    cpw=2.91
 
xk2=(xkva2/xkva1)**2
tk2=(tk+twr)/(tk+tkva1)
pw=xk2*pw*tk2
pe=xk2*pe/tk2
ps=xk2*ps/tk2
pt=pw+pe+ps+pc
 
if (pe/pw)>puelhs:
    puelhs=pe/pw
 
tkhs=(thsr+tk)/(twr+tk)
pwhs=tkhs*pw
pehs=puelhs*pwhs
xmcp=(pe+pw)*tauw/(twrt-tdaor)
wwind=xmcp/cpw
 
if wwind>wcc:
    print "Constante de tiempo de devanado muy alta, cambie \
    el dato en el archivo de lectura de datos a un valor mas pequeño"
    sal.write("Constante de tiempo de devanado muy alta, cambie \
    el dato en el archivo de lectura de datos a un valor mas pequeño\n")
 
if mf==1:
    cpf=13.92
    rhof=0.031621
    c=2797.3
    b=0.0013473
    print "Fluido de enfriamiento: Aceite de transformador"
    sal.write("Fluido de enfriamiento: Aceite de transformador\n")
elif mf==2:
    cpf=11.49
    rhof=0.0347
    c=1782.3
    b=0.12127
    print "Fluido de enfriamiento: Silicona"
    sal.write("Fluido de enfriamiento: Silicona\n")
elif mf==3:
    cpf=14.55
    rhof=0.03178
    c=4434.7
    b=7.343e-5
    print "Fluido de enfriamitno: HTHC"
    sal.write("Fluido de enfriamitno: HTHC\n")
 
wcore=wcc-wwind
cpst=3.51
wfl=gfluid*231*rhof
summcp=(wtank*cpst)+(wcore*cpst)+(wfl*cpf)
t=(twrt+tdaor)/2
visr=fnv(b,c,t)
t=(thsr+twor)/2
vihsr=fnv(b,c,t)
tmp=0
 
if mpr<1:
    dtp=15
 
kk=int(floor(tim[jj-1]/dtp)+0.01)
k=0
timp=zeros(24)
for k in xrange(kk):
    tmp=tmp+dtp
    timp[k]=tmp
 
if mpr>=1:
    print "Time    HS   TOPO   TOPDO  BOTO \nHORAS  TEMP  TEMP    TEMP   TEMP"
    sal.write("\nTime        HS       TOPO       TOPDO      BOTO \nHORAS       TEMP     TEMP       TEMP       TEMP\n")
 
thsmax=ths
timhs=0
ttomax=tto
timto=0
ax=(15000.0/383.0)-(15000.0/(ths+273.0))
a=exp(ax)
asum=0
j=0
k=0
tims=0
timsh=0.0
dt=1
 
if (tauw/dt)<2:
    dt=dt/2
 
if mpr>=1:
    print '%3.3f'%(timsh),'%3.3f'%(ths), '%3.3f'%(tto), '%3.3f'%(ttdo), '%3.3f'%(tbo)
 
    val='%3.3f'%(timsh),'%3.3f'%(ths), '%3.3f'%(tto), '%3.3f'%(ttdo), '%3.3f'%(tbo)
    sal.write(str(val)+"\n")
 
 
 
 
 
 
while tims<tim[jj-1]:
 
 
    while tims<timp[k]:
 
 
        tims=tims+dt
        if tims>tim[j+1]:
            j+=1
 
 
 
        timsh=tims/60.0
 
        if absolute(tim[j+1]-tim[j])<0.01:
            j+=1
 
        sl=(pul[j+1]-pul[j])/(tim[j+1]-tim[j])
        pl=pul[j]+(sl*(tims-tim[j]))
        slamb=(amb[j+1]-amb[j])/(tim[j+1]-tim[j])
        ta=amb[j]+(slamb*(tims-tim[j]))
        tdao=(ttdo+tbo)/2
 
        if tw<tdao:
            tw=tdao
 
 
 
        tkw=(tw+tk)/(twr+tk)
        qwgen=pl*pl*((tkw*pw)+(pe/tkw))*dt
        t=(tw+tdao)/2
        vis=fnv(b,c,t)
        qwlost=(((tw-tdao)/(twrt-tdaor))**1.25)*((visr/vis)**0.25)*(pw+pe)*dt
        tw=(qwgen-qwlost+(xmcp*tw))/xmcp
        dtdo=(ttdor-tbor)*((qwlost/((pw+pe)*dt))**x)
        ttdo=tbo+dtdo
        tdao=(ttdo+tbo)/2
        two=tbo+(hhs*dtdo)
        tkhs=(ths+tk)/(thsr+tk)
 
        if (ttdo+0.1)<tto:
            two=tto
 
        if ths<tw:
            ths=tw
 
        if ths<two:
            ths=two
 
        qhsgen=pl*pl*((tkhs*pwhs)+(pehs/tkhs))*dt
        t=(ths+two)/2
        vishs=fnv(b,c,t)
        qlhs=(((ths-two)/(thsr-twor))**1.25)*((vihsr/vishs)**0.25)*(pwhs+pehs)*dt
        ths=(qhsgen-qlhs+(xmcp*ths))/xmcp
        qs=((pl*pl*ps)/tkw)*dt
        qlostf=(((tfave-ta)/(tfaver-tar))**(1/yn))*pt*dt
 
        if mcore>1:
            if tims>timcor:
                qc=pcoe*dt
            else:
                qc=pc*dt
        else:
            qc=pc*dt
 
        tfave=(qwlost+qc+qs-qlostf+(summcp*tfave))/summcp
        dttb=((qlostf/(pt*dt))**z)*(ttor-tbor)
        tto=tfave+(dttb/2)
        tbo=tfave-(dttb/2)
        ax=(15000.0/383.0)-(15000.0/(ths+273.0))
        a=exp(ax)
        asum=asum+(a*dt)
 
        if ths>thsmax:
            thsmax=ths
            timhs=timsh
        else :
            if tto>ttomax:
                ttomax=tto
                timto=timsh
    if mpr>=1:
        print '%3.3f'%(timsh),'%3.3f'%(ths), '%3.3f'%(tto), '%3.3f'%(ttdo), '%3.3f'%(tbo)
 
        val='%3.3f'%(timsh),'%3.3f'%(ths), '%3.3f'%(tto), '%3.3f'%(ttdo), '%3.3f'%(tbo)
        sal.write(str(val)+"\n")
 
    k+=1
 
 
 
tims=tims-dt
asum=asum/60.0
aeq=asum/timsh
print "\nCarga en pu", xkva2,"kva"
sal.write("\nCarga en pu "+str('%3.3f'%(xkva2))+ " kva""\n")
 
print "A este kva, las perdidas a",twr," grados C son como sigue:"
sal.write("A este kva, las perdidas a "+str(twr)+" °C son como sigue:\n")
 
print "Perdidas I2R",pw,"Watts"
sal.write("Perdidas I2R "+str('%3.3f'%(pw))+ " Watts""\n")
 
print "Perdidas por Eddy",pe,"Watts"
sal.write("Perdidas por Eddy "+str('%3.3f'%(pe))+ " Watts""\n")
 
print "Perdidas por dispersion",ps,"Watts"
sal.write("Perdidas por dispersión "+str('%3.3f'%(ps))+ " Watts""\n")
 
print "Perdidas en el nucleo",pc,"Watts"
sal.write("Perdidas en el núcleo "+str('%3.3f'%(pc))+ " Watts""\n")
 
print "Perdidas totales",pt,"Watts \n"
sal.write("Perdidas totales "+str('%3.3f'%(pt))+ " Watts""\n\n")
 
print "Temperaturas durante el ciclo de carga:\n"
sal.write("Temperaturas durante el ciclo de carga:\n")
 
print "Temperatura maxima del punto caliente:",thsmax, "a las",timhs,"hrs"
sal.write("Temperatura máxima del punto caliente "+str('%3.3f'%(thsmax))+ " a las "+str('%3.3f'%(timhs))+ " hrs\n")
 
print "Temperatura maxima del fluido de la parte superior:",ttomax,"a las",timto,"hrs"
sal.write("Temperatura máxima del fluido de la parte superior "+str('%3.3f'%(ttomax))+ " a las "+str('%3.3f'%(timto))+ " hrs\n\n")
 
print "Temperatura final del punto caliente:",ths
sal.write("Temperatura del punto caliente: "+str('%3.3f'%(ths))+"\n")
 
print "Temperatura final promedio del devanado:",tw
sal.write("Temperatura final promedio del devanado "+str('%3.3f'%(tw))+"\n")
 
print "Temperatura final del aceite de la parte superior:",tto
sal.write("Temperatura final del aceite de la parte superior: "+str('%3.3f'%(tto))+"\n")
 
print "Temperatura final del aceite del ducto:",ttdo
sal.write("Temperatura final del aceite del ducto: "+str('%3.3f'%(ttdo))+"\n")
 
print "Temperatura final del aceite de la parte inferior:",tbo,"\n"
sal.write("Temperatura final del aceite de la parte inferior: "+str('%3.3f'%(tbo))+"\n\n")
 
print "Envejecimiento equivalente:",asum,"hrs"
sal.write("Envejecimiento equivalente: "+str('%3.3f'%(asum))+" hrs\n")
 
print "Duracion del ciclo de carga:",timsh,"hrs"
sal.write("Duración del ciclco de carga: "+str('%3.3f'%(timsh))+" hrs\n")
 
print "Factor de envejecimiento equivalente:"'%6.6f'%(aeq),"por unidad"
sal.write("Factor de envejecimiento equivalente: "+str('%3.3f'%(aeq))+" por unidad")
 
 
sal.close()



Comentarios sobre la versión: Versión 1 (0)


No hay comentarios
 

Comentar la versión: Versión 1

Nombre
Correo (no se visualiza en la web)
Valoración
Comentarios...
CerrarCerrar
CerrarCerrar
Cerrar

Tienes que ser un usuario registrado para poder insertar imágenes, archivos y/o videos.

Puedes registrarte o validarte desde aquí.

Codigo
Negrita
Subrayado
Tachado
Cursiva
Insertar enlace
Imagen externa
Emoticon
Tabular
Centrar
Titulo
Linea
Disminuir
Aumentar
Vista preliminar
sonreir
dientes
lengua
guiño
enfadado
confundido
llorar
avergonzado
sorprendido
triste
sol
estrella
jarra
camara
taza de cafe
email
beso
bombilla
amor
mal
bien
Es necesario revisar y aceptar las políticas de privacidad

http://lwp-l.com/s2671