kopia lustrzana https://github.com/miguelvaca/vk3cpu
Revert "Added stacking for 43, 52, 61 and 31 240-sized toroids."
This reverts commit 9014b11296
.
pull/2/head
rodzic
9014b11296
commit
dc318c2a52
78
toroid.html
78
toroid.html
|
@ -23,8 +23,7 @@
|
|||
<select name="modes" id="mode-select" onchange="setMode()">
|
||||
<option value="Inductor">Inductor</option>
|
||||
<option value="Suppressor">Suppressor</option>
|
||||
<option value="Transformer" >Transformer</option>
|
||||
<!--option value="Transformer" disabled="false">Transformer</option-->
|
||||
<option value="Transformer" disabled="true">Transformer</option>
|
||||
</select>
|
||||
<select name="toroids" id="toroid-select" onchange="setToroid()">
|
||||
<!--option value="FT240">FT240</option>
|
||||
|
@ -1920,7 +1919,7 @@
|
|||
|
||||
function setMode() {
|
||||
var modes = document.getElementsByName("modes");
|
||||
controller.t_mode = modes[0].value;
|
||||
t_mode = modes[0].value;
|
||||
|
||||
l_inductors = {
|
||||
sort_order : {
|
||||
|
@ -1960,7 +1959,7 @@
|
|||
}
|
||||
|
||||
var l_mat_selected;
|
||||
if(controller.t_mode == "Suppressor") {
|
||||
if(t_mode == "Suppressor") {
|
||||
l_mat_selected = l_suppressors;
|
||||
} else { // Inductors and Transformers should use the inductor material list:
|
||||
l_mat_selected = l_inductors;
|
||||
|
@ -2312,16 +2311,7 @@
|
|||
fctx.fillText("(" + (controller.toroid.core.B*0.03937).toFixed(3) + "\")", 0, 26);
|
||||
fctx.restore();
|
||||
}
|
||||
|
||||
function drawWire(ctx, x1, y1, x2, y2, wireRadius, fillColor) {
|
||||
var angle = math.atan2(y1 - y2, x1 - x2) - Math.PI * 0.5;
|
||||
ctx.beginPath();
|
||||
ctx.arc(x1, y1, wireRadius, angle, Math.PI+angle);
|
||||
ctx.arc(x2, y2, wireRadius, Math.PI+angle, angle);
|
||||
ctx.fillStyle = fillColor;
|
||||
ctx.fill();
|
||||
}
|
||||
|
||||
|
||||
function drawTransformer(fctx, originX, originY, outerRadius, innerRadius, wireRadius, turns) {
|
||||
// Draw toroid former:
|
||||
fctx.beginPath();
|
||||
|
@ -2332,55 +2322,6 @@
|
|||
fctx.stroke();
|
||||
fctx.lineWidth = 1.0;
|
||||
|
||||
// Draw left-hand entry wire:
|
||||
var x1 = originX - innerRadius + wireRadius;
|
||||
var y1 = originY;
|
||||
var x2 = originX - outerRadius - 100;
|
||||
var y2 = originY;
|
||||
drawWire(fctx, x1, y1, x2, y2, wireRadius, "black");
|
||||
|
||||
// Right-hand exit wire:
|
||||
x1 = originX + outerRadius + wireRadius;
|
||||
y1 = originY;
|
||||
x2 = originX + outerRadius + 100;
|
||||
y2 = originY;
|
||||
drawWire(fctx, x1, y1, x2, y2, wireRadius, "red");
|
||||
|
||||
// Draw cross-over wire:
|
||||
let theta = Math.PI/8.0;
|
||||
x1 = originX + (innerRadius - wireRadius) * Math.cos(Math.PI - theta);
|
||||
y1 = originY + (innerRadius - wireRadius) * Math.sin(Math.PI - theta);
|
||||
x2 = originX + (outerRadius + wireRadius) * Math.cos(- theta);
|
||||
y2 = originY + (outerRadius + wireRadius) * Math.sin(- theta);
|
||||
drawWire(fctx, x1, y1, x2, y2, wireRadius, "blue");
|
||||
|
||||
for(let i = 0; i < (turns-1); i++) {
|
||||
x1 = originX + (innerRadius - wireRadius) * Math.cos((i/(turns-1.5)) * (Math.PI - theta));
|
||||
y1 = originY + (innerRadius - wireRadius) * Math.sin((i/(turns-1.5)) * (Math.PI - theta));
|
||||
x2 = originX + (outerRadius + wireRadius) * Math.cos(((i+0.5)/(turns-1.5)) * (Math.PI - theta));
|
||||
y2 = originY + (outerRadius + wireRadius) * Math.sin(((i+0.5)/(turns-1.5)) * (Math.PI - theta));
|
||||
drawWire(fctx, x1, y1, x2, y2, wireRadius, "red");
|
||||
}
|
||||
|
||||
for(let i = 0; i < (turns-2); i++) {
|
||||
x1 = originX + (innerRadius - wireRadius) * Math.cos(((i+1.0)/(turns-1.5)) * (Math.PI - theta) + Math.PI);
|
||||
y1 = originY + (innerRadius - wireRadius) * Math.sin(((i+1.0)/(turns-1.5)) * (Math.PI - theta) + Math.PI);
|
||||
x2 = originX + (outerRadius + wireRadius) * Math.cos(((i+0.5)/(turns-1.5)) * (Math.PI - theta) + Math.PI);
|
||||
y2 = originY + (outerRadius + wireRadius) * Math.sin(((i+0.5)/(turns-1.5)) * (Math.PI - theta) + Math.PI);
|
||||
drawWire(fctx, x1, y1, x2, y2, wireRadius, "black");
|
||||
}
|
||||
}
|
||||
|
||||
function drawBalun(fctx, originX, originY, outerRadius, innerRadius, wireRadius, turns) {
|
||||
// Draw toroid former:
|
||||
fctx.beginPath();
|
||||
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();
|
||||
fctx.lineWidth = 1.0;
|
||||
|
||||
// Draw left-hand entry wire:
|
||||
var x1 = originX - innerRadius + wireRadius;
|
||||
var y1 = originY;
|
||||
|
@ -2446,6 +2387,10 @@
|
|||
fctx.fill();
|
||||
}
|
||||
}
|
||||
|
||||
function drawBalun(fctx, originX, originY, outerRadius, innerRadius, wireRadius, turns) {
|
||||
//
|
||||
}
|
||||
|
||||
function drawDesign() {
|
||||
const win_width = document.getElementById("inductor-container").clientWidth;
|
||||
|
@ -2466,11 +2411,8 @@
|
|||
|
||||
let inner_radius = outer_radius * controller.toroid.core.B / controller.toroid.core.A;
|
||||
let thickness = 2.0 * outer_radius * controller.toroid.core.C / controller.toroid.core.A;
|
||||
if(controller.t_mode == "Transformer") {
|
||||
drawTransformer(fctx, loopx, loopy, outer_radius, inner_radius, cond_radius, controller.toroid.N);
|
||||
} else {
|
||||
drawInductor(fctx, loopx, loopy, outer_radius, inner_radius, cond_radius, controller.toroid.N, thickness, controller.toroid.mat.color);
|
||||
}
|
||||
drawInductor(fctx, loopx, loopy, outer_radius, inner_radius, cond_radius, controller.toroid.N, thickness, controller.toroid.mat.color);
|
||||
//drawTransformer(fctx, loopx, loopy, outer_radius, inner_radius, cond_radius, toroid.N);
|
||||
|
||||
const y_offset = loopy + outer_radius + 20;
|
||||
var arrow_size = 10.0;
|
||||
|
|
Ładowanie…
Reference in New Issue