Skip to content

Commit 3ca8a72

Browse files
committed
batter plots ver2.0
1 parent b8539a6 commit 3ca8a72

File tree

2 files changed

+96
-9
lines changed

2 files changed

+96
-9
lines changed

src/hyperloop/battery_plot.py

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import numpy as np
2+
import pylab as p
3+
4+
#design variables
5+
# hl.Mach_bypass = .95
6+
# hl.Mach_pod_max = .90
7+
# hl.Mach_c1_in = .65
8+
# hl.c1_PR_des = 13
9+
10+
# #initial guesses
11+
# hl.compress.W_in = .35
12+
# hl.flow_limit.radius_tube = hl.pod.radius_tube_inner = 178
13+
# hl.compress.Ts_tube = hl.flow_limit.Ts_tube = hl.tube_wall_temp.tubeWallTemp = 322
14+
# hl.compress.c2_PR_des = 5
15+
16+
#Mach, Battery Energy, Comp Energy/s, Time
17+
18+
data = np.array([
19+
[0.69999999999999996, 0.70999999999999996, 0.71999999999999997, 0.72999999999999998, 0.73999999999999999, 0.75, 0.76000000000000001, 0.77000000000000002, 0.78000000000000003, 0.79000000000000004, 0.80000000000000004, 0.81000000000000005, 0.82000000000000006, 0.83000000000000007, 0.84000000000000008, 0.85000000000000009, 0.8600000000000001, 0.87000000000000011, 0.88000000000000012, 0.89000000000000012, 0.90000000000000013, 0.91000000000000014, 0.92000000000000015, 0.93000000000000016],
20+
[425.64734534294513, 419.65424475203628, 413.82772409685742, 408.16094022060747, 402.64742075574082, 397.28103790778948, 392.05598627110015, 386.96676904786113, 382.00815317806808, 377.1751865322513, 372.46316034132201, 367.86760002503087, 363.38424705208229, 359.00904154735571, 354.73813422797747, 350.56784050845937, 346.49464897789539, 342.51522233298749, 338.62635318664013, 334.82501553606085, 331.1082699045225, 327.47334674417999, 323.91756978015695, 320.43839279530488],
21+
[345.33770199869105, 346.5392280454048, 347.77005182839076, 349.03173094706352, 350.32484572200718, 351.6500050517148, 353.00781977374407, 354.399264528071, 355.82499428958067, 357.28562569758549, 358.78210283805197, 360.31530103162191, 361.88440156468499, 363.49217031265931, 365.13789903116964, 366.82390861203487, 368.54951824043007, 370.31660813514264, 372.13130119605955, 373.97719159650512, 375.8732069051859, 377.81270605751422, 379.79821127671244, 381.83106344615129],
22+
[2806.4660132501872, 2766.9510642991399, 2728.5344445946644, 2691.1710344215876, 2654.8181588290604, 2619.4354147766339, 2584.9845248643965, 2551.429246469414, 2518.7350758993498, 2486.8693617511071, 2455.8010571955297, 2425.500659505698, 2395.9400904532899, 2367.0925816309168, 2338.9327531514996, 2311.4363110447871, 2284.5801031509586, 2258.3421252724447, 2232.7012298020227, 2207.6374650729285, 2183.1314499199289, 2159.164923588, 2135.7202403087272, 2112.780611837175]
23+
])
24+
25+
fig, ax = p.subplots()
26+
# Twin the x-axis twice to make independent y-axes.
27+
axes = [ax, ax.twinx(), ax.twinx()]
28+
# Make some space on the right side for the extra y-axis.
29+
fig.subplots_adjust(right=0.75)
30+
# Move the last y-axis spine over to the right by 20% of the width of the axes
31+
axes[-1].spines['right'].set_position(('axes', 1.2))
32+
# To make the border of the right-most axis visible, we need to turn the frame
33+
# on. This hides the other plots, however, so we need to turn its fill off.
34+
axes[-1].set_frame_on(True)
35+
axes[-1].patch.set_visible(False)
36+
# And finally we get to plot things...
37+
colors = ('Green', 'Red', 'Blue')
38+
index = [1, 2, 3]
39+
40+
for i, ax, color in zip(index, axes, colors):
41+
if i == 1:
42+
ax.plot(data[0],data[1], color=color, lw=3)
43+
ax.set_ylabel('Battery Size (kW-hr)', color=color, fontsize = 18)
44+
ax.set_ylim([0,450])
45+
if i == 2:
46+
ax.plot(data[0],data[2], color=color, lw=3)
47+
ax.set_ylabel('Compressor Power Req (kW)', color=color, fontsize = 18)
48+
ax.set_ylim([0,450])
49+
if i == 3:
50+
ax.plot(data[0],data[3], color=color, lw=3)
51+
ax.set_ylabel('Total Mission Time', color=color, fontsize = 18)
52+
ax.set_ylim([0,3000])
53+
ax.tick_params(axis='y', colors=color)
54+
axes[0].set_xlabel('Max Pod Mach', fontsize=18)
55+
56+
#p.tick_params(axis='both', which='major', labelsize=15)
57+
58+
#p.ylabel('Battery', fontsize=18)
59+
#p.title('Battery vs Max Pod Mach', fontsize=20)
60+
#p.plot(data[0],data[1], label="Tube (c1MN = .65)", lw=3)
61+
#p.xlim([0.65,0.95])
62+
#p.ylim([0,450])
63+
#ax2 = p.twinx()
64+
#ax2.plot(data[0],data[3], label="Tube", lw=3)
65+
#ax2.set_ylabel('Total time')
66+
p.legend(loc="best")
67+
68+
#p.gcf().set_size_inches(11,5.5)
69+
#p.gcf().savefig('test2png.png',dpi=130)
70+
p.show()

src/hyperloop/hyperloop_sim.py

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def configure(self):
112112
#design variables
113113
hl.Mach_bypass = .95
114114
hl.Mach_pod_max = .90
115-
hl.Mach_c1_in = .75
115+
hl.Mach_c1_in = .65
116116
hl.c1_PR_des = 13
117117

118118
#initial guesses
@@ -121,20 +121,37 @@ def configure(self):
121121
hl.compress.Ts_tube = hl.flow_limit.Ts_tube = hl.tube_wall_temp.tubeWallTemp = 322
122122
hl.compress.c2_PR_des = 5
123123

124+
#machs = []
125+
#tube_r = []
126+
#capsule_r = []
127+
128+
#for m in np.arange(.781,.95, .01):
129+
# hl.Mach_pod_max = m
130+
# hl.run()
131+
# machs.append(m)
132+
# tube_r.append(hl.pod.radius_inlet_back_outer)
133+
# capsule_r.append(hl.flow_limit.radius_tube)
134+
135+
# print machs
136+
# print tube_r
137+
# print capsule_r
138+
124139
machs = []
125-
tube_r = []
126-
capsule_r = []
140+
batt = []
141+
compE = []
142+
timeT = []
127143

128-
for m in np.arange(.781,.95, .01):
144+
for m in np.arange(.7,.95, .01):
129145
hl.Mach_pod_max = m
130146
hl.run()
131147
machs.append(m)
132-
tube_r.append(hl.pod.radius_inlet_back_outer)
133-
capsule_r.append(hl.flow_limit.radius_tube)
134-
148+
batt.append(hl.pod.energy)
149+
compE.append(hl.compress.pwr_req)
150+
timeT.append(hl.mission.time)
135151
print machs
136-
print tube_r
137-
print capsule_r
152+
print batt
153+
print compE
154+
print timeT
138155

139156
design_data = OrderedDict([
140157
('Mach bypass', hl.Mach_bypass),

0 commit comments

Comments
 (0)