From 85a4961247c701525d334123bcd6054fe48adf8b Mon Sep 17 00:00:00 2001 From: AmyangXYZ Date: Wed, 27 Dec 2023 12:20:05 -0500 Subject: [PATCH] resolve conflicts --- package-lock.json | 151 +++++++++++----------- src/components/PacketSniffer.vue | 3 +- src/hooks/useDrawSchedule3D.ts | 212 ++++++++++++++++--------------- src/hooks/useDrawTopology.ts | 112 ++++++++-------- src/networks/5G/network.ts | 4 +- src/networks/TSCH/network.ts | 4 +- src/networks/TSCH/typedefs.ts | 1 - src/networks/TSN/network.ts | 4 +- src/networks/TSN/typedefs.ts | 8 +- src/networks/common.ts | 14 +- 10 files changed, 263 insertions(+), 250 deletions(-) diff --git a/package-lock.json b/package-lock.json index ef5de27..9fee4a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -52,11 +52,12 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.5.tgz", - "integrity": "sha512-Xmwn266vad+6DAqEB2A6V/CcZVp62BbwVmcOJc2RPuwih1kw02TjQvWVWlcKGbBPd+8/0V5DEkOcizRGYsspYQ==", + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", + "integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==", "dependencies": { - "@babel/highlight": "^7.22.5" + "@babel/highlight": "^7.23.4", + "chalk": "^2.4.2" }, "engines": { "node": ">=6.9.0" @@ -100,11 +101,11 @@ } }, "node_modules/@babel/generator": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.22.5.tgz", - "integrity": "sha512-+lcUbnTRhd0jOewtFSedLyiPsD5tswKkbgcezOqqWFUVNEwoUTlpPOBmvhG7OXWLR4jMdv0czPGH5XbflnD1EA==", + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz", + "integrity": "sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==", "dependencies": { - "@babel/types": "^7.22.5", + "@babel/types": "^7.23.6", "@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" @@ -165,20 +166,20 @@ } }, "node_modules/@babel/helper-environment-visitor": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.5.tgz", - "integrity": "sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-function-name": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.22.5.tgz", - "integrity": "sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", "dependencies": { - "@babel/template": "^7.22.5", - "@babel/types": "^7.22.5" + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" }, "engines": { "node": ">=6.9.0" @@ -293,9 +294,9 @@ } }, "node_modules/@babel/helper-split-export-declaration": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.5.tgz", - "integrity": "sha512-thqK5QFghPKWLhAV321lxF95yCg2K3Ob5yw+M3VHWfdia0IkPXUtoLH8x/6Fh486QUvzhb8YOWHChTVen2/PoQ==", + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", "dependencies": { "@babel/types": "^7.22.5" }, @@ -304,17 +305,17 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", - "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz", + "integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz", - "integrity": "sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", "engines": { "node": ">=6.9.0" } @@ -341,12 +342,12 @@ } }, "node_modules/@babel/highlight": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.5.tgz", - "integrity": "sha512-BSKlD1hgnedS5XRnGOljZawtag7H1yPfQp0tdNJCHoH6AZ+Pcm9VvkrK59/Yy593Ypg0zMxH2BxD1VPYUQ7UIw==", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", + "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", "dependencies": { - "@babel/helper-validator-identifier": "^7.22.5", - "chalk": "^2.0.0", + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", "js-tokens": "^4.0.0" }, "engines": { @@ -354,9 +355,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.5.tgz", - "integrity": "sha512-DFZMC9LJUG9PLOclRC32G63UXwzqS2koQC8dkx+PLdmt1xSePYpbT/NbsrJy8Q/muXz7o/h/d4A7Fuyixm559Q==", + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.6.tgz", + "integrity": "sha512-Z2uID7YJ7oNvAI20O9X0bblw7Qqs8Q2hFy0R9tAfnfLkp5MW0UH9eUvnDSnFwKZ0AvgS1ucqR4KzvVHgnke1VQ==", "bin": { "parser": "bin/babel-parser.js" }, @@ -410,32 +411,32 @@ } }, "node_modules/@babel/template": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.5.tgz", - "integrity": "sha512-X7yV7eiwAxdj9k94NEylvbVHLiVG1nvzCV2EAowhxLTwODV1jl9UzZ48leOC0sH7OnuHrIkllaBgneUykIcZaw==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", "dependencies": { - "@babel/code-frame": "^7.22.5", - "@babel/parser": "^7.22.5", - "@babel/types": "^7.22.5" + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.5.tgz", - "integrity": "sha512-7DuIjPgERaNo6r+PZwItpjCZEa5vyw4eJGufeLxrPdBXBoLcCJCIasvK6pK/9DVNrLZTLFhUGqaC6X/PA007TQ==", - "dependencies": { - "@babel/code-frame": "^7.22.5", - "@babel/generator": "^7.22.5", - "@babel/helper-environment-visitor": "^7.22.5", - "@babel/helper-function-name": "^7.22.5", + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.6.tgz", + "integrity": "sha512-czastdK1e8YByZqezMPFiZ8ahwVMh/ESl9vPgvgdB9AmFMGP5jfpFax74AQgl5zj4XHzqeYAg2l8PuUeRS1MgQ==", + "dependencies": { + "@babel/code-frame": "^7.23.5", + "@babel/generator": "^7.23.6", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", "@babel/helper-hoist-variables": "^7.22.5", - "@babel/helper-split-export-declaration": "^7.22.5", - "@babel/parser": "^7.22.5", - "@babel/types": "^7.22.5", - "debug": "^4.1.0", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.23.6", + "@babel/types": "^7.23.6", + "debug": "^4.3.1", "globals": "^11.1.0" }, "engines": { @@ -443,12 +444,12 @@ } }, "node_modules/@babel/types": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.5.tgz", - "integrity": "sha512-zo3MIHGOkPOfoRXitsgHLjEXmlDaD/5KU1Uzuc9GNiZPhSqVxVRtxuPaSBZDsYZ9qV88AjtMtWW7ww98loJ9KA==", + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.6.tgz", + "integrity": "sha512-+uarb83brBzPKN38NX1MkB6vb6+mwvR6amUulqAE7ccQw1pEl+bCia9TbdG1lsnFP7lZySvUn37CHyXQdfTwzg==", "dependencies": { - "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.5", + "@babel/helper-string-parser": "^7.23.4", + "@babel/helper-validator-identifier": "^7.22.20", "to-fast-properties": "^2.0.0" }, "engines": { @@ -3775,9 +3776,9 @@ "dev": true }, "node_modules/nanoid": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", - "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", "funding": [ { "type": "github", @@ -3827,9 +3828,9 @@ } }, "node_modules/normalize-package-data/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, "bin": { "semver": "bin/semver" @@ -3891,9 +3892,9 @@ } }, "node_modules/npm-run-all/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, "bin": { "semver": "bin/semver" @@ -4142,9 +4143,9 @@ } }, "node_modules/postcss": { - "version": "8.4.24", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.24.tgz", - "integrity": "sha512-M0RzbcI0sO/XJNucsGjvWU9ERWxb/ytp1w6dKtxTKgixdtQDq4rmx/g8W1hnaheq9jgwL/oyEdH5Bc4WwJKMqg==", + "version": "8.4.32", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.32.tgz", + "integrity": "sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw==", "funding": [ { "type": "opencollective", @@ -4160,7 +4161,7 @@ } ], "dependencies": { - "nanoid": "^3.3.6", + "nanoid": "^3.3.7", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" }, @@ -4393,9 +4394,9 @@ } }, "node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "bin": { "semver": "bin/semver.js" } @@ -5060,9 +5061,9 @@ } }, "node_modules/word-wrap": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", - "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", "dev": true, "engines": { "node": ">=0.10.0" diff --git a/src/components/PacketSniffer.vue b/src/components/PacketSniffer.vue index b121f9d..7b13541 100644 --- a/src/components/PacketSniffer.vue +++ b/src/components/PacketSniffer.vue @@ -158,5 +158,4 @@ Row.inheritAttrs = false text-align: center; } -@/networks/TSCH -@/networks/common \ No newline at end of file +@/networks/TSCH @/networks/common diff --git a/src/hooks/useDrawSchedule3D.ts b/src/hooks/useDrawSchedule3D.ts index 20c603b..5e7a8c6 100644 --- a/src/hooks/useDrawSchedule3D.ts +++ b/src/hooks/useDrawSchedule3D.ts @@ -4,114 +4,116 @@ import 'echarts-gl' import { Network } from './useStates' export function useDrawSchedule3D(chartDom: HTMLElement): any { - const chart = echarts.init(chartDom) + const chart = echarts.init(chartDom) - const zCategories = ['Shared', 'Mgmt', 'Data']; + const zCategories = ['Shared', 'Mgmt', 'Data'] - const option: any = { - dataset: { - dimensions: ['slot', 'channel', 'type'], - source: [] - }, - yAxis3D: { - type: 'category', - name: 'Channels', - nameTextStyle: { - color: 'white' - }, - data: Array.from({length: Network.SchConfig.value.num_slots}, (_, i) => i + 1), - axisTick: { - interval: 1 - }, - axisLabel: { - color: 'white' - }, - min: 0, - max: 10 - }, - xAxis3D: { - type: 'category', - name: 'Slots', - nameTextStyle: { - color: 'white' - }, - data: Array.from({length: Network.SchConfig.value.num_channels}, (_, i) => i + 1), - axisTick: { - interval: 1 - }, - axisLabel: { - color: 'white' - }, - min: 0, - max: 20 - }, - zAxis3D: { - type: 'category', - data: zCategories, - axisTick: { - interval: 1 - }, - axisLabel: { - color: 'white' - }, - min: 0, - max: 2 - }, - grid3D: { - light: { - main: { - shadow: true, - quality: 'ultra', - intensity: 1.5 - } - }, - borderColor: 'white' - }, - series: [{ - type: 'bar3D', - - xAxisIndex: 0, - yAxisIndex: 0, - zAxisIndex: 0, + const option: any = { + dataset: { + dimensions: ['slot', 'channel', 'type'], + source: [] + }, + yAxis3D: { + type: 'category', + name: 'Channels', + nameTextStyle: { + color: 'white' + }, + data: Array.from({ length: Network.SchConfig.value.num_slots }, (_, i) => i + 1), + axisTick: { + interval: 1 + }, + axisLabel: { + color: 'white' + }, + min: 0, + max: 10 + }, + xAxis3D: { + type: 'category', + name: 'Slots', + nameTextStyle: { + color: 'white' + }, + data: Array.from({ length: Network.SchConfig.value.num_channels }, (_, i) => i + 1), + axisTick: { + interval: 1 + }, + axisLabel: { + color: 'white' + }, + min: 0, + max: 20 + }, + zAxis3D: { + type: 'category', + data: zCategories, + axisTick: { + interval: 1 + }, + axisLabel: { + color: 'white' + }, + min: 0, + max: 2 + }, + grid3D: { + light: { + main: { + shadow: true, + quality: 'ultra', + intensity: 1.5 + } + }, + borderColor: 'white' + }, + series: [ + { + type: 'bar3D', - seriesIndex: 0, - itemStyle: { - depth: 20, - height: 20 - }, - encode: { - x: 'slot', - y: 'channel', - z: { - field: 'type', - ordinal: 'true', - }, - color: 'color' - } - }], - visualMap: { - show: false, - dimension: 2, - categories: [0, 1, 2], - inRange: { - color: ['green', 'red', 'blue'] - } - }, - responsive: true - } + xAxisIndex: 0, + yAxisIndex: 0, + zAxisIndex: 0, - for (let slot = 1; slot <= Network.SchConfig.value.num_slots; slot++) { - for (let channel = 1; channel <= Network.SchConfig.value.num_channels; channel++) { - const cell = Network.Schedule.value[slot][channel] - if (cell) { - option.dataset.source.push({ - slot: `${slot}`, - channel: `${channel}`, - type: cell.type - }) - } + seriesIndex: 0, + itemStyle: { + depth: 20, + height: 20 + }, + encode: { + x: 'slot', + y: 'channel', + z: { + field: 'type', + ordinal: 'true' + }, + color: 'color' } + } + ], + visualMap: { + show: false, + dimension: 2, + categories: [0, 1, 2], + inRange: { + color: ['green', 'red', 'blue'] + } + }, + responsive: true + } + + for (let slot = 1; slot <= Network.SchConfig.value.num_slots; slot++) { + for (let channel = 1; channel <= Network.SchConfig.value.num_channels; channel++) { + const cell = Network.Schedule.value[slot][channel] + if (cell) { + option.dataset.source.push({ + slot: `${slot}`, + channel: `${channel}`, + type: cell.type + }) + } } - console.log(option.dataset.source) - chart.setOption(option) -} \ No newline at end of file + } + console.log(option.dataset.source) + chart.setOption(option) +} diff --git a/src/hooks/useDrawTopology.ts b/src/hooks/useDrawTopology.ts index 53be181..6c7ea75 100644 --- a/src/hooks/useDrawTopology.ts +++ b/src/hooks/useDrawTopology.ts @@ -8,7 +8,7 @@ import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls' import { DragControls } from 'three/examples/jsm/controls/DragControls.js' import Stats from 'three/examples/jsm/libs/stats.module' import * as TWEEN from '@tweenjs/tween.js' -import { NODE_TYPE, NetworkType, type Packet } from '@/networks/common' +import { NODE_TYPE, NETWORK_TYPE, type Packet } from '@/networks/common' export function useDrawTopology(dom: HTMLElement) { const scene = new THREE.Scene() @@ -26,7 +26,7 @@ export function useDrawTopology(dom: HTMLElement) { stats.dom.style.position = 'fixed' stats.dom.style.right = '16px' stats.dom.style.top = '16px' - stats.dom.style.left = null + stats.dom.style.left = '' document.body.appendChild(stats.dom) const setCamera = () => { @@ -111,13 +111,13 @@ export function useDrawTopology(dom: HTMLElement) { let drawnNodes: { [name: string]: any } = {} const drawNodes = () => { switch (Network.Type) { - case NetworkType.TSCH: + case NETWORK_TYPE.TSCH: drawTSCHNodes() break - case NetworkType.TSN: + case NETWORK_TYPE.TSN: drawTSNNodes() break - case NetworkType.FiveG: + case NETWORK_TYPE.FiveG: drawFiveGBS() drawFiveGUE() break @@ -337,64 +337,77 @@ export function useDrawTopology(dom: HTMLElement) { } const drawEndSystems = () => { - const loader = new GLTFLoader(); - - const loadAndPlaceModel = async (modelPath: any, scale: any, rotationY: any, positionY: any, labelY: any, typeVal: any) => { + const loader = new GLTFLoader() + + const loadAndPlaceModel = async ( + modelPath: any, + scale: any, + rotationY: any, + positionY: any, + labelY: any, + typeVal: any + ) => { const gltf: any = await new Promise((resolve) => { - loader.load(modelPath, (gltf: any) => resolve(gltf)); - }); - - const modelTemplate = gltf.scene; - - modelTemplate.scale.set(...scale); - modelTemplate.rotation.y = rotationY; + loader.load(modelPath, (gltf: any) => resolve(gltf)) + }) + + const modelTemplate = gltf.scene + + modelTemplate.scale.set(...scale) + modelTemplate.rotation.y = rotationY modelTemplate.traverse((object: any) => { if (object.isMesh) { - object.castShadow = true; - object.receiveShadow = true; - object.material.color = new THREE.Color('#999'); + object.castShadow = true + object.receiveShadow = true + object.material.color = new THREE.Color('#999') } - }); - - const box = new THREE.Box3().setFromObject(modelTemplate); - const size = new THREE.Vector3(); - box.getSize(size); - + }) + + const box = new THREE.Box3().setFromObject(modelTemplate) + const size = new THREE.Vector3() + box.getSize(size) + for (const es of Network.EndSystems.value) { - if (es.type !== typeVal) continue; - - const model = modelTemplate.clone(); - model.position.set(es.pos[0], positionY, es.pos[1]); + if (es.type !== typeVal) continue + + const model = modelTemplate.clone() + model.position.set(es.pos[0], positionY, es.pos[1]) model.traverse((object: any) => { if (object.isMesh) { - object.userData.type = NODE_TYPE[4]; // EndSystem - object.userData.node_id = es.id; + object.userData.type = NODE_TYPE[4] // EndSystem + object.userData.node_id = es.id } - }); - scene.add(model); - - const label = createLabel(`${NODE_TYPE[4]}-${es.id}`); - label.position.set(model.position.x, labelY, model.position.z); - scene.add(label); - - const { dragBox, dragBoxHelper } = createDragBox(node, model) - + }) + scene.add(model) + + const label = createLabel(`${NODE_TYPE[4]}-${es.id}`) + label.position.set(model.position.x, labelY, model.position.z) + scene.add(label) + + const { dragBox, dragBoxHelper } = createDragBox(es, model) + drawnNodes[`${NODE_TYPE[4]}-${es.id}`] = { model, label, modelGroup: model, dragBox, - boxHelper, - }; + dragBoxHelper + } } - }; - + } + // Load and place models - loadAndPlaceModel('/models/server/scene.gltf', [3, 3, 3], -Math.PI / 2, 3, 7, 0); - loadAndPlaceModel('/models/robotic_arm/scene.gltf', [0.004, 0.004, 0.004], -Math.PI / 2, 0, 7, 1); - loadAndPlaceModel('/models/sensor/scene.gltf', [2, 2, 2], -Math.PI / 2, 0, 5, 2); - }; - + loadAndPlaceModel('/models/server/scene.gltf', [3, 3, 3], -Math.PI / 2, 0, 7, 0) + loadAndPlaceModel( + '/models/robotic_arm/scene.gltf', + [0.004, 0.004, 0.004], + -Math.PI / 2, + 0, + 7, + 1 + ) + loadAndPlaceModel('/models/sensor/scene.gltf', [2, 2, 2], -Math.PI / 2, 0, 5, 2) + } const createDragBox = (node: any, model: any): any => { const box = new THREE.Box3().setFromObject(model) @@ -419,7 +432,6 @@ export function useDrawTopology(dom: HTMLElement) { scene.add(dragBoxHelper) return { dragBox, dragBoxHelper } } - const drawEndSystems = () => {} let drawnLinks: { [uid: number]: any } = {} const drawLinks = () => { @@ -644,7 +656,7 @@ export function useDrawTopology(dom: HTMLElement) { } u.mesh.geometry.setFromPoints(u.positions) - const sizes = [] + const sizes: number[] = [] for (let i = 0; i < u.positions.length; i++) { sizes[i] = (1 - i / u.positions.length) * 1.5 } diff --git a/src/networks/5G/network.ts b/src/networks/5G/network.ts index d7171e3..cafeed4 100644 --- a/src/networks/5G/network.ts +++ b/src/networks/5G/network.ts @@ -1,12 +1,12 @@ import { ref } from 'vue' -import { Network, NetworkType, NODE_TYPE, type LinkMeta } from '../common' +import { Network, NETWORK_TYPE, NODE_TYPE, type LinkMeta } from '../common' import type { ScheduleConfig, FiveGNodeMeta } from './typedefs' import { SeededRandom } from '@/hooks/useSeed' export class FiveGNetwork extends Network { constructor() { super() - this.Type = NetworkType.FiveG + this.Type = NETWORK_TYPE.FiveG // this.Schedule = ref([]) this.SchConfig = ref({ num_slots: 40 diff --git a/src/networks/TSCH/network.ts b/src/networks/TSCH/network.ts index 74f8f17..aee6315 100644 --- a/src/networks/TSCH/network.ts +++ b/src/networks/TSCH/network.ts @@ -9,7 +9,7 @@ import type { } from './typedefs' import { ADDR, MSG_TYPES, PKT_TYPES, CELL_TYPES } from './typedefs' import { SeededRandom } from '@/hooks/useSeed' -import { Network, NetworkType, NODE_TYPE } from '../common' +import { Network, NETWORK_TYPE, NODE_TYPE } from '../common' import type { Packet, Message, MsgHandler, LinkMeta } from '../common' export class TSCHNetwork extends Network { @@ -19,7 +19,7 @@ export class TSCHNetwork extends Network { constructor() { super() - this.Type = NetworkType.TSCH + this.Type = NETWORK_TYPE.TSCH this.Schedule = ref([]) this.SchConfig = ref({ num_slots: 40, diff --git a/src/networks/TSCH/typedefs.ts b/src/networks/TSCH/typedefs.ts index 3dedbae..9ba83a5 100644 --- a/src/networks/TSCH/typedefs.ts +++ b/src/networks/TSCH/typedefs.ts @@ -18,7 +18,6 @@ export interface ScheduleConfig { shared_channel: number } - // basic unit of the communication schedule export interface Cell { type: number diff --git a/src/networks/TSN/network.ts b/src/networks/TSN/network.ts index e8cda90..ea268f0 100644 --- a/src/networks/TSN/network.ts +++ b/src/networks/TSN/network.ts @@ -1,5 +1,5 @@ import { ref, toRaw } from 'vue' -import { Network, NetworkType, NODE_TYPE, type Message } from '../common' +import { Network, NETWORK_TYPE, NODE_TYPE, type Message } from '../common' import { MSG_TYPES, type INIT_MSG_PAYLOAD, type ScheduleConfig, type TSNNodeMeta } from './typedefs' import { SeededRandom } from '@/hooks/useSeed' @@ -9,7 +9,7 @@ export class TSNNetwork extends Network { constructor() { super() - this.Type = NetworkType.TSN + this.Type = NETWORK_TYPE.TSN // this.Schedule = ref([]) this.SchConfig = ref({ num_slots: 40 diff --git a/src/networks/TSN/typedefs.ts b/src/networks/TSN/typedefs.ts index 6d28894..cce1c44 100644 --- a/src/networks/TSN/typedefs.ts +++ b/src/networks/TSN/typedefs.ts @@ -6,22 +6,20 @@ export interface ScheduleConfig { export interface TSNNodeMeta extends NodeMeta {} - export enum MSG_TYPES { INIT, ASN, DONE, // finished all activities of the current slot - STAT, + STAT } export interface INIT_MSG_PAYLOAD { id: number pos: number[] - neighbors:[], + neighbors: [] sch_config: ScheduleConfig } - export enum PKT_TYPES { DATA -} \ No newline at end of file +} diff --git a/src/networks/common.ts b/src/networks/common.ts index f19fb7b..c91f475 100644 --- a/src/networks/common.ts +++ b/src/networks/common.ts @@ -12,7 +12,7 @@ export class Network { Schedule: any Packets = ref([]) ASN = ref(0) - asnTimer = 0 + asnTimer: any PacketsCurrent = ref([]) SignalReset = ref(0) @@ -34,15 +34,17 @@ export class Network { } createEndSystems = () => { // initialize ref array if it does not already exist - this.EndSystems = ref([]) + this.EndSystems = ref([]) const rand = new SeededRandom(this.TopoConfig.value.seed) - + this.EndSystems.value = [] // clear any old end systems - + for (let i = 1; i <= this.TopoConfig.value.num_es; i++) { const es = { id: i, - type: Math.floor(rand.next() * Object.keys(END_SYSTEM_TYPE).filter(key => isNaN(Number(key))).length), // Object.keys(...).filter(...) is used to count # of elements in enum + type: Math.floor( + rand.next() * Object.keys(END_SYSTEM_TYPE).filter((key) => isNaN(Number(key))).length + ), // Object.keys(...).filter(...) is used to count # of elements in enum pos: [ Math.floor(rand.next() * this.TopoConfig.value.grid_size) - this.TopoConfig.value.grid_size / 2, @@ -79,7 +81,7 @@ export class Network { } } -export enum NetworkType { +export enum NETWORK_TYPE { TSCH, TSN, FiveG