Python - Calculate the Forward Drive Efficiency of a Power Screw
by matt392 in Circuits > Software
59 Views, 1 Favorites, 0 Comments
Python - Calculate the Forward Drive Efficiency of a Power Screw
print ("This program will calculate the Forward Drive Efficiency for a Power Screw.") import math ### Formula for calculating the Foward Drive Efficiency for Power Screws: # FowardDriveEfficiency = (tan(LeadAngle)) * ((cos(ThreadAngleNormalPlane) - (CoefficientOfFriction*tan(LeadAngle) / # (((cos(ThreadAngleNormalPlane)) * (tan(LeadAngle))) + CoefficientOfFriction)) ############################################################################### # Enter the LeadAngle, ThreadAngleNormalPlane, CoefficientOfFriction ContinueCalculations = "y" def CalculateFowardDriveEfficiencyPowerScrew(): print ("Calculating the Foward Drive Efficiency for a Power Screw.") # Enter the LeadAngle LeadAngle = float(input("Enter the lead angle: ") ) # Enter the ThreadAngleNormalPlane ThreadAngleNormalPlane = float(input("Enter the Thread Angle in Normal Plane: ") ) # Enter the CoefficientOfFriction CoefficientOfFriction = float(input("Enter the Coefficient Of Friction: ") ) # Convert degrees to radians # Python trig functions take radians # Use math.radians() function to convert degrees to radians LeadAngleInDegrees = math.radians(LeadAngle) ThreadAngleInDegrees = math.radians(ThreadAngleNormalPlane) print("The cosine of the ThreadAngleNormalPlane is: ", math.cos(ThreadAngleInDegrees) ) print("The tangent of the LeadAngle is: ", math.tan(LeadAngleInDegrees) ) print("=========") # Calculate the top of the fraction TopOfFraction = ( (math.cos(ThreadAngleInDegrees)) - (CoefficientOfFriction*(math.tan(LeadAngleInDegrees))) ) print ("Top of Fraction is: ", TopOfFraction) # Calculate the bottom of the fraction BottomOfFraction = ((math.cos(ThreadAngleInDegrees) * math.tan(LeadAngleInDegrees)) + CoefficientOfFriction) # Calculate the fraction FullFraction = TopOfFraction/BottomOfFraction # Calculate the tangent and multiply by fraction ForwardDriveEfficiency = (math.tan(LeadAngleInDegrees)) * FullFraction print("The Forward Drive Efficiency is: ", ForwardDriveEfficiency) while (ContinueCalculations=="y"): CalculateFowardDriveEfficiencyPowerScrew() ContinueCalculations = str(input("Would you like to continue to calculate the Coefficient Of Friction? (y/n): ")) print("==================================") print ("Thank you to Screw University on www.roton.com for assistance with this formula.")