diff --git a/INSTALL.md b/INSTALL.md
new file mode 100644
index 0000000..8b98f37
--- /dev/null
+++ b/INSTALL.md
@@ -0,0 +1,15 @@
+# Οδηγίες Εγκατάστασης-Εκτέλεσης Εφαρμογής
+
+
+Για την εκτέλεση της εφαρμογής είναι απαραίτητο να είναι εγκατεστημένο στο σύστημα του χρήστη το περιβάλλον εκτέλεσης Node js και το npm καθώς εκτελείται πρόγραμμα Node js στο επίπεδο του host(εκτός docker) με σκοπό την
+δημιουργία container οχημάτων ανάλογα με την είσοδο του χρήστη μέσω της web εφαρμογής.
+
+Η εφαρμογή εκκινεί με την εκτέλεση του script "start.sh". Το script "start.sh" αρχικά δημιουργεί τα docker images των κόμβων με βάση τα αντίστοιχα Dockerfile και το δίκτυο των container. Στην συνέχεια δημιουργεί ένα container για τις βάσεις
+δεδομένων, ένα container για το REST API, 8 containers για τους φωτεινούς σηματοδότες, 40 containers για τους αισθητήρες κίνησης, ένα container για τον κόμβο συντονιστή και ένα container για τον web server. Τέλος εγκαθιστά τα κατάλληλα modules
+για το πρόγραμμα(entry handler) που εκτελείται στο επίπεδο του host και το θέτει σε λειτουργία αναμένοντας αιτήματα από τον χρήστη. Μεταβαίνοντας στην διεύθυνση 127.0.0.1:8080 ο χρήστης μπορεί να εισάγει νέα οχήματα και να παρατηρεί την κατάσταση του έξυπνου οδικού δικτύου.
+
+Η εφαρμογή σταματάει με την εκτέλεση του script "stop.sh". Το script "stop.sh" σταματάει τα container που δημιουργήθηκαν και στην συνέχεια τα διαγράφει. Ο χρήστης μπορεί να σταματήσει την εκτέλεση του προγράμματος(entry handler) που εκτελείται
+στο επίπεδο του host κλείνοντας το τερματικό στο οποίο εκτελείται το script "start.sh"(ή πατώντας τον συνδυασμό πλήκτρων CTRL+C).
+
+Είναι σημαντικό να σημειωθεί ότι λόγω του πλήθους των container και των αιτημάτων που πραγματοποιούνται στο REST API, η εφαρμογή καταναλώνει αρκετή επεξεργαστική ισχύ. Επομένως προτείνεται σε χρήστες που έχουν περιορισμένη επεξεργαστική ισχύ
+να αυξήσουν τον χρόνο αναμονής(να διπλασιάσουν το όρισμα της μεθόδου time.sleep) στους κόμβους αισθητήρων κίνησης(αρχείο sensor.py) και στους κόμβους οχημάτων(αρχείο vehicle.py) πριν θέσουν σε λειτουργία την εφαρμογή. Αυτό θα έχει σαν αποτέλεσμα οι αισθητήρες κίνησης να δειγματοληπτούν σε μικρότερο βαθμό και τα οχήματα να κινούνται με μικρότερη ταχύτητα.
diff --git a/README.md b/README.md
index e63ef91..ef6e73b 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Υπολογιστική Νέφους και Υπηρεσίες - Εργασία Εξαμήνου
+# Οδηγίες Εγκατάστασης-Εκτέλεσης Εφαρμογής
## Συγγραφείς
diff --git a/api/Dockerfile b/api/Dockerfile
new file mode 100644
index 0000000..ef6b0e0
--- /dev/null
+++ b/api/Dockerfile
@@ -0,0 +1,14 @@
+
+FROM node:18-alpine
+
+WORKDIR /app
+
+COPY ["api/package.json", "./"]
+
+RUN npm install
+
+WORKDIR /app/src
+
+COPY ["api/src", "./"]
+
+CMD ["node", "."]
diff --git a/api/package.json b/api/package.json
new file mode 100644
index 0000000..f6bffe7
--- /dev/null
+++ b/api/package.json
@@ -0,0 +1,7 @@
+{
+ "dependencies": {
+ "cors": "^2.8.5",
+ "express": "^4.18.2",
+ "mongodb": "4.4"
+ }
+}
diff --git a/api/src/index.js b/api/src/index.js
new file mode 100644
index 0000000..19726a0
--- /dev/null
+++ b/api/src/index.js
@@ -0,0 +1,290 @@
+const app = require("express")();
+const cors = require("cors");
+const mongo = require("mongodb").MongoClient;
+const ObjectId = require("mongodb").ObjectId;
+const PORT = 8080;
+const database = "mongodb://cloud_computing_project_db:27017/";
+let traffic_lights_db;
+let sensors_db;
+let vehicles_db;
+
+
+mongo.connect(database, function(err, db) {
+ if(err) throw err;
+ traffic_lights_db = db.db("traffic_lights_db");
+ sensors_db = db.db("sensors_db");
+ vehicles_db = db.db("vehicles_db");
+})
+
+app.use(cors());
+
+app.listen(
+ PORT,
+ () => console.log("API up and running")
+);
+
+
+app.get("/:database/subscribe", (req, res) => {
+
+ if(req.params.database === "traffic_lights")
+ {
+ if(req.query.road === undefined)
+ {
+ res.status(404).send("Not found");
+ }
+ else
+ {
+ let obj = { road: +req.query.road, redLight: 1, orangeLight: 0, greenLight: 0 };
+
+ traffic_lights_db.collection("traffic_lights").insertOne(obj, function(err, result) {
+ if(err) throw err;
+ res.status(200).send(result);
+ });
+
+ }
+
+ }
+ else if(req.params.database === "sensors")
+ {
+ if(req.query.position === undefined)
+ {
+ res.status(404).send("Not found");
+ }
+ else
+ {
+ let obj = { position: +req.query.position, value: 0 };
+
+ sensors_db.collection("sensors").insertOne(obj, function(err, result) {
+ if(err) throw err;
+ res.status(200).send(result);
+ });
+ }
+ }
+ else if(req.params.database === "vehicles")
+ {
+ if(req.query.start === undefined || req.query.destination === undefined)
+ {
+ res.status(404).send("Not found");
+ }
+ else
+ {
+ let obj = { start: +req.query.start, destination: +req.query.destination, position: +req.query.start };
+
+ vehicles_db.collection("vehicles").insertOne(obj, function(err, result) {
+ if(err) throw err;
+ res.status(200).send(result);
+ });
+
+ }
+ }
+ else
+ {
+ res.status(404).send("Not found");
+ }
+
+});
+
+app.get("/:database/update", (req, res) => {
+
+ if(req.params.database === "traffic_lights")
+ {
+ if(req.query.road === undefined || req.query.redLight === undefined || req.query.orangeLight === undefined || req.query.greenLight === undefined)
+ {
+ res.status(404).send("Not found");
+ }
+ else
+ {
+ let query = { road: +req.query.road };
+ let values = { $set: { redLight: +req.query.redLight, orangeLight: +req.query.orangeLight, greenLight: +req.query.greenLight } };
+
+ traffic_lights_db.collection("traffic_lights").updateOne(query, values, function(err, result) {
+ if(err) throw err;
+ res.status(200).send(result);
+ });
+ }
+
+ }
+ else if(req.params.database === "sensors")
+ {
+ if(req.query.id === undefined || req.query.value === undefined)
+ {
+ res.status(404).send("Not found");
+ }
+ else
+ {
+ let objectId = new ObjectId(req.query.id);
+ let query = { _id: objectId };
+ let values = { $set: { value: +req.query.value } };
+
+ sensors_db.collection("sensors").updateOne(query, values, function(err, result) {
+ if(err) throw err;
+ res.status(200).send(result);
+ });
+ }
+ }
+ else if(req.params.database === "vehicles")
+ {
+ if(req.query.id === undefined || req.query.position === undefined)
+ {
+ res.status(404).send("Not found");
+ }
+ else
+ {
+ let objectId = new ObjectId(req.query.id);
+ let query = { _id: objectId };
+ let values = { $set: { position: +req.query.position } };
+
+ vehicles_db.collection("vehicles").updateOne(query, values, function(err, result) {
+ if(err) throw err;
+ res.status(200).send(result);
+ });
+
+ }
+ }
+ else
+ {
+ res.status(404).send("Not found");
+ }
+
+});
+
+app.get("/:database/read", (req, res) => {
+
+ if(req.params.database === "traffic_lights")
+ {
+ if(req.query.id === undefined)
+ {
+ traffic_lights_db.collection("traffic_lights").find({}).toArray(function(err, result) {
+ if(err) throw err;
+ res.status(200).send(result);
+ });
+ }
+ else
+ {
+ let objectId = new ObjectId(req.query.id);
+ let query = { _id: objectId };
+
+ traffic_lights_db.collection("traffic_lights").findOne(query, function(err, result) {
+ if(err) throw err;
+ res.status(200).send(result);
+ });
+ }
+ }
+ else if(req.params.database === "sensors")
+ {
+ sensors_db.collection("sensors").find({}).toArray(function(err, result) {
+ if(err) throw err;
+ res.status(200).send(result);
+ });
+ }
+ else if(req.params.database === "vehicles")
+ {
+ vehicles_db.collection("vehicles").find({}).toArray(function(err, result) {
+ if(err) throw err;
+ res.status(200).send(result);
+ });
+ }
+ else
+ {
+ res.status(404).send("Not found");
+ }
+
+});
+
+app.get("/:database/discover", (req, res) => {
+
+ if(req.params.database === "vehicles")
+ {
+ if(req.query.position === undefined)
+ {
+ res.status(404).send("Not found");
+ }
+ else
+ {
+ rangeStart = req.query.position - 8;
+ rangeEnd = +req.query.position;
+
+ let query = { position: { $gte: rangeStart, $lte: rangeEnd} };
+
+ vehicles_db.collection("vehicles").findOne(query, function(err, result) {
+ if(err) throw err;
+ res.status(200).send(result);
+ });
+
+ }
+ }
+ else
+ {
+ res.status(404).send("Not found");
+ }
+});
+
+app.get("/:database/look", (req, res) => {
+
+ if(req.params.database === "traffic_lights")
+ {
+ if(req.query.road === undefined)
+ {
+ res.status(404).send("Not found");
+ }
+ else
+ {
+ let query = { road: +req.query.road};
+
+ traffic_lights_db.collection("traffic_lights").findOne(query, function(err, result) {
+ if(err) throw err;
+ res.status(200).send(result);
+ });
+ }
+ }
+ else if(req.params.database === "vehicles")
+ {
+ if(req.query.position === undefined)
+ {
+ res.status(404).send("Not found");
+ }
+ else
+ {
+ rangeStart = +req.query.position;
+ rangeEnd = +req.query.position + 11;
+
+ let query = { position: { $gt: rangeStart, $lte: rangeEnd} };
+
+ vehicles_db.collection("vehicles").findOne(query, function(err, result) {
+ if(err) throw err;
+ res.status(200).send(result);
+ });
+
+ }
+ }
+ else
+ {
+ res.status(404).send("Not found");
+ }
+});
+
+app.get("/:database/delete", (req, res) => {
+
+ if(req.params.database === "vehicles")
+ {
+ if(req.query.id === undefined)
+ {
+ res.status(404).send("Not found");
+ }
+ else
+ {
+ let objectId = new ObjectId(req.query.id);
+ let query = { _id: objectId };
+
+ vehicles_db.collection("vehicles").deleteOne(query, function(err, result) {
+ if(err) throw err;
+ res.status(200).send(result);
+ });
+
+ }
+ }
+ else
+ {
+ res.status(404).send("Not found");
+ }
+});
diff --git a/coordinator/Dockerfile b/coordinator/Dockerfile
new file mode 100644
index 0000000..ccd3771
--- /dev/null
+++ b/coordinator/Dockerfile
@@ -0,0 +1,8 @@
+
+FROM python:3-alpine
+
+WORKDIR /app/src
+
+RUN pip install requests
+
+COPY ["coordinator/src", "./"]
diff --git a/coordinator/src/coordinator.py b/coordinator/src/coordinator.py
new file mode 100644
index 0000000..b67f221
--- /dev/null
+++ b/coordinator/src/coordinator.py
@@ -0,0 +1,133 @@
+import requests
+import time
+import json
+
+
+class Lane:
+ def __init__(self, ID):
+ self.ID = ID
+ self.weight = 0
+ self.waitTime = 0
+ #self.serviceTime = 20
+ self.serviceTime = 40
+ self.trafficLightState = 0
+ self.timer = -1
+
+Lanes = [Lane(11000), Lane(21000), Lane(31000), Lane(41000), Lane(12000), Lane(22000), Lane(32000), Lane(42000)]
+
+secondSelections = [[4, 1, 6], [5, 0, 7], [6, 3, 5], [7, 2, 4], [0, 5, 3], [1, 4, 2], [2, 7, 0], [3, 6, 1]]
+
+
+while True:
+
+ res = requests.get("http://cloud_computing_project_api:8080/sensors/read")
+
+ sensorValues = json.loads(res.text)
+
+ sum = [0, 0, 0, 0, 0, 0, 0, 0]
+
+ firstPriority = 0
+ secondPriority = 0
+ firstPrioritySet = False
+ secondPrioritySet = False
+
+ for i in range(8):
+ for j in range(5):
+ sum[i] += sensorValues[i*5+j]["value"]
+
+ #Lanes[i].weight = sum[i] * (1 + Lanes[i].waitTime / 40 + 20 / Lanes[i].serviceTime)
+ Lanes[i].weight = sum[i] * (1 + Lanes[i].waitTime / 40 + 40 / Lanes[i].serviceTime)
+
+ if(Lanes[i].weight != 0):
+ firstPrioritySet = True
+
+ if(Lanes[i].weight > Lanes[firstPriority].weight):
+ firstPriority = i
+
+
+
+ if firstPrioritySet:
+ secondPriority = secondSelections[firstPriority][0]
+
+ if Lanes[secondPriority].weight != 0:
+ secondPrioritySet = True
+
+
+ for i in range(1, 3):
+ if Lanes[secondSelections[firstPriority][i]].weight > Lanes[secondPriority].weight:
+ secondPriority = secondSelections[firstPriority][i]
+ secondPrioritySet = True
+
+
+ for i in range(8):
+ if i != firstPriority and ((not secondPrioritySet) or i != secondPriority) and Lanes[i].trafficLightState == 2:
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=" + str(Lanes[i].ID) +"&redLight=0&orangeLight=1&greenLight=0")
+ Lanes[i].trafficLightState = 1
+ Lanes[i].timer = 12
+
+ elif Lanes[i].trafficLightState == 1 and Lanes[i].timer == 0:
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=" + str(Lanes[i].ID) +"&redLight=1&orangeLight=0&greenLight=0")
+ Lanes[i].trafficLightState = 0
+ Lanes[i].timer = -1
+
+
+
+ orangeLightIndex = -1
+ orangeLightCounter = 0
+
+ for i in range(8):
+ if Lanes[i].trafficLightState == 1:
+ orangeLightIndex = i
+ orangeLightCounter += 1
+
+
+ valid = False
+ if orangeLightIndex != -1:
+ for i in range(3):
+ if secondSelections[orangeLightIndex][i] == firstPriority:
+ valid = True
+ break
+
+
+ if orangeLightCounter < 2 and Lanes[firstPriority].trafficLightState == 0 and (orangeLightIndex == -1 or valid):
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=" + str(Lanes[firstPriority].ID) +"&redLight=0&orangeLight=0&greenLight=1")
+ Lanes[firstPriority].trafficLightState = 2
+ Lanes[firstPriority].serviceTime = 1
+
+ if secondPrioritySet and orangeLightCounter < 1 and Lanes[secondPriority].trafficLightState == 0:
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=" + str(Lanes[secondPriority].ID) +"&redLight=0&orangeLight=0&greenLight=1")
+ Lanes[secondPriority].trafficLightState = 2
+ Lanes[secondPriority].serviceTime = 1
+
+
+ else:
+ for i in range(8):
+ if Lanes[i].trafficLightState == 2:
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=" + str(Lanes[i].ID) +"&redLight=0&orangeLight=1&greenLight=0")
+ Lanes[i].trafficLightState = 1
+ Lanes[i].timer = 12
+
+ elif Lanes[i].trafficLightState == 1 and Lanes[i].timer == 0:
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=" + str(Lanes[i].ID) +"&redLight=1&orangeLight=0&greenLight=0")
+ Lanes[i].trafficLightState = 0
+ Lanes[i].timer = -1
+
+
+ time.sleep(1)
+
+ for i in range(8):
+ if Lanes[i].trafficLightState == 0 and Lanes[i].weight != 0:
+ Lanes[i].waitTime += 1
+ #Lanes[i].serviceTime = 20
+ Lanes[i].serviceTime = 40
+ elif Lanes[i].trafficLightState == 2:
+ Lanes[i].waitTime = 0
+ Lanes[i].serviceTime += 1
+ else:
+ Lanes[i].waitTime = 0
+ #Lanes[i].serviceTime = 20
+ Lanes[i].serviceTime = 40
+
+
+ if Lanes[i].timer > 0:
+ Lanes[i].timer -= 1
diff --git a/coordinator/src/new_coordinator.py b/coordinator/src/new_coordinator.py
new file mode 100644
index 0000000..ab9acf8
--- /dev/null
+++ b/coordinator/src/new_coordinator.py
@@ -0,0 +1,236 @@
+import requests
+import time
+import json
+import os
+
+"""
+waitTime = [0, 0, 0, 0]
+serviceTime = [20, 20, 20, 20]
+trafficLightState = [0, 0, 0, 0]
+
+
+while True:
+ os.system("clear")
+ res = requests.get("http://cloud_computing_project_api:8080/sensors/read")
+
+ sensors = json.loads(res.text)
+
+ sum = [0, 0, 0, 0]
+ weight = [0, 0, 0, 0]
+
+ for i in range(4):
+ for j in range(5):
+ print(sensors[i*5+j]["value"])
+
+ for i in range(4):
+ for j in range(5):
+ sensorValue = sensors[i*5+j]["value"]
+ sum[i] += sensorValue
+
+ priority = 0
+ prioritySet = False
+ for i in range(4):
+ #weight[i] = sum[i] * (1 + waitTime[i] / 40 + 10 / serviceTime[i])
+ weight[i] = sum[i] * (1 + waitTime[i] / 40 + 20 / serviceTime[i])
+ if(weight[i] != 0):
+ prioritySet = True
+
+ if(weight[i] > weight[priority]):
+ priority = i
+
+ print("weight[" + str(i) + "]= " + str([weight[i]]))
+
+ if not prioritySet:
+ if trafficLightState[0] == 1 or trafficLightState[1] == 1:
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=11000&redLight=0&orangeLight=1&greenLight=0")
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=21000&redLight=0&orangeLight=1&greenLight=0")
+ time.sleep(6)
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=11000&redLight=1&orangeLight=0&greenLight=0")
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=21000&redLight=1&orangeLight=0&greenLight=0")
+ trafficLightState[0] = 0
+ trafficLightState[1] = 0
+
+ elif trafficLightState[2] == 1 or trafficLightState[3] == 1:
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=31000&redLight=0&orangeLight=1&greenLight=0")
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=41000&redLight=0&orangeLight=1&greenLight=0")
+ time.sleep(6)
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=31000&redLight=1&orangeLight=0&greenLight=0")
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=41000&redLight=1&orangeLight=0&greenLight=0")
+ trafficLightState[2] = 0
+ trafficLightState[3] = 0
+
+ elif priority == 0 or priority == 1:
+ if trafficLightState[2] == 1 or trafficLightState[3] == 1:
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=31000&redLight=0&orangeLight=1&greenLight=0")
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=41000&redLight=0&orangeLight=1&greenLight=0")
+ time.sleep(6)
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=31000&redLight=1&orangeLight=0&greenLight=0")
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=41000&redLight=1&orangeLight=0&greenLight=0")
+ trafficLightState[2] = 0
+ trafficLightState[3] = 0
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=11000&redLight=0&orangeLight=0&greenLight=1")
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=21000&redLight=0&orangeLight=0&greenLight=1")
+ trafficLightState[0] = 1
+ trafficLightState[1] = 1
+ serviceTime[0] = 1
+ serviceTime[1] = 1
+
+ elif trafficLightState[0] == 0 or trafficLightState[1] == 0:
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=11000&redLight=0&orangeLight=0&greenLight=1")
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=21000&redLight=0&orangeLight=0&greenLight=1")
+ trafficLightState[0] = 1
+ trafficLightState[1] = 1
+ serviceTime[0] = 1
+ serviceTime[1] = 1
+
+ elif priority == 2 or priority == 3:
+ if trafficLightState[0] == 1 or trafficLightState[1] == 1:
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=11000&redLight=0&orangeLight=1&greenLight=0")
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=21000&redLight=0&orangeLight=1&greenLight=0")
+ time.sleep(6)
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=11000&redLight=1&orangeLight=0&greenLight=0")
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=21000&redLight=1&orangeLight=0&greenLight=0")
+ trafficLightState[0] = 0
+ trafficLightState[1] = 0
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=31000&redLight=0&orangeLight=0&greenLight=1")
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=41000&redLight=0&orangeLight=0&greenLight=1")
+ trafficLightState[2] = 1
+ trafficLightState[3] = 1
+ serviceTime[2] = 1
+ serviceTime[3] = 1
+
+ elif trafficLightState[2] == 0 or trafficLightState[3] == 0:
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=31000&redLight=0&orangeLight=0&greenLight=1")
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=41000&redLight=0&orangeLight=0&greenLight=1")
+ trafficLightState[2] = 1
+ trafficLightState[3] = 1
+ serviceTime[2] = 1
+ serviceTime[3] = 1
+
+
+
+ time.sleep(1)
+
+ for i in range(4):
+ if trafficLightState[i] == 0 and weight != 0:
+ waitTime[i] += 1
+ serviceTime[i] = 20
+ elif trafficLightState[i] == 1:
+ waitTime[i] = 0
+ serviceTime[i] += 1
+ else:
+ waitTime[i] = 0
+ serviceTime[i] = 20
+"""
+
+
+
+class Lane:
+ def __init__(self, ID):
+ self.ID = ID
+ self.weight = 0
+ self.waitTime = 0
+ self.serviceTime = 20
+ self.trafficLightState = 0
+
+Lanes = [Lane(11000), Lane(21000), Lane(31000), Lane(41000), Lane(12000), Lane(22000), Lane(32000), Lane(42000)]
+
+secondSelections = [[4, 1, 6], [5, 0, 7], [6, 3, 5], [7, 2, 4], [0, 5, 3], [1, 4, 2], [2, 7, 0], [3, 6, 1]]
+
+while True:
+ os.system("clear")
+ res = requests.get("http://cloud_computing_project_api:8080/sensors/read")
+
+ sensorValues = json.loads(res.text)
+
+ sum = [0, 0, 0, 0, 0, 0, 0, 0]
+
+ for i in range(8):
+ for j in range(5):
+ #print(sensorValues[i*5+j]["value"])
+ sum[i] += sensorValues[i*5+j]["value"]
+ print("")
+
+
+ firstPriority = 0
+ secondPriority = 0
+ firstPrioritySet = False
+ secondPrioritySet = False
+ togglingOrangeLight = False
+
+ for i in range(8):
+ Lanes[i].weight = sum[i] * (1 + Lanes[i].waitTime / 40 + 20 / Lanes[i].serviceTime)
+ if(Lanes[i].weight != 0):
+ firstPrioritySet = True
+
+ if(Lanes[i].weight > Lanes[firstPriority].weight):
+ firstPriority = i
+
+ print("weight[" + str(i) + "]= " + str(Lanes[i].weight))
+
+ if firstPrioritySet:
+ secondPriority = secondSelections[firstPriority][0]
+
+ if Lanes[secondPriority].weight != 0:
+ secondPrioritySet = True
+
+
+ for i in range(1, 3):
+ if Lanes[secondSelections[firstPriority][i]].weight > Lanes[secondPriority].weight:
+ secondPriority = secondSelections[firstPriority][i]
+ secondPrioritySet = True
+
+
+ for i in range(8):
+ if i != firstPriority and ((not secondPrioritySet) or i != secondPriority) and Lanes[i].trafficLightState == 1:
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=" + str(Lanes[i].ID) +"&redLight=0&orangeLight=1&greenLight=0")
+ togglingOrangeLight = True
+
+ if togglingOrangeLight:
+ #time.sleep(6)
+ time.sleep(12)
+
+ for i in range(8):
+ if i != firstPriority and ((not secondPrioritySet) or i != secondPriority) and Lanes[i].trafficLightState == 1:
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=" + str(Lanes[i].ID) +"&redLight=1&orangeLight=0&greenLight=0")
+ Lanes[i].trafficLightState = 0
+
+
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=" + str(Lanes[firstPriority].ID) +"&redLight=0&orangeLight=0&greenLight=1")
+ Lanes[firstPriority].trafficLightState = 1
+ Lanes[firstPriority].serviceTime = 1
+
+ if secondPrioritySet:
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=" + str(Lanes[secondPriority].ID) +"&redLight=0&orangeLight=0&greenLight=1")
+ Lanes[secondPriority].trafficLightState = 1
+ Lanes[secondPriority].serviceTime = 1
+
+
+ else:
+ for i in range(8):
+ if Lanes[i].trafficLightState == 1:
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=" + str(Lanes[i].ID) +"&redLight=0&orangeLight=1&greenLight=0")
+ togglingOrangeLight = True
+
+ if togglingOrangeLight:
+ #time.sleep(6)
+ time.sleep(12)
+
+ for i in range(8):
+ if Lanes[i].trafficLightState == 1:
+ requests.get("http://cloud_computing_project_api:8080/traffic_lights/update?road=" + str(Lanes[i].ID) +"&redLight=1&orangeLight=0&greenLight=0")
+ Lanes[i].trafficLightState = 0
+
+
+ time.sleep(1)
+
+ for i in range(8):
+ if Lanes[i].trafficLightState == 0 and Lanes[i].weight != 0:
+ Lanes[i].waitTime += 1
+ Lanes[i].serviceTime = 20
+ elif Lanes[i].trafficLightState == 1:
+ Lanes[i].waitTime = 0
+ Lanes[i].serviceTime += 1
+ else:
+ Lanes[i].waitTime = 0
+ Lanes[i].serviceTime = 20
diff --git a/entry_handler/package.json b/entry_handler/package.json
new file mode 100644
index 0000000..eb29778
--- /dev/null
+++ b/entry_handler/package.json
@@ -0,0 +1,6 @@
+{
+ "dependencies": {
+ "cors": "^2.8.5",
+ "express": "^4.18.2"
+ }
+}
diff --git a/entry_handler/src/index.js b/entry_handler/src/index.js
new file mode 100644
index 0000000..9a797c8
--- /dev/null
+++ b/entry_handler/src/index.js
@@ -0,0 +1,39 @@
+const app = require("express")();
+const cors = require("cors");
+const { exec } = require("child_process");
+const PORT = 8082;
+let vehicleNumber = 0;
+
+app.use(cors());
+
+app.listen(
+ PORT,
+ () => console.log("Entry handler up and running")
+);
+
+app.get("/insert", (req, res) => {
+
+ if(req.query.start === undefined || req.query.destination === undefined)
+ {
+ res.status(404).send("Not found");
+ }
+ else
+ {
+ vehicleNumber++;
+ let command = "docker run -d --network cloud_computing_project --name vehicle" + vehicleNumber + " cloud_computing_project_vehicle python vehicle.py " + req.query.start + " " + req.query.destination;
+
+ exec(command, (err, stdout, stderr) => {
+ let id = stdout.substring(0, stdout.length - 1);
+ console.log("New container created with id " + id + ". Vehicle number " + vehicleNumber + " with start " + req.query.start + " and destination " + req.query.destination);
+ console.log(stderr);
+ if(err != null)
+ {
+ console.log(err);
+ }
+ });
+
+ res.status(200).send("Ok");
+
+ }
+
+});
\ No newline at end of file
diff --git a/sensors/Dockerfile b/sensors/Dockerfile
new file mode 100644
index 0000000..7c76c76
--- /dev/null
+++ b/sensors/Dockerfile
@@ -0,0 +1,8 @@
+
+FROM python:3-alpine
+
+WORKDIR /app/src
+
+RUN pip install requests
+
+COPY ["sensors/src", "./"]
diff --git a/sensors/src/sensor.py b/sensors/src/sensor.py
new file mode 100644
index 0000000..cb5ebea
--- /dev/null
+++ b/sensors/src/sensor.py
@@ -0,0 +1,24 @@
+import requests
+import time
+import json
+import sys
+
+position = int(sys.argv[1])
+
+value = 0
+
+res = requests.get("http://cloud_computing_project_api:8080/sensors/subscribe?position=" + str(position))
+
+ID = json.loads(res.text)["insertedId"]
+
+while True:
+ res = requests.get("http://cloud_computing_project_api:8080/vehicles/discover?position=" + str(position))
+
+ if res.text != "" and value == 0:
+ value = 1
+ res = requests.get("http://cloud_computing_project_api:8080/sensors/update?id=" + str(ID) + "&value=1")
+ elif res.text == "" and value == 1:
+ value = 0
+ res = requests.get("http://cloud_computing_project_api:8080/sensors/update?id=" + str(ID) + "&value=0")
+
+ time.sleep(0.1)
\ No newline at end of file
diff --git a/start.sh b/start.sh
new file mode 100755
index 0000000..d062ff6
--- /dev/null
+++ b/start.sh
@@ -0,0 +1,122 @@
+#!/bin/bash
+
+if ! [ $(docker image ls | grep cloud_computing_project_api | cut -d ' ' -f 1) ]
+then
+ docker build -f api/Dockerfile -t cloud_computing_project_api .
+fi
+
+if ! [ $(docker image ls | grep cloud_computing_project_traffic_light | cut -d ' ' -f 1) ]
+then
+ docker build -f traffic_lights/Dockerfile -t cloud_computing_project_traffic_light .
+fi
+
+if ! [ $(docker image ls | grep cloud_computing_project_sensor | cut -d ' ' -f 1) ]
+then
+ docker build -f sensors/Dockerfile -t cloud_computing_project_sensor .
+fi
+
+if ! [ $(docker image ls | grep cloud_computing_project_vehicle | cut -d ' ' -f 1) ]
+then
+ docker build -f vehicles/Dockerfile -t cloud_computing_project_vehicle .
+fi
+
+if ! [ $(docker image ls | grep cloud_computing_project_coordinator | cut -d ' ' -f 1) ]
+then
+ docker build -f coordinator/Dockerfile -t cloud_computing_project_coordinator .
+fi
+
+if ! [ $(docker image ls | grep cloud_computing_project_web_server | cut -d ' ' -f 1) ]
+then
+ docker build -f web_server/Dockerfile -t cloud_computing_project_web_server .
+fi
+
+
+if ! [ $(docker network ls | grep cloud_computing_project | cut -d ' ' -f 1) ]
+then
+ docker network create cloud_computing_project
+fi
+
+
+docker run -d --network cloud_computing_project --network-alias cloud_computing_project_db --name cloud_computing_project_db mongo:4.4
+
+docker run -dp 8081:8080 --network cloud_computing_project --network-alias cloud_computing_project_api cloud_computing_project_api
+
+docker run -d --network cloud_computing_project cloud_computing_project_traffic_light python traffic_light.py 11000
+docker run -d --network cloud_computing_project cloud_computing_project_traffic_light python traffic_light.py 21000
+docker run -d --network cloud_computing_project cloud_computing_project_traffic_light python traffic_light.py 31000
+docker run -d --network cloud_computing_project cloud_computing_project_traffic_light python traffic_light.py 41000
+
+docker run -d --network cloud_computing_project cloud_computing_project_traffic_light python traffic_light.py 12000
+docker run -d --network cloud_computing_project cloud_computing_project_traffic_light python traffic_light.py 22000
+docker run -d --network cloud_computing_project cloud_computing_project_traffic_light python traffic_light.py 32000
+docker run -d --network cloud_computing_project cloud_computing_project_traffic_light python traffic_light.py 42000
+
+
+
+
+
+docker run -d --network cloud_computing_project --name sensor1_1_1 cloud_computing_project_sensor python sensor.py 11008
+docker run -d --network cloud_computing_project --name sensor1_1_2 cloud_computing_project_sensor python sensor.py 11017
+docker run -d --network cloud_computing_project --name sensor1_1_3 cloud_computing_project_sensor python sensor.py 11026
+docker run -d --network cloud_computing_project --name sensor1_1_4 cloud_computing_project_sensor python sensor.py 11035
+docker run -d --network cloud_computing_project --name sensor1_1_5 cloud_computing_project_sensor python sensor.py 11044
+
+docker run -d --network cloud_computing_project --name sensor2_1_1 cloud_computing_project_sensor python sensor.py 21008
+docker run -d --network cloud_computing_project --name sensor2_1_2 cloud_computing_project_sensor python sensor.py 21017
+docker run -d --network cloud_computing_project --name sensor2_1_3 cloud_computing_project_sensor python sensor.py 21026
+docker run -d --network cloud_computing_project --name sensor2_1_4 cloud_computing_project_sensor python sensor.py 21035
+docker run -d --network cloud_computing_project --name sensor2_1_5 cloud_computing_project_sensor python sensor.py 21044
+
+docker run -d --network cloud_computing_project --name sensor3_1_1 cloud_computing_project_sensor python sensor.py 31008
+docker run -d --network cloud_computing_project --name sensor3_1_2 cloud_computing_project_sensor python sensor.py 31017
+docker run -d --network cloud_computing_project --name sensor3_1_3 cloud_computing_project_sensor python sensor.py 31026
+docker run -d --network cloud_computing_project --name sensor3_1_4 cloud_computing_project_sensor python sensor.py 31035
+docker run -d --network cloud_computing_project --name sensor3_1_5 cloud_computing_project_sensor python sensor.py 31044
+
+docker run -d --network cloud_computing_project --name sensor4_1_1 cloud_computing_project_sensor python sensor.py 41008
+docker run -d --network cloud_computing_project --name sensor4_1_2 cloud_computing_project_sensor python sensor.py 41017
+docker run -d --network cloud_computing_project --name sensor4_1_3 cloud_computing_project_sensor python sensor.py 41026
+docker run -d --network cloud_computing_project --name sensor4_1_4 cloud_computing_project_sensor python sensor.py 41035
+docker run -d --network cloud_computing_project --name sensor4_1_5 cloud_computing_project_sensor python sensor.py 41044
+
+
+
+
+
+
+docker run -d --network cloud_computing_project --name sensor1_2_1 cloud_computing_project_sensor python sensor.py 12008
+docker run -d --network cloud_computing_project --name sensor1_2_2 cloud_computing_project_sensor python sensor.py 12017
+docker run -d --network cloud_computing_project --name sensor1_2_3 cloud_computing_project_sensor python sensor.py 12026
+docker run -d --network cloud_computing_project --name sensor1_2_4 cloud_computing_project_sensor python sensor.py 12035
+docker run -d --network cloud_computing_project --name sensor1_2_5 cloud_computing_project_sensor python sensor.py 12044
+
+docker run -d --network cloud_computing_project --name sensor2_2_1 cloud_computing_project_sensor python sensor.py 22008
+docker run -d --network cloud_computing_project --name sensor2_2_2 cloud_computing_project_sensor python sensor.py 22017
+docker run -d --network cloud_computing_project --name sensor2_2_3 cloud_computing_project_sensor python sensor.py 22026
+docker run -d --network cloud_computing_project --name sensor2_2_4 cloud_computing_project_sensor python sensor.py 22035
+docker run -d --network cloud_computing_project --name sensor2_2_5 cloud_computing_project_sensor python sensor.py 22044
+
+docker run -d --network cloud_computing_project --name sensor3_2_1 cloud_computing_project_sensor python sensor.py 32008
+docker run -d --network cloud_computing_project --name sensor3_2_2 cloud_computing_project_sensor python sensor.py 32017
+docker run -d --network cloud_computing_project --name sensor3_2_3 cloud_computing_project_sensor python sensor.py 32026
+docker run -d --network cloud_computing_project --name sensor3_2_4 cloud_computing_project_sensor python sensor.py 32035
+docker run -d --network cloud_computing_project --name sensor3_2_5 cloud_computing_project_sensor python sensor.py 32044
+
+docker run -d --network cloud_computing_project --name sensor4_2_1 cloud_computing_project_sensor python sensor.py 42008
+docker run -d --network cloud_computing_project --name sensor4_2_2 cloud_computing_project_sensor python sensor.py 42017
+docker run -d --network cloud_computing_project --name sensor4_2_3 cloud_computing_project_sensor python sensor.py 42026
+docker run -d --network cloud_computing_project --name sensor4_2_4 cloud_computing_project_sensor python sensor.py 42035
+docker run -d --network cloud_computing_project --name sensor4_2_5 cloud_computing_project_sensor python sensor.py 42044
+
+
+
+docker run -d --network cloud_computing_project --name coordinator cloud_computing_project_coordinator python coordinator.py
+
+
+docker run -dp 8080:80 --network cloud_computing_project --name web_server cloud_computing_project_web_server
+
+
+cd entry_handler
+npm install
+cd src
+node .
\ No newline at end of file
diff --git a/stop.sh b/stop.sh
new file mode 100755
index 0000000..4b68c44
--- /dev/null
+++ b/stop.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+docker stop $(docker ps | grep cloud_computing_project | cut -d ' ' -f 1)
+docker rm $(docker ps -a | grep cloud_computing_project | cut -d ' ' -f 1)
\ No newline at end of file
diff --git a/traffic_lights/Dockerfile b/traffic_lights/Dockerfile
new file mode 100644
index 0000000..0bddd88
--- /dev/null
+++ b/traffic_lights/Dockerfile
@@ -0,0 +1,8 @@
+
+FROM python:3-alpine
+
+WORKDIR /app/src
+
+RUN pip install requests
+
+COPY ["traffic_lights/src", "./"]
diff --git a/traffic_lights/src/traffic_light.py b/traffic_lights/src/traffic_light.py
new file mode 100644
index 0000000..e4a7578
--- /dev/null
+++ b/traffic_lights/src/traffic_light.py
@@ -0,0 +1,15 @@
+import requests
+import time
+import json
+import sys
+
+road = int(sys.argv[1])
+
+res = requests.get("http://cloud_computing_project_api:8080/traffic_lights/subscribe?road=" + str(road))
+
+ID = json.loads(res.text)["insertedId"]
+
+while True:
+ res = requests.get("http://cloud_computing_project_api:8080/traffic_lights/read?id=" + str(ID))
+
+ time.sleep(1)
diff --git a/vehicles/Dockerfile b/vehicles/Dockerfile
new file mode 100644
index 0000000..6f7cd8a
--- /dev/null
+++ b/vehicles/Dockerfile
@@ -0,0 +1,8 @@
+
+FROM python:3-alpine
+
+WORKDIR /app/src
+
+RUN pip install requests
+
+COPY ["vehicles/src", "./"]
diff --git a/vehicles/src/vehicle.py b/vehicles/src/vehicle.py
new file mode 100644
index 0000000..f81d46e
--- /dev/null
+++ b/vehicles/src/vehicle.py
@@ -0,0 +1,66 @@
+import requests
+import time
+import json
+import sys
+
+start = int(sys.argv[1])
+destination = int(sys.argv[2])
+position = start
+road = start
+route = (start % 10000) / 1000
+
+res = requests.get("http://cloud_computing_project_api:8080/vehicles/subscribe?start=" + str(start) + "&destination=" + str(destination))
+
+ID = json.loads(res.text)["insertedId"]
+
+while position != destination:
+
+ res = requests.get("http://cloud_computing_project_api:8080/vehicles/look?position=" + str(position))
+
+ if res.text == "":
+
+ if route == 1:
+ if position > (start + 44):
+ position += 1
+ requests.get("http://cloud_computing_project_api:8080/vehicles/update?id=" + str(ID) + "&position=" + str(position))
+
+ else:
+ res = requests.get("http://cloud_computing_project_api:8080/traffic_lights/look?road=" + str(road))
+ greenLight = json.loads(res.text)["greenLight"]
+
+ if greenLight == 1 or position < (start + 44):
+ position += 1
+ requests.get("http://cloud_computing_project_api:8080/vehicles/update?id=" + str(ID) + "&position=" + str(position))
+
+
+ elif route == 2:
+ if position > (start + 44):
+ if position == (start + 85):
+ position = destination - 71
+ else:
+ position += 1
+
+ requests.get("http://cloud_computing_project_api:8080/vehicles/update?id=" + str(ID) + "&position=" + str(position))
+
+ else:
+ res = requests.get("http://cloud_computing_project_api:8080/traffic_lights/look?road=" + str(road))
+ greenLight = json.loads(res.text)["greenLight"]
+
+ if greenLight == 1 or position < (start + 44):
+ position += 1
+ requests.get("http://cloud_computing_project_api:8080/vehicles/update?id=" + str(ID) + "&position=" + str(position))
+
+
+ elif(route == 3):
+ if position == (start + 56):
+ position = destination - 60
+ else:
+ position += 1
+
+ requests.get("http://cloud_computing_project_api:8080/vehicles/update?id=" + str(ID) + "&position=" + str(position))
+
+
+
+ time.sleep(0.2)
+
+requests.get("http://cloud_computing_project_api:8080/vehicles/delete?id=" + str(ID))
\ No newline at end of file
diff --git a/web_server/Dockerfile b/web_server/Dockerfile
new file mode 100644
index 0000000..5d56118
--- /dev/null
+++ b/web_server/Dockerfile
@@ -0,0 +1,4 @@
+
+FROM nginx:1.25-alpine
+
+COPY ["web_server/src", "/usr/share/nginx/html"]
\ No newline at end of file
diff --git a/web_server/src/images/street.png b/web_server/src/images/street.png
new file mode 100644
index 0000000..0301c83
Binary files /dev/null and b/web_server/src/images/street.png differ
diff --git a/web_server/src/images/vehicle1.png b/web_server/src/images/vehicle1.png
new file mode 100644
index 0000000..1c00cf9
Binary files /dev/null and b/web_server/src/images/vehicle1.png differ
diff --git a/web_server/src/images/vehicle10.png b/web_server/src/images/vehicle10.png
new file mode 100644
index 0000000..be97b5d
Binary files /dev/null and b/web_server/src/images/vehicle10.png differ
diff --git a/web_server/src/images/vehicle11.png b/web_server/src/images/vehicle11.png
new file mode 100644
index 0000000..16bd287
Binary files /dev/null and b/web_server/src/images/vehicle11.png differ
diff --git a/web_server/src/images/vehicle12.png b/web_server/src/images/vehicle12.png
new file mode 100644
index 0000000..d0790bf
Binary files /dev/null and b/web_server/src/images/vehicle12.png differ
diff --git a/web_server/src/images/vehicle13.png b/web_server/src/images/vehicle13.png
new file mode 100644
index 0000000..eca3ee6
Binary files /dev/null and b/web_server/src/images/vehicle13.png differ
diff --git a/web_server/src/images/vehicle14.png b/web_server/src/images/vehicle14.png
new file mode 100644
index 0000000..e286b3c
Binary files /dev/null and b/web_server/src/images/vehicle14.png differ
diff --git a/web_server/src/images/vehicle15.png b/web_server/src/images/vehicle15.png
new file mode 100644
index 0000000..7e8163c
Binary files /dev/null and b/web_server/src/images/vehicle15.png differ
diff --git a/web_server/src/images/vehicle16.png b/web_server/src/images/vehicle16.png
new file mode 100644
index 0000000..055d954
Binary files /dev/null and b/web_server/src/images/vehicle16.png differ
diff --git a/web_server/src/images/vehicle17.png b/web_server/src/images/vehicle17.png
new file mode 100644
index 0000000..91cedec
Binary files /dev/null and b/web_server/src/images/vehicle17.png differ
diff --git a/web_server/src/images/vehicle18.png b/web_server/src/images/vehicle18.png
new file mode 100644
index 0000000..329e68d
Binary files /dev/null and b/web_server/src/images/vehicle18.png differ
diff --git a/web_server/src/images/vehicle19.png b/web_server/src/images/vehicle19.png
new file mode 100644
index 0000000..87ab685
Binary files /dev/null and b/web_server/src/images/vehicle19.png differ
diff --git a/web_server/src/images/vehicle2.png b/web_server/src/images/vehicle2.png
new file mode 100644
index 0000000..48df877
Binary files /dev/null and b/web_server/src/images/vehicle2.png differ
diff --git a/web_server/src/images/vehicle20.png b/web_server/src/images/vehicle20.png
new file mode 100644
index 0000000..4c049ec
Binary files /dev/null and b/web_server/src/images/vehicle20.png differ
diff --git a/web_server/src/images/vehicle21.png b/web_server/src/images/vehicle21.png
new file mode 100644
index 0000000..7773eec
Binary files /dev/null and b/web_server/src/images/vehicle21.png differ
diff --git a/web_server/src/images/vehicle22.png b/web_server/src/images/vehicle22.png
new file mode 100644
index 0000000..b8ac024
Binary files /dev/null and b/web_server/src/images/vehicle22.png differ
diff --git a/web_server/src/images/vehicle23.png b/web_server/src/images/vehicle23.png
new file mode 100644
index 0000000..d3f5350
Binary files /dev/null and b/web_server/src/images/vehicle23.png differ
diff --git a/web_server/src/images/vehicle24.png b/web_server/src/images/vehicle24.png
new file mode 100644
index 0000000..be3a6b5
Binary files /dev/null and b/web_server/src/images/vehicle24.png differ
diff --git a/web_server/src/images/vehicle3.png b/web_server/src/images/vehicle3.png
new file mode 100644
index 0000000..f88f708
Binary files /dev/null and b/web_server/src/images/vehicle3.png differ
diff --git a/web_server/src/images/vehicle4.png b/web_server/src/images/vehicle4.png
new file mode 100644
index 0000000..91ae0c5
Binary files /dev/null and b/web_server/src/images/vehicle4.png differ
diff --git a/web_server/src/images/vehicle5.png b/web_server/src/images/vehicle5.png
new file mode 100644
index 0000000..faba073
Binary files /dev/null and b/web_server/src/images/vehicle5.png differ
diff --git a/web_server/src/images/vehicle6.png b/web_server/src/images/vehicle6.png
new file mode 100644
index 0000000..dcf0c21
Binary files /dev/null and b/web_server/src/images/vehicle6.png differ
diff --git a/web_server/src/images/vehicle7.png b/web_server/src/images/vehicle7.png
new file mode 100644
index 0000000..5ca5a06
Binary files /dev/null and b/web_server/src/images/vehicle7.png differ
diff --git a/web_server/src/images/vehicle8.png b/web_server/src/images/vehicle8.png
new file mode 100644
index 0000000..80a87e4
Binary files /dev/null and b/web_server/src/images/vehicle8.png differ
diff --git a/web_server/src/images/vehicle9.png b/web_server/src/images/vehicle9.png
new file mode 100644
index 0000000..c3da7cb
Binary files /dev/null and b/web_server/src/images/vehicle9.png differ
diff --git a/web_server/src/index.css b/web_server/src/index.css
new file mode 100644
index 0000000..571001d
--- /dev/null
+++ b/web_server/src/index.css
@@ -0,0 +1,156 @@
+body {
+ background-image: url("images/street.png");
+ background-size: cover;
+}
+
+#prompt {
+ position: fixed;
+ left: 280px;
+ top: 50px;
+
+}
+
+#route {
+ position: fixed;
+ left: 245px;
+ top: 120px;
+}
+
+
+div {
+ border: 5px solid black;
+ width: 30px;
+ /*position: absolute;*/
+ position: fixed;
+ display: inline-block;
+ background-color: black;
+}
+
+#trafficLight1 {
+ /*left: 39%;
+ top: 59%;*/
+ left: 689px;
+ top: 692px;
+ width: 90px;
+}
+
+#trafficLight2 {
+ /*left: 56%;
+ top: 33%;*/
+ left: 1130px;
+ top: 240px;
+ width: 90px;
+}
+
+#trafficLight3 {
+ /*left: 42%;
+ top: 28%;*/
+ left: 707px;
+ top: 226px;
+}
+
+#trafficLight4 {
+ /*left: 56%;
+ top: 59%;*/
+ left: 1172px;
+ top: 655px;
+}
+
+#trafficLight5 {
+ /*left: 39%;
+ top: 59%;*/
+ left: 689px;
+ top: 655px;
+ width: 90px;
+}
+
+#trafficLight6 {
+ /*left: 56%;
+ top: 33%;*/
+ left: 1130px;
+ top: 278px;
+ width: 90px;
+}
+
+#trafficLight7 {
+ /*left: 42%;
+ top: 28%;*/
+ left: 749px;
+ top: 226px;
+}
+
+#trafficLight8 {
+ /*left: 56%;
+ top: 59%;*/
+ left: 1130px;
+ top: 655px;
+}
+
+#trafficLight9 {
+ /*left: 39%;
+ top: 59%;*/
+ left: 689px;
+ top: 730px;
+ width: 90px;
+}
+
+#trafficLight10 {
+ /*left: 56%;
+ top: 33%;*/
+ left: 1130px;
+ top: 203px;
+ width: 90px;
+}
+
+#trafficLight11 {
+ /*left: 42%;
+ top: 28%;*/
+ left: 665px;
+ top: 226px;
+}
+
+#trafficLight12 {
+ /*left: 56%;
+ top: 59%;*/
+ left: 1214px;
+ top: 655px;
+}
+
+button {
+ border-radius: 80%;
+ height: 25px;
+ width: 25px;
+ display: inline-block;
+ position: relative;
+ /*left: 8%;*/
+ left: 4%;
+}
+
+#trafficLight3 button, #trafficLight4 button, #trafficLight7 button, #trafficLight8 button, #trafficLight11 button {
+ left: 9%;
+}
+
+
+.trafficLights {
+ border: 2px solid grey;
+ background-color: grey;
+}
+
+#insert {
+ position: fixed;
+ border-radius: 10%;
+ height: 30px;
+ width: 160px;
+ left: 265px;
+ top: 160px;
+}
+
+
+.arrows {
+ color: grey;
+ font-size: 16px;
+}
+
+#orangeLight9 {
+ color: rgb(255, 115, 0);
+}
diff --git a/web_server/src/index.html b/web_server/src/index.html
new file mode 100644
index 0000000..1f84b36
--- /dev/null
+++ b/web_server/src/index.html
@@ -0,0 +1,91 @@
+
+
+