Ver código fonte

Better analysis

Petra Lamborn 6 anos atrás
pai
commit
d9a580d303
2 arquivos alterados com 13 adições e 4 exclusões
  1. 4
    0
      analysis.rmd
  2. 9
    4
      monitor.py

+ 4
- 0
analysis.rmd Ver arquivo

18
 mass <- baseg + geom_line(aes(y=mass)) + ylab("Vessel mass (kg)") + ggtitle("Mass")
18
 mass <- baseg + geom_line(aes(y=mass)) + ylab("Vessel mass (kg)") + ggtitle("Mass")
19
 fuel <- baseg + geom_line(aes(y=fuel)) + ylab("Fuel (kg)") + ggtitle("Fuel")
19
 fuel <- baseg + geom_line(aes(y=fuel)) + ylab("Fuel (kg)") + ggtitle("Fuel")
20
 at <- baseg + geom_line(aes(y=available_thrust)) + ylab("Available thrust (Newtons)") + ggtitle("Available thrust")
20
 at <- baseg + geom_line(aes(y=available_thrust)) + ylab("Available thrust (Newtons)") + ggtitle("Available thrust")
21
+thrust <- baseg + geom_line(aes(y=current_thrust)) + ylab("Current thrust (Newtons)") + ggtitle("Current thrust")
22
+g_force <- baseg + geom_line(aes(y=g_force)) + ylab("G-force (m/s²)") + ggtitle("G-force")
21
 ```
23
 ```
22
 
24
 
23
 ```{r drawgraphs, echo=FALSE}
25
 ```{r drawgraphs, echo=FALSE}
27
 mass
29
 mass
28
 fuel
30
 fuel
29
 at
31
 at
32
+thrust
33
+g_force
30
 ```
34
 ```

+ 9
- 4
monitor.py Ver arquivo

30
 # Set up a stream to monitor the throttle button
30
 # Set up a stream to monitor the throttle button
31
 button_clicked = conn.add_stream(getattr, button, 'clicked')
31
 button_clicked = conn.add_stream(getattr, button, 'clicked')
32
 f = open(datafile, 'w')
32
 f = open(datafile, 'w')
33
-f.write('timepoint, current_altitude, v_speed, h_speed, mass, fuel, available_thrust\n')
33
+f.write('timepoint, current_altitude, v_speed, h_speed, mass, fuel, available_thrust, current_thrust, g_force\n')
34
 timepoint = 0
34
 timepoint = 0
35
 
35
 
36
 vessel = conn.space_center.active_vessel
36
 vessel = conn.space_center.active_vessel
44
     current_altitude = vessel.flight(r_frame).surface_altitude
44
     current_altitude = vessel.flight(r_frame).surface_altitude
45
     v_speed = vessel.flight(r_frame).vertical_speed
45
     v_speed = vessel.flight(r_frame).vertical_speed
46
     h_speed = vessel.flight(r_frame).horizontal_speed
46
     h_speed = vessel.flight(r_frame).horizontal_speed
47
-    f.write('{0}, {1}, {2}, {3}, {4}, {5}, {6}\n'.format(timepoint,
48
-                                                         current_altitude,
49
-                                                         v_speed, h_speed, vm, vm - dry_mass, at))
47
+    c_thrust = vessel.thrust
48
+    g_force = vessel.flight(r_frame).g_force
49
+    f.write('{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}\n'.format(timepoint,
50
+                                                              current_altitude,
51
+                                                              v_speed, h_speed,
52
+                                                              vm, vm -
53
+                                                              dry_mass, at,
54
+                                                              c_thrust, g_force))
50
     timepoint = timepoint + 1
55
     timepoint = timepoint + 1
51
     time.sleep(0.1)
56
     time.sleep(0.1)
52
 
57