├── .github
└── workflows
│ └── nodejs.yml
├── .gitignore
├── .travis.yml
├── LICENSE
├── README.md
├── img
├── demo.gif
├── handoff.PNG
└── simulation structure.PNG
├── package-lock.json
├── package.json
├── public
├── bs.png
├── index.html
└── robots.txt
└── src
├── App.js
├── App.test.js
├── HandoffVisualizer
├── Components
│ ├── BootstrapDrop.jsx
│ ├── BootstrapNav.css
│ ├── BootstrapNav.jsx
│ ├── Data.css
│ ├── Data.jsx
│ ├── Entrance.css
│ ├── Entrance.jsx
│ ├── Icons.css
│ ├── Icons.jsx
│ ├── Line.jsx
│ ├── Node.css
│ ├── Node.jsx
│ ├── Plots.jsx
│ └── Simulation.jsx
├── Handoff.css
├── Handoff.jsx
└── img
│ ├── arrow0.svg
│ ├── arrow1.svg
│ ├── arrow2.svg
│ ├── arrow3.svg
│ ├── bs.png
│ ├── bs.svg
│ ├── handoff.svg
│ ├── handoff2(1).svg
│ ├── handoff2.svg
│ ├── handoff3.svg
│ └── logo.svg
├── index.css
├── index.js
├── serviceWorker.js
├── setupTests.js
└── utils.mjs
/.github/workflows/nodejs.yml:
--------------------------------------------------------------------------------
1 | # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3 |
4 | name: Node.js CI
5 |
6 | on:
7 | push:
8 | branches: [ master ]
9 | pull_request:
10 | branches: [ master ]
11 |
12 | jobs:
13 | build:
14 |
15 | runs-on: ubuntu-latest
16 |
17 | strategy:
18 | matrix:
19 | node-version: [10.x, 12.x]
20 |
21 | steps:
22 | - uses: actions/checkout@v2
23 | - name: Use Node.js ${{ matrix.node-version }}
24 | uses: actions/setup-node@v1
25 | with:
26 | node-version: ${{ matrix.node-version }}
27 | - run: npm ci
28 | - run: npm run build --if-present
29 | - run: npm test
30 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "stable"
4 | cache:
5 | directories:
6 | - node_modules
7 | script:
8 | - npm run build
9 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Tony Chou
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | > 📶 Visualizing the transmission between users and base stations!
16 |
17 | Play with it! https://chonyy.github.io/handoff-visualizer/
18 |
19 | Handoff is the **transition** for any given user of signal transmission from one base station to a geographically adjacent base station as the user moves around. In this project, we **visualize** the process of handoff by generating cars moving around the blocks and connecting them to different base stations based on different policies.
20 |
21 | This project is to **visualize** handoff and make the concept of handoff in wireless network easy to understand. **Different policies** are implemented to perform the handoff in different situations. The goal is to make the users try out all the different policies, understand the differences, and find out the most efficient policy.
22 |
23 | If your are interested in this visualiztion, please also check out the [handoff-simulator](https://github.com/chonyy/handoff-simulator). We want people to understand handoff in this visualizer project, and we **value the data** in that [handoff-simulator](https://github.com/chonyy/handoff-simulator).
24 |
25 | ## Simulation Structure
26 |
27 |
28 |
29 |
30 | Each node is a 20 * 20 (m^2) square. A block is composed of 24 nodes, whick makes the block size 120 * 80 (m^2). Cars are assummed to be moving on an extremely thin line path between blocks, the path doesn't take up any space. The velocity of the car is 20m/s. In our simulation, we iterate once in a second. The cars move one node, and all the data are calculated and updated every second.
31 |
32 | - **Velocity** = 72km/hr = 20m/s
33 | - **Probability of cars entrance** follows [Poisson distribution](https://en.wikipedia.org/wiki/Poisson_distribution)
34 | - **⋋** = 1 cars/ min [ P(t) = ⋋"e" ^(−"⋋" ) (t is in sec) ]
35 | - **Probability of cars turning** based on predefined value listed below
36 | - **Received Power Calculation** explained below
37 |
38 | ### Car Entrance Distribution
39 |
40 | The probability of the entrance follows [Poisson distribution](https://en.wikipedia.org/wiki/Poisson_distribution) and
41 |
42 | In our simultation
43 |
44 | - **⋋** = 0.0167 cars/ sec
45 | - **k** = 1
46 |
47 | ### Received Power
48 |
49 | The received power is calculated by the formula below. Read [ScienceDirect](https://www.sciencedirect.com/topics/engineering/received-signal-power) to dig deeper.
50 |
51 | - Base station transmission Pt(mW) = -50 dBm
52 | - Base = 1mW
53 | - 10log(Pt / Base) = dBm
54 | - First-meter path loss = 10 dBm
55 | - **P0 = -50 dBm**
56 | - **Pd = -50 - 10 - 20log(d(m) / 1m)**
57 |
58 | ## Policies Pseudocode
59 |
60 | Received Power referred to **P**, base station referered to **B**.
61 |
62 | Threshold referred to **T**, entrophy referred to **E**.
63 |
64 | ### Best Policy
65 |
66 | ```javascript
67 | if (Pnew > Pold) {
68 | car.bs = Bnew;
69 | car.power = Pnew;
70 | }
71 | ```
72 |
73 | ### Threshold Policy
74 |
75 | ```javascript
76 | if (Pnew > Pold && Pold < T) {
77 | car.bs = Bnew;
78 | car.power = Pnew;
79 | }
80 | ```
81 |
82 | ### Entrophy Policy
83 |
84 | ```javascript
85 | if (Pnew > Pold + E) {
86 | car.bs = Bnew;
87 | car.power = Pnew;
88 | }
89 | ```
90 |
91 | ### Minimum Policy
92 |
93 | ```javascript
94 | if (Pnew < Pmin) {
95 | car.bs = Bnew;
96 | car.power = Pnew;
97 | }
98 | ```
99 |
100 | ## Demo Video
101 |
102 |
103 |
106 |
107 |
108 | ## What is handoff?
109 |
110 |
111 |
112 |
113 |
114 | [Handoff](https://searchmobilecomputing.techtarget.com/definition/handoff) is the **transition** for any given user of signal transmission from one base station to a geographically adjacent base station as the user **moves around**.
115 |
116 | Each time a mobile or portable cellular subscriber passes from one cellinto another, the network automatically **switches** coverage responsibility from one basestation to another. Each base-station transition, as well as the switching processor sequence itself, is called handoff.
117 |
118 | ## Policies parameter value
119 |
120 | The different parameters for each policy are listed below.
121 |
122 | | Parameters | Value |
123 | | ---------- | :------: |
124 | | Threshold | -108 dBm |
125 | | Entrophy | 5 dBm |
126 | | Minimum | -112 dBm |
127 |
128 | ## Posssibility of turning
129 |
130 | The possibility of changing direction when encountering intersection is listed below.
131 |
132 | ### Intersection with four roads
133 |
134 | | Direction | Possibility |
135 | | ----------- | :---------: |
136 | | Go straight | 1/2 |
137 | | Turn right | 1/3 |
138 | | Turn left | 1/6 |
139 |
140 | ### Intersection with three roads
141 |
142 | | Direction | Possibility |
143 | | ---------- | :---------: |
144 | | Turn right | 1/2 |
145 | | Turn left | 1/2 |
146 |
147 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
148 |
149 | ## Available Scripts
150 |
151 | In the project directory, you can run:
152 |
153 | ### `npm start`
154 |
155 | Runs the app in the development mode.
156 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
157 |
158 | The page will reload if you make edits.
159 | You will also see any lint errors in the console.
160 |
161 | ### `npm test`
162 |
163 | Launches the test runner in the interactive watch mode.
164 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
165 |
166 | ### `npm run build`
167 |
168 | Builds the app for production to the `build` folder.
169 | It correctly bundles React in production mode and optimizes the build for the best performance.
170 |
171 | The build is minified and the filenames include the hashes.
172 | Your app is ready to be deployed!
173 |
174 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
175 |
176 | ### `npm run eject`
177 |
178 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!**
179 |
180 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
181 |
182 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
183 |
184 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
185 |
186 | ## Learn More
187 |
188 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
189 |
190 | To learn React, check out the [React documentation](https://reactjs.org/).
191 |
192 | ### Code Splitting
193 |
194 | This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
195 |
196 | ### Analyzing the Bundle Size
197 |
198 | This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
199 |
200 | ### Making a Progressive Web App
201 |
202 | This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
203 |
204 | ### Advanced Configuration
205 |
206 | This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
207 |
208 | ### Deployment
209 |
210 | This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
211 |
212 | ### `npm run build` fails to minify
213 |
214 | This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
215 |
--------------------------------------------------------------------------------
/img/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chonyy/handoff-visualizer/e7f10a04cc8b74c033e536a7842d63c315c000d7/img/demo.gif
--------------------------------------------------------------------------------
/img/handoff.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chonyy/handoff-visualizer/e7f10a04cc8b74c033e536a7842d63c315c000d7/img/handoff.PNG
--------------------------------------------------------------------------------
/img/simulation structure.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chonyy/handoff-visualizer/e7f10a04cc8b74c033e536a7842d63c315c000d7/img/simulation structure.PNG
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "newhandoff",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^4.2.4",
7 | "@testing-library/react": "^9.4.0",
8 | "@testing-library/user-event": "^7.2.1",
9 | "bootstrap": "^4.4.1",
10 | "plotly.js": "^1.52.2",
11 | "react": "^16.12.0",
12 | "react-bootstrap": "^1.0.0-beta.16",
13 | "react-dom": "^16.12.0",
14 | "react-plotly.js": "^2.4.0",
15 | "react-scripts": "3.4.0"
16 | },
17 | "homepage": "http://chonyy.github.io/handoff-visualizer",
18 | "scripts": {
19 | "start": "react-scripts start",
20 | "build": "react-scripts build",
21 | "test": "react-scripts test",
22 | "eject": "react-scripts eject",
23 | "predeploy": "npm run build",
24 | "deploy": "gh-pages -d build"
25 | },
26 | "eslintConfig": {
27 | "extends": "react-app"
28 | },
29 | "browserslist": {
30 | "production": [
31 | ">0.2%",
32 | "not dead",
33 | "not op_mini all"
34 | ],
35 | "development": [
36 | "last 1 chrome version",
37 | "last 1 firefox version",
38 | "last 1 safari version"
39 | ]
40 | },
41 | "devDependencies": {
42 | "gh-pages": "^2.2.0"
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/public/bs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chonyy/handoff-visualizer/e7f10a04cc8b74c033e536a7842d63c315c000d7/public/bs.png
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
12 | Wireless Handoff Visualizer
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Handoff from './HandoffVisualizer/Handoff'
3 |
4 | function App() {
5 | return (
6 |
7 | );
8 | }
9 |
10 | export default App;
11 |
--------------------------------------------------------------------------------
/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from '@testing-library/react';
3 | import ReactDOM from 'react-dom';
4 | import App from './App';
5 |
6 | it('renders without crashing', () => {
7 | const div = document.createElement('div');
8 | ReactDOM.render(, div);
9 | });
10 |
--------------------------------------------------------------------------------
/src/HandoffVisualizer/Components/BootstrapDrop.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from "react";
2 | import Dropdown from "react-bootstrap/Dropdown";
3 |
4 | export default class BootstrapDrop extends Component {
5 | handledrop(clicked) {
6 | let policyobj = this.props.policyobj;
7 | if (clicked === 0) {
8 | document.getElementById("dropdown-basic").innerHTML = "Best Policy";
9 | policyobj.policy = 0;
10 | } else if (clicked === 1) {
11 | document.getElementById("dropdown-basic").innerHTML =
12 | "Threshsold Policy";
13 | policyobj.policy = 1;
14 | } else if (clicked === 2) {
15 | document.getElementById("dropdown-basic").innerHTML =
16 | "Entrophy Policy";
17 | policyobj.policy = 2;
18 | } else if (clicked === 3) {
19 | document.getElementById("dropdown-basic").innerHTML =
20 | "Minimum Policy";
21 | policyobj.policy = 3;
22 | }
23 | }
24 |
25 | render() {
26 | return (
27 |
28 |
33 | Best Policy
34 |
35 |
36 |
37 | this.handledrop(0)}>
38 | Best Policy
39 |
40 | this.handledrop(1)}>
41 | Threshold Policy
42 |
43 | this.handledrop(2)}>
44 | Entrophy Policy
45 |
46 | this.handledrop(3)}>
47 | Minimum Policy
48 |
49 |
50 |
51 | );
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/src/HandoffVisualizer/Components/BootstrapNav.css:
--------------------------------------------------------------------------------
1 | .navbarlinks {
2 | margin-left: 30px;
3 | margin-right: 30px;
4 | font-weight: 400;
5 | }
6 |
7 | .navbrand {
8 | font-weight: 600;
9 | }
--------------------------------------------------------------------------------
/src/HandoffVisualizer/Components/BootstrapNav.jsx:
--------------------------------------------------------------------------------
1 | import React, { Component } from "react";
2 | import { Navbar, Nav } from "react-bootstrap";
3 | import "./BootstrapNav.css";
4 |
5 | export default class BootstrapNav extends Component {
6 | render() {
7 | return (
8 |