-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathev-fleet-demo
executable file
·70 lines (55 loc) · 2.77 KB
/
ev-fleet-demo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
######################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# SPDX-License-Identifier: MIT-0 #
######################################################################
############################################################################################
# EV Fleet Demo Description:
# --------------------------
# This script demonstrates an application of the aws-do-pm framework for a fleet of Electric Vehicles.
# A a configured number of electric vehicles, each driving a specified number of routes is simulated
# through generation of vehicle, route, and battery data using an emperical model.
# A generic neural network model is then trained with a dataset combined from all initial routes.
# Each next vehicle route is predicted by the model. When actual data becomes available,
# the prediction error is calculated and if it is above a configured threshold, the model
# for that vehicle is updated before a prediction for the following route is made.
# This workflow is applied in parallel for each vehicle, in effect creating a digital twin
# which is always up-to-date and provides a prediction for the upcoming route for a
# fleet of electric vehicles.
# This demo has a route first approach. A model service is deployed for each vehicle.
# When the vehicle model needs to be updated, the current service is destroyed, and the updated
# model is deployed as the new model service.
############################################################################################
source .env
export QUIET=true
export PYTHONPATH=${PROJECT_HOME}/src/python
stty sane
# If needed, set target orchestrator
if [ ! "$TO" == "$PM_TO" ]; then
echo $PM_TO > wd/.to
source .env
fi
NUM_PLATFORM_CONTAINERS=$(./status.sh | grep platform | wc -l)
echo ""
echo "============================================================="
echo " Launching $NUM_PLATFORM_CONTAINERS groups"
echo "============================================================="
echo ""
TIMESTAMP_START=$(date +%Y%m%d-%H%M%S)
TIME_START=$(date +%s)
echo ""
echo "Launch time: ${TIMESTAMP_START}"
echo ""
python src/python/example/ev/ev_fleet_demo_init.py --config src/python/example/ev/ev_fleet_demo.json
./cp-to.sh platform 1 src/python/example/ev/ev_fleet_demo.json ${PM_ROOT_PATH}/tmp/ev_fleet_demo.json
python src/python/example/ev/ev_fleet_demo_launch.py --config ${PM_ROOT_PATH}/tmp/ev_fleet_demo.json --groups $NUM_PLATFORM_CONTAINERS
TIMESTAMP_END=$(date +%Y%m%d-%H%M%S)
TIME_END=$(date +%s)
stty sane
echo ""
echo "Launch end time: ${TIMESTAMP_END}"
echo ""
echo "Total elapsed time: $(( (${TIME_END} - ${TIME_START})/60 )) minutes"
echo ""
echo "Total number of groups: $NUM_PLATFORM_CONTAINERS"
echo ""