def zeroThrustForces(self, flightPitchDegrees, AoADegrees, v, altitude, planet): """ Return the forces other than thrust that this part produces. Returns a tuple (drag, lift, apparentGravity) with quantities in kN. Lift and drag are vectors; gravity is a number (just the y coordinate, positive means up). """ Cd = self._staticCd Clift = 0 if isinstance(self._parttype, lift.wing): Cd = self._parttype.dragCoeff(self._AoA + AoADegrees) Clift = self._parttype.liftCoeff(self._AoA + AoADegrees) elif isinstance(self._parttype, jets.intake): Cd = self._parttype.dragCoeff(self._AoA + AoADegrees) elif isinstance(self._parttype, jets.jetengine): Cd = 0.2 elif isinstance(self._parttype, engine.engine): Cd = 0.2 dragMagnitude = planet.dragForce(altitude, v, self.mass(), Cd) liftMagnitude = v * planet.pressure(altitude) * Clift flightPitchRad = math.radians(flightPitchDegrees) cosPitch = math.cos(flightPitchRad) sinPitch = math.sin(flightPitchRad) horizontalSpeedSrf = v * cosPitch horizontalSpeedOrb = horizontalSpeedSrf + planet.siderealSpeed(altitude) vOrbit = planet.orbitalVelocity(altitude) centrifuge = horizontalSpeedOrb * horizontalSpeedOrb / (vOrbit * vOrbit) gravity = planet.gravity(altitude) downForceMagnitude = self.mass() * (centrifuge - gravity) dragVector = physics.vector(-cosPitch * dragMagnitude, -sinPitch * dragMagnitude) liftVector = physics.vector(-sinPitch * liftMagnitude, cosPitch * liftMagnitude) return (dragVector, liftVector, downForceMagnitude)
def standardDrag(mass): f = planet.dragForce(altitude, v, mass, 0.2) return (-f * flightPitchCos, -f * flightPitchSin)
def dragForce(self, AoAdegrees, v, altitude = 0, planet = planet.kerbin): Cd = self.deflectionDrag(AoAdegrees) * self.drag return planet.dragForce(altitude, v, self.mass, Cd)
def dragForce(self, AoAdegrees, v, altitude = 0, planet = planet.kerbin): Cd = self.dragCoeff(AoAdegrees) return planet.dragForce(altitude, v, self.mass, Cd)