Skip to content
/ SOTA Public
generated from matbmoser/template

Repository of the Final Degree Project of Mathias Brunkow Moser, this repo has the main code for the Parking Time Optimization System. This project has received the best note and Honors for the 2022 UFV Promotion.

License

Notifications You must be signed in to change notification settings

matbmoser/SOTA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Tags Issues MIT License LinkedIn


Logo

Sistema de OptimizaciĂłn de Tiempo de Aparcamiento (SOTA)

Explore the docs »

View Demo · Report Bug · Request Feature

Description

NOTE: The system default lenguage is Spanish, because the project is for a University in Spain (Interfaces are in Spanish, system intern communication messages are in English. The docs are in English for easing the universal undertanding of the PTOS System, all over the world)

Parking Time Optimization System (PTOS)

PTOS or SOTA (in Spanish) is a Smart Parking integrated system that offers a safe live view to managers and users of a Smart Campus Parking Lot. The system is capable of handling the detection of a licence plate by a IP Camera at the entrance of a parking lot and asign to registered users a parking place with a unique ticket.

Users are able to interact with the system in a Web Aplication called UFV MyParking. There can to add vehicles that will be detected by the cameras in the parking lot entrance and exits. They are also able to visualize the parking lot capacity and status

Once a user enterers a ticket will be generated indicating the asigned parking place. This asigned place is the one that best suits the type of vehicle configured in the WebApp.

Table of Contents

Integrated Systems:


  1. Digital Twin (Parking Administration Platform and Simulator)

  2. DeviceManager (Simulated IP Cameras Manager Server)

  3. UFV MyParking WebApp (Vehicle and User Platform)



Digital Twin ScreenShot


Logo



UFV MyParking WebApp ScreenShot


Logo



Virtual Tickets


Logo




Important

If you want to deploy the system in your local machine, you must have a linux (unix) enviroment, we recommend the use of Git Bash to be able to execute the buildDocker.sh script and deploy the system into container using docker-compose

Built With

Technology arquitecture


Logo


(back to top)

Getting Started

You need to install Git or GitBash to be able to handle the scripts used by the system. Despite of that you will need to install Docker in your local machine. The system has the docker files configured and waiting for being mounted.

Prerequisites

For Windows

For the installation of the system you will need:

Install Git with Gitbash

https://gitforwindows.org/

NOTE: If you already have a virtualizated linux bash shell, like cygwin, please make sure you can execute .sh scripts.

Install Docker:

NOTE: Please check the system requirements to successfullu install docker

Use a Web Browser

Both Digital Twin and UFV MyParking systems make use of the browser to interact with the users. So make sure that you have a updated browser like Google Chrome, Firefox, Edge or Any Chromium Browser.

(back to top)

Deploying the App

1 - Start Docker Daemon

Here you will find more information about it:

https://docs.docker.com/desktop/windows/

NOTE:: In windows you just need to open the Docker Desktop App

2 - Clone this Repository

git clone https://github.com/matbmoser/SOTA.git

3 - Configure Credentials (Optional):

Configure the database credentials, default settings and default of the enviroment.

NOTE: The system is already configurated with default values, so is optional the configuration of credentials. If you are willing to modify parameters like the connection to the Database, here there is a description.

Digital Twin Global Configurations:

Go to:

 cd digital-twin/src/assets/mod/configs

NOTE: If you are unsafe about editing the configurations you can let them in their default values.

The directory contains two configuration files.

├───configs
    ├───config.php ## Global configurations
    └───db.config.php ## Database configurations

Device Manager Global Configurations

Go to:

 cd digital-twin/deviceManager/assets/mod/configs

Device Manager Scructure:

├───camera ## Camera Connection Files
│   └───socket ## Socket Camera Client Files
├───db ## Database files
│   ├───controllers ## Data Access Controllers
│   └───dbConfig.py #<HERE you can edit the DB Connection Settings>
├───docs ## Useful docs like SJMP protocol description
├───operators ## Encription Tools and Operators
├───protocols ## Comunication Protocols Handlers
├───server ## Server Files
└───globalConfig.py ##<HERE you can edit the global configurations> 

UFV MyParking Laravel Configurations

Go to:

 cd /webapp/src

Open the following file:

.env

Laravel unificates all the global configurations in only one enviroment file. To configurate the database parameters you can access the file and modify the following parameters:

DB_CONNECTION=mysql
DB_HOST=mysql # Indicate DB Server ip or hostname.
DB_PORT=3306 # DEFAULT: MySQL 3306
DB_DATABASE=sotadb ## The default database created is sotadb.
DB_USERNAME=<username> # DEFAULT: root
DB_PASSWORD=<password>

Docker Compose File

You can modify the docker compose file before building the app.

## --------------------------------------------------------------
# Parking Time Optimization System Configuration
# Author: Mathias Brunkow Moser 
# ©2022 - ALL RIGHTS RESERVED
## --------------------------------------------------------------

version: "3.9"

services:
  ## MySQL Database Configuration
  mysql:
    image: mysql
    container_name: mysql-bbdd
    environment:
      ## Database configuration
      MYSQL_DATABASE: "sotadb"
      
      MYSQL_USER: "dbadmin"
   
      MYSQL_PASSWORD: "GT9zEN(FdxSAmWiy"

      MYSQL_ROOT_PASSWORD: "s0t42022"
    ports:
      ## Port Configuration
      - "3306:3306"

    volumes:
      - ./data:/var/lib/mysql

  ## phpMyAdmin administrator configuration
  php-my-admin:
    image: phpmyadmin
    container_name: php-my-admin
    ports:
      - 7777:80
    environment:
      - PMA_HOST=mysql
    depends_on:
      - mysql

  ## UFV MyParking WebApp Configuration
  php-apache:
    container_name: php-webapp
    build:
      context: ./webapp
    environment:
      WEBAPP: "/var/www/webapp"
    ports:
      # Range of ports in production
      - "8080:80"
      ## Port range in Development
      - "3001:8001"
      - "3000:8000"
      - "3002:8002"
    volumes:
      ## Create volumes to save the configurations
      - ./webapp/src:/var/www/webapp
      - ./webapp/apache/default.conf:/etc/apache2/sites-enabled/000-default.conf
    depends_on:
      - mysql
    networks:
      ## Belongs to the internal network created
      - default
      - appNet

  ## Digital twin configuration
  digital-twin:
    container_name: digital-twin
    build:
      context: ./digital-twin
    environment:
      ## Configuration of default path variables
      DEVICE_MANAGER: "/usr/src/app"

      DIGITAL_TWIN: "/var/www/digital-twin"

    ports:
      ## Range of ports used.
      - "3333:80" # Access port to the digital twin.
      - "8888:8888" # Default device manager port.
      - "4050-4100:4050-4100" # Device manager port range.
    volumes:
      ## Volumes created to configure the environment
      - ./digital-twin/src:/var/www/digital-twin
      - ./digital-twin/php/php.ini-development:/usr/local/etc/php/php.ini-development
      - ./digital-twin/php/php.ini-production:/usr/local/etc/php/php.ini-production
      - ./digital-twin/deviceManager:/usr/src/app
      - ./digital-twin/apache/default.conf:/etc/apache2/sites-enabled/000-default.conf
    depends_on:
      - mysql
    networks:
      - default
      - appNet

## We create networks so that containers can communicate with each other.
networks:
  default: 
    driver: bridge
  appNet: 
    external: true

## The volumes used by the database will be stored in data.
volumes:
  data:

(back to top)

4- Build the App

NOTE: When you build the docker compose container enviroment, a new directory will be created, it will contain the persistent data from the system database.

  ./data

Execute Build Docker Script

The deployement from all the SOTA system is centralized in only one Bash Script.

For building the docker compose container enviroment run the following script.

 ./buildDocker.sh

ALERT: If you execute for the first time the script it will take some minutes.

The script will perform a series of actions to build the containers.

########## < buildDocker.sh >

## Set up internal network
docker network create appNet 

## Build Docker Compose <docker-compose.yml> file required
docker-compose up -d --build

## Give permits for Laravel to access the storage.
docker exec -it php-webapp chmod -R 777 storage 

## Install all the PHP Laravel packets
docker exec -it php-webapp composer install
## Install all JS Packets 
docker exec -it php-webapp npm install

## Wait 15 seconds for MySQL Server Container to startup 
sleep 15

## Execute the preconfigured database migration. 
docker exec -it php-webapp npm run migrate 

NOTE: This is a simplified version of buildDocker.sh, to show the main commands.

(back to top)

User Manual

Once the migrations are completed, the system is ready to go.

Access To Digital Twin

You can enter in the Digital Twin accessing the following url:

 http://localhost:3333

For safety reasons you will be redirected to a login page in /login:
Logo

Access Digital Twin Default Credentials

Introduce the following credentials to have access to the digital twin.


> Default Admin Credentials:

Email: [email protected]
Password: 789456123 # Default Password


> Default Manager Credentials:

Email: [email protected]
Password: 789456123 # Default Password


(back to top)

** You can configure more default users in "```./webapp/src/database/seeders/UserSeeder.php```" and after you need to run again "```./buildDocker.sh```" to execute the migrations.

In case you want to execute a manual migration you can use:

docker exec -it php-webapp php artisan migrate --seed

Digital Twin Interface

The the digital twin will have some test data included so you can visualize how the data is shown:

You have two interface color modes: Dark Mode (DEFAULT) and Light Mode:

Dark Mode


Logo



Light Mode


Logo



NOTE: Here you can visualize the parking place in real time, by zones.

(back to top)


Header


Logo



In the header are able to:
  • Logout
  • Visualize your current information
  • Change to light/dark modes

(back to top)


Map

The map will show you the parking lot capacity status, in zones.

NOTE: In smartphones you will be not able to see the zones capacity just with Ver Plazas Action Button.


Logo


(back to top)


Action Buttons


Logo



In the action buttons you are able to:
  • Open a Camera Manager Server
  • Add a new vehicle to the parking place
  • Delete vehicle from parking place
  • See all the vehicles inside the parking place
  • Simulate the control of the barrers
  • Visualize the parking place free space capacity
  • Visualize the parking place filled space capacity

(back to top)


Device Manager Server Admin

This server manages all the cameras, and recieves WebSocket and TCP connections if the structures uses the SJMP Protocol digital-twin/deviceManager/docs/SJMPProtocolDescription.pdf packet structure.

Logo

Before Opened


Logo



When Started up a random UUID will be generated as serverid.

Here you can see the server status, inside the digital-twin docker container.

After Opened


Logo



In server admin you can:
  • Choose a random port to open the server.
  • Choose the default port.
  • Open the server when is closed
  • Close the server when is opened (will close all the cameras)
  • If open you can see the server log inside the digital-twin container

(back to top)


Connect Camera


Logo


Before Connected


Logo



The camera will connect to the current running server using SJMP Protocol digital-twin/deviceManager/docs/SJMPProtocolDescription.pdf

Here you can see the logs for the camera connected to the server in digital-twin docker container.

You will recieve a sessionid which can identify your session in the server.

After Opened


Logo



In camera admin you can:
  • See camera status
  • Disconnect the camera

After you connected the button will change to disconnect:

Logo



NOTE: If you reload the digital twin page, the camera will reconnect to the server and recieve a new sessionid.


(back to top)

Add Vehicle Button


Logo


NOTE: Make sure the camera is connected, before adding!

Here you can simulate to add a new vehicle like a camera.

The camera will send a SJMP Protocol digital-twin/deviceManager/docs/SJMPProtocolDescription.pdf IN Flag with the plate


Logo



Delete Vehicle Button


Logo


NOTE: Make sure the camera is connected, before adding!

Here you can simulate to delete a new vehicle like a camera.

The camera will send a SJMP Protocol digital-twin/deviceManager/docs/SJMPProtocolDescription.pdf IN Flag with the plate


Logo



See Places Button


Logo


Here you can see all the vehicles in the parking.


Logo



(back to top)

Barrers Button


Logo


Here you can simulate to open and close the barrers.

Open Entrace Barrer


Logo



Close Entrace Barrer


Logo



Change to Exit Barrer


Logo




All the information from status will appear in the monitor.

Refresh and AutoRefresh Button


Autorefesh: Every 10 seconds it will update the parking map and info if is on.

You can click in refresh to refresh the information in the map.

Enabled Refresh


Logo




Disabled Refresh


Logo





The parking information will update then.

(back to top)


Access To WebApp UFV MyParking

You can enter in the WebApp UFV MyParking accessing the following url if available:

NOTE: If is not available you can change in the docker-compose.yaml the default port in php-webapp container, then rerun the ./buildDocker.sh command.

 http://localhost:8080

For safety reasons you will be redirected to a login page in /login:
Logo

Access WebApp Default Credentials

Introduce the following credentials to have access to the webapp:


> Default Admin Credentials:

Email: [email protected]
Password: 789456123 # Default Password


> Default Manager Credentials:

Email: [email protected]
Password: 789456123 # Default Password


> Default User Credentials:

Email: [email protected]
Password: 123456789 # Default Password

Register

You can also create your own user:

NOTE: To register click in Registrate in the bottom of the login.


Logo



Data Policy

Read the data policy if is necesary, there we specify why the data is stored.
Logo


Dashboard

The dashboard shows you all the parking places.


Logo



The menu is variable by the permits of the user rol.

Menu User


Logo




Menu Manager


Logo




Menu Admin


Logo




Header


Logo




(back to top)


Profile

Click over the icon of profile in the header

Here you can see your data and permits:

NOTE: As a normal user you have no permits, change to admin to have more permits.


Logo



Edit profile data

Here you can modify your data, and password.
Logo


(back to top)

Vehicles

Add vehicles so you can simulate them in the digital twin

Here you can see and manage all your vehicles


Logo



Add Vehicle

Click over the add button in the bottom right of the screen
Logo

Introduce your plate and vehicle type :


Logo




Delete Vehicle

Click over the delete button in the right of the register and click on delete:


Logo




(back to top)

Tickets

NOTE: Go to digital twin and click over the Add Vehicle Button and add the plate you just added

You will recieve a ticket if you refresh the page.


Logo



Click over Ver Ticket:

Open Valid Virtual Ticket

You can see your parking place in the top left:
Logo

NOTE: Go to digital twin and click over the Delete Vehicle Button and add the plate in your ticket and refresh the page.


Invalid Virtual Ticket

Your ticket is now invalid, because you went from the parking lot.


Logo




(back to top)

Responsive Views

All the WebApp UFV MyParking is responsive so you can see how the views are in mobile:

Responsive Login


Logo




Responsive Dashboard Parking Zones


Logo




Responsive Header


Logo




Responsive Map


Logo




Responsive Ticket


Logo




(back to top)

Open TCP/IP Camera Simulator

You can open a new camera and simulate using the CameraManager simulator

NOTE: You need to have an open server, in the digital twin!

Execute the script:

 ./openCamera.sh

A menu will open for you to configure a new camera:
Logo

Select the diferent options to:

  • Start new Camera
  • Start Default Camera, if the default server is open.
  • Disconnect a camera
  • Add a vehicle to parking (needs to exist)
  • Delete vehicle from parking (needs to be inside)
  • List all the cameras in the manager

NOTE: If you exit all the cameras will be closed!

Start Camera

Introduce the data from the open server to connect!

NOTE: If you introduce empty, the default settings will be used.


Logo




NOTE: After this you are ready to add/delete vehicles, select the camera in the list that will be deployed. Then you can add the vehicle plate, and it is done!

License

Distributed under the Creative Commons License. See LICENSE.md for more information.

Commercial use is not authorized, please contact with: Mathias Moser - [email protected]

(back to top)

Contact

Mathias Moser - [email protected]

Project Link: https://github.com/matbmoser/SOTA

(back to top)

About

Repository of the Final Degree Project of Mathias Brunkow Moser, this repo has the main code for the Parking Time Optimization System. This project has received the best note and Honors for the 2022 UFV Promotion.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published