2020-11-24 08:24:41 +00:00
<!DOCTYPE html>
< html lang = "en" >
< head >
< meta charset = "UTF-8" >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
< title > VK3CPU RF Inductor Calculator< / title >
< link rel = "stylesheet" href = "inductor.css" >
< / head >
< body >
2020-11-25 23:38:17 +00:00
< header > Miguel < a href = "mailto:vk3cpu@gmail.com" > VK3CPU< / a > - RF Inductor Calculator< br > < a href = "inductor.html" > [Wire Metric]< / a > < a href = "inductor_swg.html" > [Wire SWG]< / a > < a href = "inductor_lrg.html" > [Coax Metric]< / a > < / header >
2020-11-24 08:24:41 +00:00
< section class = "gridLayoutClass" >
< div id = "inductor-container" class = "inductor-container" style = "position: relative;" >
< canvas id = "inductor2D" class = "inductorClass" width = "350" height = "350" >
< / canvas >
< / div >
< div class = "slider_container" >
< div class = "sliders" >
< label for = "conductor_diameter_slider" > & #8960a:< / label >
2020-11-25 23:02:43 +00:00
< input type = "range" id = "conductor_diameter_slider" min = "0" max = "40" value = "20" step = "1" >
2020-11-24 08:24:41 +00:00
< / div >
< div class = "sliders" >
< label for = "loop_diameter_slider" > & #8960b:< / label >
2020-11-25 06:12:26 +00:00
< input type = "range" id = "loop_diameter_slider" min = "0.25" max = "2.0" value = "1.00" step = "0.01" >
2020-11-24 08:24:41 +00:00
< / div >
< div class = "sliders" >
< label for = "loop_spacing_slider" > c/a:< / label >
< input type = "range" id = "loop_spacing_slider" min = "1.1" max = "4.0" value = "2.0" step = "0.01" >
< / div >
< div class = "sliders" >
< label for = "loop_turns_slider" > N:< / label >
2020-11-24 21:34:08 +00:00
< input type = "range" id = "loop_turns_slider" min = "2" max = "100" value = "8.0" step = "1.0" >
2020-11-24 08:24:41 +00:00
< / div >
< div class = "sliders" >
< label for = "frequency_slider" > f:< / label >
2021-09-02 00:49:54 +00:00
< input type = "range" id = "frequency_slider" min = "1.0" max = "54.0" value = "7.0" step = "0.05" >
2020-11-24 08:24:41 +00:00
< / div >
< / div >
< div id = "notes" class = "notes" >
< br >
< b > < u > Notes:< / u > < / b > < br >
RF Inductor Calculator was developed to help users predict the RF characteristics of a single-layer solenoid-style air-core inductor. < br > < br >
< u > Inputs via the slider widgets:< / u >
< ul >
2020-11-25 23:02:43 +00:00
< li > ⌀ a : Conductor diameter slider changes AWG from 0-40. Actual diameter displayed in decimal inches.< / li >
2021-09-04 05:30:07 +00:00
< li > ⌀ b : Coil diameter in decimal inches.< / li >
2020-11-25 23:02:43 +00:00
< li > c/a : 'c' is the winding-to-winding distance, measured from the conductor mid-points. The 'a' is the conductor diameter, so 'c/a' is the spacing ratio. (c/a >= 1.1)
2020-11-24 08:24:41 +00:00
A low-value will increase the resistance due to the proximity effect.< / li >
< li > N : Number of turns or windings.< / li >
2021-09-04 05:30:07 +00:00
< li > f : The frequency of interest (MHz) for some of the calculations. Frequency dependent results are shown on the top-right.< / li >
2020-11-24 08:24:41 +00:00
< / ul >
< p > Characteristics on the left are independent of frequency, while the characteristics on the right are dependent on the selected frequency. < br > < br >
Each of the graphic representations attempt to keep the relative geometry correct, without exceeding the drawing boundary. The coil diameter
relative to the conductor diameter are representative. < / p >
< u > Calculated dimensions:< / u >
< ul >
2021-09-04 05:30:07 +00:00
< li > ⌀ o : Outer coil diameter (inches) < / li >
< li > ⌀ i : Inner coil diameter (inches) - corresponds to the diameter of the winding former.< / li >
2020-11-24 09:08:38 +00:00
< li > c : Distance between windings, measured from the conductor centers (inches).< / li >
2020-11-25 07:22:14 +00:00
< li > ℓ : Length of the coil (inches). Equal to c x N.< / li >
2020-11-24 08:24:41 +00:00
< / ul >
< u > Calculated parameters:< / u >
2021-09-04 06:13:46 +00:00
< ul > < b > Frequency independent:[L]< / b >
2020-11-24 09:08:38 +00:00
< li > L : Inductance is calculated using Nagaoka's equation incorporating his coefficient.< / li >
2020-11-24 08:24:41 +00:00
< li > C : Capacitance is calculated using Knight's 2016 paper on self-resonance and self-capacitance of solenoid coils.< / li >
< li > Rdc : DC resistance is calculated using conductor length divided by the conductor cross-sectional area, assuming a copper conductor.< / li >
2021-09-02 05:13:35 +00:00
< li > SRF : Self-resonant frequency (MHz) for the unloaded coil. < / li >
2021-09-04 06:08:12 +00:00
< li > wire : Length of wire required to wind the inductor. < / li >
< / ul >
2021-09-04 06:13:46 +00:00
< ul > < b > Frequency dependent:[R]< / b > (Text goes < font color = "red" > RED< / font > when selected frequency > SRF. Inductor model is not accurate once SRF is exceeded.)
2021-09-04 06:08:12 +00:00
< li > f : Selected frequency in MHz< / li >
2020-11-25 07:12:22 +00:00
< li > δ : Skin depth due to skin effect (μ m)< / li >
2020-11-24 08:24:41 +00:00
< li > Rac : AC resistance is calculated using the skin effect and proximity resistance from empirical data collected by Medhurst using the spacing ratio, and length-to-diameter ratio.< / li >
2021-09-04 06:46:19 +00:00
< li > Xₗ : Inductive reactance at the given frequency. (Ω ) - pure inductive component, ignoring parasitic capacitance < / li >
< li > Z : Complex impedance at the given frequency. (Ω ) - includes losses due to series Rac and parallel parasitic C< / li >
2021-09-04 06:08:12 +00:00
< li > |Z| : Impedance magnitude at the given frequency. (Ω )< / li >
2021-09-04 06:46:19 +00:00
< li > Q : Effective Quality Factor of the inductor at the given frequency. - (|Z.im|/Z.re)< / li >
2020-11-24 08:24:41 +00:00
< / ul >
< / div >
< / section >
2020-11-25 06:12:26 +00:00
< script src = "https://cdnjs.cloudflare.com/ajax/libs/mathjs/7.5.1/math.min.js" > < / script >
2020-11-24 08:24:41 +00:00
< script src = "inductor.js" > < / script >
< script >
2020-11-25 23:02:43 +00:00
function awgToMm(awg) {
//
switch (awg) {
case 40: return 0.0799;
case 39: return 0.0897;
case 38: return 0.101;
case 37: return 0.113;
case 36: return 0.127;
case 35: return 0.143;
case 34: return 0.160;
case 33: return 0.180;
case 32: return 0.202;
case 31: return 0.227;
case 30: return 0.255;
case 29: return 0.286;
case 28: return 0.321;
case 27: return 0.361;
case 26: return 0.405;
case 25: return 0.455;
case 24: return 0.511;
case 23: return 0.573;
case 22: return 0.644;
case 21: return 0.723;
case 20: return 0.812;
case 19: return 0.912;
case 18: return 1.024;
case 17: return 1.150;
case 16: return 1.291;
case 15: return 1.450;
case 14: return 1.628;
case 13: return 1.828;
case 12: return 2.053;
case 11: return 2.305;
case 10: return 2.588;
case 9: return 2.906;
case 8: return 3.264;
case 7: return 3.665;
case 6: return 4.115;
case 5: return 4.621;
case 4: return 5.189;
case 3: return 5.827;
case 2: return 6.544;
case 1: return 7.348;
case 0: return 8.251;
default: return 0.0;
}
}
2020-11-24 08:24:41 +00:00
// Define global storage for calculated values, so we don't recalculate the same things multiple times:
var inductor = {
2020-11-25 23:02:43 +00:00
loop_diameter_meters : 0.0,
cond_diameter_meters : 0.0,
spacing_ratio : 0.0,
loop_turns : 0.0,
frequency_hz : 0.0,
2020-11-24 08:24:41 +00:00
L : 0.0,
C : 0.0,
Rdc : 0.0,
SRF : 0.0,
2020-11-25 06:12:26 +00:00
Xl : 0.0,
Xc : 0.0,
Z : 0.0,
2020-11-24 08:24:41 +00:00
skin_depth : 0.0,
Rac : 0.0,
Q : 0.0
};
// Solve all the parameters, and re-draw the canvas:
function recalculate() {
// Input variables:
2020-11-25 23:02:43 +00:00
inductor.loop_diameter_meters = 0.001 * loop_diameter_slider.value * 25.4; // Inches to mm then to m
2020-11-27 09:08:35 +00:00
inductor.cond_diameter_meters = 0.001 * awgToMm(40.0 - conductor_diameter_slider.value);
2020-11-25 23:02:43 +00:00
inductor.spacing_ratio = 1.0 * loop_spacing_slider.value;
inductor.loop_turns = 1.0 * loop_turns_slider.value;
inductor.frequency_hz = 1e6 * frequency_slider.value;
2020-11-24 08:24:41 +00:00
// Frequency independent characteristics:
2020-11-25 23:02:43 +00:00
inductor.L = getInductance(inductor.loop_diameter_meters, inductor.cond_diameter_meters, inductor.spacing_ratio, inductor.loop_turns);
inductor.C = multiloopCapacitance(inductor.loop_diameter_meters, inductor.cond_diameter_meters, inductor.spacing_ratio, inductor.loop_turns);
inductor.Rdc = dcResistance(inductor.loop_diameter_meters, inductor.cond_diameter_meters, inductor.spacing_ratio, inductor.loop_turns);
2020-11-24 08:24:41 +00:00
inductor.SRF = selfResonantFrequency(inductor.L, inductor.C);
// Frequency dependent characteristics:
2020-11-25 23:02:43 +00:00
inductor.Xl = inductiveReactance(inductor.frequency_hz, inductor.L);
inductor.Xc = capacitiveReactance(inductor.frequency_hz, inductor.C);
inductor.skin_depth = skinDepth(inductor.frequency_hz);
inductor.Rac = acResistance(inductor.loop_diameter_meters, inductor.cond_diameter_meters, inductor.spacing_ratio, inductor.loop_turns, inductor.frequency_hz);
2021-09-04 05:30:07 +00:00
//inductor.Q = qualityFactor(inductor.Xl, inductor.Rac);
2020-11-25 06:12:26 +00:00
// Calculate impedance:
var Zl = math.complex(inductor.Rac, inductor.Xl);
var Zc = math.complex(0, inductor.Xc);
2021-09-04 05:30:07 +00:00
inductor.Z = math.divide(math.multiply(Zl, Zc), math.add(Zl, Zc));
inductor.Q = Math.abs(inductor.Z.im) / inductor.Z.re;
2020-11-24 08:24:41 +00:00
// Redraw the canvas:
2021-09-09 14:26:29 +00:00
//drawDesign();
2020-11-24 08:24:41 +00:00
}
2021-09-09 14:26:29 +00:00
var loop_dia_timer_handler = 0;
var loop_dia_font = "12px arial";
2020-11-24 08:24:41 +00:00
loop_diameter_slider.oninput = function() {
recalculate();
2021-09-09 14:26:29 +00:00
if(loop_dia_timer_handler == 0) {
loop_dia_font = "bold 13px arial";
loop_dia_timer_handler = setTimeout(function(){
loop_dia_font = "12px arial";
drawDesign();
loop_dia_timer_handler = 0;
2021-09-10 08:24:04 +00:00
}, 1500);
2021-09-09 14:26:29 +00:00
} else {
clearTimeout(loop_dia_timer_handler);
loop_dia_timer_handler = setTimeout(function(){
loop_dia_font = "12px arial";
drawDesign();
loop_dia_timer_handler = 0;
2021-09-10 08:24:04 +00:00
}, 1500);
2021-09-09 14:26:29 +00:00
}
drawDesign();
2020-11-24 08:24:41 +00:00
}
2021-09-09 14:26:29 +00:00
var cond_dia_timer_handler = 0;
var cond_dia_font = "12px arial";
2020-11-24 08:24:41 +00:00
conductor_diameter_slider.oninput = function() {
recalculate();
2021-09-09 14:26:29 +00:00
if(cond_dia_timer_handler == 0) {
cond_dia_font = "bold 13px arial";
cond_dia_timer_handler = setTimeout(function(){
cond_dia_font = "12px arial";
drawDesign();
cond_dia_timer_handler = 0;
2021-09-10 08:24:04 +00:00
}, 1500);
2021-09-09 14:26:29 +00:00
} else {
clearTimeout(cond_dia_timer_handler);
cond_dia_timer_handler = setTimeout(function(){
cond_dia_font = "12px arial";
drawDesign();
cond_dia_timer_handler = 0;
2021-09-10 08:24:04 +00:00
}, 1500);
2021-09-09 14:26:29 +00:00
}
drawDesign();
2020-11-24 08:24:41 +00:00
}
2021-09-10 08:24:04 +00:00
var turns_timer_handler = 0;
var turns_font = "12px arial";
2020-11-24 08:24:41 +00:00
loop_turns_slider.oninput = function() {
recalculate();
2021-09-10 08:24:04 +00:00
if(turns_timer_handler == 0) {
turns_font = "bold 13px arial";
turns_timer_handler = setTimeout(function(){
turns_font = "12px arial";
drawDesign();
turns_timer_handler = 0;
}, 1500);
} else {
clearTimeout(turns_timer_handler);
turns_timer_handler = setTimeout(function(){
turns_font = "12px arial";
drawDesign();
turns_timer_handler = 0;
}, 1500);
}
2021-09-09 14:26:29 +00:00
drawDesign();
2020-11-24 08:24:41 +00:00
}
2021-09-10 08:24:04 +00:00
var spacing_timer_handler = 0;
var spacing_font = "12px arial";
2020-11-24 08:24:41 +00:00
loop_spacing_slider.oninput = function() {
recalculate();
2021-09-10 08:24:04 +00:00
if(spacing_timer_handler == 0) {
spacing_font = "bold 13px arial";
spacing_timer_handler = setTimeout(function(){
spacing_font = "12px arial";
drawDesign();
spacing_timer_handler = 0;
}, 1500);
} else {
clearTimeout(spacing_timer_handler);
spacing_timer_handler = setTimeout(function(){
spacing_font = "12px arial";
drawDesign();
spacing_timer_handler = 0;
}, 1500);
}
2021-09-09 14:26:29 +00:00
drawDesign();
2020-11-24 08:24:41 +00:00
}
2021-09-10 08:24:04 +00:00
var frequency_timer_handler = 0;
var frequency_font = "12px arial";
2020-11-24 08:24:41 +00:00
frequency_slider.oninput = function() {
recalculate();
2021-09-10 08:24:04 +00:00
if(frequency_timer_handler == 0) {
frequency_font = "bold 13px arial";
frequency_timer_handler = setTimeout(function(){
frequency_font = "12px arial";
drawDesign();
frequency_timer_handler = 0;
}, 1500);
} else {
clearTimeout(frequency_timer_handler);
frequency_timer_handler = setTimeout(function(){
frequency_font = "12px arial";
drawDesign();
frequency_timer_handler = 0;
}, 1500);
}
2021-09-09 14:26:29 +00:00
drawDesign();
2020-11-24 08:24:41 +00:00
}
window.onresize = function() {
recalculate();
2021-09-09 14:26:29 +00:00
drawDesign();
2020-11-24 08:24:41 +00:00
}
window.onorientationchange = function() {
recalculate();
2021-09-09 14:26:29 +00:00
drawDesign();
2020-11-24 08:24:41 +00:00
}
window.onbeforeprint = function() {
console.log("onbeforeprint");
drawDesign();
}
const afront_canvas = document.getElementById("inductor2D");
const fctx = afront_canvas.getContext('2d');
function drawDesign() {
const win_width = document.getElementById("inductor-container").clientWidth;
const win_height = document.getElementById("inductor-container").clientHeight;
afront_canvas.width = win_width-12;
afront_canvas.height = win_height-12;
fctx.clearRect(0, 0, win_width, win_height);
2020-11-25 23:02:43 +00:00
const loop_radius = 0.11 * win_height;
var cond_radius = loop_radius * (inductor.cond_diameter_meters / inductor.loop_diameter_meters);
2020-11-24 08:24:41 +00:00
const loopx = win_width/2;
const loopy = win_height/4;
2020-11-26 06:51:50 +00:00
const loop_diameter_mm = inductor.loop_diameter_meters * 1000.0;
const cond_diameter_mm = inductor.cond_diameter_meters * 1000.0;
2020-11-26 07:09:25 +00:00
const loop_diameter_inches = loop_diameter_mm / 25.4;
const cond_diameter_inches = cond_diameter_mm / 25.4;
2020-11-25 23:02:43 +00:00
2020-11-24 09:20:22 +00:00
fctx.font = "bold 14px arial";
fctx.textAlign = "center";
2020-11-25 23:02:43 +00:00
fctx.fillText("Wire - AWG", win_width*0.5, 18);
2020-11-24 09:20:22 +00:00
2020-11-24 08:24:41 +00:00
// Draw loop ends first, then draw the loop after:
fctx.strokeStyle = "grey";
fctx.beginPath();
fctx.arc(loopx - 0.5*loop_radius, loopy + 1.414*loop_radius, 0.5 * loop_radius, 0.0, -0.40 * Math.PI, true);
fctx.lineWidth = cond_radius * 2.0;
fctx.stroke();
fctx.strokeStyle = "black";
fctx.beginPath();
fctx.arc(loopx + 0.5*loop_radius, loopy + 1.414*loop_radius, 0.5 * loop_radius, Math.PI, -0.60 * Math.PI, false);
fctx.lineWidth = cond_radius * 2.0;
fctx.stroke();
// Draw loop:
fctx.beginPath();
fctx.arc(loopx, loopy, loop_radius, 0.0, 2.0 * Math.PI, false);
fctx.stroke();
fctx.lineWidth = 1.0;
// Draw loop diameter arrow:
const y_offset = loopy + loop_radius + 20;
var arrow_size = 10.0;
fctx.beginPath();
fctx.moveTo(loopx - loop_radius, loopy);
fctx.lineTo(loopx - loop_radius, y_offset);
fctx.lineTo(loopx - loop_radius - arrow_size, y_offset - arrow_size);
fctx.lineTo(loopx - loop_radius - arrow_size, y_offset + arrow_size);
fctx.lineTo(loopx - loop_radius, y_offset);
fctx.lineTo(loopx - loop_radius - 3.0*arrow_size, y_offset);
fctx.stroke();
fctx.beginPath();
fctx.moveTo(loopx + loop_radius, loopy);
fctx.lineTo(loopx + loop_radius, y_offset);
fctx.lineTo(loopx + loop_radius + arrow_size, y_offset - arrow_size);
fctx.lineTo(loopx + loop_radius + arrow_size, y_offset + arrow_size);
fctx.lineTo(loopx + loop_radius, y_offset);
fctx.lineTo(loopx + loop_radius + 3.0*arrow_size, y_offset);
fctx.stroke();
2020-11-25 06:12:26 +00:00
// Write conductor diameter symbol:
2021-09-09 14:26:29 +00:00
fctx.font = cond_dia_font;
2020-11-24 08:24:41 +00:00
fctx.textAlign = "right";
2020-11-25 23:02:43 +00:00
fctx.fillText("\u2300a = " + cond_diameter_inches.toFixed(4).toString() + "\"", loopx - loop_radius - 2.0*arrow_size, loopy - 6);
2020-11-26 06:51:50 +00:00
fctx.fillText("(" + cond_diameter_mm.toFixed(3).toString() + "mm)", loopx - loop_radius - 2.0*arrow_size, loopy + 12);
2020-11-25 06:12:26 +00:00
2021-09-09 14:26:29 +00:00
fctx.textAlign = "center";
//fctx.font = "14px courier";
2021-09-10 08:27:56 +00:00
fctx.fillText((40-conductor_diameter_slider.value).toString() + "AWG", loopx, loopy + 3);
2021-09-09 14:26:29 +00:00
//fctx.font = "12px arial";
fctx.textAlign = "right";
fctx.font = loop_dia_font;
2020-11-25 06:12:26 +00:00
// Write loop diameter symbol:
2020-11-26 06:51:50 +00:00
fctx.fillText("\u2300b = " + loop_diameter_inches.toFixed(2).toString() + "\"", loopx - loop_radius - 2.0*arrow_size, y_offset - 4);
fctx.fillText("(" + loop_diameter_mm.toFixed(2).toString() + "mm)", loopx - loop_radius - 2.0*arrow_size, y_offset + 12);
2021-09-09 14:26:29 +00:00
fctx.font = "12px arial";
2021-09-09 14:39:22 +00:00
fctx.fillText("(A=" + (cond_diameter_mm**2).toFixed(2).toString() + " mm\u00B2)", loopx - loop_radius - 2.0*arrow_size, loopy + 28);
2020-11-24 08:24:41 +00:00
// Draw inner-diameter arrows: (for using a winding former)
const inner_dia_y = loopy + loop_radius + 40;
fctx.beginPath();
fctx.moveTo(loopx - loop_radius + cond_radius, loopy);
fctx.lineTo(loopx - loop_radius + cond_radius, inner_dia_y);
fctx.lineTo(loopx - loop_radius + cond_radius - arrow_size, inner_dia_y - arrow_size);
fctx.lineTo(loopx - loop_radius + cond_radius - arrow_size, inner_dia_y + arrow_size);
fctx.lineTo(loopx - loop_radius + cond_radius, inner_dia_y);
fctx.lineTo(loopx - loop_radius - 3.0*arrow_size, inner_dia_y);
fctx.stroke();
fctx.beginPath();
fctx.moveTo(loopx + loop_radius - cond_radius, loopy);
fctx.lineTo(loopx + loop_radius - cond_radius, inner_dia_y);
fctx.lineTo(loopx + loop_radius - cond_radius + arrow_size, inner_dia_y - arrow_size);
fctx.lineTo(loopx + loop_radius - cond_radius + arrow_size, inner_dia_y + arrow_size);
fctx.lineTo(loopx + loop_radius - cond_radius, inner_dia_y);
fctx.lineTo(loopx + loop_radius + 3.0*arrow_size, inner_dia_y);
fctx.stroke();
fctx.textAlign = "left";
2020-11-26 07:09:25 +00:00
fctx.fillText("\u2300i = " + (loop_diameter_inches-0.5*cond_diameter_inches).toFixed(3).toString() + "\"", loopx + loop_radius + 2.0*arrow_size, inner_dia_y - 4);
2020-11-26 06:51:50 +00:00
fctx.fillText("(" + (loop_diameter_mm-0.5*cond_diameter_mm).toFixed(2).toString() + "mm)", loopx + loop_radius + 2.0*arrow_size, inner_dia_y + 12);
2020-11-24 08:24:41 +00:00
// Draw outer-diameter arrows: (for using a winding former)
const outer_dia_y = loopy + loop_radius + 0;
fctx.beginPath();
fctx.moveTo(loopx - loop_radius - cond_radius, loopy);
fctx.lineTo(loopx - loop_radius - cond_radius, outer_dia_y);
fctx.lineTo(loopx - loop_radius - cond_radius - arrow_size, outer_dia_y - arrow_size);
fctx.lineTo(loopx - loop_radius - cond_radius - arrow_size, outer_dia_y + arrow_size);
fctx.lineTo(loopx - loop_radius - cond_radius, outer_dia_y);
fctx.lineTo(loopx - loop_radius - 3.0*arrow_size, outer_dia_y);
fctx.stroke();
fctx.beginPath();
fctx.moveTo(loopx + loop_radius + cond_radius, loopy);
fctx.lineTo(loopx + loop_radius + cond_radius, outer_dia_y);
fctx.lineTo(loopx + loop_radius + cond_radius + arrow_size, outer_dia_y - arrow_size);
fctx.lineTo(loopx + loop_radius + cond_radius + arrow_size, outer_dia_y + arrow_size);
fctx.lineTo(loopx + loop_radius + cond_radius, outer_dia_y);
fctx.lineTo(loopx + loop_radius + 3.0*arrow_size, outer_dia_y);
fctx.stroke();
2020-11-26 07:09:25 +00:00
fctx.fillText("\u2300o = " + (loop_diameter_inches+0.5*cond_diameter_inches).toFixed(3).toString() + "\"", loopx + loop_radius + 2.0*arrow_size, outer_dia_y - 4);
2020-11-26 06:51:50 +00:00
fctx.fillText("(" + (loop_diameter_mm+0.5*cond_diameter_mm).toFixed(2).toString() + "mm)", loopx + loop_radius + 2.0*arrow_size, outer_dia_y + 12);
2020-11-24 08:24:41 +00:00
// Write loop inductance:
fctx.font = "12px arial";
fctx.textAlign = "left";
const L = inductor.L * 1.0e+6;
fctx.fillText("L = " + L.toPrecision(3).toString() + " \u03bcH", 8, 18);
fctx.fillText("C = " + (inductor.C * 1e12).toFixed(1) + " pF", 8, 32);
fctx.fillText("Rdc = " + inductor.Rdc.toFixed(2) + " \u03A9", 8, 46);
fctx.fillText("SRF = " + (inductor.SRF * 1e-6).toFixed(1) + " MHz", 8, 60);
2020-11-26 10:00:14 +00:00
const wire_length_m = Math.sqrt((inductor.loop_turns * inductor.spacing_ratio * inductor.cond_diameter_meters)**2 + (Math.PI * inductor.loop_diameter_meters * inductor.loop_turns)**2);
2020-11-27 10:32:39 +00:00
fctx.fillText("wire = " + (wire_length_m*3.2808).toFixed(2) + "\' (" + wire_length_m.toFixed(2) + "m)", 8, 74);
2020-11-24 08:24:41 +00:00
// Draw conductor diameter arrow:
fctx.beginPath();
2020-11-25 06:12:26 +00:00
fctx.moveTo(loopx - loop_radius - cond_radius, loopy);
fctx.lineTo(loopx - loop_radius - cond_radius - arrow_size, loopy - arrow_size);
fctx.lineTo(loopx - loop_radius - cond_radius - arrow_size, loopy + arrow_size);
fctx.lineTo(loopx - loop_radius - cond_radius, loopy);
fctx.lineTo(loopx - loop_radius - 3.0*arrow_size, loopy);
2020-11-24 08:24:41 +00:00
fctx.stroke();
fctx.beginPath();
2020-11-25 06:12:26 +00:00
fctx.moveTo(loopx - loop_radius + cond_radius, loopy);
fctx.lineTo(loopx - loop_radius + cond_radius + arrow_size, loopy - arrow_size);
fctx.lineTo(loopx - loop_radius + cond_radius + arrow_size, loopy + arrow_size);
fctx.lineTo(loopx - loop_radius + cond_radius, loopy);
fctx.lineTo(loopx - loop_radius + cond_radius + 2.0*arrow_size, loopy);
2020-11-24 08:24:41 +00:00
fctx.stroke();
2020-11-25 06:12:26 +00:00
2021-09-09 14:26:29 +00:00
//fctx.textAlign = "center";
//fctx.font = "14px courier";
//fctx.fillText((40-conductor_diameter_slider.value).toString() + "AWG", loopx, loopy - 6);
//fctx.font = "12px arial";
2020-11-24 08:24:41 +00:00
2020-11-25 23:02:43 +00:00
var cond_spacing = 2.0 * cond_radius * inductor.spacing_ratio;
if((cond_spacing * inductor.loop_turns) > (0.8 * win_width)) {
cond_radius = ((0.8 * win_width) / (inductor.loop_turns * 2.0*inductor.spacing_ratio));
cond_spacing = 2.0 * cond_radius * inductor.spacing_ratio;
2020-11-24 08:24:41 +00:00
}
2020-11-25 23:02:43 +00:00
var start_x = win_width/2.0 - inductor.loop_turns * cond_spacing * 0.5;
2020-11-24 08:24:41 +00:00
var top_y = win_height * 0.56;
2020-11-25 23:02:43 +00:00
var bot_y = top_y + 2.0 * cond_radius * (inductor.loop_diameter_meters / inductor.cond_diameter_meters);
2020-11-26 03:27:58 +00:00
var angle = math.atan2((cond_spacing * 0.5), (bot_y - top_y));
2020-11-25 23:02:43 +00:00
for (let i = 0; i < inductor.loop_turns ; i + + ) {
2020-11-24 08:24:41 +00:00
fctx.beginPath();
2020-11-26 03:27:58 +00:00
fctx.arc(start_x + (i+0.5) * cond_spacing, top_y, cond_radius, Math.PI-angle, -angle, false);
fctx.arc(start_x + (i+1) * cond_spacing, bot_y, cond_radius, -angle, Math.PI-angle, false);
2020-11-24 08:24:41 +00:00
fctx.fillStyle = "grey";
fctx.fill();
fctx.beginPath();
2020-11-26 03:27:58 +00:00
fctx.arc(start_x + (i * cond_spacing), bot_y, cond_radius, angle, Math.PI+angle);
fctx.arc(start_x + (cond_spacing * 0.5) + i * cond_spacing, top_y, cond_radius, Math.PI+angle, angle);
2020-11-24 08:24:41 +00:00
fctx.fillStyle = "black";
fctx.fill();
}
// Draw the wire ends:
2020-11-26 06:51:50 +00:00
fctx.fillRect(start_x - cond_radius, bot_y, 2.0 * cond_radius, 20);
2020-11-24 08:24:41 +00:00
fctx.fillStyle = "grey";
2020-11-26 06:51:50 +00:00
fctx.fillRect(start_x + inductor.loop_turns * cond_spacing - cond_radius, bot_y, 2.0 * cond_radius, 20);
2020-11-24 08:24:41 +00:00
fctx.fillStyle = "black";
// Draw left spacing arrow:
2020-11-26 06:51:50 +00:00
const dim_y = win_height * 0.88;
2020-11-24 08:24:41 +00:00
fctx.beginPath();
fctx.moveTo(start_x - 20, dim_y);
fctx.lineTo(start_x, dim_y);
fctx.lineTo(start_x - 7, dim_y + 7)
fctx.lineTo(start_x - 7, dim_y - 7)
fctx.lineTo(start_x, dim_y);
fctx.moveTo(start_x, dim_y - 7);
fctx.lineTo(start_x, dim_y + 7);
fctx.stroke();
// Draw right spacing arrow:
fctx.beginPath();
fctx.moveTo(start_x + cond_spacing + 20, dim_y);
fctx.lineTo(start_x + cond_spacing, dim_y);
fctx.lineTo(start_x + cond_spacing + 7, dim_y + 7)
fctx.lineTo(start_x + cond_spacing + 7, dim_y - 7)
fctx.lineTo(start_x + cond_spacing, dim_y);
fctx.moveTo(start_x + cond_spacing, dim_y - 7);
fctx.lineTo(start_x + cond_spacing, dim_y + 7);
fctx.stroke();
// Draw right length arrow:
fctx.beginPath();
2020-11-25 23:02:43 +00:00
fctx.moveTo(start_x + inductor.loop_turns * cond_spacing + 20, dim_y);
fctx.lineTo(start_x + inductor.loop_turns * cond_spacing, dim_y);
fctx.lineTo(start_x + inductor.loop_turns * cond_spacing + 7, dim_y + 7)
fctx.lineTo(start_x + inductor.loop_turns * cond_spacing + 7, dim_y - 7)
fctx.lineTo(start_x + inductor.loop_turns * cond_spacing, dim_y);
fctx.moveTo(start_x + inductor.loop_turns * cond_spacing, dim_y - 7);
fctx.lineTo(start_x + inductor.loop_turns * cond_spacing, dim_y + 7);
2020-11-24 08:24:41 +00:00
fctx.stroke();
// Extended lines:
fctx.strokeStyle = "grey";
fctx.beginPath();
2020-11-26 06:51:50 +00:00
fctx.moveTo(start_x, bot_y + 25);
2020-11-24 08:24:41 +00:00
fctx.lineTo(start_x, dim_y - 12);
2020-11-26 06:51:50 +00:00
fctx.moveTo(start_x + cond_spacing, bot_y + 10);
2020-11-24 08:24:41 +00:00
fctx.lineTo(start_x + cond_spacing, dim_y - 12);
2020-11-26 06:51:50 +00:00
fctx.moveTo(start_x + inductor.loop_turns * cond_spacing, bot_y + 25);
2020-11-25 23:02:43 +00:00
fctx.lineTo(start_x + inductor.loop_turns * cond_spacing, dim_y - 12);
2020-11-24 08:24:41 +00:00
fctx.stroke();
2021-09-04 05:43:32 +00:00
fctx.strokeStyle = "black";
2020-11-24 08:24:41 +00:00
2021-09-10 08:24:04 +00:00
//fctx.textAlign = "center";
fctx.font = spacing_font;
fctx.textAlign = "right";
fctx.fillText("c/a = " + inductor.spacing_ratio.toFixed(2).toString() + " ", win_width/2, win_height * 0.52);
fctx.font = turns_font;
fctx.textAlign = "left";
fctx.fillText(" N = " + inductor.loop_turns.toString(), win_width/2, win_height * 0.52);
fctx.font = "12px arial";
2020-11-24 08:24:41 +00:00
// Draw spacing text: (gap is to avoid collision of spacing and length texts)
fctx.textAlign = "right";
2020-11-25 23:02:43 +00:00
var gap = ((inductor.loop_turns * cond_spacing - cond_spacing) < 60 ) ? ( 60 - ( inductor . loop_turns * cond_spacing - cond_spacing ) ) : 0 ;
const spc = inductor.spacing_ratio * cond_diameter_inches;
2020-11-24 08:24:41 +00:00
fctx.fillText("c = " + spc.toFixed(3).toString() + "\"", start_x + cond_spacing + 20 - gap, dim_y + 20);
2020-11-26 06:51:50 +00:00
fctx.fillText("(" + (spc*25.4).toFixed(3).toString() + "mm)", start_x + cond_spacing + 20 - gap, dim_y + 34);
2020-11-24 08:24:41 +00:00
// Draw length text:
2020-11-25 23:02:43 +00:00
const sol_len = inductor.loop_turns * spc;
fctx.fillText("\u2113 = " + sol_len.toFixed(3).toString() + "\"", start_x + inductor.loop_turns * cond_spacing + 20, dim_y + 20);
2020-11-26 06:51:50 +00:00
fctx.fillText("(" + (sol_len*25.4).toFixed(1).toString() + "mm)", start_x + inductor.loop_turns * cond_spacing + 20, dim_y + 34);
2021-09-04 05:30:07 +00:00
fctx.strokeStyle = "black";
if(inductor.frequency_hz < = inductor.SRF) {
fctx.fillStyle = "black";
} else {
fctx.fillStyle = "red";
}
2021-09-10 08:24:04 +00:00
//fctx.font = "12px courier";
2021-09-04 05:30:07 +00:00
fctx.textAlign = "right";
var freq = 1e-6 * inductor.frequency_hz;
2021-09-10 08:24:04 +00:00
fctx.font = frequency_font;
2021-09-04 05:30:07 +00:00
fctx.fillText("f = " + freq.toFixed(2) + " MHz", win_width-18, 18);
2021-09-10 08:24:04 +00:00
fctx.font = "12px arial";
2021-09-04 05:30:07 +00:00
fctx.fillText("\u03B4 = " + (inductor.skin_depth * 1e6).toFixed(1) + " \u03BCm", win_width-18, 32);
fctx.fillText("Rac = " + inductor.Rac.toFixed(2) + " \u03A9", win_width-18, 46);
fctx.fillText("X\u2097 = " + inductor.Xl.toFixed(1) + " \u03A9", win_width-18, 60);
2021-09-04 06:37:41 +00:00
var str = "Z = " + inductor.Z.re.toFixed(1);
if(inductor.Z.im >= 0.0) {
str += " + j";
} else {
str += " - j";
}
str += Math.abs(inductor.Z.im).toFixed(1) + " \u03A9";
fctx.fillText(str, win_width-18, 74);
//fctx.fillText("Z = " + inductor.Z.re.toFixed(1) + " " + inductor.Z.im.toFixed(1) + "j \u03A9", win_width-18, 74);
2021-09-04 05:30:07 +00:00
fctx.fillText("|Z| = " + inductor.Z.toPolar().r.toFixed(1) + " \u03A9", win_width-18, 88);
fctx.fillText("Q = " + inductor.Q.toFixed(1), win_width-18, 102);
2020-11-24 08:24:41 +00:00
}
recalculate();
2021-09-09 14:26:29 +00:00
drawDesign();
2020-11-24 08:24:41 +00:00
< / script >
< / body >
< / html >