Compare commits
2 commits
307df511ad
...
37e847990f
Author | SHA1 | Date | |
---|---|---|---|
Wolfgang | 37e847990f | ||
Wolfgang | 0d7b2c3ab1 |
52
band-plan-de.yml
Normal file
52
band-plan-de.yml
Normal 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
|
|
@ -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
|
||||
|
|
237
band-plan.html
237
band-plan.html
|
@ -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,85 +72,168 @@ 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);
|
||||
}
|
||||
return response.text();
|
||||
}).then((data) => {
|
||||
try {
|
||||
const bands = yaml.load(data);
|
||||
var tdata = [];
|
||||
bands.forEach((band) => {
|
||||
band.parts.forEach((part) => {
|
||||
tdata.push({
|
||||
"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 ,
|
||||
});
|
||||
});
|
||||
});
|
||||
function isInRange(number, min, max) {
|
||||
return number >= min && number <= max;
|
||||
}
|
||||
|
||||
// require in tabular-tables
|
||||
// eslint-disable-next-line no-undef
|
||||
var table = new Tabulator("#data-table", {
|
||||
layout: "fitDataTable",
|
||||
initialSort: [
|
||||
{column: "frequency", dir: "asc"},
|
||||
{column: "band", dir: "desc"},
|
||||
],
|
||||
selectableRows: true,
|
||||
data: tdata,
|
||||
columns: [
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
{title: "band", field: "band", headerFilter: "input", sorter: function(a, b, aRow, bRow, column, dir, sorterParams){
|
||||
return parseFloat(new Measures().from(a).to('m')) - parseFloat(new Measures().from(b).to('m'));
|
||||
}},
|
||||
{title: "frequency/kHz", field: "frequency", sorter: "number", headerFilter: "input", headerFilterFunc: filter_with_not},
|
||||
{title: "bandwidth/Hz", field: "bandwidth", headerFilter: "input", headerFilterFunc: filter_with_not},
|
||||
{title: "mode", field: "mode", headerFilter: "input", headerFilterFunc: filter_with_not},
|
||||
//{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},
|
||||
],
|
||||
});
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("download").addEventListener("click", () => {
|
||||
let download_range = "all";
|
||||
if (table.getSelectedRows().length > 0) {
|
||||
download_range = "selected";
|
||||
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) => {
|
||||
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,
|
||||
//"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;
|
||||
}
|
||||
}
|
||||
}
|
||||
table.download(
|
||||
"pdf",
|
||||
path.basename(document.getElementById('sel_plan').value, '.yml') + '.pdf',
|
||||
{ orientation:"portrait" },
|
||||
download_range);
|
||||
});
|
||||
if (!parts_already_added) {
|
||||
tdata.push(p);
|
||||
}
|
||||
parts_already_added = false;
|
||||
});
|
||||
});
|
||||
|
||||
table.on("tableBuilt", () => {
|
||||
var div_togglebuttons = document.getElementById("togglebuttons");
|
||||
div_togglebuttons.innerHTML = "<span>Toggle column:</span>";
|
||||
table.getColumns().forEach((col) => {
|
||||
let col_name = col.getField();
|
||||
let b = document.createElement("button");
|
||||
b.innerText = col_name;
|
||||
b.addEventListener("click", () => {
|
||||
table.toggleColumn(col_name);
|
||||
});
|
||||
div_togglebuttons.appendChild(b);
|
||||
});
|
||||
});
|
||||
document.getElementById("error").innerText = "";
|
||||
// require in tabular-tables
|
||||
// eslint-disable-next-line no-undef
|
||||
var table = new Tabulator("#data-table", {
|
||||
layout: "fitDataTable",
|
||||
initialSort: [
|
||||
{column: "frequency", dir: "asc"},
|
||||
{column: "band", dir: "desc"},
|
||||
],
|
||||
selectableRows: true,
|
||||
data: tdata,
|
||||
columns: [
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
{title: "band", field: "band", headerFilter: "input", sorter: function(a, b, aRow, bRow, column, dir, sorterParams){
|
||||
return parseFloat(new Measures().from(a).to('m')) - parseFloat(new Measures().from(b).to('m'));
|
||||
}},
|
||||
{title: "frequency/kHz", field: "frequency", sorter: "number", headerFilter: "input", headerFilterFunc: filter_with_not},
|
||||
{title: "bandwidth/Hz", field: "bandwidth", headerFilter: "input", headerFilterFunc: filter_with_not},
|
||||
{title: "mode", field: "mode", headerFilter: "input", headerFilterFunc: filter_with_not},
|
||||
//{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},
|
||||
],
|
||||
});
|
||||
|
||||
document.getElementById("download").addEventListener("click", () => {
|
||||
let download_range = "all";
|
||||
if (table.getSelectedRows().length > 0) {
|
||||
download_range = "selected";
|
||||
}
|
||||
table.download(
|
||||
"pdf",
|
||||
path.basename(document.getElementById('base_plan').value, '.yml') + '.pdf',
|
||||
{ orientation:"portrait" },
|
||||
download_range);
|
||||
});
|
||||
|
||||
table.on("tableBuilt", () => {
|
||||
var div_togglebuttons = document.getElementById("togglebuttons");
|
||||
div_togglebuttons.innerHTML = "<span>Toggle column:</span>";
|
||||
table.getColumns().forEach((col) => {
|
||||
let col_name = col.getField();
|
||||
let b = document.createElement("button");
|
||||
b.innerText = col_name;
|
||||
b.addEventListener("click", () => {
|
||||
table.toggleColumn(col_name);
|
||||
});
|
||||
div_togglebuttons.appendChild(b);
|
||||
});
|
||||
});
|
||||
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);
|
||||
});
|
||||
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue