People can feel a little overwhelmed by the number of springs on mcmaster.com--I sure was when I first started out! Eventually, I stumbled upon this post, which clearly explained how to obtain all spring properties given the weird Mcmaster constant (now changed to a rate constant) and other spring attributes. I decided to write a computer program (in Python) incorporating all the variables from Ozymandias's spreadsheet in the post I just linked.
The math was very simple--most of the time was spent making the output look pretty. My program creates spring objects that are initialized with their Mcmaster constants. I then wrote functions to print out various properties for various springs of various lengths with various compression. Say, for example, you want to find out how much power a 5 inch [k26] puts out with 3 inches of draw. You could write out a bunch of equations on paper and figure it out, or you could plug the [k26] values into my program, create the [k26] spring object, and print out all the useful data. Here is an example of my program's output for the [k26] spring:
[ [k26] ]
========================================
Deflection rate = 0.7528
Max load = 32.13 lbs (14.58 kg)
--------------------
length = 1 in
spring constant = 42.69 lbs/in
max draw = 0.75 in
--------------------
length = 2 in
spring constant = 21.34 lbs/in
max draw = 1.51 in
1 inch draw produces 21.34 lbs (9.68 kg) of force
--------------------
length = 3 in
spring constant = 14.23 lbs/in
max draw = 2.26 in
1 inch draw produces 14.23 lbs (6.45 kg) of force
2 inch draw produces 28.46 lbs (12.91 kg) of force
--------------------
length = 4 in
spring constant = 10.67 lbs/in
max draw = 3.01 in
1 inch draw produces 10.67 lbs (4.84 kg) of force
2 inch draw produces 21.34 lbs (9.68 kg) of force
3 inch draw produces 32.01 lbs (14.52 kg) of force
--------------------
length = 5 in
spring constant = 8.54 lbs/in
max draw = 3.76 in
1 inch draw produces 8.54 lbs (3.87 kg) of force
2 inch draw produces 17.07 lbs (7.74 kg) of force
3 inch draw produces 25.61 lbs (11.62 kg) of force
--------------------
length = 6 in
spring constant = 7.11 lbs/in
max draw = 4.52 in
1 inch draw produces 7.11 lbs (3.23 kg) of force
2 inch draw produces 14.23 lbs (6.45 kg) of force
3 inch draw produces 21.34 lbs (9.68 kg) of force
4 inch draw produces 28.46 lbs (12.91 kg) of force
--------------------
length = 7 in
spring constant = 6.10 lbs/in
max draw = 5.27 in
1 inch draw produces 6.10 lbs (2.77 kg) of force
2 inch draw produces 12.20 lbs (5.53 kg) of force
3 inch draw produces 18.29 lbs (8.30 kg) of force
4 inch draw produces 24.39 lbs (11.06 kg) of force
5 inch draw produces 30.49 lbs (13.83 kg) of force
--------------------
length = 8 in
spring constant = 5.34 lbs/in
max draw = 6.02 in
1 inch draw produces 5.34 lbs (2.42 kg) of force
2 inch draw produces 10.67 lbs (4.84 kg) of force
3 inch draw produces 16.01 lbs (7.26 kg) of force
4 inch draw produces 21.34 lbs (9.68 kg) of force
5 inch draw produces 26.68 lbs (12.10 kg) of force
6 inch draw produces 32.01 lbs (14.52 kg) of force
--------------------
length = 9 in
spring constant = 4.74 lbs/in
max draw = 6.78 in
1 inch draw produces 4.74 lbs (2.15 kg) of force
2 inch draw produces 9.49 lbs (4.30 kg) of force
3 inch draw produces 14.23 lbs (6.45 kg) of force
4 inch draw produces 18.97 lbs (8.61 kg) of force
5 inch draw produces 23.71 lbs (10.76 kg) of force
6 inch draw produces 28.46 lbs (12.91 kg) of force
--------------------
length = 10 in
spring constant = 4.27 lbs/in
max draw = 7.53 in
1 inch draw produces 4.27 lbs (1.94 kg) of force
2 inch draw produces 8.54 lbs (3.87 kg) of force
3 inch draw produces 12.81 lbs (5.81 kg) of force
4 inch draw produces 17.07 lbs (7.74 kg) of force
5 inch draw produces 21.34 lbs (9.68 kg) of force
6 inch draw produces 25.61 lbs (11.62 kg) of force
7 inch draw produces 29.88 lbs (13.55 kg) of force
--------------------
length = 11 in
spring constant = 3.88 lbs/in
max draw = 8.28 in
1 inch draw produces 3.88 lbs (1.76 kg) of force
2 inch draw produces 7.76 lbs (3.52 kg) of force
3 inch draw produces 11.64 lbs (5.28 kg) of force
4 inch draw produces 15.52 lbs (7.04 kg) of force
5 inch draw produces 19.40 lbs (8.80 kg) of force
6 inch draw produces 23.28 lbs (10.56 kg) of force
7 inch draw produces 27.16 lbs (12.32 kg) of force
8 inch draw produces 31.04 lbs (14.08 kg) of force
--------------------
30.00 lbs of force with a 3.00 inch draw requires a 4.27 inch spring
As you can see, you get pretty much everything you've ever wanted to know about the [k26]. My code is very simple, and it's very easy to plug in values for any cut-to-length compression spring in the McMaster catalog using Ozymandias's spreadsheet. I will now post the actual code. To run it, download Python off python.org and install it. It should already come with the IDLE editor. Just open up IDLE, paste the code in, and hit F5 to run it. Of course, you can add any springs you want. Here is the code:
#!/usr/bin/env python """ spring.py A simple spring class that shines light on the properties of Mcmaster cut-to-length compression springs. """ __author__ = "Thomas Megantz a.k.a. T da B" class Spring(object): def __init__(self, name, rate_constant, coils_per_inch, max_length, wire_diameter): self.name = name self.rate_constant = rate_constant self.coils_per_inch = coils_per_inch self.max_length = max_length self.wire_diameter = wire_diameter self.deflection_rate = 1 - (self.coils_per_inch * self.wire_diameter) self.k = self.rate_constant / self.max_length self.max_load = self.deflection_rate * self.rate_constant def print_stats(self): print '[ {0} ]'.format(self.name) print '='*40 print 'Deflection rate = ' + str(self.deflection_rate) print 'Max load = {0:.2f} lbs ({1:.2f} kg)'.format(self.max_load, self.max_load/2.20462) print '-'*20 for length in range(self.max_length): print 'length = ' + str(length+1) + ' in' spring_constant = self.rate_constant/(length+1) print 'spring constant = {0:.2f} lbs/in'.format(spring_constant) max_draw = (length+1)*self.deflection_rate print 'max draw = {0:.2f} in'.format(max_draw) for draw in range(1, int(max_draw)+2): if draw <= max_draw: print ('{0} inch draw produces {1:.2f} lbs ({2:.2f} kg) of ' 'force').format(draw, draw*spring_constant, draw*spring_constant/2.20462) print "-" * 20 def get_length_for_load(self, draw, desired_load): spring_constant = desired_load / draw length = self.rate_constant / spring_constant print ("{0:.2f} lbs of force with a {1:.2f} inch draw requires a " "{2:.2f} inch spring").format(desired_load, draw, length) def print_spring_data(): # Add any springs here [k26] = Spring(name='[k26]', rate_constant=42.69, coils_per_inch=3.09, max_length=11, wire_diameter=.08) [k25] = Spring(name='[k25]', rate_constant=38.53, coils_per_inch=2.18, max_length=11, wire_diameter=.08) k18 = Spring(name='K18', rate_constant=32.92, coils_per_inch=2.09, max_length=11, wire_diameter=.091) k15 = Spring(name='K15', rate_constant=67.98, coils_per_inch=4, max_length=11, wire_diameter=.105) k14 = Spring(name='K14', rate_constant=73.96, coils_per_inch=2.45, max_length=11, wire_diameter=.105) # Make sure to add any new springs into the list below springs = [[k26], [k25], k18, k15, k14] for spring in springs: spring.print_stats() spring.get_length_for_load(3, 30) print "=" * 40 if __name__ == '__main__': print_spring_data()
Let me know what you guys think! I hope this helps the NIC as much as it helps me in selecting my springs and cutting them appropriately. For anyone who can't handle downloading Python and copy/pasting, let me know if you want me to paste output for other springs in Ozymandias's spreadsheet. Happy nerfing!
~T da B
Edited by T da B, 22 January 2013 - 03:43 PM.