import matplotlib.pyplot as plt # Required Inputs payload = 6.0 balloonWeight = 1000 parachuteDia = 6.0 helium = 1.5 desiredLat = 42.290977 desiredLon = -83.717548 launchTime = '2019-08-23 23:00:00' tolerace = 5 #ft #ans = balloon.plotStations('US') # Do a single prediction data = balloon.prediction(payload, balloonWeight, parachuteDia, helium, desiredLat, desiredLon, -1, 1, launchTime, 100, 0.2) # Animate the result balloon.PredictionAni(data, 0) # Do backwards prediction calculation launchLoc = balloon.launchPrediction(payload, balloonWeight, parachuteDia, helium, desiredLat, desiredLon, launchTime, tolerace) print('Distance reached: ' + str(launchLoc['Tolerace'])) # Check work data = balloon.prediction(payload, balloonWeight, parachuteDia, helium, launchLoc['Lat'], launchLoc['Lon'], -1, 1, launchTime, 50, 0.2) balloon.plotPrediction(data)
CycleError = True ErrorCode = 8 # If no error has occurred yet, Do Prediction if CycleError == False: try: # Prediction print("Preforming Prediction: Status " + str(status)) data = balloon.prediction( payload, balloonWeight, parachuteDia, helium, APRS_data["lat"], APRS_data["lng"], APRS_data["altitude"] * 3.281, status, "now", ensembles, errInEnsembles, TESTINGtimeDiff, ARcorr, UTCdiff, ) # Save prediction data to file (package data into a file) balloon.package(data, predictionNum, flightID) predictionNum = predictionNum + 1 # Stick landing coordinates in vector predLat.append(data["Landing Lat"]) predLon.append(data["Landing Lon"]) except:
import balloon from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt # Import Flight Data data = balloon.prediction(6.0, 1000, 6.0, 1, 41.64, -83.243, 40000, 1, 'now', 500, 0.2) # Plot Nominal Data fig = plt.figure(figsize=(40, 35)) ax = fig.gca(projection='3d') ax.plot(data['TimeData']['Latitude'], data['TimeData']['Longitude'], data['TimeData']['Altitude']) for ensembles in data['Secondary Tracks']: ax.plot(data['Secondary Tracks'][str(ensembles)]['Lat'], data['Secondary Tracks'][str(ensembles)]['Lon'], data['Secondary Tracks'][str(ensembles)]['Alt']) plt.show()
import datetime import balloon from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt # Define what predictions you want flightID = '01' predictionNum = 5 deltaHour = 8 # Get list of times and convert to strings timeList = list() start = datetime.datetime.strptime( datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"), "%Y-%m-%d %H:%M:%S") timeList.append(str(start)) new = start for predictionNum in range(1, predictionNum + 1): last = new new = last + datetime.timedelta(hours=deltaHour) timeList.append(str(new)) # Import Flight Data for each time and record to pickle file i = 1 for times in timeList: data = balloon.prediction(6.0, 1000, 6.0, 1, 41.64, -83.243, 5000, -1, times, 100, 0.2) balloon.package(data, 'p_' + flightID + '_' + str(i)) i = i + 1
break # Check if location is reporting same position twice - If so send message to group if APRS_data['lasttime'] != APRS_data['time']: message = 'Warning: Tracker may have lost GPS signal. Data transmission remains nominal.' balloon.send_slack(message,messageType,recipient,slackURL) except: CycleError = True ErrorCode = 3 # Do Prediction if CycleError == False: try: # Prediction print('Preforming Prediction: Status ' + str(status)) data = balloon.prediction(payload,balloonWeight,parachuteDia,helium,APRS_data['lat'],APRS_data['lng'],APRS_data['altitude'] * 3.281,status,'now',ensembles,errInEnsembles,TESTINGtimeDiff) # Save prediction data to file balloon.package(data,predictionNum,flightID) predictionNum = predictionNum + 1 # Stick landing coordinates in vector predLat.append(data['Landing Lat']) predLon.append(data['Landing Lon']) except: CycleError = True ErrorCode = 4 # Do deviation calculation if CycleError == False: try: # If more than one predction exists, figure out if it has shifted by a certain tolerace since the last NOTIFICATION
tolerace, 0, UTCdiff, ) print("Launch Location: " + str(launchLoc["Lat"]) + "," + str(launchLoc["Lon"])) print("Distance reached: " + str(launchLoc["Tolerace"])) # Check work from backwards calculation data = balloon.prediction( payload, balloonWeight, parachuteDia, helium, launchLoc["Lat"], launchLoc["Lon"], -1, 1, launchTime, ensem, ensem_per, 0, -1, UTCdiff, ) # balloon.plotPrediction(data) print("Requested: " + str(desiredLat) + "," + str(desiredLon)) print("Actual: " + str(data["Landing Lat"]) + "," + str(data["Landing Lon"])) print("Popping Altitude: " + str(data["Burst Altitude"]) + " ft") popTime = data["TimeData"].loc[data["TimeData"]["Status"] == 1].index[-1] print("Rise time: " + str(popTime - data["Inputs"]["Launch Time"])) print("Flight time: " + str(data["Landing Time"] - data["Inputs"]["Launch Time"])) if doDrivingCalc == True: