Compare commits

...

2 commits

Author SHA1 Message Date
Wolfgang 37e847990f fix typo in iaru plan 2024-05-23 17:47:57 +02:00
Wolfgang 0d7b2c3ab1 add second plan for e. g. allowed power 2024-05-23 17:47:11 +02:00
3 changed files with 217 additions and 76 deletions

52
band-plan-de.yml Normal file
View file

@ -0,0 +1,52 @@
- start: 135.7
end: 137.8
power_a: 1 W ERP
- start: 472
end: 479
power_a: 1 W ERP
- start: 1810
end: 1850
power_a: 750 W PEP
power_e: 100 W PEP
- start: 1850
end: 1890
power_a: 75 W PEP
power_e: 75 W PEP
- start: 1890
end: 2000
power_a: 10 W PEP
power_e: 10 W PEP
- start: 3500
end: 3800
power_a: 750 W PEP
power_e: 100 W PEP
- start: 5351.5
end: 5366.5
power_a: 15 W EIRP
- start: 7000
end: 7100
power_a: 750 W PEP
- start: 7100
end: 7200
power_a: 750 W PEP
- start: 10100
end: 10150
power_a: 150 W PEP
- start: 14000
end: 14350
power_a: 750 W PEP
- start: 18068
end: 18168
power_a: 750 W PEP
- start: 21000
end: 21450
power_a: 750 W PEP
power_e: 100 W PEP
- start: 24890
end: 24990
power_a: 750 W PEP
- start: 28000
end: 29700
power_a: 750 W PEP
power_e: 100 W PEP
power_n: 10 W ERP

View file

@ -255,11 +255,11 @@
- band: 20 m
mode: All modes
bandwidth: 2700
start: 141101
start: 14101
end: 14350
parts:
- description: Digimodes, automatically controlled data stations (unattended)
start: 141101
start: 14101
end: 14112
- start: 14112
end: 14125

View file

@ -37,7 +37,7 @@ div#togglebuttons>button {
document.addEventListener('DOMContentLoaded', () => {
update_plan();
document.getElementById("sel_plan").addEventListener("keydown", (event) => {
document.getElementById("base_plan").addEventListener("keydown", (event) => {
if (event.key === 'Enter') {
update_plan()
}
@ -72,29 +72,91 @@ div#togglebuttons>button {
document.getElementById("error").innerText = e;
}
function update_plan() {
fetch(document.getElementById('sel_plan').value, {
mode: 'cors'
}).then((response) => {
if (!response.ok) {
throw new Error(response.status);
function isInRange(number, min, max) {
return number >= min && number <= max;
}
return response.text();
}).then((data) => {
try {
const bands = yaml.load(data);
function add_power(add, p) {
if (typeof add.power_a !== "undefined") {
p["power_a"] = add.power_a;
}
if (typeof add.power_e !== "undefined") {
p["power_e"] = add.power_e;
}
if (typeof add.power_n !== "undefined") {
p["power_n"] = add.power_n;
}
}
function debug_tdata(s, tdata) {
if (tdata.length > 0) {
console.log(s + " " + tdata.length + " " + tdata[tdata.length - 1].frequency + " " + tdata[tdata.length - 1].power_a);
//console.log(s + " " + tdata.length);
//tdata.forEach((t) => {
// console.log(s + " " + t.frequency);
//});
}
}
function update_table(bands, additions) {
var tdata = [];
bands.forEach((band) => {
band.parts.forEach((part) => {
tdata.push({
let p = {
"band": band.band,
"mode": band.mode,
//"band_start": band.start,
//"band_end": band.end,
"bandwidth": band.bandwidth,
"description": part.description,
"frequency": typeof part.at !== "undefined" ? part.at : part.start + '\u2013' + part.end ,
"frequency": typeof part.at !== "undefined" ? part.at : part.start + '\u2013' + part.end,
//"at": part.at,
//"start": part.start,
//"end": part.end,
};
let parts_already_added = false;
additions.forEach((add) => {
if (typeof part.at !== "undefined") {
if (isInRange(part.at, add.start, add.end)) {
// at single frequency
add_power(add, p);
}
} else {
// frequeny range
if ((add.start == part.start) && (add.end == part.end)) {
// ranges are the same
add_power(add, p);
} else if (isInRange(part.start, add.start, add.end) && isInRange(part.end, add.start, add.end)) {
// range of part is inside of range of add
add_power(add, p);
} else {
// part range is split by add range
if (isInRange(add.start, part.start, part.end)) {
// part range starts below add range
let p_clone = structuredClone(p);
let start = add.start;
let end = part.end < add.end ? part.end : add.end;
p_clone["frequency"] = start + '\u2013' + end;
add_power(add, p_clone);
tdata.push(p_clone);
parts_already_added = true;
} else if (isInRange(add.end, part.start, part.end)) {
// add range starts below part range
let p_clone = structuredClone(p);
let start = part.start;
let end = add.end;
p_clone["frequency"] = start + '\u2013' + end;
add_power(add, p_clone);
tdata.push(p_clone);
parts_already_added = true;
}
}
}
});
if (!parts_already_added) {
tdata.push(p);
}
parts_already_added = false;
});
});
@ -119,6 +181,9 @@ div#togglebuttons>button {
//{title: "band_start", field: "band_start", headerFilter: "input"},
//{title: "band_end", field: "band_end", headerFilter: "input"},
{title: "description", field: "description", headerFilter: "input", headerFilterFunc: filter_with_not},
{title: "power_a", field: "power_a", headerFilter: "input", headerFilterFunc: filter_with_not},
{title: "power_e", field: "power_e", headerFilter: "input", headerFilterFunc: filter_with_not},
{title: "power_n", field: "power_n", headerFilter: "input", headerFilterFunc: filter_with_not},
],
});
@ -129,7 +194,7 @@ div#togglebuttons>button {
}
table.download(
"pdf",
path.basename(document.getElementById('sel_plan').value, '.yml') + '.pdf',
path.basename(document.getElementById('base_plan').value, '.yml') + '.pdf',
{ orientation:"portrait" },
download_range);
});
@ -148,12 +213,30 @@ div#togglebuttons>button {
});
});
document.getElementById("error").innerText = "";
}
function update_plan() {
Promise.all([
fetch(document.getElementById('base_plan').value, { mode: 'cors' }),
fetch(document.getElementById('additions_plan').value, { mode: 'cors' }),
]).then((res) => {
res.forEach((r) => {
if (!r.ok) {
throw new Error(r.status);
}
});
Promise.all([res[0].text(), res[1].text()]).then((d) => {
try {
update_table(yaml.load(d[0]),yaml.load(d[1]));
} catch (e) {
display_error(e);
}
}).catch((e) => {
display_error(e);
});
}).catch((e) => {
display_error(e);
});
}
// used in button
@ -168,8 +251,14 @@ div#togglebuttons>button {
}
</script>
<div>
<label>Plan:
<input name="plan" id="sel_plan" type="text" value="band-plan-iaru_r1_hf.yml">
<label>Base Plan:
<input name="plan" id="base_plan" type="text" value="band-plan-iaru_r1_hf.yml">
</label>
<button onclick="update_plan()">Change plan</button>
</div>
<div>
<label>Additions:
<input name="plan" id="additions_plan" type="text" value="band-plan-de.yml">
</label>
<button onclick="update_plan()">Change plan</button>
</div>