Create size list based on sizes supported by the material type

pull/2/head
miguel 2021-10-16 13:37:08 +11:00
rodzic 79608da3bf
commit c180a1c824
1 zmienionych plików z 97 dodań i 60 usunięć

Wyświetl plik

@ -31,7 +31,7 @@
<option value="FT114">FT114</option>
<option value="FT82">FT82</option>
<option value="FT50">FT50</option>
<option value="FT37">FT37</option>
<option value="FT37" disabled="true">FT37</option>
</select>
<select name="materials" id="material-select" onchange="setMaterial()">
<option value="75">75 [5000]</option>
@ -155,11 +155,13 @@
// TODO - add 77 material in FT240, FT140, FT50A, FT50 and FT23
const cores = {
'77' : {
'FT240' : { PN:'5977003801', A:61.0, B:35.55, C:12.7, W:106.0, CC:9.20, le:14.5, Ae:1.58, Ve:22.8, Al:3155.0 },
'FT140' : { PN:'5977002701', A:35.55, B:23.00, C:12.7, W:33.00, CC:11.20, le:8.90, Ae:0.79, Ve:7.00, Al:2545.0 },
'FT114' : { PN:'5977001001', A:29.00, B:19.00, C:7.5, W:13.0, CC:19.80, le:7.30, Ae:0.37, Ve:2.70, Al:1365.0 },
'FT50' : { PN:'5977000301', A:12.70, B:7.15, C:4.90, W:2.00, CC:22.90, le:2.95, Ae:0.129, Ve:0.38, Al:1180.0 },
'FT37' : { PN:'5977000201', A:9.50, B:4.75, C:3.30, W:0.83, CC:28.60, le:2.07, Ae:0.072, Ve:0.15, Al:945.0 },
size : {
'FT240' : { PN:'5977003801', A:61.0, B:35.55, C:12.7, W:106.0, CC:9.20, le:14.5, Ae:1.58, Ve:22.8, Al:3155.0 },
'FT140' : { PN:'5977002701', A:35.55, B:23.00, C:12.7, W:33.00, CC:11.20, le:8.90, Ae:0.79, Ve:7.00, Al:2545.0 },
'FT114' : { PN:'5977001001', A:29.00, B:19.00, C:7.5, W:13.0, CC:19.80, le:7.30, Ae:0.37, Ve:2.70, Al:1365.0 },
'FT50' : { PN:'5977000301', A:12.70, B:7.15, C:4.90, W:2.00, CC:22.90, le:2.95, Ae:0.129, Ve:0.38, Al:1180.0 },
'FT37' : { PN:'5977000201', A:9.50, B:4.75, C:3.30, W:0.83, CC:28.60, le:2.07, Ae:0.072, Ve:0.15, Al:945.0 },
},
mat : "MnZn",
mu_i : 2000,
B : 4900,
@ -175,11 +177,13 @@
}
},
'75' : {
'FT240' : { PN:'5975003801', A:61.0, B:35.35, C:12.7, W:106.0, CC:9.20, le:14.5, Ae:1.58, Ve:22.8, Al:6850.0 },
'FT140' : { PN:'5975002701', A:35.55, B:23.00, C:12.7, W:33.00, CC:11.20, le:8.90, Ae:0.79, Ve:7.00, Al:5500.0 },
'FT100' : { PN:'5975006401', A:25.40, B:15.50, C:12.7, W:19.0, CC:10.00, le:6.20, Ae:0.62, Ve:3.80, Al:6250.0 },
'FT50' : { PN:'5975000301', A:12.70, B:7.15, C:4.90, W:2.00, CC:22.90, le:2.95, Ae:0.129, Ve:0.38, Al:2725.0 },
'FT37' : { PN:'5975000201', A:9.50, B:4.75, C:3.30, W:0.83, CC:28.60, le:2.06, Ae:0.072, Ve:0.15, Al:2200.0 },
size : {
'FT240' : { PN:'5975003801', A:61.0, B:35.35, C:12.7, W:106.0, CC:9.20, le:14.5, Ae:1.58, Ve:22.8, Al:6850.0 },
'FT140' : { PN:'5975002701', A:35.55, B:23.00, C:12.7, W:33.00, CC:11.20, le:8.90, Ae:0.79, Ve:7.00, Al:5500.0 },
'FT100' : { PN:'5975006401', A:25.40, B:15.50, C:12.7, W:19.0, CC:10.00, le:6.20, Ae:0.62, Ve:3.80, Al:6250.0 },
'FT50' : { PN:'5975000301', A:12.70, B:7.15, C:4.90, W:2.00, CC:22.90, le:2.95, Ae:0.129, Ve:0.38, Al:2725.0 },
'FT37' : { PN:'5975000201', A:9.50, B:4.75, C:3.30, W:0.83, CC:28.60, le:2.06, Ae:0.072, Ve:0.15, Al:2200.0 },
},
mat : "MnZn",
mu_i : 5000,
B : 4800,
@ -196,12 +200,14 @@
},
'67' : {
'FT240' : { PN:'5967003801', A:61.0, B:35.55, C:12.7, W:106.0, CC:9.20, le:14.5, Ae:1.58, Ve:22.8, Al:55.0 },
'FT140' : { PN:'5967002701', A:35.55, B:23.00, C:12.7, W:33.00, CC:11.20, le:8.90, Ae:0.79, Ve:7.00, Al:45.0 },
'FT114' : { PN:'5967001001', A:29.00, B:19.00, C:7.50, W:13.0, CC:19.80, le:7.30, Ae:0.37, Ve:2.70, Al:25.0 },
'FT82' : { PN:'5967000601', A:21.00, B:13.20, C:6.35, W:6.40, CC:21.30, le:5.20, Ae:0.243, Ve:1.26, Al:24.0 },
'FT50' : { PN:'5967000301', A:12.70, B:7.15, C:4.90, W:2.00, CC:22.90, le:2.95, Ae:0.129, Ve:0.38, Al:22 },
'FT37' : { PN:'5967000201', A:9.50, B:4.75, C:3.30, W:0.83, CC:28.60, le:2.07, Ae:0.072, Ve:0.15, Al:18.0 },
size : {
'FT240' : { PN:'5967003801', A:61.0, B:35.55, C:12.7, W:106.0, CC:9.20, le:14.5, Ae:1.58, Ve:22.8, Al:55.0 },
'FT140' : { PN:'5967002701', A:35.55, B:23.00, C:12.7, W:33.00, CC:11.20, le:8.90, Ae:0.79, Ve:7.00, Al:45.0 },
'FT114' : { PN:'5967001001', A:29.00, B:19.00, C:7.50, W:13.0, CC:19.80, le:7.30, Ae:0.37, Ve:2.70, Al:25.0 },
'FT82' : { PN:'5967000601', A:21.00, B:13.20, C:6.35, W:6.40, CC:21.30, le:5.20, Ae:0.243, Ve:1.26, Al:24.0 },
'FT50' : { PN:'5967000301', A:12.70, B:7.15, C:4.90, W:2.00, CC:22.90, le:2.95, Ae:0.129, Ve:0.38, Al:22 },
'FT37' : { PN:'5967000201', A:9.50, B:4.75, C:3.30, W:0.83, CC:28.60, le:2.07, Ae:0.072, Ve:0.15, Al:18.0 },
},
mat : "NiZn",
mu_i : 40,
B : 2300,
@ -218,12 +224,14 @@
},
'61' : {
'FT240' : { PN:'5961003801', A:61.0, B:35.55, C:12.7, W:106.0, CC:9.20, le:14.5, Ae:1.58, Ve:22.8, Al:170.0 },
'FT140' : { PN:'5961002701', A:35.55, B:23.00, C:12.7, W:33.00, CC:11.20, le:8.90, Ae:0.79, Ve:7.00, Al:140.0 },
'FT114' : { PN:'5961001001', A:29.00, B:19.00, C:7.50, W:13.0, CC:19.80, le:7.30, Ae:0.37, Ve:2.70, Al:80.0 },
'FT82' : { PN:'5961000601', A:21.00, B:13.20, C:6.35, W:6.40, CC:21.30, le:5.20, Ae:0.243, Ve:1.26, Al:75.0 },
'FT50' : { PN:'5961000301', A:12.70, B:7.15, C:4.90, W:2.00, CC:22.90, le:2.95, Ae:0.129, Ve:0.38, Al:69 },
'FT37' : { PN:'5961000201', A:9.50, B:4.75, C:3.30, W:0.83, CC:28.60, le:2.07, Ae:0.072, Ve:0.15, Al:55.0 },
size : {
'FT240' : { PN:'5961003801', A:61.0, B:35.55, C:12.7, W:106.0, CC:9.20, le:14.5, Ae:1.58, Ve:22.8, Al:170.0 },
'FT140' : { PN:'5961002701', A:35.55, B:23.00, C:12.7, W:33.00, CC:11.20, le:8.90, Ae:0.79, Ve:7.00, Al:140.0 },
'FT114' : { PN:'5961001001', A:29.00, B:19.00, C:7.50, W:13.0, CC:19.80, le:7.30, Ae:0.37, Ve:2.70, Al:80.0 },
'FT82' : { PN:'5961000601', A:21.00, B:13.20, C:6.35, W:6.40, CC:21.30, le:5.20, Ae:0.243, Ve:1.26, Al:75.0 },
'FT50' : { PN:'5961000301', A:12.70, B:7.15, C:4.90, W:2.00, CC:22.90, le:2.95, Ae:0.129, Ve:0.38, Al:69 },
'FT37' : { PN:'5961000201', A:9.50, B:4.75, C:3.30, W:0.83, CC:28.60, le:2.07, Ae:0.072, Ve:0.15, Al:55.0 },
},
mat : "NiZn",
mu_i : 125,
B : 2350,
@ -239,12 +247,14 @@
}
},
'52' : {
'FT240' : { PN:'5952003801', A:60.0, B:35.35, C:12.7, W:133.44, CC:9.14, le:14.5, Ae:1.58, Ve:22.8, Al:325.0 },
'FT140' : { PN:'5952020801', A:35.25, B:22.60, C:12.7, W:38.26, CC:11.10, le:8.79, Ae:0.792, Ve:6.959, Al:283.0 },
'FT114' : { PN:'5952020701', A:28.8, B:18.70, C:7.50, W:14.81, CC:19.34, le:7.23, Ae:0.374, Ve:2.702, Al:162.0 },
'FT82' : { PN:'5952020601', A:21.70, B:13.50, C:6.35, W:7.54, CC:20.80, le:5.33, Ae:0.256, Ve:1.368, Al:151.0 },
'FT50' : { PN:'5952020501', A:12.45, B:7.8, C:6.35, W:2.46, CC:21.24, le:3.06, Ae:0.144, Ve:0.442, Al:148.0 },
'FT37' : { PN:'5952020301', A:9.42, B:4.72, C:3.30, W:0.87, CC:28.66, le:2.06, Ae:0.072, Ve:0.147, Al:110.0 },
size : {
'FT240' : { PN:'5952003801', A:60.0, B:35.35, C:12.7, W:133.44, CC:9.14, le:14.5, Ae:1.58, Ve:22.8, Al:325.0 },
'FT140' : { PN:'5952020801', A:35.25, B:22.60, C:12.7, W:38.26, CC:11.10, le:8.79, Ae:0.792, Ve:6.959, Al:283.0 },
'FT114' : { PN:'5952020701', A:28.8, B:18.70, C:7.50, W:14.81, CC:19.34, le:7.23, Ae:0.374, Ve:2.702, Al:162.0 },
'FT82' : { PN:'5952020601', A:21.70, B:13.50, C:6.35, W:7.54, CC:20.80, le:5.33, Ae:0.256, Ve:1.368, Al:151.0 },
'FT50' : { PN:'5952020501', A:12.45, B:7.8, C:6.35, W:2.46, CC:21.24, le:3.06, Ae:0.144, Ve:0.442, Al:148.0 },
'FT37' : { PN:'5952020301', A:9.42, B:4.72, C:3.30, W:0.87, CC:28.66, le:2.06, Ae:0.072, Ve:0.147, Al:110.0 },
},
mat : "NiZn",
mu_i : 250,
B : 4200,
@ -260,12 +270,14 @@
}
},
'43' : {
'FT240' : { PN:'5943003801', A:61.0, B:35.55, C:12.7, W:106.0, CC:9.20, le:14.5, Ae:1.58, Ve:22.8, Al:1075.0 },
'FT140' : { PN:'5943002701', A:35.55, B:23.00, C:12.7, W:33.0, CC:11.20, le:8.90, Ae:0.79, Ve:7.00, Al:885.0 },
'FT114' : { PN:'5943001001', A:29.00, B:19.00, C:7.50, W:13.0, CC:19.80, le:7.30, Ae:0.37, Ve:2.70, Al:510.0 },
'FT82' : { PN:'5943000601', A:21.00, B:13.20, C:6.35, W:6.40, CC:21.30, le:5.20, Ae:0.243, Ve:1.26, Al:470.0 },
'FT50' : { PN:'5943000301', A:12.70, B:7.15, C:4.90, W:2.00, CC:22.90, le:2.95, Ae:0.129, Ve:0.38, Al:440.0 },
'FT37' : { PN:'5943000201', A:9.50, B:4.75, C:3.30, W:0.83, CC:28.60, le:2.07, Ae:0.072, Ve:0.15, Al:350.0 },
size : {
'FT240' : { PN:'5943003801', A:61.0, B:35.55, C:12.7, W:106.0, CC:9.20, le:14.5, Ae:1.58, Ve:22.8, Al:1075.0 },
'FT140' : { PN:'5943002701', A:35.55, B:23.00, C:12.7, W:33.0, CC:11.20, le:8.90, Ae:0.79, Ve:7.00, Al:885.0 },
'FT114' : { PN:'5943001001', A:29.00, B:19.00, C:7.50, W:13.0, CC:19.80, le:7.30, Ae:0.37, Ve:2.70, Al:510.0 },
'FT82' : { PN:'5943000601', A:21.00, B:13.20, C:6.35, W:6.40, CC:21.30, le:5.20, Ae:0.243, Ve:1.26, Al:470.0 },
'FT50' : { PN:'5943000301', A:12.70, B:7.15, C:4.90, W:2.00, CC:22.90, le:2.95, Ae:0.129, Ve:0.38, Al:440.0 },
'FT37' : { PN:'5943000201', A:9.50, B:4.75, C:3.30, W:0.83, CC:28.60, le:2.07, Ae:0.072, Ve:0.15, Al:350.0 },
},
mat : "NiZn",
mu_i : 800,
B : 3500,
@ -281,9 +293,11 @@
}
},
'31' : {
'FT240' : { PN:'2631803802', A:61.0, B:35.55, C:12.7, W:118.0, H:0.09, R : {1:12, 5:28, 10:40, 25:63, 100:119, 250:215} },
'FT200' : { PN:'2631626202', A:50.80, B:25.40, C:38.1, W:278.0, H:0.11, R : {1:40, 5:103, 10:140, 25:215, 100:365, 250:290} },
'FT114' : { PN:'2631801202', A:29.00, B:19.00, C:13.85, W:25.0, H:0.17, R : {1:10, 5:24, 10:31, 25:49, 100:88, 250:130} },
size : {
'FT240' : { PN:'2631803802', A:61.0, B:35.55, C:12.7, W:118.0, H:0.09, R : {1:12, 5:28, 10:40, 25:63, 100:119, 250:215} },
'FT200' : { PN:'2631626202', A:50.80, B:25.40, C:38.1, W:278.0, H:0.11, R : {1:40, 5:103, 10:140, 25:215, 100:365, 250:290} },
'FT114' : { PN:'2631801202', A:29.00, B:19.00, C:13.85, W:25.0, H:0.17, R : {1:10, 5:24, 10:31, 25:49, 100:88, 250:130} },
},
mat : "MnZn",
mu_i : 1500,
B : 3600,
@ -320,7 +334,7 @@
var material = '43';
var toroid = {
core : cores[material][t_size],
core : cores[material].size[t_size],
cond_diameter_meters : 0.0,
N_max : 0,
N : 0,
@ -456,7 +470,7 @@
// Solve all the parameters, and re-draw the canvas:
function recalculate() {
// Input variables:
toroid.core = cores[material][t_size];
toroid.core = cores[material].size[t_size];
toroid.cond_diameter_meters = 0.001 * awgToMm(40.0 - conductor_diameter_slider.value);
toroid.frequency_hz = 10.0**frequency_slider.value;
toroid.Vrms = 1.0 * voltage_slider.value;
@ -468,7 +482,13 @@
toroid.B_peak = (toroid.Vrms * 1e8) / (4.44 * toroid.frequency_hz * toroid.N); //
toroid.cond_length_meters = toroid.N * (2*toroid.core.C + toroid.core.A - toroid.core.B) * 1e-3;
toroid.Rdc = 1.68e-8 * toroid.cond_length_meters / (Math.PI * ((toroid.cond_diameter_meters*0.5)**2.0));
//const Cpmult = 12.9*()
//toroid.C = (0.9 + (78.1/toroid.N**2))*1e-12; // In Farads
// Based on David Knight's equation:
toroid.C = (0.9 + (78.1/toroid.N**2))*1e-12; // In Farads
toroid.SRF = 1.0/(2.0*Math.PI* Math.sqrt(toroid.L*toroid.C));
// Frequency dependent characteristics:
@ -529,6 +549,7 @@
var toroids = document.getElementsByName("toroids");
t_size = toroids[0].value;
recalculate()
myChart.options.plugins.title.text = "Fair-Rite " + t_size + "-" + material + " [" + toroid.core.PN + "]";
myChart.data.datasets[0].data = calculateImpedance();
myChart.data.datasets[1].data = calculateResistance();
myChart.data.datasets[2].data = calculateReactance();
@ -546,7 +567,32 @@
//console.log("setMaterial()")
var materials = document.getElementsByName("materials");
material = materials[0].value;
// Remove all toroid sizes in the DOM:
var toroid_sizes = document.getElementById("toroid-select");
while(toroid_sizes.firstChild) {
toroid_sizes.removeChild(toroid_sizes.firstChild);
}
// Now insert only the sizes that exist for this material:
for(const key in cores[material].size) {
// console.log(key);
// Create an option tag:
let size_opt = document.createElement('option',)
if(t_size == key) {
// This is so that if the size was selected and still exists, then maintain the setting:
toroid_sizes.appendChild(new Option(key, key, false, true));
} else {
toroid_sizes.appendChild(new Option(key, key));
}
}
if(!(t_size in cores[material].size)) {
//console.log(t_size + " NOT exists!");
t_size = Object.keys(cores[material].size)[0];
}
recalculate()
myChart.options.plugins.title.text = "Fair-Rite " + t_size + "-" + material + " [" + toroid.core.PN + "]";
myChart.data.datasets[0].data = calculateImpedance();
myChart.data.datasets[1].data = calculateResistance();
myChart.data.datasets[2].data = calculateReactance();
@ -636,7 +682,7 @@
const fctx = afront_canvas.getContext('2d');
function drawInductor(fctx, originX, originY, outerRadius, innerRadius, wireRadius, turns, width) {
let theta = Math.PI/8.0;
let theta = Math.PI/12.0;
// Draw entry and exit wires:
var x1 = originX + (outerRadius + 20) * Math.cos(0.5 * Math.PI + 0.5 * theta);
@ -654,10 +700,8 @@
// Draw front profile of toroid former:
fctx.lineWidth = outerRadius - innerRadius;
//fctx.fillStyle = "#1F0000";
fctx.strokeStyle = "#7F7F7F"; // rgb(100, 100, 100);
fctx.beginPath();
//fctx.lineWidth = wireRadius * 2.0;
fctx.arc(originX, originY, 0.5 * (outerRadius + innerRadius), 0.0, 2.0 * Math.PI, false);
fctx.stroke();
fctx.lineWidth = 1.0;
@ -669,14 +713,15 @@
fctx.fillStyle = 'lightgrey';
fctx.fillRect(originX + outerRadius + 20, originY - innerRadius, width, (2 * innerRadius));
// Write width of cross-section of toroid (not including winding wire thickness):
fctx.font = "12px arial";
fctx.fillStyle = "black";
fctx.textAlign = "center";
fctx.fillText((toroid.core.C).toFixed(1) + " mm", originX + outerRadius + 20 + 0.5*width, originY + outerRadius + 20);
fctx.fillText("(" + (toroid.core.C*0.03937).toFixed(3) + "\")", originX + outerRadius + 20 + 0.5*width, originY + outerRadius + 34);
// Draw wire winding around top cross-section view:
fctx.strokeStyle = "black";
fctx.beginPath();
fctx.lineWidth = 2.0 * wireRadius;
fctx.moveTo(originX + outerRadius + 20 + 0.5*width, originY - outerRadius - wireRadius);
@ -687,6 +732,7 @@
fctx.lineTo(originX + outerRadius + 20 + 0.5*width, originY - outerRadius - wireRadius);
fctx.stroke();
// Draw wire winding around bottom cross-section view:
fctx.beginPath();
fctx.lineWidth = 2.0 * wireRadius;
fctx.moveTo(originX + outerRadius + 20 + 0.5*width, originY + outerRadius + wireRadius);
@ -697,6 +743,7 @@
fctx.lineTo(originX + outerRadius + 20 + 0.5*width, originY + outerRadius + wireRadius);
fctx.stroke();
// Draw horizontal wires across mid of cross-section view:
fctx.lineWidth = 1.0;
for(let i = 0; i < Math.floor(turns/2); i++) {
x1 = (originX + outerRadius + 20 - wireRadius);
@ -712,18 +759,6 @@
fctx.fill();
}
/*
//
fctx.beginPath();
//fctx.lineWidth = wireRadius * 2.0;
fctx.arc(originX, originY, outerRadius, 0.0, 2.0 * Math.PI, false);
fctx.stroke();
fctx.beginPath();
fctx.arc(originX, originY, innerRadius, 0.0, 2.0 * Math.PI, false);
fctx.stroke();
*/
x1 = originX + (outerRadius + 20) * Math.cos(0.5 * Math.PI - 0.5 * theta);
y1 = originY + (outerRadius + 20) * Math.sin(0.5 * Math.PI - 0.5 * theta);
@ -951,9 +986,10 @@
fctx.fillText("H = " + cores[material].H + " Oe", win_width-18, 60);
fctx.fillText("Br = " + cores[material].Br + " G", win_width-18, 74);
fctx.fillText("Hc = " + cores[material].Hc + " Oe", win_width-18, 88);
fctx.fillText("Tc = " + cores[material].Tc + " C", win_width-18, 102);
fctx.fillText("Tc >= " + cores[material].Tc + " C", win_width-18, 102);
fctx.fillText("\u03C1 = " + cores[material].R.toPrecision(2) + " \u03A9", win_width-18, 116);
fctx.fillText("[" + cores[material].mat + "]", win_width-18, 130);
fctx.fillText("[" + toroid.core.PN + "]", win_width-18, 144);
/*
// Draw spacing text: (gap is to avoid collision of spacing and length texts)
@ -1068,7 +1104,8 @@
backgroundColor: 'rgb(100,100,100)',
data: calculatePowerLoss(),
borderWidth: 1,
yAxisID: 'wattsID'
yAxisID: 'wattsID',
hidden: true
}]
},
options: {
@ -1193,8 +1230,8 @@
//showLines: true,
mode : 'nearest',
title: {
display: false,
text: "Property vs Frequency",
display: true,
text: "Fair-Rite " + t_size + "-" + material + " [" + toroid.core.PN + "]",
},
tooltip: {
enabled: true,