Skip to content

Commit 4eb423d

Browse files
authored
Update antennaizer.html
1 parent 689adbe commit 4eb423d

File tree

1 file changed

+43
-51
lines changed

1 file changed

+43
-51
lines changed

antennas/antennaizer.html

Lines changed: 43 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ <h2>Input Parameters</h2>
119119
<input type="number" id="wireGauge" min="6" max="30" value="14">
120120
</label>
121121
<label>
122-
Use Balun:
122+
Use Balun/UnUn:
123123
<input type="checkbox" id="useBalun">
124124
</label>
125125
<label>
@@ -181,7 +181,7 @@ <h2>Results</h2>
181181
if (antennaType === 'hybrid' && hybridElementCount === 0) {
182182
addHybridElement();
183183
}
184-
toggleTrapOptions(); // Ensure trap options reflect antenna type
184+
toggleTrapOptions();
185185
}
186186

187187
function toggleTrapOptions() {
@@ -276,23 +276,21 @@ <h2>Results</h2>
276276
const centerX = canvas.width / 2;
277277
const centerY = canvas.height / 2;
278278
const maxLength = Math.max(...lengths);
279-
const scale = Math.min(20, (canvas.width - 150) / (maxLength * 2));
279+
const scale = Math.min(20, (canvas.width - 100) / (maxLength * 2)); // Reduced padding for better fit
280280
const cutGap = 10;
281281

282282
ctx.strokeStyle = '#000';
283283
ctx.lineWidth = 2;
284-
ctx.font = '12px Arial';
284+
ctx.font = '10px Arial'; // Smaller font for less clutter
285285
ctx.textAlign = 'center';
286286

287-
function drawFeedPoint(x, y, label = false) {
287+
function drawFeedPoint(x, y) {
288288
ctx.beginPath();
289-
ctx.arc(x, y, 5, 0, 2 * Math.PI);
289+
ctx.arc(x, y, 4, 0, 2 * Math.PI);
290290
ctx.fillStyle = '#FF0000';
291291
ctx.fill();
292-
if (label) {
293-
ctx.fillStyle = '#000';
294-
ctx.fillText('Feed Point', x, y - 25);
295-
}
292+
ctx.fillStyle = '#000';
293+
ctx.fillText('Feed', x, y - 15); // Simplified label, moved closer
296294
}
297295

298296
function drawGroundPlane(x, y, length) {
@@ -302,21 +300,21 @@ <h2>Results</h2>
302300
ctx.lineTo(x + length * scale, y);
303301
ctx.stroke();
304302
ctx.strokeStyle = '#000';
305-
ctx.fillText(`Ground Plane: ${length.toFixed(2)} m`, x, y + 30);
303+
ctx.fillText(`${length.toFixed(2)} m`, x, y + 15); // Simplified ground plane label
306304
}
307305

308306
function drawBalun(x, y, ratio) {
309307
ctx.fillStyle = '#00F';
310-
ctx.fillRect(x - 10, y - 5, 20, 10);
308+
ctx.fillRect(x - 8, y - 4, 16, 8); // Smaller balun rectangle
311309
ctx.fillStyle = '#000';
312-
ctx.fillText(`Balun (${ratio})`, x, y - 35);
310+
ctx.fillText(`${ratio}`, x, y - 20); // Just ratio, moved up
313311
}
314312

315313
function drawTrap(x, y, freq) {
316314
ctx.fillStyle = '#0F0';
317-
ctx.fillRect(x - 5, y - 5, 10, 10);
315+
ctx.fillRect(x - 4, y - 4, 8, 8); // Smaller trap rectangle
318316
ctx.fillStyle = '#000';
319-
ctx.fillText(`${freq.toFixed(1)}`, x, y + 20);
317+
ctx.fillText(`${freq.toFixed(1)}`, x, y + 15); // Frequency only, below trap
320318
}
321319

322320
if (antennaType === 'dipole') {
@@ -327,27 +325,26 @@ <h2>Results</h2>
327325
ctx.moveTo(centerX + cutGap / 2, centerY);
328326
ctx.lineTo(centerX + length * scale, centerY);
329327
ctx.stroke();
330-
drawFeedPoint(centerX, centerY, true);
328+
drawFeedPoint(centerX, centerY);
331329
if (useBalun && balunRatio) drawBalun(centerX, centerY, balunRatio);
332-
ctx.fillText(`${length.toFixed(2)} m`, centerX - length * scale / 2, centerY + 20);
333-
ctx.fillText(`${length.toFixed(2)} m`, centerX + length * scale / 2, centerY + 20);
330+
ctx.fillText(`${length.toFixed(2)} m`, centerX - length * scale / 2, centerY + 15);
331+
ctx.fillText(`${length.toFixed(2)} m`, centerX + length * scale / 2, centerY + 15);
334332
} else if (antennaType === 'quarterVertical') {
335333
const length = lengths[0];
336334
ctx.beginPath();
337335
ctx.moveTo(centerX, centerY);
338336
ctx.lineTo(centerX, centerY - length * scale);
339337
ctx.stroke();
340-
drawFeedPoint(centerX, centerY, true);
338+
drawFeedPoint(centerX, centerY);
341339
if (useBalun && balunRatio) drawBalun(centerX, centerY, balunRatio);
342340
drawGroundPlane(centerX, centerY, length);
343341
ctx.textAlign = 'left';
344-
ctx.fillText(`${length.toFixed(2)} m`, centerX + 60, centerY - length * scale / 2);
342+
ctx.fillText(`${length.toFixed(2)} m`, centerX + 10, centerY - length * scale / 2);
345343
ctx.textAlign = 'center';
346344
} else if (antennaType === 'foldedDipole') {
347345
const length = lengths[0] / 2;
348-
const height = 20;
346+
const height = 15; // Reduced height for less clutter
349347
const spacing = 0.02;
350-
const totalWireLength = lengths[0] * 2;
351348
ctx.beginPath();
352349
ctx.moveTo(centerX - length * scale, centerY - height);
353350
ctx.lineTo(centerX - cutGap / 2, centerY - height);
@@ -357,28 +354,25 @@ <h2>Results</h2>
357354
ctx.lineTo(centerX - length * scale, centerY + height);
358355
ctx.lineTo(centerX - length * scale, centerY - height);
359356
ctx.stroke();
360-
drawFeedPoint(centerX, centerY - height, true);
357+
drawFeedPoint(centerX, centerY - height);
361358
if (useBalun && balunRatio) drawBalun(centerX, centerY - height, balunRatio);
362-
ctx.fillText(`${length.toFixed(2)} m`, centerX - length * scale / 2, centerY - height - 30);
363-
ctx.fillText(`${length.toFixed(2)} m`, centerX + length * scale / 2, centerY - height - 30);
364-
ctx.fillText(`Spacing: ${spacing.toFixed(2)} m`, centerX, centerY + height + 20);
365-
ctx.fillText(`Total Wire: ${totalWireLength.toFixed(2)} m`, centerX, centerY + height + 35);
359+
ctx.fillText(`${length.toFixed(2)} m`, centerX - length * scale / 2, centerY - height - 15);
360+
ctx.fillText(`${length.toFixed(2)} m`, centerX + length * scale / 2, centerY - height - 15);
361+
ctx.fillText(`${spacing.toFixed(2)} m`, centerX, centerY + height + 15);
366362
} else if (antennaType === 'endFed') {
367363
const length = lengths[0];
368364
ctx.beginPath();
369365
ctx.moveTo(centerX - length * scale, centerY);
370366
ctx.lineTo(centerX, centerY);
371367
ctx.stroke();
372-
drawFeedPoint(centerX - length * scale, centerY, true);
368+
drawFeedPoint(centerX - length * scale, centerY);
373369
if (useBalun && balunRatio) drawBalun(centerX - length * scale, centerY, balunRatio);
374-
ctx.textAlign = 'left';
375-
ctx.fillText(`${length.toFixed(2)} m`, centerX - length * scale / 2, centerY + 20);
376-
ctx.textAlign = 'center';
370+
ctx.fillText(`${length.toFixed(2)} m`, centerX - length * scale / 2, centerY + 15);
377371
} else if (antennaType === 'fanDipole' || antennaType === 'hybrid') {
378-
const totalHeight = (lengths.length - 1) * 60;
372+
const totalHeight = (lengths.length - 1) * 50; // Reduced spacing
379373
let trapIndex = 0;
380374
lengths.forEach((length, index) => {
381-
const yOffset = centerY - totalHeight / 2 + index * 60;
375+
const yOffset = centerY - totalHeight / 2 + index * 50;
382376
const elementType = types[index];
383377
if (elementType === 'dipole') {
384378
const halfLength = length / 2;
@@ -388,37 +382,35 @@ <h2>Results</h2>
388382
ctx.moveTo(centerX + cutGap / 2, yOffset);
389383
ctx.lineTo(centerX + halfLength * scale, yOffset);
390384
ctx.stroke();
391-
drawFeedPoint(centerX, yOffset, index === 0);
385+
if (index === 0) drawFeedPoint(centerX, yOffset);
392386
if (useBalun && balunRatio && index === 0) drawBalun(centerX, yOffset, balunRatio);
393387
if (useTraps && trapIndex < trapFrequencies.length && index > 0) {
394388
const trapSpacing = halfLength / 2;
395389
drawTrap(centerX - trapSpacing * scale, yOffset, trapFrequencies[trapIndex]);
396390
drawTrap(centerX + trapSpacing * scale, yOffset, trapFrequencies[trapIndex]);
397391
trapIndex++;
398392
}
399-
ctx.fillText(`${halfLength.toFixed(2)} m`, centerX - halfLength * scale / 2, yOffset + 20);
400-
ctx.fillText(`${halfLength.toFixed(2)} m`, centerX + halfLength * scale / 2, yOffset + 20);
393+
ctx.fillText(`${halfLength.toFixed(2)} m`, centerX - halfLength * scale / 2, yOffset + 15);
394+
ctx.fillText(`${halfLength.toFixed(2)} m`, centerX + halfLength * scale / 2, yOffset + 15);
401395
ctx.textAlign = 'left';
402-
ctx.fillText(`${length.toFixed(2)} m (${frequencies[index].toFixed(1)} MHz)`,
403-
centerX + halfLength * scale + 10, yOffset - 10);
396+
ctx.fillText(`${frequencies[index].toFixed(1)} MHz`, centerX + halfLength * scale + 10, yOffset);
404397
ctx.textAlign = 'center';
405398
} else if (elementType === 'quarterVertical') {
406399
ctx.beginPath();
407400
ctx.moveTo(centerX, yOffset);
408401
ctx.lineTo(centerX, yOffset - length * scale);
409402
ctx.stroke();
410-
drawFeedPoint(centerX, yOffset, index === 0);
403+
if (index === 0) drawFeedPoint(centerX, yOffset);
411404
if (useBalun && balunRatio && index === 0) drawBalun(centerX, yOffset, balunRatio);
412405
drawGroundPlane(centerX, yOffset, length);
413406
ctx.textAlign = 'left';
414407
ctx.fillText(`${length.toFixed(2)} m (${frequencies[index].toFixed(1)} MHz)`,
415-
centerX + 60, yOffset - length * scale / 2);
408+
centerX + 10, yOffset - length * scale / 2);
416409
ctx.textAlign = 'center';
417410
} else if (elementType === 'foldedDipole') {
418411
const halfLength = length / 2;
419-
const height = 20;
412+
const height = 15;
420413
const spacing = 0.02;
421-
const totalWireLength = length * 2;
422414
ctx.beginPath();
423415
ctx.moveTo(centerX - halfLength * scale, yOffset - height);
424416
ctx.lineTo(centerX - cutGap / 2, yOffset - height);
@@ -428,20 +420,19 @@ <h2>Results</h2>
428420
ctx.lineTo(centerX - halfLength * scale, yOffset + height);
429421
ctx.lineTo(centerX - halfLength * scale, yOffset - height);
430422
ctx.stroke();
431-
drawFeedPoint(centerX, yOffset - height, index === 0);
423+
if (index === 0) drawFeedPoint(centerX, yOffset - height);
432424
if (useBalun && balunRatio && index === 0) drawBalun(centerX, yOffset - height, balunRatio);
433425
if (useTraps && trapIndex < trapFrequencies.length && index > 0) {
434426
const trapSpacing = halfLength / 2;
435427
drawTrap(centerX - trapSpacing * scale, yOffset, trapFrequencies[trapIndex]);
436428
drawTrap(centerX + trapSpacing * scale, yOffset, trapFrequencies[trapIndex]);
437429
trapIndex++;
438430
}
439-
ctx.fillText(`${halfLength.toFixed(2)} m`, centerX - halfLength * scale / 2, yOffset - height - 30);
440-
ctx.fillText(`${halfLength.toFixed(2)} m`, centerX + halfLength * scale / 2, yOffset - height - 30);
431+
ctx.fillText(`${halfLength.toFixed(2)} m`, centerX - halfLength * scale / 2, yOffset - height - 15);
432+
ctx.fillText(`${halfLength.toFixed(2)} m`, centerX + halfLength * scale / 2, yOffset - height - 15);
441433
ctx.textAlign = 'left';
442-
ctx.fillText(`${totalWireLength.toFixed(2)} m (${frequencies[index].toFixed(1)} MHz)`,
443-
centerX + halfLength * scale + 10, yOffset - 10);
444-
ctx.fillText(`Spacing: ${spacing.toFixed(2)} m`, centerX + halfLength * scale + 10, yOffset + 5);
434+
ctx.fillText(`${frequencies[index].toFixed(1)} MHz`, centerX + halfLength * scale + 10, yOffset);
435+
ctx.fillText(`${spacing.toFixed(2)} m`, centerX + halfLength * scale + 10, yOffset + 15);
445436
ctx.textAlign = 'center';
446437
}
447438
});
@@ -517,7 +508,8 @@ <h2>Results</h2>
517508
if (!useBalun) return null;
518509
switch (type) {
519510
case 'endFed':
520-
return '9:1'; // High impedance (~450Ω) to 50Ω
511+
// For half-wave end-fed, impedance is ~2500-3000Ω, so 49:1 is often better than 9:1
512+
return '49:1';
521513
case 'foldedDipole':
522514
return '4:1'; // 300Ω to 75Ω
523515
case 'dipole':
@@ -584,8 +576,8 @@ <h2>Results</h2>
584576
frequencies.push(frequency);
585577
types.push('endFed');
586578
results.push(`End-Fed Wire: Total length = ${formatLength(length)}`);
587-
if (balunRatio) results.push(`Balun (${balunRatio}): Place at the feedpoint (end of wire)`);
588-
results.push(`Estimated SWR at ${frequency} MHz: ${estimateSWR(length, frequency, 'endFed')} (high impedance, typically requires 9:1 balun)`);
579+
if (balunRatio) results.push(`UnUn (${balunRatio}): Place at the feedpoint (end of wire)`);
580+
results.push(`Estimated SWR at ${frequency} MHz: ${estimateSWR(length, frequency, 'endFed')} (high impedance, typically requires 49:1 UnUn)`);
589581
calcResults.push(`Element 1 (${frequency} MHz, End-Fed Wire):`);
590582
calcResults.push(`- Wavelength (λ) = c / f = ${speedOfLight} / (${frequency} × 10⁶) = ${(speedOfLight / (frequency * 1000000)).toFixed(2)} m`);
591583
calcResults.push(`- Total Length = λ × 0.5 × VF = ${(speedOfLight / (frequency * 1000000)).toFixed(2)} × 0.5 × ${velocityFactor} = ${length.toFixed(2)} m`);

0 commit comments

Comments
 (0)