Skip to content

Commit

Permalink
Merge pull request #42 from Cloud-RF/add-interference-ssrf-demo
Browse files Browse the repository at this point in the history
Add interference ssrf demo
  • Loading branch information
FarrantAlex authored Dec 18, 2024
2 parents 47f3cd7 + ed2208f commit 5dd3c20
Show file tree
Hide file tree
Showing 45 changed files with 4,146 additions and 28,057 deletions.
1 change: 1 addition & 0 deletions integrations/SSRF/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target/
71 changes: 71 additions & 0 deletions integrations/SSRF/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion integrations/SSRF/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[workspace]
resolver = "2"
members = [ "cloudrf","openssrf", "openssrf_multisite_pipeline", "openssrf_test_xml_generator"]
members = [ "cloudrf","openssrf", "openssrf_to_cloudrf", "openssrf_interference_analysis", "openssrf_multisite_pipeline", "openssrf_test_xml_generator", "openssrf_xml_merger"]
28 changes: 22 additions & 6 deletions integrations/SSRF/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,38 @@ This Rust client is capable of processing Standard Spectrum Resource Format (SSR

SSRF-XML is used to share spectrum information including transmitters, receivers, geo location and propagation ranges. By pushing this **public** data through our GPU accelerated "Multisite" API, we can rapidly model complex systems in seconds which previously would have been impossible in a practical time frame or with a unpublished spectrum standard.

![Network interference](network_interference.jpg "Network interference")

## Setup

apt-get install cargo

To use it you will need an API like https://api.cloudrf.com and an API key.

## Generate test data

A test script to generate SSRF XML exists called gen_xml.sh.
Within this you can set a center point, maximum number of transmitters and a random distance error measured in degrees. The demo below will generate up to 32 transmitters in England, spread across 0.01 degrees of latitude/longitude.

cargo run -p openssrf_test_xml_generator -- --lat 51.7 --lon -2.4 -m 32 --std 0.01 -o ./xml

## Multisite pipeline

This iterates over a folder of xml documents and processes each in turn. To use it you will need an API like https://api.cloudrf.com and an API key.
Define both as environment variables so the gen_kmz.sh script can find them.

cargo run -q -p openssrf_multisite_pipeline -- -k $API_KEY --url $API_URL -i ./xml -o ./kmz -ncv
cargo run -p openssrf_multisite_pipeline -- -k $API_KEY --url $API_URL -i ./xml -o

## Merge test data

## Generate test data
To combine SSRF XML files into one, you can use the openssrf_xml_merger like so:

A test script to generate SSRF XML exists called gen_xml.sh.
Within this you can set a center point, maximum number of transmitters and a random distance error measured in degrees. The demo below will generate up to 512 transmitters in Switzerland.
cargo run -p openssrf_xml_merger -- -i xml/rnd-ssrf-016.xml -i xml/rnd-ssrf-032.xml -i xml/rnd-ssrf-064.xml -o ssrf-interference-data.xml

## Interference analysis

To run multisite and then interference analysis between the assignments in an SSRF XML document, run the following:

cargo run -q -p openssrf_test_xml_generator -- --lat 47 --lon 8 -m 512 --std 0.2 -o ./xml
cargo run -p openssrf_interference_analysis -- -k $API_KEY --url $API_URL -i two-32-radio-networks-1W-1W.ssrf.xml -o kmz


## Further reading
Expand Down
1 change: 1 addition & 0 deletions integrations/SSRF/cloudrf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ serde_json = "1.0.113"
serde_repr = "0.1.18"
serde_tuple = "0.5.0"
thiserror = "1.0.57"
regex = "1.5.4"
10 changes: 5 additions & 5 deletions integrations/SSRF/cloudrf/src/antenna.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ pub struct Antenna {
impl Default for Antenna {
fn default() -> Self {
Self {
txg: 21.0,
txg: 2.0,
txl: 0.0,
ant: 0,
ant: 1,
azi: 0.0,
tlt: 0.0,
hbw: 120.0,
vbw: 60.0,
fbr: 30.0,
hbw: 0.0,
vbw: 0.0,
fbr: 0.0,
pol: Polarisation::Vertical,
}
}
Expand Down
4 changes: 2 additions & 2 deletions integrations/SSRF/cloudrf/src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ impl Default for Environment {
fn default() -> Self {
Self {
clt: "Temperate.clt".to_owned(),
elevation: Elevation::Terrain,
landcover: true,
elevation: Elevation::Surface,
landcover: false,
buildings: false,
obstacles: false,
}
Expand Down
73 changes: 73 additions & 0 deletions integrations/SSRF/cloudrf/src/interference.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
use serde::{Deserialize, Serialize};

use crate::misc::{Bounds, ColourKeyValue};


#[derive(Debug, Serialize)]
pub struct InterferenceReq {
#[serde(flatten)]
pub signal: Signal,
#[serde(flatten)]
pub jamming: Jamming,
pub name: String,
pub colour_key: String,
}

impl Default for InterferenceReq {
fn default() -> Self {
Self {
signal: Default::default(),
jamming: Default::default(),
name: "QRM".to_owned(),
colour_key: "JS.dB".to_owned(),
}
}
}

#[derive(Debug, Serialize)]
#[serde(untagged)]
pub enum Signal {
Network{s_network: String},
Sites{s_sites: Vec<String>},
Both{s_network: String, s_sites: Vec<String>},
}

#[derive(Debug, Serialize)]
#[serde(untagged)]
pub enum Jamming {
Network{j_network: String},
Sites{j_sites: Vec<String>},
Both{j_network: String, j_sites: Vec<String>},
}


impl Default for Signal {
fn default() -> Self {
Self::Network{ s_network: "My_Signal_Network".to_owned()}
}
}

impl Default for Jamming {
fn default() -> Self {
Self::Network{ j_network: "My_Jamming_Network".to_owned()}
}
}

#[derive(Debug, Deserialize)]
#[serde(untagged)]
pub enum InterferenceRes {
Error {
error: String,
},
Success {
kmz: String,
#[serde(rename = "PNG_WGS84")]
png_wgs84: String,
#[serde(rename = "PNG_Mercator")]
png_mercator: String,
bounds: Bounds,
key: Vec<ColourKeyValue>,
elapsed: f64,
calculation_adjusted: Option<Vec<String>>,
},
}
Loading

0 comments on commit 5dd3c20

Please sign in to comment.