Updating Docs

This commit is contained in:
2025-12-15 16:03:46 -05:00
parent 6d9afb1571
commit b541866027
10 changed files with 42724 additions and 570 deletions

View File

@@ -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()

View File

@@ -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
x_2_min = 0 # Axis Limits and Ticks
x_2_max = 9.5
x_2_step_maj = 1 #steps not division
x_2_max = 29
x_2_step_maj = 2 #steps not division
x_2_step_min = 1
ax[1].set_xlim(x_2_min,x_2_max) # X limits