From c30cd1f5a32080b28bc6ff29df9514e427aec56c Mon Sep 17 00:00:00 2001 From: Chris Lewis Date: Sat, 11 Nov 2017 19:40:12 -0500 Subject: [PATCH 1/2] added Pressure sketch --- PressureSensor/PressureSensor.ino | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 PressureSensor/PressureSensor.ino diff --git a/PressureSensor/PressureSensor.ino b/PressureSensor/PressureSensor.ino new file mode 100644 index 0000000..96d4faf --- /dev/null +++ b/PressureSensor/PressureSensor.ino @@ -0,0 +1,30 @@ +#include +#include "MS5837.h" + +MS5837 sensor; + +void setup() { + + Serial.begin(9600) + + Wire.begin(); + + sensor.init(); + // Set the density of the working fluid to freshwater + sensor.setModel(997); +} + +void loop() { + + sensor.read(); + // put your main code here, to run repeatedly: + float pressure = sensor.pressure(); + float temperature = sensor.temperature(); + float depth = sensor.depth(); + float altitude = sensor.altitude(); + + Serial.println(pressure); + Serial.println(temperature); + Serial.println(depth); + Serial.println(altitude); +} From 30c1f9334134e1186b38b3a2dddf68b48eb55bb3 Mon Sep 17 00:00:00 2001 From: Chris Lewis Date: Sun, 28 Jan 2018 16:35:40 -0500 Subject: [PATCH 2/2] Plane Path Calculator --- planePathCalculator.py | 69 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 planePathCalculator.py diff --git a/planePathCalculator.py b/planePathCalculator.py new file mode 100644 index 0000000..6dac104 --- /dev/null +++ b/planePathCalculator.py @@ -0,0 +1,69 @@ +import scipy.integrate as integrate +import math + +class PlanePathCalculator(): + def __init__(self, heading, ascentAirSpd, ascentRate, engFailTime, descentAirSpd, descentRate, windSpd, windDirection): + self.heading = math.radians(heading) + self.ascentAirSpd = ascentAirSpd + self.ascentRate = ascentRate + self.engFailTime = engFailTime + self.descentAirSpd = descentAirSpd + self.descentRate = descentRate + self.windSpd = windSpd + self.windDirection = math.radians(windDirection) + + + def ascentMovement(self): + distance = self.engFailTime * self.ascentAirSpd + Ydistance = math.cos(self.heading) * distance + Xdistance = math.sin(self.heading) * distance + + return (Xdistance, Ydistance) + + def descentMovement(self): + airTime = self.ascentRate * self.engFailTime / self. descentRate + distance = airTime * self.descentAirSpd + Ydistance = math.cos(self.heading) * distance + Xdistance = math.sin(self.heading) * distance + + return (Xdistance, Ydistance) + + def windMovement(self): + airTime = self.ascentRate * self.engFailTime / self. descentRate + result = integrate.quad(lambda t: -(1/720)*t**2 + 25, 0, airTime) + Ydistance = math.cos(self.windDirection) * result[0] + Xdistance = math.sin(self.windDirection) * result[0] + + return (Xdistance, Ydistance) + + def totalMovement(self): + + return (self.ascentMovement()[0] + self.descentMovement()[0] + self.windMovement()[0], self.ascentMovement()[1] + self.descentMovement()[1] + self.windMovement()[1]) + + def searchLocation(self): + movement = self.totalMovement() + distance = math.sqrt(movement[0]**2 + movement[1]**2) + degree = math.degrees(math.atan(movement[1]/movement[0])) + + return (distance, degree) + + + +def main(): + + heading = int(input("Heading: ")) + ascentAirSpd = int(input("Ascent Air Speed: ")) + ascentRate = int(input("Ascent Rate: ")) + engFailTime = int(input("Engine Failure Time: ")) + descentAirSpd = int(input("Descent Air Speed: ")) + descentRate = int(input("Descent Rate: ")) + windSpd = int(input("Wind Speed: ")) + windDirection = int(input("Wind Direction: ")) + + calc = PlanePathCalculator(heading, ascentAirSpd, ascentRate, engFailTime, descentAirSpd, descentRate, windSpd, windDirection) + + search = calc.searchLocation() + print("Reported Search Zone: %f in direction %f degrees from take off" % (search[0], search[1])) + +if __name__ == "__main__": + main()