Max circumference in 20pc of lambda

pull/2/head
miguel 2020-10-18 23:27:18 +11:00
rodzic d2020f42a1
commit 61ce4dc6cb
1 zmienionych plików z 105 dodań i 96 usunięć

Wyświetl plik

@ -57,10 +57,11 @@
</body> </body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.js"></script>
<script> <script>
const frequencies = [ var frequencies = [
1.8, 2.2, 2.8, 3.5, 5.0, 7.0, 10.1, 14.0, 18.068, 21.0, 24.89, 28.0 1.8, 3.5, 5.0, 7.0, 10.1, 14.0, 18.068, 21.0, 24.89, 28.0
//1.8, 2.2, 2.8, 3.5, 5.0, 7.0, 10.1, 14.0, 18.068, 21.0, 24.89, 28.0
]; ];
var loop_diameter_slider = document.getElementById("loop_diameter_slider"); var loop_diameter_slider = document.getElementById("loop_diameter_slider");
var loop_diameter_value = document.getElementById("loop_diameter_value"); var loop_diameter_value = document.getElementById("loop_diameter_value");
loop_diameter_value.innerHTML = loop_diameter_slider.value; loop_diameter_value.innerHTML = loop_diameter_slider.value;
@ -85,6 +86,24 @@
var heightAboveGround_value = document.getElementById("heightAboveGround_value"); var heightAboveGround_value = document.getElementById("heightAboveGround_value");
heightAboveGround_value.innerHTML = heightAboveGround_slider.value; heightAboveGround_value.innerHTML = heightAboveGround_slider.value;
function updateFrequencies() {
const hamFrequencies = [
1.8, 3.5, 5.0, 7.0, 10.1, 14.0, 18.068, 21.0, 24.89, 28.0
//1.8, 2.2, 2.8, 3.5, 5.0, 7.0, 10.1, 14.0, 18.068, 21.0, 24.89, 28.0
];
frequencies = [];
hamFrequencies.forEach(freq => {
const wavelength = 3e8 / (freq * 1e6);
const l = (Math.PI * loop_diameter_slider.value) / wavelength;
if (l <= 0.20) {
frequencies.push(freq);
}
});
}
// Update the frequencies, now that we have the sliders available:
updateFrequencies();
function getInductance() { function getInductance() {
const a_coil_radius = loop_diameter_slider.value * 0.5; const a_coil_radius = loop_diameter_slider.value * 0.5;
const b_conductor_radius = conductor_diameter_slider.value * 0.0005; const b_conductor_radius = conductor_diameter_slider.value * 0.0005;
@ -105,12 +124,8 @@
function calculateRadiationResistance() { function calculateRadiationResistance() {
var retval = []; var retval = [];
frequencies.forEach(freq => { frequencies.forEach(freq => {
//const wavelength = 3e8 / (freq * 1e6); const rr = radiationResistance(freq);
//const l = (Math.PI * loop_diameter_slider.value) / wavelength; retval.push({x:freq, y:rr});
//if (l <= 0.25) {
const rr = radiationResistance(freq);
retval.push({x:freq, y:rr});
//}
}); });
return retval; return retval;
} }
@ -126,12 +141,8 @@
function calculateInductiveReactance() { function calculateInductiveReactance() {
var retval = []; var retval = [];
frequencies.forEach(freq => { frequencies.forEach(freq => {
//const wavelength = 3e8 / (freq * 1e6);
//const l = (Math.PI * loop_diameter_slider.value) / wavelength;
//if (l <= 0.25) {
const reactance = inductiveReactance(freq); const reactance = inductiveReactance(freq);
retval.push({x:freq, y:reactance}); retval.push({x:freq, y:reactance});
//}
}); });
return retval; return retval;
} }
@ -148,10 +159,8 @@
function calculateTuningCapacitor() { function calculateTuningCapacitor() {
var retval = []; var retval = [];
frequencies.forEach(freq => { frequencies.forEach(freq => {
//if (l <= 0.25) { const capacitor = tuningCapacitance(freq);
const capacitor = tuningCapacitance(freq); retval.push({x:freq, y:capacitor});
retval.push({x:freq, y:capacitor});
//}
}); });
return retval; return retval;
} }
@ -253,6 +262,7 @@
loop_diameter_slider.oninput = function() { loop_diameter_slider.oninput = function() {
loop_diameter_value.innerHTML = this.value; loop_diameter_value.innerHTML = this.value;
updateFrequencies();
myChart.data.datasets[0].data = calculateRadiationResistance(); myChart.data.datasets[0].data = calculateRadiationResistance();
myChart.data.datasets[1].data = calculateInductiveReactance(); myChart.data.datasets[1].data = calculateInductiveReactance();
myChart.data.datasets[2].data = calculateTuningCapacitor(); myChart.data.datasets[2].data = calculateTuningCapacitor();
@ -314,24 +324,6 @@
type: 'line', type: 'line',
data: { data: {
datasets: [ datasets: [
{
label: 'Radiation Resistance \u03A9',
fill: false,
borderColor: 'red',
backgroundColor: 'red',
data: calculateRadiationResistance(),
borderWidth: 1,
yAxisID: 'mohmsID'
},
{
label: 'Inductive Reactance \u03A9',
fill: false,
borderColor: 'blue',
backgroundColor: 'blue',
data: calculateInductiveReactance(),
borderWidth: 1,
yAxisID: 'ohmsID'
},
{ {
label: 'Tuning Capacitance', label: 'Tuning Capacitance',
fill: false, fill: false,
@ -342,13 +334,13 @@
yAxisID: 'pfID' yAxisID: 'pfID'
}, },
{ {
label: 'Loss Resistance \u03A9', label: 'BW kHz',
fill: false, fill: false,
borderColor: 'orange', borderColor: 'brown',
backgroundColor: 'orange', backgroundColor: 'brown',
data: calculateLossResistance(), data: calculateBandwidth(),
borderWidth: 1, borderWidth: 1,
yAxisID: 'mohmsID' yAxisID: 'bwID'
}, },
{ {
label: 'Efficiency', label: 'Efficiency',
@ -360,22 +352,40 @@
yAxisID: 'effID' yAxisID: 'effID'
}, },
{ {
label: 'Q Factor', label: 'Radiation Resistance \u03A9',
fill: false,
borderColor: 'red',
backgroundColor: 'red',
data: calculateRadiationResistance(),
borderWidth: 1,
yAxisID: 'mohmsID'
},
{
label: 'Reactance j\u03A9',
fill: false,
borderColor: 'blue',
backgroundColor: 'blue',
data: calculateInductiveReactance(),
borderWidth: 1,
yAxisID: 'ohmsID'
},
{
label: 'Loss Resistance \u03A9',
fill: false,
borderColor: 'orange',
backgroundColor: 'orange',
data: calculateLossResistance(),
borderWidth: 1,
yAxisID: 'mohmsID'
},
{
label: 'Q',
fill: false, fill: false,
borderColor: 'purple', borderColor: 'purple',
backgroundColor: 'purple', backgroundColor: 'purple',
data: calculateQualityFactor(), data: calculateQualityFactor(),
borderWidth: 1, borderWidth: 1,
yAxisID: 'qID' yAxisID: 'qID'
},
{
label: 'BW kHz',
fill: false,
borderColor: 'brown',
backgroundColor: 'brown',
data: calculateBandwidth(),
borderWidth: 1,
yAxisID: 'bwID'
}] }]
}, },
options: { options: {
@ -390,40 +400,6 @@
} }
}], }],
yAxes: [{ yAxes: [{
type: 'linear',
display: true,
scaleLabel: {
display: true,
labelString: 'j\u03A9',
fontColor: 'blue',
fontStyle: 'bold'
},
position: 'left',
id: 'ohmsID'
},
{
type: 'linear',
display: true,
scaleLabel: {
display: true,
labelString: '\u03A9',
fontColor: 'red',
fontStyle: 'bold'
},
position: 'left',
id: 'mohmsID',
},{
type: 'linear',
display: true,
scaleLabel: {
display: true,
labelString: 'pF',
fontColor: 'green',
fontStyle: 'bold'
},
position: 'right',
id: 'pfID'
},{
type: 'linear', type: 'linear',
display: true, display: true,
scaleLabel: { scaleLabel: {
@ -432,19 +408,8 @@
fontColor: 'black', fontColor: 'black',
fontStyle: 'bold' fontStyle: 'bold'
}, },
position: 'right', position: 'left',
id: 'effID' id: 'effID'
},{
type: 'linear',
display: true,
scaleLabel: {
display: true,
labelString: 'Quality',
fontColor: 'purple',
fontStyle: 'bold'
},
position: 'right',
id: 'qID'
},{ },{
type: 'linear', type: 'linear',
display: true, display: true,
@ -456,6 +421,50 @@
}, },
position: 'left', position: 'left',
id: 'bwID' id: 'bwID'
},{
type: 'linear',
display: true,
scaleLabel: {
display: true,
labelString: '\u03A9',
fontColor: 'red',
fontStyle: 'bold'
},
position: 'right',
id: 'mohmsID',
},{
type: 'linear',
display: true,
scaleLabel: {
display: true,
labelString: 'pF',
fontColor: 'green',
fontStyle: 'bold'
},
position: 'left',
id: 'pfID'
},{
type: 'linear',
display: true,
scaleLabel: {
display: true,
labelString: 'j\u03A9',
fontColor: 'blue',
fontStyle: 'bold'
},
position: 'right',
id: 'ohmsID'
},{
type: 'linear',
display: true,
scaleLabel: {
display: true,
labelString: 'Q',
fontColor: 'purple',
fontStyle: 'bold'
},
position: 'right',
id: 'qID'
}] }]
}, },
showLines: true showLines: true