-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcorriente-cortocircuito.htm
215 lines (180 loc) · 8.36 KB
/
corriente-cortocircuito.htm
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
<!DOCTYPE html>
<html>
<head>
<title>Calculadora de Corriente de Cortocircuito del Transformador</title>
<style>
.calculadora-icc-outer-container {
display: flex;
justify-content: center;
align-items: center;
width: 100%; /* Asegura que ocupe todo el ancho disponible */
height: 100vh; /* O cualquier altura que desees */
}
.calculadora-icc-container {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
max-width: 400px;
background: white;
padding: 20px;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
margin: auto;
}
.calculadora-icc-input {
margin-bottom: 10px;
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
width: 95%;
}
.calculadora-icc-input-tramos {
width: 60%; /* O el ancho específico que prefieras */
}
.calculadora-icc-message {
color: black;
margin-top: 10px;
padding: 10px;
background-color: #f0f0f0;
border-radius: 4px;
}
.calculadora-icc-error-message {
color: red;
}
.calculadora-icc-button-container-separado {
margin-top: 20px;
}
.calculadora-icc-button {
background-color: #007bff;
color: white;
border: none;
padding: 10px 15px;
text-align: center;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
border-radius: 4px;
width: calc(50% - 10px);
}
.calculadora-icc-button:hover {
background-color: #0056b3;
}
.calculadora-icc-button-container {
display: flex;
justify-content: space-between;
}
.calculadora-icc-label {
font-size: 14px;
margin-bottom: 5px;
color: #333;
}
</style>
</head>
<body>
<div class="calculadora-icc-container">
<div class="calculadora-icc-label">Potencia del transformador (kVA):</div>
<input type="number" id="potencia" class="calculadora-icc-input" placeholder="Ingrese la potencia">
<div class="calculadora-icc-label">Tensión de línea (V):</div>
<input type="number" id="tension" class="calculadora-icc-input" placeholder="Ingrese la tensión de línea" value="380">
<!-- Contenedor Flex para Tramos y el botón Cargar tramos -->
<div style="display: flex; align-items: center;">
<div style="flex-grow: 1; margin-right: 10px;">
<div class="calculadora-icc-label">Tramos:</div>
<input type="number" id="tramos" class="calculadora-icc-input calculadora-icc-input-tramos" value="1">
</div>
<button onclick="cargarTramos()" class="calculadora-icc-button">Cargar tramos</button>
</div>
<div id="seccionesTramos"></div>
<div class="calculadora-icc-button-container calculadora-icc-button-container-separado">
<button onclick="calculate()" class="calculadora-icc-button">Calcular</button>
<button onclick="reset()" class="calculadora-icc-button">Reiniciar</button>
</div>
<div id="output" class="calculadora-icc-message"></div>
</div>
<script>
function cargarTramos() {
var numeroTramos = parseInt(document.getElementById('tramos').value);
var contenedorTramos = document.getElementById('seccionesTramos');
contenedorTramos.innerHTML = '';
for (var i = 0; i < numeroTramos; i++) {
contenedorTramos.innerHTML += `
<div class="tramo-container" style="margin-top: 10px;">
<div class="calculadora-icc-label">Tipo de cable (Tramo ${i + 1}):</div>
<select class="calculadora-icc-input tipoCable">
<option value="1">IRAM 2263 - Al - 3x25/50</option>
<option value="2">IRAM 2263 - Al - 3x35/50</option>
<option value="3">IRAM 2263 - Al - 3x50/50</option>
<option value="4">IRAM 2263 - Al - 3x70/50</option>
<option value="5">IRAM 2263 - Al - 3x95/50</option>
<option value="6">IRAM 2178 - Cu - 4x4</option>
<option value="7">IRAM 2178 - Cu - 4x6</option>
<option value="8">IRAM 2178 - Cu - 4x10</option>
<option value="9">IRAM 2178 - Cu - 4x16</option>
</select>
<div class="calculadora-icc-label">Longitud (Metros):</div>
<input type="number" class="calculadora-icc-input distancia" placeholder="Ingrese la distancia">
</div>
`;
}
}
function calculate() {
var potencia = parseFloat(document.getElementById('potencia').value);
var tension = parseFloat(document.getElementById('tension').value); // Recuperar la tensión de línea
var output = document.getElementById('output');
var tramos = document.getElementsByClassName('tramo-container');
try {
if (isNaN(potencia)) {
throw "Por favor, ingrese un valor numérico válido para la potencia.";
}
var Z = calcularZ(potencia); //Z%
var Icct = (potencia * 100000) / (tension * 1.73 * Z);
var Zt = (Z * tension * tension) / (100 * potencia); //Impedancia del trafo
var Zsuma = 0; //Impedancia total de todo el circuito
output.innerHTML = 'Icc en bornes del transformador: ' + Icct.toFixed(2) + ' A<br>';
for (var i = 0; i < tramos.length; i++) {
var tipoCable = tramos[i].querySelector('.tipoCable').value;
var distancia = parseFloat(tramos[i].querySelector('.distancia').value);
if (isNaN(distancia)) {
throw "Por favor, ingrese valores numéricos válidos para las distancias.";
}
var { Rc, Xc } = obtenerValoresCable(tipoCable);
var Rct = Rc * distancia;
var Xct = Xc * distancia;
var Zct = Math.sqrt(Rct * Rct + Xct * Xct); //Impedancia de este tramo
Zsuma = Zsuma + Zct //Sumo la Z de este tramo a los tramos previos
var Icc = Icct / (1 + (Zsuma / Zt));
output.innerHTML += 'Icc tramo ' + (i + 1) + ': ' + Icc.toFixed(2) + ' A<br>';
}
} catch (err) {
output.innerHTML = '<span class="error-message">' + err + '</span>';
}
}
function calcularZ(potencia) {
if (potencia <= 100) return 4;
else if (potencia <= 400) return 4.5;
else if (potencia <= 500) return 4.5;
else if (potencia <= 800) return 5;
else return 6.5;
}
function obtenerValoresCable(tipoCable) {
switch (tipoCable) {
case "1": return { Rc: 1.394, Xc: 0.088 };
case "2": return { Rc: 1.008, Xc: 0.088 };
case "3": return { Rc: 0.745, Xc: 0.086 };
case "4": return { Rc: 0.515, Xc: 0.085 };
case "5": return { Rc: 0.373, Xc: 0.084 };
case "6": return { Rc: 5.92, Xc: 0.0991 };
case "7": return { Rc: 3.95, Xc: 0.0901 };
case "8": return { Rc: 2.29, Xc: 0.0860 };
case "9": return { Rc: 1.45, Xc: 0.0813 };
default: throw "Tipo de cable no válido.";
}
}
function reset() {
document.getElementById('potencia').value = '';
document.getElementById('tramos').value = '1';
document.getElementById('seccionesTramos').innerHTML = '';
document.getElementById('output').innerHTML = '';
}
</script>
</body>
</html>