1
1
import streamlit as st
2
2
import requests
3
3
import json
4
+ import time
4
5
import copy
5
6
from pandas import *
6
7
class objectview (object ):
@@ -117,13 +118,67 @@ def sideBarInput():
117
118
updatedshuttle = None
118
119
if st .sidebar .checkbox ("updateAngle" ):
119
120
UpdatedAngleBelowHorizontal = st .sidebar .slider ("NewAngleBelowHorizontal" ,0.0 ,90.0 ,6.0 )
121
+ UpdatedAngleOfAttack = st .sidebar .slider ("NewAngleOfAttack" ,0.0 ,90.0 ,6.0 )
120
122
updatedshuttle = UpdatedShuttle (copy .deepcopy (shuttle ))
121
123
updatedshuttle .Time = st .sidebar .slider ("Applied TimeFrame" ,0 ,100 ,1 )
122
124
updatedshuttle .shuttle .AngleBelowHorizontal = UpdatedAngleBelowHorizontal
125
+ updatedshuttle .shuttle .AngleOfAttack = UpdatedAngleOfAttack
123
126
return [shuttle ,updatedshuttle ]
124
127
128
+ def autoSimulation (o ):
129
+ SimulationSpeed = st .slider ("Select Simulation Speed" , 1 , 10 , 1 )
130
+ spTimePmt = st .empty ()
131
+ spTfPmt = st .empty ()
132
+ spSpdPmt = st .empty ()
133
+ spSpeed = st .empty ()
134
+ spAccPmt = st .empty ()
135
+ spAccRefPmt = st .empty ()
136
+ spAcc = st .empty ()
137
+ spAngPmt = st .empty ()
138
+ spAng = st .empty ()
139
+ spAltPmt = st .empty ()
140
+ spAlt = st .empty ()
141
+ spDispPmt = st .empty ()
142
+ spDispEarthPmt = st .empty ()
143
+ spDisp = st .empty ()
144
+ spTmpPmt = st .empty ()
145
+ spGtmpPmt = st .empty ()
146
+ spTmp = st .empty ()
147
+ spDragPmt = st .empty ()
148
+ spDragLiftPmt = st .empty ()
149
+ spDrag = st .empty ()
150
+
151
+ for i in range (0 , len (o .time )):
152
+ spTimePmt .markdown ("Current Time Elapsed **" + rnd (o .time [i ])+ "**" )
153
+ spTfPmt .markdown ("Curent TimeFrame **" + str (i ) + "**" )
154
+
155
+ spSpdPmt .markdown ("The current velocity is **" + rnd (o .vec ["velocity" ][i ])+ "**" )
156
+ spSpeed .line_chart (o .vec [0 :i ], height = 100 )
157
+
158
+ spAccPmt .markdown ("Current Absolute Acceleration **" + rnd (o .acc ["absAcc" ][i ]) + "**" )
159
+ spAcc .line_chart (o .acc [0 :i ], height = 100 )
160
+
161
+ spAngPmt .markdown ("Current Angle below Horizontal **" + rnd (- o .angle ["angBelowHor" ][i ]) + "**" )
162
+ spAng .line_chart (o .angle ["angBelowHor" ][0 :i ], height = 100 )
163
+
164
+ spAltPmt .markdown ("Current Height **" + rnd (o .hgt ["height" ][i ]) + "**" )
165
+ spAlt .area_chart (o .hgt [0 :i ], height = 100 )
166
+
167
+ spDispPmt .markdown ("Current Displacement is **" + rnd (o .disp ["disp" ][i ]) + "**" )
168
+ spDispEarthPmt .markdown ("Current Displacement around Earth **" + rnd (o .disp ["dispEarth" ][i ]) + "**" )
169
+ spDisp .area_chart (o .disp [0 :i ], height = 100 )
170
+
171
+ spTmpPmt .markdown ("The current temp is **" + rnd (o .temp ["curTemp" ][i ]) + "**" )
172
+ spGtmpPmt .markdown ("The maximum temp is **" + rnd (o .temp ["maxTemp" ][i ]) + "**" )
173
+ spTmp .area_chart (o .temp [0 :i ], height = 100 )
174
+
175
+ spDragPmt .markdown ("Current Drag Coefficient **" + rnd (o .drag ["dragCoeff" ][i ]) + "**" )
176
+ spDragLiftPmt .markdown ("Current Lift to Drag **" + rnd (o .drag ["liftToDrag" ][i ]) + "**" )
177
+ spDrag .line_chart (o .drag [0 :i ], height = 100 )
178
+ time .sleep (1.0 / SimulationSpeed )
179
+
125
180
def manualSimulation (o ):
126
- i = st .slider ("Current TimeFrame" , 0 , len (o .time ))
181
+ i = st .slider ("Current TimeFrame" , 0 , len (o .time )- 1 )
127
182
st .markdown ("**Please drag TimeFrame slider slowly**" )
128
183
st .markdown ("Current Time Elapsed **" + rnd (o .time [i ]) + "**" )
129
184
st .markdown ("Curent TimeFrame **" + str (i ) + "**" )
@@ -173,10 +228,10 @@ def fetchcombined(sideInput):
173
228
174
229
def startApp ():
175
230
st .markdown ("# Spacecraft Landing Simulator UI" )
176
- input = sideBarInput ( )
177
- if st . sidebar . checkbox ( "Hide Prompt and Press Start" ) :
178
- manualSimulation (convert (fetchcombined (input )))
179
- else :
231
+ start = st . sidebar . selectbox ( "Select Page" ,( "Introduction" , "Manual Simulation" , "Automated Simulation" ) )
232
+ if start == "Manual Simulation" :
233
+ manualSimulation (convert (fetchcombined (sideBarInput () )))
234
+ elif start == "Introduction" :
180
235
st .empty ()
181
236
st .markdown ("""
182
237
## Instructions:
@@ -196,6 +251,8 @@ def startApp():
196
251
This is the board where we brainstorm and sort out how properties are related \n
197
252
(Registeration may be required to view the public board)
198
253
""" )
254
+ elif start == "Automated Simulation" :
255
+ autoSimulation (convert (fetchcombined (sideBarInput ())))
199
256
200
257
if __name__ == '__main__' :
201
258
startApp ()
0 commit comments