Compare commits
10 Commits
6fa2fcf5a2
...
418ce7b583
| Author | SHA1 | Date | |
|---|---|---|---|
| 418ce7b583 | |||
| 97679cd03b | |||
| dcb11b9925 | |||
| 2fae519a45 | |||
| 05989271ef | |||
| 9c0d7e0466 | |||
| 49c1a58566 | |||
| 167b5af2bf | |||
| b541866027 | |||
| 6d9afb1571 |
@@ -1,11 +1,11 @@
|
|||||||
# Cloud Server Docker Contianers
|
# Cloud Server Docker Contianers
|
||||||
|
|
||||||
### Device -- Raspberry Pi 4
|
## Device -- Raspberry Pi 4
|
||||||
|
|
||||||
### Information
|
## Information
|
||||||
This folder contains all of the services running on the Pi
|
This folder contains all of the services running on the Pi
|
||||||
|
|
||||||
### Contents:
|
## Contents:
|
||||||
**`~/Docker`**
|
**`~/Docker`**
|
||||||
├── **`cloudflared/`**
|
├── **`cloudflared/`**
|
||||||
├── **`dashy/`**
|
├── **`dashy/`**
|
||||||
@@ -17,7 +17,7 @@ This folder contains all of the services running on the Pi
|
|||||||
├── **`README.md`**
|
├── **`README.md`**
|
||||||
└── **`syncthing/`**
|
└── **`syncthing/`**
|
||||||
|
|
||||||
### Current Ports:
|
## Current Ports:
|
||||||
- **`81`** --> nginx proxy manager web ui
|
- **`81`** --> nginx proxy manager web ui
|
||||||
- **`2222`** --> gitea ssh
|
- **`2222`** --> gitea ssh
|
||||||
- **`3000`** --> gitea web ui
|
- **`3000`** --> gitea web ui
|
||||||
@@ -33,9 +33,9 @@ This folder contains all of the services running on the Pi
|
|||||||
- **`50000`** --> ha bridge
|
- **`50000`** --> ha bridge
|
||||||
- **`61208`** --> glances web ui
|
- **`61208`** --> glances web ui
|
||||||
|
|
||||||
### Current Web Paths:
|
## Current Web Paths:
|
||||||
- **`szumko.net`** --> dashy
|
- **`szumko.net`** --> Home Assistant
|
||||||
- **`szumko.net/data`** --> glances
|
- **`szumko.net/data`** --> glances **\*Currently Disabled**
|
||||||
- **`pihole.szumko.net`** --> Pihole
|
- **`pihole.szumko.net`** --> Pihole
|
||||||
- **`git.szumko.net`** --> Gitea
|
- **`git.szumko.net`** --> Gitea
|
||||||
- **`cloud.szumko.net`** --> nextcloud
|
- **`cloud.szumko.net`** --> nextcloud
|
||||||
@@ -47,3 +47,23 @@ This folder contains all of the services running on the Pi
|
|||||||
|
|
||||||
## Adding Paths:
|
## Adding Paths:
|
||||||
1. Add path in NPM (must be on **`homelab`**)
|
1. Add path in NPM (must be on **`homelab`**)
|
||||||
|
|
||||||
|
## UFW Settings
|
||||||
|
```
|
||||||
|
Logging: on (low)
|
||||||
|
Default: deny (incoming), allow (outgoing), deny (routed)
|
||||||
|
New profiles: skip
|
||||||
|
|
||||||
|
To Action From
|
||||||
|
-- ------ ----
|
||||||
|
22/tcp ALLOW IN 192.168.0.0/24 # LAN ssh
|
||||||
|
22/tcp on tailscale0 ALLOW IN Anywhere # Tailscle ssh
|
||||||
|
53,80,81,443,61208/tcp ALLOW IN 192.168.0.0/24 # LAN Access, 53 -> Pihole, 61208 -> glances
|
||||||
|
53,80,81,443,61208/udp ALLOW IN 192.168.0.0/24 # LAN Access, 53 -> Pihole, 61208 -> glances
|
||||||
|
53,80,81,443,61208/tcp on tailscale0 ALLOW IN Anywhere # Tailscale Access, 53 -> Pihole, 61208 -> glances
|
||||||
|
53,80,81,443,61208/udp on tailscale0 ALLOW IN Anywhere # Tailscale Access, 53 -> Pihole, 61208 -> glances
|
||||||
|
80/tcp ALLOW IN 172.16.0.0/12 # Docker networks (for calling pihole from NPM)
|
||||||
|
22/tcp (v6) on tailscale0 ALLOW IN Anywhere (v6) # Tailscale ssh (IPv6)
|
||||||
|
53,80,81,443,61208/tcp (v6) on tailscale0 ALLOW IN Anywhere (v6) # Tailscale Access (IPv6), 53 -> Pihole, 61208 -> glances
|
||||||
|
53,80,81,443,61208/udp (v6) on tailscale0 ALLOW IN Anywhere (v6) # Tailscale Access (IPv6), 53 -> Pihole, 61208 -> glances
|
||||||
|
```
|
||||||
|
|||||||
@@ -38,4 +38,5 @@
|
|||||||
- **cloud.szumko.net** --> nextcloud
|
- **cloud.szumko.net** --> nextcloud
|
||||||
- **git.szumko.net** --> Gitea
|
- **git.szumko.net** --> Gitea
|
||||||
- **ha.szumko.net** --> Home Assistant
|
- **ha.szumko.net** --> Home Assistant
|
||||||
- **pihole.szumko.net**
|
- **pihole.szumko.net** --> Pihole Admin
|
||||||
|
- **lib.szumko.net** --> Calibre
|
||||||
|
|||||||
@@ -12,4 +12,6 @@ ingress:
|
|||||||
service: http://nginx-app-1:80
|
service: http://nginx-app-1:80
|
||||||
- hostname: ha.szumko.net
|
- hostname: ha.szumko.net
|
||||||
service: http://nginx-app-1:80
|
service: http://nginx-app-1:80
|
||||||
|
- hostname: lib.szumko.net
|
||||||
|
service: http://nginx-app-1:80
|
||||||
- service: http_status:404
|
- service: http_status:404
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# Not In use, replaced by Home Assistant for now
|
||||||
|
|
||||||
# Dashy Info
|
# Dashy Info
|
||||||
|
|
||||||
## Instructions:
|
## Instructions:
|
||||||
|
|||||||
@@ -23,3 +23,13 @@
|
|||||||
## Ignored Files:
|
## Ignored Files:
|
||||||
- **`.env`**: Environment Variables
|
- **`.env`**: Environment Variables
|
||||||
|
|
||||||
|
## NPM Configurations
|
||||||
|
- ```
|
||||||
|
location /data/ {
|
||||||
|
proxy_pass http://glances:61208/;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
add_header Access-Control-Allow-Origin *;
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
*.env
|
*.env
|
||||||
ha_config/
|
ha_config/
|
||||||
bridge_config/
|
bridge_config/
|
||||||
|
!ha_config/configuration.yml
|
||||||
|
!ha_config/automations.yml
|
||||||
|
!ha_config/scripts.yml
|
||||||
|
|
||||||
|
|
||||||
# Ignore system generated logs
|
# Ignore system generated logs
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ services:
|
|||||||
- ./ha_config:/config
|
- ./ha_config:/config
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
- /run/dbus:/run/dbus:ro
|
- /run/dbus:/run/dbus:ro
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
privileged: false
|
privileged: false
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
@@ -0,0 +1,123 @@
|
|||||||
|
- id: '1766178088964'
|
||||||
|
alias: Morning Weather
|
||||||
|
description: ''
|
||||||
|
triggers:
|
||||||
|
- trigger: time
|
||||||
|
at: 07:00:00
|
||||||
|
weekday:
|
||||||
|
- sun
|
||||||
|
- mon
|
||||||
|
- tue
|
||||||
|
- wed
|
||||||
|
- thu
|
||||||
|
- fri
|
||||||
|
- sat
|
||||||
|
conditions: []
|
||||||
|
actions:
|
||||||
|
- action: rest_command.get_phone_weather
|
||||||
|
data: {}
|
||||||
|
response_variable: weather_data
|
||||||
|
- variables:
|
||||||
|
max_temp: '{{weather_data.content.daily.temperature_2m_max[0]}}'
|
||||||
|
min_temp: '{{weather_data.content.daily.temperature_2m_min[0]}}'
|
||||||
|
temp_unit: '{{weather_data.content.daily_units.temperature_2m_max}}'
|
||||||
|
condition: "{% set code = weather_data.content.daily.weather_code[0] | int %}
|
||||||
|
{% set mapper = {\n 0: \"Clear sky\",\n 1: \"Mainly clear\",\n 2: \"Partly
|
||||||
|
cloudy\",\n 3: \"Overcast\",\n 45: \"Fog\",\n 48: \"Depositing rime fog\",\n
|
||||||
|
\ 51: \"Drizzle - Light intensity\",\n 53: \"Drizzle - Moderate intensity\",\n
|
||||||
|
\ 55: \"Drizzle - Dense intensity\",\n 56: \"Freezing Drizzle - Light intensity\",\n
|
||||||
|
\ 57: \"Freezing Drizzle - Dense intensity\",\n 61: \"Rain - Slight intensity\",\n
|
||||||
|
\ 63: \"Rain - Moderate intensity\",\n 65: \"Rain - Heavy intensity\",\n
|
||||||
|
\ 66: \"Freezing Rain - Light intensity\",\n 67: \"Freezing Rain - Heavy
|
||||||
|
intensity\",\n 71: \"Snow fall - Slight intensity\",\n 73: \"Snow fall -
|
||||||
|
Moderate intensity\",\n 75: \"Snow fall - Heavy intensity\",\n 77: \"Snow
|
||||||
|
grains\",\n 80: \"Rain showers - Slight intensity\",\n 81: \"Rain showers
|
||||||
|
- Moderate intensity\",\n 82: \"Rain showers - Violent intensity\",\n 85:
|
||||||
|
\"Snow showers - Slight intensity\",\n 86: \"Snow showers - Heavy intensity\",\n
|
||||||
|
\ 95: \"Thunderstorm - Slight intensity\",\n 96: \"Thunderstorm with slight
|
||||||
|
hail\",\n 99: \"Thunderstorm with heavy hail\"\n } %}\n {{ mapper.get(code,
|
||||||
|
\"Not Availible\") }}\n"
|
||||||
|
- action: script.general_notificatioon
|
||||||
|
metadata: {}
|
||||||
|
data:
|
||||||
|
title: Morning Weather
|
||||||
|
message: 'Good Morning!
|
||||||
|
|
||||||
|
Here is the weather for today:
|
||||||
|
|
||||||
|
High: {{max_temp}} {{temp_unit}}
|
||||||
|
|
||||||
|
Low: {{min_temp}} {{temp_unit}}
|
||||||
|
|
||||||
|
Conditions: {{condition}}
|
||||||
|
|
||||||
|
'
|
||||||
|
mode: single
|
||||||
|
- id: '1766182515375'
|
||||||
|
alias: Dash Test
|
||||||
|
description: ''
|
||||||
|
triggers: []
|
||||||
|
conditions: []
|
||||||
|
actions:
|
||||||
|
- action: script.phone_weather
|
||||||
|
metadata: {}
|
||||||
|
data: {}
|
||||||
|
response_variable: weather
|
||||||
|
- variables:
|
||||||
|
max_temp: '{{weather.content.daily.temperature_2m_max[0]}}'
|
||||||
|
mode: single
|
||||||
|
- id: '1766406207253'
|
||||||
|
alias: Morning Test
|
||||||
|
description: ''
|
||||||
|
triggers:
|
||||||
|
- trigger: time
|
||||||
|
at: 07:00:00
|
||||||
|
weekday:
|
||||||
|
- sun
|
||||||
|
- mon
|
||||||
|
- tue
|
||||||
|
- wed
|
||||||
|
- thu
|
||||||
|
- fri
|
||||||
|
- sat
|
||||||
|
conditions: []
|
||||||
|
actions:
|
||||||
|
- action: rest_command.get_phone_weather
|
||||||
|
data: {}
|
||||||
|
response_variable: weather_data
|
||||||
|
- variables:
|
||||||
|
max_temp: '{{weather_data.content.daily.temperature_2m_max[0]}}'
|
||||||
|
min_temp: '{{weather_data.content.daily.temperature_2m_min[0]}}'
|
||||||
|
temp_unit: '{{weather_data.content.daily_units.temperature_2m_max}}'
|
||||||
|
condition: "{% set code = weather_data.content.daily.weather_code[0] | int %}
|
||||||
|
{% set mapper = {\n 0: \"Clear sky\",\n 1: \"Mainly clear\",\n 2: \"Partly
|
||||||
|
cloudy\",\n 3: \"Overcast\",\n 45: \"Fog\",\n 48: \"Depositing rime fog\",\n
|
||||||
|
\ 51: \"Drizzle - Light intensity\",\n 53: \"Drizzle - Moderate intensity\",\n
|
||||||
|
\ 55: \"Drizzle - Dense intensity\",\n 56: \"Freezing Drizzle - Light intensity\",\n
|
||||||
|
\ 57: \"Freezing Drizzle - Dense intensity\",\n 61: \"Rain - Slight intensity\",\n
|
||||||
|
\ 63: \"Rain - Moderate intensity\",\n 65: \"Rain - Heavy intensity\",\n
|
||||||
|
\ 66: \"Freezing Rain - Light intensity\",\n 67: \"Freezing Rain - Heavy
|
||||||
|
intensity\",\n 71: \"Snow fall - Slight intensity\",\n 73: \"Snow fall -
|
||||||
|
Moderate intensity\",\n 75: \"Snow fall - Heavy intensity\",\n 77: \"Snow
|
||||||
|
grains\",\n 80: \"Rain showers - Slight intensity\",\n 81: \"Rain showers
|
||||||
|
- Moderate intensity\",\n 82: \"Rain showers - Violent intensity\",\n 85:
|
||||||
|
\"Snow showers - Slight intensity\",\n 86: \"Snow showers - Heavy intensity\",\n
|
||||||
|
\ 95: \"Thunderstorm - Slight intensity\",\n 96: \"Thunderstorm with slight
|
||||||
|
hail\",\n 99: \"Thunderstorm with heavy hail\"\n } %}\n {{ mapper.get(code,
|
||||||
|
\"Not Availible\") }}\n"
|
||||||
|
- action: script.general_notificatioon
|
||||||
|
metadata: {}
|
||||||
|
data:
|
||||||
|
title: Morning Weather
|
||||||
|
message: 'Good Morning!
|
||||||
|
|
||||||
|
Here is the weather for today:
|
||||||
|
|
||||||
|
High: {{max_temp}} {{temp_unit}}
|
||||||
|
|
||||||
|
Low: {{min_temp}} {{temp_unit}}
|
||||||
|
|
||||||
|
Conditions: {{condition}}
|
||||||
|
|
||||||
|
'
|
||||||
|
mode: single
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
|
||||||
|
# Loads default set of integrations. Do not remove.
|
||||||
|
default_config:
|
||||||
|
|
||||||
|
# Load frontend themes from the themes folder
|
||||||
|
frontend:
|
||||||
|
themes: !include_dir_merge_named themes
|
||||||
|
|
||||||
|
automation: !include automations.yaml
|
||||||
|
script: !include scripts.yaml
|
||||||
|
scene: !include scenes.yaml
|
||||||
|
|
||||||
|
http:
|
||||||
|
use_x_forwarded_for: true
|
||||||
|
trusted_proxies:
|
||||||
|
#- 172.19.0.2 # Add the IP address of the proxy server
|
||||||
|
- 172.0.0.0/8 # You may also provide the subnet mask
|
||||||
|
|
||||||
|
rest_command: # This api shows: Daily code, max/min temp, apperent max/min temp, sunrise/sunset/daylight, UV, percip sum/hours/probability
|
||||||
|
get_phone_weather: # All in US units for 3 days out
|
||||||
|
url: >
|
||||||
|
{% set lat = state_attr('device_tracker.alexs_phone','latitude') %}
|
||||||
|
{% set lon = state_attr('device_tracker.alexs_phone','longitude') %}
|
||||||
|
https://api.open-meteo.com/v1/forecast?latitude={{lat}}&longitude={{lon}}&daily=weather_code,temperature_2m_max,temperature_2m_min,apparent_temperature_max,apparent_temperature_min,sunrise,daylight_duration,sunset,uv_index_max,precipitation_sum,precipitation_hours,precipitation_probability_max&timezone=America%2FNew_York&forecast_days=3&wind_speed_unit=mph&temperature_unit=fahrenheit&precipitation_unit=inch
|
||||||
|
method: GET
|
||||||
|
|
||||||
|
rest:
|
||||||
|
- resource_template: >
|
||||||
|
{% set lat = state_attr('device_tracker.alexs_phone','latitude') %}
|
||||||
|
{% set lon = state_attr('device_tracker.alexs_phone','longitude') %}
|
||||||
|
https://api.open-meteo.com/v1/forecast?latitude={{lat}}&longitude={{lon}}&daily=weather_code,temperature_2m_max,temperature_2m_min,apparent_temperature_max,apparent_temperature_min,sunrise,daylight_duration,sunset,uv_index_max,rain_sum,snowfall_sum,precipitation_sum,precipitation_hours,precipitation_probability_max&hourly=temperature_2m,apparent_temperature,precipitation_probability,weather_code,precipitation¤t=temperature_2m,apparent_temperature,precipitation,weather_code,is_day&timezone=America%2FNew_York&wind_speed_unit=mph&temperature_unit=fahrenheit&precipitation_unit=inch
|
||||||
|
scan_interval: 900
|
||||||
|
sensor:
|
||||||
|
- name: "Phone Location Minimum Temperature"
|
||||||
|
unique_id: "phone_min_temp"
|
||||||
|
value_template: '{{value_json.daily.temperature_2m_min[0]}}'
|
||||||
|
unit_of_measurement: '°F'
|
||||||
|
device_class: temperature
|
||||||
|
- name: "Phone Location Maximum Temperature"
|
||||||
|
unique_id: "phone_max_temp"
|
||||||
|
value_template: '{{value_json.daily.temperature_2m_max[0]}}'
|
||||||
|
unit_of_measurement: '°F'
|
||||||
|
device_class: temperature
|
||||||
|
|
||||||
|
monitor_docker:
|
||||||
|
- name: Docker
|
||||||
|
containers:
|
||||||
|
- cloudflared-cloudflared-1
|
||||||
|
- gitea-db-1
|
||||||
|
- gitea-server-1
|
||||||
|
- glances
|
||||||
|
- habridge
|
||||||
|
- homeassistant
|
||||||
|
- nextcloud-app-1
|
||||||
|
- nextcloud-db-1
|
||||||
|
- nextcloud-redis-1
|
||||||
|
- nginx-app-1
|
||||||
|
- portainer
|
||||||
|
- syncthing
|
||||||
|
rename:
|
||||||
|
cloudflared-cloudflared-1: 'Cloudflared'
|
||||||
|
gitea-db-1: 'Gitea Database'
|
||||||
|
gitea-server-1: 'Gitea Server'
|
||||||
|
glances: 'Glances'
|
||||||
|
habridge: 'Home Assistant Bridge'
|
||||||
|
homeassistant: 'Home Assistant'
|
||||||
|
nextcloud-app-1: 'Nextcloud Server'
|
||||||
|
nextcloud-db-1: 'Nextcloud Database'
|
||||||
|
nextcloud-redis-1: 'Nextcloud Redis'
|
||||||
|
nginx-app-1: 'Nginx Proxy Manager'
|
||||||
|
portainer: 'Portainer'
|
||||||
|
syncthing: 'Syncthing'
|
||||||
|
monitored_conditions:
|
||||||
|
- version
|
||||||
|
- containers_running
|
||||||
|
- containers_paused
|
||||||
|
- containers_stopped
|
||||||
|
- containers_total
|
||||||
|
- containers_memory_percentage
|
||||||
|
- images
|
||||||
|
- state
|
||||||
|
- status
|
||||||
|
- health
|
||||||
|
- uptime
|
||||||
|
- image
|
||||||
|
- 1cpu_percentage
|
||||||
|
- memory
|
||||||
|
- memory_percentage
|
||||||
|
scan_interval: 60
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
phone_weather:
|
||||||
|
sequence:
|
||||||
|
- action: rest_command.get_phone_weather
|
||||||
|
data: {}
|
||||||
|
response_variable: weather_data
|
||||||
|
- variables:
|
||||||
|
max_temp: '{{ weather_data.content.daily.temperature_2m_max[0] }}'
|
||||||
|
- action: script.general_notificatioon
|
||||||
|
metadata: {}
|
||||||
|
data:
|
||||||
|
message: 'Good morning!
|
||||||
|
|
||||||
|
The high for today is {{ max_temp }}
|
||||||
|
|
||||||
|
'
|
||||||
|
title: Morning Weather
|
||||||
|
alias: Phone Weather
|
||||||
|
description: ''
|
||||||
|
general_notificatioon:
|
||||||
|
sequence:
|
||||||
|
- action: notify.mobile_app_alexs_iphone_2
|
||||||
|
metadata: {}
|
||||||
|
data:
|
||||||
|
message: '{{ message }}'
|
||||||
|
title: '{{ title }}'
|
||||||
|
- action: notify.persistent_notification
|
||||||
|
metadata: {}
|
||||||
|
data:
|
||||||
|
message: '{{ message }}'
|
||||||
|
title: '{{ title }}'
|
||||||
|
fields:
|
||||||
|
title:
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
name: Title
|
||||||
|
required: true
|
||||||
|
message:
|
||||||
|
selector:
|
||||||
|
text:
|
||||||
|
name: Message
|
||||||
|
required: true
|
||||||
|
alias: General Notification
|
||||||
|
description: ''
|
||||||
|
icon: mdi:bell-badge
|
||||||
@@ -14,8 +14,8 @@ def get_data(filename):
|
|||||||
y.append(float(data[1]))
|
y.append(float(data[1]))
|
||||||
return x, y
|
return x, y
|
||||||
|
|
||||||
x_meas, y_meas = get_data('Plotting\Base\Measured.txt')
|
x_meas, y_meas = get_data('Base\Measured.txt')
|
||||||
x_sim, y_sim = get_data("Plotting\Base\Simulated.txt")
|
x_sim, y_sim = get_data("Base\Simulated.txt")
|
||||||
|
|
||||||
#print(min(x_meas),min(x_sim))
|
#print(min(x_meas),min(x_sim))
|
||||||
|
|
||||||
|
|||||||
Executable
+240
@@ -0,0 +1,240 @@
|
|||||||
|
import numpy as np
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
|
||||||
|
def get_data(filename):
|
||||||
|
file = open(filename)
|
||||||
|
lines = file.readlines()
|
||||||
|
x = []
|
||||||
|
y = []
|
||||||
|
for i in range(len(lines)):
|
||||||
|
if i % 2 == 0:
|
||||||
|
lines[i].strip()
|
||||||
|
data = lines[i].split()
|
||||||
|
x.append(float(data[0]))
|
||||||
|
y.append(float(data[1]))
|
||||||
|
return x, y
|
||||||
|
|
||||||
|
|
||||||
|
time, load_power = get_data('Drone Comparison Data for Dan/ME481_load_power.txt')
|
||||||
|
|
||||||
|
time1, engine_power = get_data('Drone Comparison Data for Dan/ME481_engine_power.txt')
|
||||||
|
|
||||||
|
time2, elec_power = get_data('Drone Comparison Data for Dan/ME481_elec_power.txt')
|
||||||
|
|
||||||
|
time3, soc_small = get_data('Drone Comparison Data for Dan/ME481_soc.txt')
|
||||||
|
|
||||||
|
time4, mft_load_power = get_data('Drone Comparison Data for Dan/required_power.txt')
|
||||||
|
|
||||||
|
time5, mft_engine_power = get_data('Drone Comparison Data for Dan/engine_power.txt')
|
||||||
|
|
||||||
|
time6, mft_elec_power = get_data('Drone Comparison Data for Dan/hybrid_battery_power.txt')
|
||||||
|
|
||||||
|
time7, mft_battery_only = get_data('Drone Comparison Data for Dan/battery_only_power.txt')
|
||||||
|
|
||||||
|
soc =[]
|
||||||
|
for data in soc_small:
|
||||||
|
soc.append(data*100)
|
||||||
|
|
||||||
|
|
||||||
|
# Basic Styling
|
||||||
|
plt.rcParams.update({
|
||||||
|
'font.family': 'Courier New', # monospace font
|
||||||
|
'font.size': 20, # Fonts
|
||||||
|
'axes.titlesize': 20, # |
|
||||||
|
'axes.labelsize': 15, # V
|
||||||
|
'xtick.labelsize': 15,
|
||||||
|
'ytick.labelsize': 15,
|
||||||
|
'legend.fontsize': 15,
|
||||||
|
'figure.titlesize': 20,
|
||||||
|
'figure.figsize': [10,10] # Figure Size
|
||||||
|
})
|
||||||
|
|
||||||
|
# Figure Setup
|
||||||
|
fig, ax = plt.subplots(3, 1, gridspec_kw={'height_ratios': [2, 1, 2]})
|
||||||
|
title = 'Power Output vs Time' # Title
|
||||||
|
# fig.suptitle(title, y=0.95) #pad controls distance to plot
|
||||||
|
|
||||||
|
### Figure 1 (top) ###
|
||||||
|
x_1_title = 'Jetfire Hybrid System Power Output'
|
||||||
|
ax[0].set_title(x_1_title)
|
||||||
|
x_1_lab = 'Time [min]' # X Label
|
||||||
|
y_1_lab = 'Power [kW]' # Y Label
|
||||||
|
ax[0].set_xlabel(x_1_lab)
|
||||||
|
ax[0].set_ylabel(y_1_lab)
|
||||||
|
ax[0].spines['top'].set_visible(False) # Controls non axis borders
|
||||||
|
ax[0].spines['right'].set_visible(False)
|
||||||
|
ax[0].spines['bottom'].set_visible(False)
|
||||||
|
|
||||||
|
### Figure 2 (middle) ###
|
||||||
|
x_2_title = 'Jetfire Hybrid System State of charge'
|
||||||
|
ax[1].set_title(x_2_title)
|
||||||
|
x_2_lab = 'Time [min]' # X Label
|
||||||
|
y_2_lab = 'Charge [%]' # Y Label
|
||||||
|
ax[1].set_xlabel(x_2_lab)
|
||||||
|
ax[1].set_ylabel(y_2_lab)
|
||||||
|
ax[1].spines['top'].set_visible(False) # Controls non axis borders
|
||||||
|
ax[1].spines['right'].set_visible(False)
|
||||||
|
|
||||||
|
### Figure 3 (middle) ###
|
||||||
|
x_3_title = 'Maximum Flight Time Test'
|
||||||
|
ax[2].set_title(x_3_title)
|
||||||
|
x_3_lab = 'Time [min]' # X Label
|
||||||
|
y_3_lab = 'Power [kW]' # Y Label
|
||||||
|
ax[2].set_xlabel(x_3_lab,labelpad=-15)
|
||||||
|
ax[2].set_ylabel(y_3_lab)
|
||||||
|
ax[2].spines['top'].set_visible(False) # Controls non axis borders
|
||||||
|
ax[2].spines['right'].set_visible(False)
|
||||||
|
ax[2].spines['bottom'].set_visible(False)
|
||||||
|
|
||||||
|
### axis is the same for both graphs ###
|
||||||
|
### x displays on bottom graph only ###
|
||||||
|
x_1_min = 0 # Axis Limits and Ticks
|
||||||
|
x_1_max = 31
|
||||||
|
x_1_step_maj = 5 #steps not division
|
||||||
|
x_1_step_min = 1
|
||||||
|
|
||||||
|
ax[0].set_xlim(x_1_min,x_1_max) # X limits
|
||||||
|
ax[0].set_xticks(np.arange(x_1_min,x_1_max,x_1_step_maj)) # X Major Ticks
|
||||||
|
# ax[0].set_xticks([17.45],[''], minor=True)
|
||||||
|
# ax[1].set_xticks([-180,-90,0,90,180], minor=True) # X Minor Ticks
|
||||||
|
|
||||||
|
x_2_min = 0 # Axis Limits and Ticks
|
||||||
|
x_2_max = 31
|
||||||
|
x_2_step_maj = 5 #steps not division
|
||||||
|
x_2_step_min = 1
|
||||||
|
|
||||||
|
ax[1].set_xlim(x_2_min,x_2_max) # X limits
|
||||||
|
ax[1].set_xticks(np.arange(x_2_min,x_2_max,x_2_step_maj)) # X Major Ticks
|
||||||
|
# ax[1].set_xticks([-180,-90,0,90,180], minor=True) # X Minor Ticks
|
||||||
|
|
||||||
|
x_3_min = 0 # Axis Limits and Ticks
|
||||||
|
x_3_max = 95
|
||||||
|
x_3_step_maj = 10 #steps not division
|
||||||
|
x_3_step_min = 1
|
||||||
|
|
||||||
|
ax[2].set_xlim(x_3_min,x_3_max) # X limits
|
||||||
|
ax[2].set_xticks(np.arange(x_3_min,x_3_max,x_3_step_maj),['0','','20','','40','','60','','80','']) # X Major Ticks
|
||||||
|
ax[2].set_xticks([28.5,71.5,92.97],['28.53','Fuel Runs\nOut','92.97'], minor=True)
|
||||||
|
# ax[2].set_xticks([0,9.17,10,20,30,40,50,60,70,71.5,80,90,92.97],['0','Electric only ])
|
||||||
|
# ax[1].set_xticks([-180,-90,0,90,180], minor=True) # X Minor Ticks
|
||||||
|
|
||||||
|
|
||||||
|
### Figure 1 (top) ###
|
||||||
|
y_1_min = -5
|
||||||
|
y_1_max = 17
|
||||||
|
y_1_step_maj = 5
|
||||||
|
y_1_step_min = 1
|
||||||
|
|
||||||
|
ax[0].set_ylim(y_1_min,y_1_max) # Y limits
|
||||||
|
ax[0].set_yticks(np.arange(y_1_min,y_1_max,y_1_step_maj)) # Y Major Ticks
|
||||||
|
# ax.set_yticks(np.arange(y_min,y_max,y_step_min),minor=True) # Y Minor Ticks
|
||||||
|
|
||||||
|
|
||||||
|
ax[0].grid(True, which='major',alpha=0.5) # Turn On Major Grid
|
||||||
|
# ax[0].grid(True, which='minor',alpha=1,color='black',linestyle='--') # Turn on Minor Grid
|
||||||
|
# alpha controls transparency
|
||||||
|
|
||||||
|
ax[0].text(0.45,0.26,'Payload\ndelivery\n <--',transform=ax[0].transAxes, fontsize=13)
|
||||||
|
ax[0].text(0.575,0.26,'Return\nflight\n -->',transform=ax[0].transAxes, fontsize=13)
|
||||||
|
|
||||||
|
### Figure 2 (bottom) ###
|
||||||
|
y_2_min = 80
|
||||||
|
y_2_max = 105
|
||||||
|
y_2_step_maj = 10
|
||||||
|
y_2_step_min = 1
|
||||||
|
|
||||||
|
ax[1].set_ylim(y_2_min,y_2_max) # Y limits
|
||||||
|
ax[1].set_yticks(np.arange(y_2_min,y_2_max,y_2_step_maj)) # Y Major Ticks
|
||||||
|
# ax[1].set_yticks(np.arange(y_2_min,y_2_max,y_2_step_min),minor=True) # Y Minor Ticks
|
||||||
|
|
||||||
|
ax[1].grid(True, which='major',alpha=0.5) # Turn On Major Grid
|
||||||
|
# ax[1].grid(True, which='minor',alpha=0.2) # Turn on Minor Grid
|
||||||
|
# alpha controls transparency
|
||||||
|
|
||||||
|
|
||||||
|
y_3_min = -5
|
||||||
|
y_3_max = 17
|
||||||
|
y_3_step_maj = 5
|
||||||
|
y_3_step_min = 1
|
||||||
|
|
||||||
|
ax[2].set_ylim(y_3_min,y_3_max) # Y limits
|
||||||
|
ax[2].set_yticks(np.arange(y_3_min,y_3_max,y_3_step_maj)) # Y Major Ticks
|
||||||
|
# ax[1].set_yticks(np.arange(y_2_min,y_2_max,y_2_step_min),minor=True) # Y Minor Ticks
|
||||||
|
|
||||||
|
ax[2].grid(True, which='major',alpha=0.5) # Turn On Major Grid
|
||||||
|
# ax[2].grid(True, which='minor',alpha=1, linestyle='--', linewidth=1, color='black') # Turn on Minor Grid
|
||||||
|
ax[2].tick_params(axis='x', which='minor', length=10)
|
||||||
|
# alpha controls transparency
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
###################### Single Line ######################
|
||||||
|
'''
|
||||||
|
# x = []
|
||||||
|
# y = []
|
||||||
|
|
||||||
|
ax.plot(x,y,color='black',linestyle='-',linewidth='1')
|
||||||
|
# Basic Line Styles: -, --, :, -.
|
||||||
|
# Basic Colors: red, blue, green, purple, cyan, magenta, black, brown, etc
|
||||||
|
# Can Specify Hex code for colors
|
||||||
|
|
||||||
|
# ax.scatter(x,y,color='black',marker='o',size=20)
|
||||||
|
# # Many Markers: circle-'o', square-'s', triangle-'^',star-'*', x-'x'
|
||||||
|
|
||||||
|
# plt.show()
|
||||||
|
'''
|
||||||
|
|
||||||
|
###################### Stacked Line ######################
|
||||||
|
|
||||||
|
x1 = [[0,31],[17.4,17.4],time,time1,time2] # List of Lists
|
||||||
|
y1 = [[0,0],[-5,15.5],load_power,engine_power,elec_power] # List of Lists
|
||||||
|
|
||||||
|
dl1 = ['','','Required Output','Jetfire Engine','Electric Motor'] # Data Labels (list)
|
||||||
|
lc1 = ['black','black',"#A30F48","#1db9be","#0C53AF"] # Line Color |
|
||||||
|
ls1 = ['-','--','-','-','-'] # Line Style |
|
||||||
|
lw1 = [1,1,2,2,2] # Line Width V
|
||||||
|
a1 = [1,1,1,1,1] # Transparency
|
||||||
|
|
||||||
|
for i in range(len(x1)):
|
||||||
|
ax[0].plot(x1[i],y1[i],label=dl1[i],color=lc1[i],linestyle=ls1[i],linewidth=lw1[i], alpha=a1[i])
|
||||||
|
|
||||||
|
ax[0].legend(loc='center', bbox_to_anchor=(0.85,0.8), ncol=1, frameon=True,edgecolor='white',framealpha=1, labelspacing=0.2, columnspacing=0.75,handlelength=0.9, handletextpad=0.3)
|
||||||
|
# anchor loc is based on the plot area, 0.5 is half the width, 1.01 is just above the top
|
||||||
|
# labelspacing is for vertical spacing, column is for horizontal, handel is for line length, textpad is for handl eto text
|
||||||
|
|
||||||
|
x2 = [time3] # List of Lists
|
||||||
|
y2 = [soc] # List of Lists
|
||||||
|
|
||||||
|
dl2 = ['State of Charge'] # Data Labels (list)
|
||||||
|
lc2 = ['#008349'] # Line Color |
|
||||||
|
ls2 = ['-'] # Line Style |
|
||||||
|
lw2 = [2] # Line Width V
|
||||||
|
a2 = [1] # Transparency
|
||||||
|
|
||||||
|
for i in range(len(x2)):
|
||||||
|
ax[1].plot(x2[i],y2[i],label=dl2[i],color=lc2[i],linestyle=ls2[i],linewidth=lw2[i], alpha=a2[i])
|
||||||
|
|
||||||
|
# ax[1].fill_between(x_temp,y_temp,hatch='///', alpha=0)
|
||||||
|
|
||||||
|
# ax[1].legend(loc='center', bbox_to_anchor=(0.8,0.8), ncol=1, frameon=True,edgecolor='white',framealpha=1, labelspacing=0.2, columnspacing=0.75,handlelength=0.9, handletextpad=0.3)
|
||||||
|
# anchor loc is based on the plot area, 0.5 is half the width, 1.01 is just above the top
|
||||||
|
# labelspacing is for vertical spacing, column is for horizontal, handel is for line length, textpad is for handl eto text
|
||||||
|
|
||||||
|
x3 = [[0,95],[28.5,28.5],[71.5,71.5],[92.97,92.97],time4,time6,time5,time7] # List of Lists
|
||||||
|
y3 = [[0,0],[-5,0],[-5,0],[-5,6.34],mft_load_power,mft_elec_power,mft_engine_power,mft_battery_only] # List of Lists
|
||||||
|
|
||||||
|
dl3 = ['','','','','Hybrid Total Output', 'Electric Motor','Jetfire Engine','Fully Electric'] # Data Labels (list)
|
||||||
|
lc3 = ['black','black','black','black',"black","#667dc9","#45afd6","#04942F"] # Line Color |
|
||||||
|
ls3 = ['-','--','--','--','-','-','-','-'] # Line Style |
|
||||||
|
lw3 = [1,1,1,1,2,2,2,2] # Line Width V
|
||||||
|
a3 = [1,1,1,1,1,1,1,1] # Transparency
|
||||||
|
|
||||||
|
for i in range(len(x3)):
|
||||||
|
ax[2].plot(x3[i],y3[i],label=dl3[i],color=lc3[i],linestyle=ls3[i],linewidth=lw3[i], alpha=a3[i])
|
||||||
|
|
||||||
|
ax[2].legend(loc='center', bbox_to_anchor=(0.65,0.8), ncol=2, frameon=True,edgecolor='white',framealpha=1, labelspacing=0.2, columnspacing=0.75,handlelength=0.9, handletextpad=0.3)
|
||||||
|
|
||||||
|
|
||||||
|
plt.tight_layout()
|
||||||
|
plt.show()
|
||||||
Executable
+9904
File diff suppressed because it is too large
Load Diff
Executable
+9904
File diff suppressed because it is too large
Load Diff
Executable
+9904
File diff suppressed because it is too large
Load Diff
Executable
+9904
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -98,8 +98,8 @@ ax[0].set_xticks(np.arange(x_1_min,x_1_max,x_1_step_maj)) # X Maj
|
|||||||
# ax[1].set_xticks([-180,-90,0,90,180], minor=True) # X Minor Ticks
|
# ax[1].set_xticks([-180,-90,0,90,180], minor=True) # X Minor Ticks
|
||||||
|
|
||||||
x_2_min = 0 # Axis Limits and Ticks
|
x_2_min = 0 # Axis Limits and Ticks
|
||||||
x_2_max = 9.5
|
x_2_max = 29
|
||||||
x_2_step_maj = 1 #steps not division
|
x_2_step_maj = 2 #steps not division
|
||||||
x_2_step_min = 1
|
x_2_step_min = 1
|
||||||
|
|
||||||
ax[1].set_xlim(x_2_min,x_2_max) # X limits
|
ax[1].set_xlim(x_2_min,x_2_max) # X limits
|
||||||
|
|||||||
+1700
-552
File diff suppressed because it is too large
Load Diff
+1158
-8
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user