Skip to content

Commit

Permalink
Merge pull request #14 from AmyangXYZ/jem/features
Browse files Browse the repository at this point in the history
added preset for converged industrial network
  • Loading branch information
AmyangXYZ authored Jan 17, 2024
2 parents e830168 + 2ec12b9 commit 735ab9a
Show file tree
Hide file tree
Showing 2 changed files with 189 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/core/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class NetworkHub {
kdTree: KDTree // to find nearest neighbors

PresetTopos: { [name: string]: any } = presetTopos
SelectedTopo = ref('Random')
SelectedTopo = ref('5G-TSN-TSCH') // realistic topo example

asnTimer: any
SignalReset = ref(0)
Expand Down Expand Up @@ -214,11 +214,11 @@ export class NetworkHub {
// 5G UE connects to one 5G tower and multiple wired end systems
case NODE_TYPE.FIVE_G_UE: {
const ueBsNeighbors = this.kdTree.FindKNearest(n.pos, 1, this.Config.value.tx_range)
const validUeBs = ueBsNeighbors.find(nn => this.Nodes.value[nn].type === NODE_TYPE.FIVE_G_GNB)
const validUeBs = ueBsNeighbors.find(nn => this.Nodes.value[nn]?.type === NODE_TYPE.FIVE_G_GNB)
if (validUeBs !== undefined) neighbors.push(validUeBs)

const ueEndNeighbors = this.kdTree.FindKNearest(n.pos, 1000, 20)
const validUeEnd = ueEndNeighbors.find(nn => this.Nodes.value[nn].type >= NODE_TYPE.END_SYSTEM_SERVER)
const validUeEnd = ueEndNeighbors.find(nn => this.Nodes.value[nn]?.type >= NODE_TYPE.END_SYSTEM_SERVER)
if (validUeEnd !== undefined) neighbors.push(validUeEnd)

break
Expand Down Expand Up @@ -249,9 +249,9 @@ export class NetworkHub {
// TSN bridge connects multiple TSN bridges, 5G tower and end systems
case NODE_TYPE.TSN: {
const tsnNeighbors = this.kdTree.FindKNearest(n.pos, 1000, this.Config.value.tx_range)
const validTsn = tsnNeighbors.filter(nn => this.Nodes.value[nn].type === NODE_TYPE.TSN)
const validFiveGnb = tsnNeighbors.find(nn => this.Nodes.value[nn].type === NODE_TYPE.FIVE_G_GNB)
const validTsnEnd = tsnNeighbors.find(nn => this.Nodes.value[nn].type >= NODE_TYPE.END_SYSTEM_SERVER)
const validTsn = tsnNeighbors.filter(nn => this.Nodes.value[nn]?.type === NODE_TYPE.TSN)
const validFiveGnb = tsnNeighbors.find(nn => this.Nodes.value[nn]?.type === NODE_TYPE.FIVE_G_GNB)
const validTsnEnd = tsnNeighbors.find(nn => this.Nodes.value[nn]?.type >= NODE_TYPE.END_SYSTEM_SERVER)
neighbors.push(...validTsn)
if (validFiveGnb !== undefined) neighbors.push(validFiveGnb)
if (validTsnEnd !== undefined) neighbors.push(validTsnEnd)
Expand All @@ -262,9 +262,9 @@ export class NetworkHub {
default: {
const networkNeighbors = this.kdTree.FindKNearest(n.pos, 3, this.Config.value.grid_size)
const validNetwork = networkNeighbors.find(nn =>
this.Nodes.value[nn].type === NODE_TYPE.TSN ||
this.Nodes.value[nn].type === NODE_TYPE.TSCH ||
this.Nodes.value[nn].type === NODE_TYPE.FIVE_G_UE)
this.Nodes.value[nn]?.type === NODE_TYPE.TSN ||
this.Nodes.value[nn]?.type === NODE_TYPE.TSCH ||
this.Nodes.value[nn]?.type === NODE_TYPE.FIVE_G_UE)
if (validNetwork !== undefined) neighbors.push(validNetwork)
break
}
Expand Down
180 changes: 180 additions & 0 deletions src/core/preset_topologies.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,185 @@
]
}
]
},
"5G-TSN-TSCH": {
"nodes": [
{
"id": 1,
"type": 1,
"pos": [
-10,
-10
]
},
{
"id": 2,
"type": 1,
"pos": [
10,
-10
]
},
{
"id": 3,
"type": 1,
"pos": [
10,
10
]
},
{
"id": 4,
"type": 1,
"pos": [
-10,
10
]
},
{
"id": 5,
"type": 1,
"pos": [
-25,
-20
]
},
{
"id": 6,
"type": 1,
"pos": [
25,
-20
]
},
{
"id": 7,
"type": 1,
"pos": [
25,
20
]
},
{
"id": 8,
"type": 1,
"pos": [
-25,
20
]
},
{
"id": 9,
"type": 1,
"pos": [
-40,
-10
]
},
{
"id": 10,
"type": 1,
"pos": [
40,
-10
]
},
{
"id": 11,
"type": 1,
"pos": [
-40,
10
]
},
{
"id": 12,
"type": 1,
"pos": [
40,
10
]
},
{
"id": 13,
"type": 16,
"pos": [
-40,
-20
]
},
{
"id": 14,
"type": 16,
"pos": [
40,
20
]
},
{
"id": 15,
"type": 12,
"pos": [
-25,
45
]
},
{
"id": 16,
"type": 13,
"pos": [
45,
-25
]
},
{
"id": 18,
"type": 11,
"pos": [
30,
-30
]
},
{
"id": 19,
"type": 11,
"pos": [
25,
30
]
},
{
"id": 20,
"type": 11,
"pos": [
-25,
-30
]
},
{
"id": 21,
"type": 11,
"pos": [
-40,
20
]
},
{
"id": 22,
"type": 3,
"pos": [
-20,
40
]
},
{
"id": 23,
"type": 2,
"pos": [
-20,
30
]
}
]
}
}

0 comments on commit 735ab9a

Please sign in to comment.