summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Anderson <jandew+dev@gmail.com>2011-11-01 11:16:49 -0500
committerJoe Anderson <jandew+dev@gmail.com>2011-11-01 11:16:49 -0500
commit0cd26aa7a8d4aecd783da543abca1815064c7ebc (patch)
treeab7a760948fa2ad890df0110d6af0516c258089b
parent58f22defd6f96b36761a62cfe95f71adf014ec80 (diff)
downloadtoss-0cd26aa7a8d4aecd783da543abca1815064c7ebc.tar.gz
toss-0cd26aa7a8d4aecd783da543abca1815064c7ebc.zip
implemented, untested
-rw-r--r--throw.py55
1 files changed, 29 insertions, 26 deletions
diff --git a/throw.py b/throw.py
index 91ddbc3..b57d06b 100644
--- a/throw.py
+++ b/throw.py
@@ -90,29 +90,32 @@ quad_co = kappa * density * Area
# fric_quad = quad_co * (r * phi1 * vcm_co)**2
### mass:
-global m, Mass
+global m, Mass, dia, l, max_tension
m = 39.7 #kilograms -- mass of the satellite cage (overestimate)
l = 0.16 #kilograms/meter -- density of Super Max cable, 16mm: 269.8kN
l = 0.41 #kilograms/meter -- density of Super Max cable, 26mm: 647.4kN
-#diameter in mm, l in kg/100m, breaking point in
-cables = [[ 6, 2.3, 41.2], [ 8, 3.9, 65.7],
- [ 9, 4.2, 82.4], [10, 5.9, 105.9],
- [11, 6.3, 133.4], [12, 9.5, 161.9],
- [14, 12.8, 215.8], [16, 16, 269.8],
- [18, 20.8, 343.3], [20, 25.5, 407.1],
- [22, 30.5, 490.5], [24, 35.8, 569.0],
- [26, 41.0, 647.4], [28, 46.5, 725.9],
- [30, 52.0, 799.5], [32, 57, 868.1],
- [34, 62.5, 941.2], [36, 68, 1020.2],
- [38, 74.0, 1098.7], [40, 84, 1245.8],
- [42, 93.0, 1373.4], [44, 102, 1491.1],
- [46, 111, 1618.6], [48, 121, 1755.9],
- [50, 131, 1893.3], [52, 141, 2020.8],
- [56, 163, 2315.1], [60, 175, 2472.0],
- [64, 200, 2766.3], [68, 226, 3099.9],
- [72, 254, 3413.8], [80, 313, 4139.7],
- [88, 379, 4934.3], [96, 451, 5768.1]]
-max_tension = 647.4 #kN, given by choice of cable above.
+#diameter in m: [l in kg/100m, breaking point in kN]
+cables = {.006: [ 2.3, 41.2], .008: [ 3.9, 65.7],
+ .009: [ 4.2, 82.4], .010: [ 5.9, 105.9],
+ .011: [ 6.3, 133.4], .012: [ 9.5, 161.9],
+ .014: [12.8, 215.8], .016: [ 16, 269.8],
+ .018: [20.8, 343.3], .020: [25.5, 407.1],
+ .022: [30.5, 490.5], .024: [35.8, 569.0],
+ .026: [41.0, 647.4], .028: [46.5, 725.9],
+ .030: [52.0, 799.5], .032: [ 57, 868.1],
+ .034: [62.5, 941.2], .036: [ 68, 1020.2],
+ .038: [74.0, 1098.7], .040: [ 84, 1245.8],
+ .042: [93.0, 1373.4], .044: [ 102, 1491.1],
+ .046: [ 111, 1618.6], .048: [ 121, 1755.9],
+ .050: [ 131, 1893.3], .052: [ 141, 2020.8],
+ .056: [ 163, 2315.1], .060: [ 175, 2472.0],
+ .064: [ 200, 2766.3], .068: [ 226, 3099.9],
+ .072: [ 254, 3413.8], .080: [ 313, 4139.7],
+ .088: [ 379, 4934.3], .096: [ 451, 5768.1]}
+dia = .016
+cable_choices = numpy.array(cables.keys())
+nearest = lambda dia: cable_choices[numpy.abs(dia - cable_choices).minarg()]
+l, max_tension = cables[nearest(dia)]
Mass = 670 #kilograms -- mass of /everything/
M = lambda phi: Mass - m - l*r(phi)
r_cm = lambda phi: (m*r(phi) + .5*l*r(phi)**2) / (m + l*r(phi) + M(phi))
@@ -241,8 +244,9 @@ def plot(time, soln, graphs=['all'], i=7):
def opt_fun(guesses, f, func, init_vars):
"""Solve, plot, and compare the diff eq."""
- global r0, m, Mass
- r0, m, Mass = guesses
+ global r0, m, Mass, l, dia, max_tension
+ r0, m, Mass, dia = guesses
+ l, max_tension = cables[nearest(dia)]
time, soln = solve_fun(func, init_vars)
@@ -260,9 +264,7 @@ def opt_fun(guesses, f, func, init_vars):
f.write("%s, " % tension_max)
f.write("%s\n" % v_tan_max)
- # If you want strict limits, you can change the return to:
- #return 1/v_tan + 1000*(Mass > Mass_limit) + 1000*(phi1.max() > phi1_limit)
- return 2/v_tan_max + Mass/600 + phi1.max() / tau
+ return 2/v_tan_max + Mass/600 + phi1.max() / tau + cable*50
v0 = numpy.sqrt(g(0) * r(0))
w0 = v0/r0
@@ -272,7 +274,8 @@ inits = [0, w0]
outfile = '/home/jandew/Documents/Impossible Challenges/microsatellite/out'
def optimize():
fil = file(outfile, 'w')
- fil.write('r0, sat. mass, Total Mass, phi, omega, Tension, Max Vel.\n')
+ fil.write('r0, sat. mass, Total Mass, cable diameter, '
+ + 'phi, omega, Tension, Max Vel.\n')
guess = (r0, m, Mass)
#try: print opt_fun(guess, fil, throw, inits)
try: print fmin(opt_fun, guess, args=(fil, throw, inits))